aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2018-01-03 23:10:59 +0100
committerTom Smeding <tom.smeding@gmail.com>2018-01-03 23:10:59 +0100
commit9911f9a73c7dc46069199e52f2bc54082d10366c (patch)
tree914cd4fc2367207271c1c53c7f11a96ed9bbc9b7 /Makefile
Initial
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 28 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e206eea
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,28 @@
+CC = gcc
+LEX = flex
+YAXX = bison
+
+CFLAGS = -Wall -Wextra -std=c11 -g -I. -D_GNU_SOURCE
+LDFLAGS = -lfl
+
+TARGET = ccomp
+
+.PHONY: all clean
+
+all: $(TARGET)
+
+clean:
+ rm -f $(TARGET) *.o
+ rm -rf bison-out
+
+
+bison-out/y.tab.c bison-out/y.tab.h: c.y
+ @mkdir -p bison-out
+ bison -d -b bison-out/y c.y
+
+bison-out/lex.yy.c: c.l
+ @mkdir -p bison-out
+ flex -o bison-out/lex.yy.c c.l
+
+$(TARGET): $(wildcard *.c) $(wildcard *.h) bison-out/y.tab.c bison-out/lex.yy.c
+ $(CC) $(CFLAGS) $(filter %.c,$^) $(LDFLAGS) -o $@