Mercurial > MadButterfly
comparison examples/tank/Makefile @ 115:3895d2224e67
Tank
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 14 Sep 2008 02:17:57 +0800 |
parents | |
children | 6749f6639924 |
comparison
equal
deleted
inserted
replaced
114:1909d53071ab | 115:3895d2224e67 |
---|---|
1 SVGS = brick.svg bullet.svg bush.svg mud.svg rock.svg \ | |
2 tank1.svg tank2.svg tank_en.svg | |
3 SVGHS = $(SVGS:C/\.svg/.h/) | |
4 SVGCS = $(SVGS:C/\.svg/.c/) | |
5 SVGOS = $(SVGS:C/\.svg/.o/) | |
6 MBS = $(SVGS:C/\.svg/.mb/) | |
7 SVG2CODE= svg2code.py | |
8 M4 = m4 | |
9 M4FLAGS = -I /usr/local/share/mb | |
10 LDFLAGS += | |
11 LIBS += -lmbfly -lX11 -L/usr/local/lib `pkg-config --libs cairo` | |
12 CFLAGS += -I/usr/local/include `pkg-config --cflags cairo` | |
13 BIN = tank | |
14 | |
15 all: tank | |
16 | |
17 tank: tank_main.o $(SVGOS) | |
18 $(CC) $(LDFLAGS) -o $@ $(.ALLSRC) $(LIBS) | |
19 | |
20 tank_main.o: tank_main.c svgs.h | |
21 $(CC) $(CFLAGS) -c tank_main.c | |
22 | |
23 svgs.h: $(SVGHS) | |
24 echo "#ifndef __SVGS_H_" > $@ | |
25 echo "#define __SVGS_H_" >> $@ | |
26 echo >> $@ | |
27 for H in $(SVGHS); do \ | |
28 echo "#include \"$$H\"" >> $@; \ | |
29 done | |
30 echo >> $@ | |
31 echo "#endif /* __SVGS_H_ */" >> $@ | |
32 | |
33 .for SVG in $(SVGS) | |
34 $(SVG:C/\.svg/.o/): $(SVG:C/.svg/.c/) | |
35 $(CC) $(CFLAGS) -c -o $@ $(.ALLSRC) | |
36 | |
37 $(SVG:C/\.svg/.mb/): $(SVG) | |
38 $(SVG2CODE) $(SVG) $@ | |
39 | |
40 $(SVG:C/\.svg/.h/): $(SVG:C/\.svg/.mb/) | |
41 $(M4) $(M4FLAGS) mb_c_header.m4 $(.ALLSRC) > $@ | |
42 | |
43 $(SVG:C/\.svg/.c/): $(SVG:C/\.svg/.mb/) | |
44 $(M4) $(M4FLAGS) mb_c_source.m4 $(.ALLSRC) > $@ | |
45 | |
46 .endfor | |
47 | |
48 clean: | |
49 @for f in svgs.h $(SVGHS) $(SVGCS) $(SVGOS) $(MBS) \ | |
50 *~ *.core tank tank_main.o; do \ | |
51 if [ -e $$f ]; then \ | |
52 echo "delete $$f"; rm -f $$f; \ | |
53 fi; \ | |
54 done |