added readme with data checkout instructions, and changed the paths in
[eradicate] / GNUmakefile
1 csrc = $(wildcard src/*.c) $(wildcard src/sdl/*.c) $(wildcard src/3dgfx/*.c)
2 asmsrc = $(wildcard src/*.asm)
3
4 obj = $(csrc:.c=.o) $(asmsrc:.asm=.o)
5 dep = $(obj:.o=.d)
6 bin = game
7
8 def = -DUSE_MMX
9 inc = -Isrc -Isrc/sdl -Isrc/3dgfx -Ilibs/imago/src
10 warn = -pedantic -Wall
11
12 CFLAGS = $(arch) $(warn) -g -MMD $(def) $(inc) `sdl-config --cflags`
13 LDFLAGS = $(arch) -Llibs/imago -limago $(sdl_ldflags) -lm
14
15 ifneq ($(shell uname -m), i386)
16         arch = -m32
17         sdl_ldflags = -L/usr/lib/i386-linux-gnu -lSDL-1.2
18 else
19         sdl_ldflags = `sdl-config --libs`
20 endif
21
22 .PHONY: all
23 all: $(bin)
24
25 $(bin): $(obj) imago
26         $(CC) -o $@ $(obj) $(LDFLAGS)
27
28 %.o: %.asm
29         nasm -f elf -o $@ $<
30
31 -include $(dep)
32
33 .PHONY: imago
34 imago:
35         $(MAKE) -C libs/imago
36
37 .PHONY: clean
38 clean:
39         rm -f $(obj) $(bin)
40
41 .PHONY: cleandep
42 cleandep:
43         rm -f $(dep)
44
45 .PHONY: data
46 data:
47         @tools/procdata