comparison examples/tank/Makefile.pmake @ 188:a7358d9127c8

autotoolize examples/tank
author Thinker K.F. Li <thinker@branda.to>
date Fri, 07 Nov 2008 15:18:22 +0800
parents examples/tank/Makefile@c490796f6c82
children
comparison
equal deleted inserted replaced
187:576fcd1c529a 188:a7358d9127c8
1 SVGS = brick.svg bullet.svg bush.svg mud.svg rock.svg \
2 tank1.svg tank2.svg tank_en.svg bang.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 MB_C_HEADER= mb_c_header.m4
9 MB_C_SOURCE= mb_c_source.m4
10 M4 = m4
11 PREFIX?= /usr/local
12 M4MACRODIR?= $(PREFIX)/share/mb
13 M4FLAGS ?= -I $(M4MACRODIR)
14 LDFLAGS +=
15 INCDIR?= $(PREFIX)/include
16 LIBDIR?= $(PREFIX)/lib
17 LIBS += -lmbfly -lX11 -L$(LIBDIR) `pkg-config --libs cairo`
18 CFLAGS += -I$(INCDIR) `pkg-config --cflags cairo`
19 BIN = tank
20
21 all: tank
22
23 tank: tank_main.o $(SVGOS)
24 $(CC) $(LDFLAGS) -o $@ $(.ALLSRC) $(LIBS)
25
26 tank_main.o: tank_main.c svgs.h
27 $(CC) $(CFLAGS) -c tank_main.c
28
29 svgs.h: $(SVGHS)
30 echo "#ifndef __SVGS_H_" > $@
31 echo "#define __SVGS_H_" >> $@
32 echo >> $@
33 for H in $(SVGHS); do \
34 echo "#include \"$$H\"" >> $@; \
35 done
36 echo >> $@
37 echo "#endif /* __SVGS_H_ */" >> $@
38
39 .for SVG in $(SVGS)
40 $(SVG:C/\.svg/.o/): $(SVG:C/.svg/.c/)
41 $(CC) $(CFLAGS) -c -o $@ $(.ALLSRC)
42
43 $(SVG:C/\.svg/.mb/): $(SVG)
44 $(SVG2CODE) $(SVG) $@
45
46 $(SVG:C/\.svg/.h/): $(SVG:C/\.svg/.mb/)
47 $(M4) $(M4FLAGS) $(MB_C_HEADER) $(.ALLSRC) > $@
48
49 $(SVG:C/\.svg/.c/): $(SVG:C/\.svg/.mb/)
50 $(M4) $(M4FLAGS) $(MB_C_SOURCE) $(.ALLSRC) > $@
51
52 .endfor
53
54 clean:
55 @for f in svgs.h $(SVGHS) $(SVGCS) $(SVGOS) $(MBS) \
56 *~ *.core tank tank_main.o; do \
57 if [ -e $$f ]; then \
58 echo "delete $$f"; rm -f $$f; \
59 fi; \
60 done