changed the DJGPP makefiles to use different suffixes for intermediate
[dosdemo] / Makefile.dj
1 src = $(wildcard src/*.c) $(wildcard src/dos/*.c)
2 obj = $(src:.c=.cof)
3 dep = $(obj:.cof=.dep)
4 bin = demo.exe
5
6 ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM)
7         hostsys = dos
8 else
9         hostsys = unix
10         TOOLPREFIX = i586-pc-msdosdjgpp-
11 endif
12
13 inc = -Isrc -Isrc/dos -Ilibs/imago/src -Ilibs/oldmik/src
14 opt = -O3 -ffast-math
15 dbg = -g
16
17 CC = $(TOOLPREFIX)gcc
18 AR = $(TOOLPREFIX)ar
19 CFLAGS = -pedantic -Wall -march=pentium $(dbg) $(opt) $(inc)
20 LDFLAGS = libs/imago/imago.dja libs/oldmik/mikmod.dja
21
22 $(bin): $(obj) imago mikmod
23         $(CC) -o $@ -Wl,-Map=ld.map $(obj) $(LDFLAGS)
24
25 -include $(dep)
26
27 %.cof: %.c
28         $(CC) $(CFLAGS) -o $@ -c $<
29
30 %.dep: %.c
31         @$(CPP) $(CFLAGS) $< -MM -MT $(@:.dep=.cof) >$@
32
33 .PHONY: imago
34 imago:
35         $(MAKE) -C libs/imago -f Makefile.dj
36
37 .PHONY: mikmod
38 mikmod:
39         $(MAKE) -C libs/oldmik -f Makefile.dj
40
41 .PHONY: cleanlibs
42 cleanlibs:
43         $(MAKE) -C libs/imago -f Makefile.dj clean
44         $(MAKE) -C libs/oldmik -f Makefile.dj clean
45
46 .PHONY: clean
47 .PHONY: cleandep
48
49 ifeq ($(hostsys), dos)
50 clean:
51         del src\*.cof
52         del src\dos\*.cof
53         del $(bin)
54
55 cleandep:
56         del src\*.dep
57         del src\dos\*.dep
58 else
59 clean:
60         rm -f $(obj) $(bin)
61
62 cleandep:
63         rm -f $(dep)
64 endif