-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
49 lines (39 loc) · 849 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
43
44
45
46
47
48
49
# This is Ding Rui's mini SysY Compiler
F=front
B=back
OBJS = \
$F/parser.tab.o \
$F/lex.yy.o \
$F/global.o \
$F/baseast.o \
$F/error.o \
$F/ast.o \
$F/strtab.o \
$F/symtab.o \
$F/flow.o \
$F/geneey.o \
$F/eerep.o \
$F/optimee.o \
$B/gentg.o \
$B/tgrep.o \
$B/optimtg.o \
main.o
Header = \
$F/*.hpp \
$B/*.hpp
compiler: $(OBJS)
g++ -std=c++11 -o compiler $(OBJS) -ll -ly -I.
$F/lex.yy.cpp: $F/lex.l
lex -o $@ $<
$F/parser.tab.cpp: $F/parser.y
yacc -d -o $@ $< -Wno-yacc
$F/%.o: $F/%.cpp $(Header)
g++ -std=c++11 -c -o $@ $< -O2 -Wno-deprecated-register -I./front
$B/%.o: $B/%.cpp $(Header)
g++ -std=c++11 -c -o $@ $< -O2 -I./back
main.o: main.cpp $(Header)
g++ -std=c++11 -c -o $@ $< -O2 -I.
clean:
rm -f $(OBJS)
cleanall:
rm -f $(OBJS) $F/parser.tab.hpp $F/parser.tab.cpp $F/lex.yy.cpp compiler