6251a077a3f22c286314e7d5c72f115ce55f4c4b
[dosrtxon] / GNUmakefile
1 src = $(wildcard src/*.c) $(wildcard src/parts/*.c) $(wildcard src/sdl/*.c)
2 obj = $(src:.c=.o) $(asmsrc:.asm=.o)
3 dep = $(obj:.o=.d)
4 bin = demo
5
6 inc = -I/usr/local/include -Isrc -Isrc/sdl -Ilibs/imago/src -Ilibs/mikmod/include
7 warn = -pedantic -Wall -Wno-unused-variable -Wno-unused-function
8
9 CFLAGS = $(warn) -g $(inc) `sdl-config --cflags`
10 LDFLAGS = -Llibs/imago -Llibs/mikmod -limago -lmikmod `sdl-config --libs` -lm
11
12 $(bin): $(obj) imago mikmod
13         $(CC) -o $@ $(obj) $(LDFLAGS)
14
15 %.o: %.asm
16         nasm -f elf -o $@ $<
17
18 -include $(dep)
19
20 %.d: %.c
21         @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
22
23 .PHONY: imago
24 imago:
25         $(MAKE) -C libs/imago
26
27 .PHONY: mikmod
28 mikmod:
29         $(MAKE) -C libs/mikmod
30
31 .PHONY: cleanlibs
32 cleanlibs:
33         $(MAKE) -C libs/imago clean
34         $(MAKE) -C libs/mikmod clean
35
36 .PHONY: clean
37 clean:
38         rm -f $(obj) $(bin)
39
40 .PHONY: cleandep
41 cleandep:
42         rm -f $(dep)