Mercurial > MadButterfly
annotate examples/calculator/Makefile @ 175:67e13d694230
Fix bug of src/Makefile.am & examples accept PREFIX variable.
- src/Makefile.am install header files into $(prefix)/include/mb instead of
$(prefix)/include original.
- examples find headers, M4 macro files, and tools with PREFIX varaible.
- default value of PREFIX is /usr/local.
- user can change PREFIX with paramter of make command, for example
'make PREFIX=../../build/dest', if MadButterfly was installed there.
- Users can install MadButterfly in their specified directory, for example,
'./configure --prefix=${PWD}/dest', the binary will installed in dest/.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Fri, 31 Oct 2008 15:15:44 +0800 |
parents | 5535899513ce |
children |
rev | line source |
---|---|
88 | 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 | 10 LIBS=-lmbfly |
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 | 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) | |
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 | 29 |
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 | 32 |
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 | 35 |
36 clean: | |
90 | 37 for i in *.mb *.o *.core *~ $(SVG:C/.svg/.c/) $(SVG:C/.svg/.h/) $(BINS); do \ |
88 | 38 if [ -e "$$i" ]; then \ |
39 echo "delete $$i"; \ | |
40 rm -f "$$i"; \ | |
41 fi; \ | |
137 | 42 done |