removed clang-format and clang_complete files from the repo
[dosdemo] / Makefile.dj
1 src = $(wildcard src/*.c) $(wildcard src/3dgfx/*.c) $(wildcard src/scr/*.c) \
2           $(wildcard src/dos/*.c)
3 asmsrc = $(wildcard src/*.asm) $(wildcard src/scr/*.asm) $(wildcard src/dos/*.asm)
4 obj = $(src:.c=.odj) $(asmsrc:.asm=.odj)
5 dep = $(src:.c=.d)
6 bin = demo.exe
7
8 asmsrc += cspr/dbgfont.asm cspr/confont.asm
9 bindata = data/loading.img
10
11 ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM)
12         hostsys = dos
13 else
14         hostsys = unix
15         TOOLPREFIX = i586-pc-msdosdjgpp-
16 endif
17
18 inc = -Isrc -Isrc/3dgfx -Isrc/scr -Isrc/dos -Ilibs \
19           -Ilibs/imago/src -Ilibs/anim/src -Ilibs/midas
20 opt = -O3 -ffast-math -fno-strict-aliasing
21 warn = -pedantic -Wall -Wno-unused-function -Wno-unused-variable
22
23 ifdef RELEASE
24         dbg = -g
25         def = -DNDEBUG -DNO_SOUND
26 else
27         def = -DNO_SOUND
28 endif
29 #prof = -pg
30
31 CC = $(TOOLPREFIX)gcc
32 AR = $(TOOLPREFIX)ar
33 CFLAGS = -march=pentium $(warn) -MMD $(dbg) $(opt) $(prof) $(inc) $(def)
34 LDFLAGS = libs/imago/imago.dja libs/anim/anim.dja
35 #libs/midas/libmidas.a
36
37 ifneq ($(hostsys), dos)
38 .PHONY: all
39 all: data $(bin)
40 endif
41
42 $(bin): $(obj) imago anim
43         $(CC) -o $@ -Wl,-Map=ld.map $(prof) $(obj) $(LDFLAGS)
44
45 %.odj: %.asm
46         nasm -f coff -o $@ $<
47
48 src/data.odj: src/data.asm $(bindata)
49
50 -include $(dep)
51
52 %.odj: %.c
53         $(CC) $(CFLAGS) -o $@ -c $<
54
55 .PHONY: imago
56 imago:
57         $(MAKE) -C libs/imago -f Makefile.dj
58
59 .PHONY: anim
60 anim:
61         $(MAKE) -C libs/anim -f Makefile.dj
62
63 .PHONY: cleanlibs
64 cleanlibs:
65         $(MAKE) -C libs/imago clean -f Makefile.dj
66         $(MAKE) -C libs/anim clean -f Makefile.dj
67
68 .PHONY: clean
69 .PHONY: cleandep
70
71 ifeq ($(hostsys), dos)
72 clean:
73         del src\*.odj
74         del src\3dgfx\*.odj
75         del src\dos\*.odj
76         del $(bin)
77
78 cleandep:
79         del src\*.d
80         del src\3dgfx\*.d
81         del src\dos\*.d
82 else
83 clean:
84         rm -f $(obj) $(bin)
85
86 cleandep:
87         rm -f $(dep)
88
89 .PHONY: data
90 data:
91         @tools/procdata
92 endif
93
94 .PHONY: strip
95 strip: $(bin)
96         $(TOOLPREFIX)strip $(bin)