annotate examples/tank/Makefile @ 164:3fec69d26be3

* use enviroment to adopt M4FLAGS
author "Mat <MatLinuxer2@gmail.com>"
date Mon, 20 Oct 2008 16:27:45 +0800
parents 7d700e5f82ba
children e959ed450b67
rev   line source
115
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 SVGS = brick.svg bullet.svg bush.svg mud.svg rock.svg \
155
6749f6639924 Fix bug for STAILQ that fail to remove a node.
Thinker K.F. Li <thinker@branda.to>
parents: 115
diff changeset
2 tank1.svg tank2.svg tank_en.svg bang.svg
115
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3 SVGHS = $(SVGS:C/\.svg/.h/)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 SVGCS = $(SVGS:C/\.svg/.c/)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 SVGOS = $(SVGS:C/\.svg/.o/)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 MBS = $(SVGS:C/\.svg/.mb/)
161
0299cdb004a1 * patch for linux, compilation still buggy.
"Mat <MatLinuxer2@gmail.com>"
parents: 155
diff changeset
7 SVG2CODE= ../../tools/svg2code.py
0299cdb004a1 * patch for linux, compilation still buggy.
"Mat <MatLinuxer2@gmail.com>"
parents: 155
diff changeset
8 MB_C_HEADER= ../../tools/mb_c_header.m4
115
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 M4 = m4
164
3fec69d26be3 * use enviroment to adopt M4FLAGS
"Mat <MatLinuxer2@gmail.com>"
parents: 163
diff changeset
10 M4FLAGS ?= -I /usr/local/share/mb
115
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 LDFLAGS +=
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 LIBS += -lmbfly -lX11 -L/usr/local/lib `pkg-config --libs cairo`
161
0299cdb004a1 * patch for linux, compilation still buggy.
"Mat <MatLinuxer2@gmail.com>"
parents: 155
diff changeset
13 CFLAGS += -I/usr/local/include `pkg-config --cflags cairo` -I../../src
115
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 BIN = tank
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 all: tank
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 tank: tank_main.o $(SVGOS)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 $(CC) $(LDFLAGS) -o $@ $(.ALLSRC) $(LIBS)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 tank_main.o: tank_main.c svgs.h
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22 $(CC) $(CFLAGS) -c tank_main.c
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 svgs.h: $(SVGHS)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 echo "#ifndef __SVGS_H_" > $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 echo "#define __SVGS_H_" >> $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 echo >> $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 for H in $(SVGHS); do \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 echo "#include \"$$H\"" >> $@; \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 done
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 echo >> $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32 echo "#endif /* __SVGS_H_ */" >> $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 .for SVG in $(SVGS)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35 $(SVG:C/\.svg/.o/): $(SVG:C/.svg/.c/)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36 $(CC) $(CFLAGS) -c -o $@ $(.ALLSRC)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
37
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
38 $(SVG:C/\.svg/.mb/): $(SVG)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
39 $(SVG2CODE) $(SVG) $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
40
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
41 $(SVG:C/\.svg/.h/): $(SVG:C/\.svg/.mb/)
161
0299cdb004a1 * patch for linux, compilation still buggy.
"Mat <MatLinuxer2@gmail.com>"
parents: 155
diff changeset
42 $(M4) $(M4FLAGS) $(MB_C_HEADER) $(.ALLSRC) > $@
115
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
43
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
44 $(SVG:C/\.svg/.c/): $(SVG:C/\.svg/.mb/)
161
0299cdb004a1 * patch for linux, compilation still buggy.
"Mat <MatLinuxer2@gmail.com>"
parents: 155
diff changeset
45 $(M4) $(M4FLAGS) $(MB_C_HEADER) $(.ALLSRC) > $@
115
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
46
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
47 .endfor
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
48
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
49 clean:
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
50 @for f in svgs.h $(SVGHS) $(SVGCS) $(SVGOS) $(MBS) \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
51 *~ *.core tank tank_main.o; do \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
52 if [ -e $$f ]; then \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
53 echo "delete $$f"; rm -f $$f; \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
54 fi; \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
55 done