annotate examples/calculator/Makefile.pmake @ 1111:fa5f71d4aa04

console backend
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 08 Dec 2010 18:59:44 +0800
parents d0646a6df46f
children
rev   line source
88
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 SVG=calculator_scr.svg
175
67e13d694230 Fix bug of src/Makefile.am & examples accept PREFIX variable.
Thinker K.F. Li <thinker@branda.to>
parents: 162
diff changeset
2 PREFIX?=/usr/local
67e13d694230 Fix bug of src/Makefile.am & examples accept PREFIX variable.
Thinker K.F. Li <thinker@branda.to>
parents: 162
diff changeset
3 INCDIR?=$(PREFIX)/include
67e13d694230 Fix bug of src/Makefile.am & examples accept PREFIX variable.
Thinker K.F. Li <thinker@branda.to>
parents: 162
diff changeset
4 LIBDIR?=$(PREFIX)/lib
67e13d694230 Fix bug of src/Makefile.am & examples accept PREFIX variable.
Thinker K.F. Li <thinker@branda.to>
parents: 162
diff changeset
5 TOOLSDIR?=$(PREFIX)/share/mb
67e13d694230 Fix bug of src/Makefile.am & examples accept PREFIX variable.
Thinker K.F. Li <thinker@branda.to>
parents: 162
diff changeset
6 BINDIR?=$(PREFIX)/bin
67e13d694230 Fix bug of src/Makefile.am & examples accept PREFIX variable.
Thinker K.F. Li <thinker@branda.to>
parents: 162
diff changeset
7 INCS=-I$(INCDIR)
67e13d694230 Fix bug of src/Makefile.am & examples accept PREFIX variable.
Thinker K.F. Li <thinker@branda.to>
parents: 162
diff changeset
8 CFLAGS+=$(INCS) `pkg-config --cflags cairo` -Wall
67e13d694230 Fix bug of src/Makefile.am & examples accept PREFIX variable.
Thinker K.F. Li <thinker@branda.to>
parents: 162
diff changeset
9 LDFLAGS=-L$(LIBDIR) `pkg-config --libs cairo`
88
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 LIBS=-lmbfly
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 BINS= calc
175
67e13d694230 Fix bug of src/Makefile.am & examples accept PREFIX variable.
Thinker K.F. Li <thinker@branda.to>
parents: 162
diff changeset
12 SVG2CODE= $(BINDIR)/svg2code.py
67e13d694230 Fix bug of src/Makefile.am & examples accept PREFIX variable.
Thinker K.F. Li <thinker@branda.to>
parents: 162
diff changeset
13 MB_C_HEADER= $(TOOLSDIR)/mb_c_header.m4
67e13d694230 Fix bug of src/Makefile.am & examples accept PREFIX variable.
Thinker K.F. Li <thinker@branda.to>
parents: 162
diff changeset
14 MB_C_SOURCE= $(TOOLSDIR)/mb_c_source.m4
88
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 all: $(BINS)
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 calc: main.o $(SVG:C/.svg/.o/)
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 $(CC) $(LDFLAGS) -o $@ $(.ALLSRC) $(LIBS)
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 main.o: main.c $(SVG:C/.svg/.h/)
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22 $(CC) $(CFLAGS) -c -o $@ main.c
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 $(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
25 $(CC) -c $(CFLAGS) -o $@ $(SVG:C/.svg/.c/)
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 $(SVG:C/.svg/.mb/): $(SVG)
162
5535899513ce * patch for linux, and a trick symbol link to include <mb/mb.h>
"Mat <MatLinuxer2@gmail.com>"
parents: 137
diff changeset
28 $(SVG2CODE) $(.ALLSRC) $@
88
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 $(SVG:C/.svg/.c/): $(SVG:C/.svg/.mb/)
162
5535899513ce * patch for linux, and a trick symbol link to include <mb/mb.h>
"Mat <MatLinuxer2@gmail.com>"
parents: 137
diff changeset
31 m4 -I $(TOOLSDIR) $(MB_C_SOURCE) $(.ALLSRC) > $@
88
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 $(SVG:C/.svg/.h/): $(SVG:C/.svg/.mb/)
162
5535899513ce * patch for linux, and a trick symbol link to include <mb/mb.h>
"Mat <MatLinuxer2@gmail.com>"
parents: 137
diff changeset
34 m4 -I $(TOOLSDIR) $(MB_C_HEADER) $(.ALLSRC) > $@
88
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36 clean:
90
bd29780bf266 Reduce redundant code
Thinker K.F. Li <thinker@branda.to>
parents: 88
diff changeset
37 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
38 if [ -e "$$i" ]; then \
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
39 echo "delete $$i"; \
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
40 rm -f "$$i"; \
dd813dcc232c New example, calculator.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
41 fi; \
137
Thinker K.F. Li <thinker@branda.to>
parents: 110
diff changeset
42 done