Mercurial > MadButterfly
comparison examples/calculator/Makefile.pmake @ 178:d0646a6df46f
Autoolize examples.
author | sylee@eeepc |
---|---|
date | Sun, 02 Nov 2008 02:37:18 +0800 |
parents | examples/calculator/Makefile@67e13d694230 |
children |
comparison
equal
deleted
inserted
replaced
177:c8cf6343868b | 178:d0646a6df46f |
---|---|
1 SVG=calculator_scr.svg | |
2 PREFIX?=/usr/local | |
3 INCDIR?=$(PREFIX)/include | |
4 LIBDIR?=$(PREFIX)/lib | |
5 TOOLSDIR?=$(PREFIX)/share/mb | |
6 BINDIR?=$(PREFIX)/bin | |
7 INCS=-I$(INCDIR) | |
8 CFLAGS+=$(INCS) `pkg-config --cflags cairo` -Wall | |
9 LDFLAGS=-L$(LIBDIR) `pkg-config --libs cairo` | |
10 LIBS=-lmbfly | |
11 BINS= calc | |
12 SVG2CODE= $(BINDIR)/svg2code.py | |
13 MB_C_HEADER= $(TOOLSDIR)/mb_c_header.m4 | |
14 MB_C_SOURCE= $(TOOLSDIR)/mb_c_source.m4 | |
15 | |
16 all: $(BINS) | |
17 | |
18 calc: main.o $(SVG:C/.svg/.o/) | |
19 $(CC) $(LDFLAGS) -o $@ $(.ALLSRC) $(LIBS) | |
20 | |
21 main.o: main.c $(SVG:C/.svg/.h/) | |
22 $(CC) $(CFLAGS) -c -o $@ main.c | |
23 | |
24 $(SVG:C/.svg/.o/): $(SVG:C/.svg/.c/) $(SVG:C/.svg/.h/) | |
25 $(CC) -c $(CFLAGS) -o $@ $(SVG:C/.svg/.c/) | |
26 | |
27 $(SVG:C/.svg/.mb/): $(SVG) | |
28 $(SVG2CODE) $(.ALLSRC) $@ | |
29 | |
30 $(SVG:C/.svg/.c/): $(SVG:C/.svg/.mb/) | |
31 m4 -I $(TOOLSDIR) $(MB_C_SOURCE) $(.ALLSRC) > $@ | |
32 | |
33 $(SVG:C/.svg/.h/): $(SVG:C/.svg/.mb/) | |
34 m4 -I $(TOOLSDIR) $(MB_C_HEADER) $(.ALLSRC) > $@ | |
35 | |
36 clean: | |
37 for i in *.mb *.o *.core *~ $(SVG:C/.svg/.c/) $(SVG:C/.svg/.h/) $(BINS); do \ | |
38 if [ -e "$$i" ]; then \ | |
39 echo "delete $$i"; \ | |
40 rm -f "$$i"; \ | |
41 fi; \ | |
42 done |