aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-17 12:09:12 +0200
committerMattias Andrée <maandree@kth.se>2021-04-17 12:09:12 +0200
commita5218fce6b19591c9412a84a5088c260c0676f61 (patch)
tree038f8b8e1064b4f61c831907ac4f20b77711f289 /Makefile
downloadlibparser-a5218fce6b19591c9412a84a5088c260c0676f61.tar.gz
libparser-a5218fce6b19591c9412a84a5088c260c0676f61.tar.bz2
libparser-a5218fce6b19591c9412a84a5088c260c0676f61.tar.xz
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile37
1 files changed, 37 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c8628b0
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,37 @@
+.POSIX:
+
+CONFIGFILE = config.mk
+include $(CONFIGFILE)
+
+
+all: libparser.a libparser-generate calc-example/calc
+libparser.o: libparser.c libparser.h
+calc-example/calc-syntax.o: calc-example/calc-syntax.c libparser.h
+
+.c.o:
+ $(CC) -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
+
+.c.lo:
+ $(CC) -fPIC -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
+
+libparser-generate: libparser-generate.o
+ $(CC) -o $@ libparser-generate.o $(LDFLAGS)
+
+libparser.a: libparser.o
+ $(AR) rc $@ libparser.o
+ $(AR) -s $@
+
+calc-example/calc: calc-example/calc.o calc-example/calc-syntax.o libparser.a
+ $(CC) -o $@ calc-example/calc.o calc-example/calc-syntax.o libparser.a $(LDFLAGS)
+
+calc-example/calc-syntax.c: libparser-generate calc-example/calc.syntax
+ ./libparser-generate _expr < calc-example/calc.syntax > $@
+
+clean:
+ -rm -f -- *.o *.lo *.a *.so *.su *-example/*.o *-example/*.su *-example/*-syntax.c libparser-generate
+ -rm -f -- calc-example/calc
+
+.SUFFIXES:
+.SUFFIXES: .c .o .lo
+
+.PHONY: all clean