annotate examples/tank/Makefile.pmake @ 726:d479f319d7b7

Merge with head
author wycc
date Mon, 16 Aug 2010 07:34:21 +0800
parents a7358d9127c8
children
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/)
167
73c4e93d331c Make makefile more flexible that user can specify dirtories.
Thinker K.F. Li <thinker@branda.to>
parents: 165
diff changeset
7 SVG2CODE= svg2code.py
73c4e93d331c Make makefile more flexible that user can specify dirtories.
Thinker K.F. Li <thinker@branda.to>
parents: 165
diff changeset
8 MB_C_HEADER= mb_c_header.m4
73c4e93d331c Make makefile more flexible that user can specify dirtories.
Thinker K.F. Li <thinker@branda.to>
parents: 165
diff changeset
9 MB_C_SOURCE= mb_c_source.m4
115
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 M4 = m4
173
c490796f6c82 Remove src/mb (soft-link).
Thinker K.F. Li <thinker@branda.to>
parents: 167
diff changeset
11 PREFIX?= /usr/local
c490796f6c82 Remove src/mb (soft-link).
Thinker K.F. Li <thinker@branda.to>
parents: 167
diff changeset
12 M4MACRODIR?= $(PREFIX)/share/mb
167
73c4e93d331c Make makefile more flexible that user can specify dirtories.
Thinker K.F. Li <thinker@branda.to>
parents: 165
diff changeset
13 M4FLAGS ?= -I $(M4MACRODIR)
115
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 LDFLAGS +=
173
c490796f6c82 Remove src/mb (soft-link).
Thinker K.F. Li <thinker@branda.to>
parents: 167
diff changeset
15 INCDIR?= $(PREFIX)/include
c490796f6c82 Remove src/mb (soft-link).
Thinker K.F. Li <thinker@branda.to>
parents: 167
diff changeset
16 LIBDIR?= $(PREFIX)/lib
c490796f6c82 Remove src/mb (soft-link).
Thinker K.F. Li <thinker@branda.to>
parents: 167
diff changeset
17 LIBS += -lmbfly -lX11 -L$(LIBDIR) `pkg-config --libs cairo`
c490796f6c82 Remove src/mb (soft-link).
Thinker K.F. Li <thinker@branda.to>
parents: 167
diff changeset
18 CFLAGS += -I$(INCDIR) `pkg-config --cflags cairo`
115
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 BIN = tank
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 all: tank
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 tank: tank_main.o $(SVGOS)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 $(CC) $(LDFLAGS) -o $@ $(.ALLSRC) $(LIBS)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 tank_main.o: tank_main.c svgs.h
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 $(CC) $(CFLAGS) -c tank_main.c
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 svgs.h: $(SVGHS)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 echo "#ifndef __SVGS_H_" > $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 echo "#define __SVGS_H_" >> $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32 echo >> $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 for H in $(SVGHS); do \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 echo "#include \"$$H\"" >> $@; \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35 done
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36 echo >> $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
37 echo "#endif /* __SVGS_H_ */" >> $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
38
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
39 .for SVG in $(SVGS)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
40 $(SVG:C/\.svg/.o/): $(SVG:C/.svg/.c/)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
41 $(CC) $(CFLAGS) -c -o $@ $(.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/.mb/): $(SVG)
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
44 $(SVG2CODE) $(SVG) $@
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
45
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
46 $(SVG:C/\.svg/.h/): $(SVG:C/\.svg/.mb/)
161
0299cdb004a1 * patch for linux, compilation still buggy.
"Mat <MatLinuxer2@gmail.com>"
parents: 155
diff changeset
47 $(M4) $(M4FLAGS) $(MB_C_HEADER) $(.ALLSRC) > $@
115
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
48
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
49 $(SVG:C/\.svg/.c/): $(SVG:C/\.svg/.mb/)
165
e959ed450b67 * compilation passed
"Mat <MatLinuxer2@gmail.com>"
parents: 164
diff changeset
50 $(M4) $(M4FLAGS) $(MB_C_SOURCE) $(.ALLSRC) > $@
115
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
51
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
52 .endfor
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
53
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
54 clean:
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
55 @for f in svgs.h $(SVGHS) $(SVGCS) $(SVGOS) $(MBS) \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
56 *~ *.core tank tank_main.o; do \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
57 if [ -e $$f ]; then \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
58 echo "delete $$f"; rm -f $$f; \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
59 fi; \
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
60 done