summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTom Harley2019-10-03 02:42:28 +0100
committerTom Harley2019-10-03 02:42:28 +0100
commit64d093247985f759669b7726542291382c1e3fc5 (patch)
tree4b8324373c4b267cd1affcab8a8ece20b920323b /Makefile
parentInitial commit (diff)
downloadsinter-64d093247985f759669b7726542291382c1e3fc5.tar.gz
sinter-64d093247985f759669b7726542291382c1e3fc5.zip

Support + and * operations

Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 24 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 56b2f72..04da4d8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,16 @@
-CC = c++
+CFLAGS = --std=c99 -Wpedantic -Wall
-CFLAGS += -x c --std=c99 -Wpedantic -Wall -Werror
-
-CFLAGS += $(shell llvm-config --cppflags)
-LDFLAGS += $(shell llvm-config --ldflags)
-LDLIBS += $(shell llvm-config --libs core analysis bitwriter --system-libs)
+CFLAGS += $(shell llvm-config --cflags)
+CXXFLAGS += $(shell llvm-config --cppflags)
+LDFLAGS += $(shell llvm-config --ldflags)
+LDLIBS += $(shell llvm-config --libs core analysis --system-libs)
.PHONY: default all clean
default: all
all: basic
+
basic: basic.o parse.o lex.o
+ $(LINK.cc) $(OUTPUT_OPTION) $^ $(LDLIBS)
basic.o lex.o: parse.h basic.h
parse.o: basic.h
@@ -18,5 +19,21 @@ parse.h: parse.y
$(YACC) -d -o /dev/null $<
mv -f y.tab.h $@
+# test stuff (warning: influenced by compiler flags declared above!)
+
+simple: simple.o common.o
+
+%.o: %.c
+ $(COMPILE.c) $(OUTPUT_OPTION) $<
+
+%.o: %.ll
+ clang -c $(OUTPUT_OPTION) $<
+
+%.ll: %.int basic
+ < $< ./basic > $@
+
+%.ll: %.c
+ $(COMPILE.c) -S -emit-llvm $(OUTPUT_OPTION) $<
+
clean:
- $(RM) basic y.tab.* *.o lex.c parse.c parse.h
+ $(RM) basic simple y.tab.* *.ll *.o lex.c parse.c parse.h