- added rules for building asm code in the gcc makefiles
[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 %.cof: %.asm
26         nasm -f coff -o $@ $<
27
28 -include $(dep)
29
30 %.cof: %.c
31         $(CC) $(CFLAGS) -o $@ -c $<
32
33 %.dep: %.c
34         @$(CPP) $(CFLAGS) $< -MM -MT $(@:.dep=.cof) >$@
35
36 .PHONY: imago
37 imago:
38         $(MAKE) -C libs/imago -f Makefile.dj
39
40 .PHONY: mikmod
41 mikmod:
42         $(MAKE) -C libs/oldmik -f Makefile.dj
43
44 .PHONY: cleanlibs
45 cleanlibs:
46         $(MAKE) -C libs/imago -f Makefile.dj clean
47         $(MAKE) -C libs/oldmik -f Makefile.dj clean
48
49 .PHONY: clean
50 .PHONY: cleandep
51
52 ifeq ($(hostsys), dos)
53 clean:
54         del src\*.cof
55         del src\dos\*.cof
56         del $(bin)
57
58 cleandep:
59         del src\*.dep
60         del src\dos\*.dep
61 else
62 clean:
63         rm -f $(obj) $(bin)
64
65 cleandep:
66         rm -f $(dep)
67 endif