aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 8c60fccd1866ef3f63d61613f5e2ccb00a3686e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
PROJECT=sercp
PREFIX=/usr/local
CC=gcc
WINCC_PREFIX=i686-w64-mingw32
WINCC64_PREFIX=x86_64-w64-mingw32

all:	$(PROJECT)

windows: $(PROJECT).w32 $(PROJECT).w64

sercp:	$(PROJECT).c
	$(CC) $(PROJECT).c -o $(PROJECT) -Wall -pedantic -MP -MD -std=gnu99 -Werror=format-security -O2 -Wformat

install: $(PROJECT)
	install -d $(DESTDIR)$(PREFIX)/bin/
	install -m 755 $< $(DESTDIR)$(PREFIX)/bin/

sercp.w64: $(PROJECT).c
	rm -f $(PROJECT).res
	$(WINCC64_PREFIX)-windres -i $(PROJECT).rc --input-format=rc --codepage=65001 -o $(PROJECT).res -O coff
	$(WINCC64_PREFIX)-gcc $(PROJECT).c $(PROJECT).res -o $(PROJECT).exe   -Wall -pedantic -MP -MD -std=gnu99 -Werror=format-security -Wformat -O2
	$(WINCC64_PREFIX)-strip $(PROJECT).exe

sercp.w32: $(PROJECT).c
	rm -f $(PROJECT).res
	$(WINCC_PREFIX)-windres -i $(PROJECT).rc --input-format=rc --codepage=65001 -o $(PROJECT).res -O coff
	$(WINCC_PREFIX)-gcc $(PROJECT).res $(PROJECT).c -o $(PROJECT)32.exe -Wall -pedantic -MP -MD -std=gnu99 -Werror=format-security -Wformat -O2
	$(WINCC_PREFIX)-strip $(PROJECT)32.exe

debug:	$(PROJECT).c
	$(CC) $(PROJECT).c -o $(PROJECT) -Wall -pedantic -MP -MD -std=gnu99 -Werror=format-security -g -O0 -Wformat

clean:
	rm -f $(PROJECT) $(PROJECT).d $(PROJECT).o $(PROJECT).res $(PROJECT)*.d $(PROJECT)*.exe