annotate examples/calculator/Makefile @ 137:5dcfaafd1a9c

-
author Thinker K.F. Li <thinker@branda.to>
date Fri, 19 Sep 2008 09:53:17 +0800
parents c14cb6d12030
children 5535899513ce
rev   line source
88
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 SVG=calculator_scr.svg
110
Thinker K.F. Li <thinker@branda.to>
parents: 108
diff changeset
2 TOOLSDIR=/usr/local/share/mb
108
565b55508c8d More dox
Thinker K.F. Li <thinker@branda.to>
parents: 90
diff changeset
3 INCS=-I/usr/local/include
88
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 CFLAGS+=`pkg-config --cflags cairo` $(INCS) -Wall
108
565b55508c8d More dox
Thinker K.F. Li <thinker@branda.to>
parents: 90
diff changeset
5 LDFLAGS=-L/usr/local/lib `pkg-config --libs cairo`
88
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 LIBS=-lmbfly
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 BINS= calc
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 all: $(BINS)
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 calc: main.o $(SVG:C/.svg/.o/)
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 $(CC) $(LDFLAGS) -o $@ $(.ALLSRC) $(LIBS)
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 main.o: main.c $(SVG:C/.svg/.h/)
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15 $(CC) $(CFLAGS) -c -o $@ main.c
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17 $(SVG:C/.svg/.o/): $(SVG:C/.svg/.c/) $(SVG:C/.svg/.h/)
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 $(CC) -c $(CFLAGS) -o $@ $(SVG:C/.svg/.c/)
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 $(SVG:C/.svg/.mb/): $(SVG)
110
Thinker K.F. Li <thinker@branda.to>
parents: 108
diff changeset
21 /usr/local/bin/svg2code.py $(.ALLSRC) $@
88
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 $(SVG:C/.svg/.c/): $(SVG:C/.svg/.mb/)
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 m4 -I $(TOOLSDIR) mb_c_source.m4 $(.ALLSRC) > $@
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 $(SVG:C/.svg/.h/): $(SVG:C/.svg/.mb/)
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 m4 -I $(TOOLSDIR) mb_c_header.m4 $(.ALLSRC) > $@
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 clean:
90
bd29780bf266 Reduce redundant code
Thinker K.F. Li <thinker@branda.to>
parents: 88
diff changeset
30 for i in *.mb *.o *.core *~ $(SVG:C/.svg/.c/) $(SVG:C/.svg/.h/) $(BINS); do \
88
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 if [ -e "$$i" ]; then \
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32 echo "delete $$i"; \
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 rm -f "$$i"; \
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 fi; \
137
Thinker K.F. Li <thinker@branda.to>
parents: 110
diff changeset
35 done