-
Notifications
You must be signed in to change notification settings - Fork 59
/
Makefile
42 lines (30 loc) · 828 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
all: compiler
OBJS = grammar.o \
token.o \
CodeGen.o \
utils.o \
main.o \
ObjGen.o \
TypeSystem.o \
LLVMCONFIG = llvm-config-3.9
CPPFLAGS = `$(LLVMCONFIG) --cppflags` -std=c++11
LDFLAGS = `$(LLVMCONFIG) --ldflags` -lpthread -ldl -lz -lncurses -rdynamic -L/usr/local/lib -ljsoncpp
LIBS = `$(LLVMCONFIG) --libs`
clean:
$(RM) -rf grammar.cpp grammar.hpp test compiler tokens.cpp *.output $(OBJS)
ObjGen.cpp: ObjGen.h
CodeGen.cpp: CodeGen.h ASTNodes.h
grammar.cpp: grammar.y
bison -d -o $@ $<
grammar.hpp: grammar.cpp
token.cpp: token.l grammar.hpp
flex -o $@ $<
%.o: %.cpp
g++ -c $(CPPFLAGS) -o $@ $<
compiler: $(OBJS)
g++ $(CPPFLAGS) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
test: compiler test.input
cat test.input | ./compiler
testlink: output.o testmain.cpp
clang output.o testmain.cpp -o test
./test