From 7bc67b95161a34f8eca635d4000d9602508a9243 Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Mon, 23 Dec 2019 01:32:39 +0000 Subject: checkpoint --- Makefile | 58 ++++++++++++++++++++++------------------------------------ 1 file changed, 22 insertions(+), 36 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index c4214a2..896dbcc 100644 --- a/Makefile +++ b/Makefile @@ -4,31 +4,41 @@ YACC = bison LEX = flex DEBUG = -ggdb3 -O0 -DGC_DEBUG -RELEASE = -O3 -DNDEBUG +RELEASE = -O2 -DNDEBUG CFLAGS = --std=c99 -Wpedantic -Wall -Wextra -Werror $(DEBUG) LFLAGS = -D_POSIX_C_SOURCE=200809L LLVM_MODULES = core executionengine mcjit interpreter analysis native bitwriter -CFLAGS += $(shell llvm-config --cflags) +CFLAGS += $(shell llvm-config --cflags) -I$(HOME)/usr/include CXXFLAGS += $(shell llvm-config --cppflags) -LDFLAGS += $(shell llvm-config --ldflags) +LDFLAGS += $(shell llvm-config --ldflags) -L$(HOME)/usr/lib LDLIBS += $(shell llvm-config --libs $(LLVM_MODULES) --system-libs) -lgc -.PHONY: default all clean +.PHONY: default all clean test + default: all -all: basic -basic.o: basic.h parse.h debug.h error.h scope.h -parse.o: basic.h -lex.o: basic.h parse.h -scope.o: scope.h error.h +all: sinter common.o + +sinter.o: sinter.h parse.h debug.h error.h scope.h llvm_codegen.h \ + graphviz_codegen.h +llvm_codegen.o: llvm_codegen.h sinter.h scope.h debug.h parse.h error.h +sinter_codegen.o: sinter_codegen.h parse.h +graphviz_codegen.o: graphviz_codegen.h parse.h error.h +parse.o: sinter.h +lex.o: sinter.h parse.h +scope.o: scope.h error.h debug.h +common.o: debug.h -basic: basic.o parse.o lex.o scope.o +sinter: sinter.o parse.o lex.o scope.o llvm_codegen.o sinter_codegen.o \ + graphviz_codegen.o $(LINK.cc) $(OUTPUT_OPTION) $^ $(LDLIBS) -# explicit rules for parse and lex prevent -Weverything being passed to them +test: all + $(MAKE) -C examples test + parse.o: parse.c $(CC) -c --std=c99 $(OUTPUT_OPTION) $< @@ -41,29 +51,5 @@ lex.o: lex.c %.c: %.y $(YACC) -o $@ $< -# test stuff (warning: influenced by compiler flags declared above!) -# TODO should probably rearrange the system so tests don't use the same build -# configs as the compiler - -simple: simple.o common.o - -%.o: %.c - $(COMPILE.c) $(OUTPUT_OPTION) $< - -%.o: %.ll - clang -c $(OUTPUT_OPTION) $< - -%.o: %.bc - clang -c $(OUTPUT_OPTION) $< - -%.ll: %.int basic - ./basic -clo $@ $< - -%.bc: %.int basic - ./basic -cbo $@ $< - -%.ll: %.c - clang -S -emit-llvm $(OUTPUT_OPTION) $< - clean: - $(RM) basic simple y.tab.* *.ll *.o lex.c parse.c parse.h + $(RM) sinter *.tab.* *.o lex.c parse.c parse.h -- cgit v1.2.1