diff examples/calculator/Makefile @ 88:dd813dcc232c

New example, calculator.
author Thinker K.F. Li <thinker@branda.to>
date Sat, 23 Aug 2008 15:26:47 +0800
parents
children bd29780bf266
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/calculator/Makefile	Sat Aug 23 15:26:47 2008 +0800
@@ -0,0 +1,35 @@
+SVG=calculator_scr.svg
+TOOLSDIR=../../tools
+INCS=-I../../src
+CFLAGS+=`pkg-config --cflags cairo` $(INCS) -Wall
+LDFLAGS=-L../../src/ `pkg-config --libs cairo`
+LIBS=-lmbfly
+BINS=	calc
+
+all:	$(BINS)
+
+calc:	main.o $(SVG:C/.svg/.o/)
+	$(CC) $(LDFLAGS) -o $@ $(.ALLSRC) $(LIBS)
+
+main.o:	main.c $(SVG:C/.svg/.h/)
+	$(CC) $(CFLAGS) -c -o $@ main.c
+
+$(SVG:C/.svg/.o/): $(SVG:C/.svg/.c/) $(SVG:C/.svg/.h/)
+	$(CC) -c $(CFLAGS) -o $@ $(SVG:C/.svg/.c/)
+
+$(SVG:C/.svg/.mb/): $(SVG)
+	$(TOOLSDIR)/svg2code.py $(.ALLSRC) $@
+
+$(SVG:C/.svg/.c/): $(SVG:C/.svg/.mb/)
+	m4 -I $(TOOLSDIR) mb_c_source.m4 $(.ALLSRC) > $@
+
+$(SVG:C/.svg/.h/): $(SVG:C/.svg/.mb/)
+	m4 -I $(TOOLSDIR) mb_c_header.m4 $(.ALLSRC) > $@
+
+clean:
+	for i in *.mb *.o *~ $(SVG:C/.svg/.c/) $(SVG:C/.svg/.h/) $(BINS); do \
+		if [ -e "$$i" ]; then \
+			echo "delete $$i"; \
+			rm -f "$$i"; \
+		fi; \
+	done
\ No newline at end of file