annotate 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
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 \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 tank1.svg tank2.svg tank_en.svg
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/)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 SVG2CODE= svg2code.py
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 M4 = m4
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 M4FLAGS = -I /usr/local/share/mb
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 LDFLAGS +=
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 LIBS += -lmbfly -lX11 -L/usr/local/lib `pkg-config --libs cairo`
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 CFLAGS += -I/usr/local/include `pkg-config --cflags cairo`
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 BIN = tank
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15 all: tank
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17 tank: tank_main.o $(SVGOS)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 $(CC) $(LDFLAGS) -o $@ $(.ALLSRC) $(LIBS)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 tank_main.o: tank_main.c svgs.h
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 $(CC) $(CFLAGS) -c tank_main.c
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 svgs.h: $(SVGHS)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 echo "#ifndef __SVGS_H_" > $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 echo "#define __SVGS_H_" >> $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 echo >> $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 for H in $(SVGHS); do \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 echo "#include \"$$H\"" >> $@; \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 done
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 echo >> $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 echo "#endif /* __SVGS_H_ */" >> $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 .for SVG in $(SVGS)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 $(SVG:C/\.svg/.o/): $(SVG:C/.svg/.c/)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35 $(CC) $(CFLAGS) -c -o $@ $(.ALLSRC)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
37 $(SVG:C/\.svg/.mb/): $(SVG)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
38 $(SVG2CODE) $(SVG) $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
39
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
40 $(SVG:C/\.svg/.h/): $(SVG:C/\.svg/.mb/)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
41 $(M4) $(M4FLAGS) mb_c_header.m4 $(.ALLSRC) > $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
42
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
43 $(SVG:C/\.svg/.c/): $(SVG:C/\.svg/.mb/)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
44 $(M4) $(M4FLAGS) mb_c_source.m4 $(.ALLSRC) > $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
45
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
46 .endfor
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
47
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
48 clean:
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
49 @for f in svgs.h $(SVGHS) $(SVGCS) $(SVGOS) $(MBS) \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
50 *~ *.core tank tank_main.o; do \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
51 if [ -e $$f ]; then \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
52 echo "delete $$f"; rm -f $$f; \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
53 fi; \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
54 done