1961fe3bb4cc19440422014c66175271f5a4fe79
[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 -O3 $(inc) `sdl-config --cflags` -fopenmp
10 LDFLAGS = -Llibs/imago -Llibs/mikmod -limago -lmikmod `sdl-config --libs` -lm -lgomp
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)