-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (39 loc) · 1.3 KB
/
Makefile
File metadata and controls
54 lines (39 loc) · 1.3 KB
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
50
51
52
53
54
# Note: run "make depend" before running "make",
# to ensure that generated source and header files are
# created properly.
C_SRCS = util.c parse.tab.c lex.yy.c grammar_symbols.c treeprint.c
C_OBJS = $(C_SRCS:%.c=%.o)
# You will probably want to add
# symbol.cpp symtab.cpp type.cpp
# to CXX_SRCS when you implement types and symbol tables.
CXX_SRCS = main.cpp cpputil.cpp node.cpp ast.cpp context.cpp \
astvisitor.cpp symtab.cpp type.cpp symbol.cpp cfg.cpp \
highlevel.cpp x86_64.cpp highlevelcodegen.cpp lowlevelcodegen.cpp \
cfg_transform.cpp live_vregs.cpp
CXX_OBJS = $(CXX_SRCS:%.cpp=%.o)
CC = gcc
CFLAGS = -g -Wall
CXX = g++
CXXFLAGS = $(CFLAGS) -std=c++17
%.o : %.c
$(CC) $(CFLAGS) -c $<
%.o : %.cpp
$(CXX) $(CXXFLAGS) -c $<
all : compiler
compiler : $(C_OBJS) $(CXX_OBJS)
$(CXX) -o $@ $(C_OBJS) $(CXX_OBJS)
parse.tab.c : parse.y
bison -d parse.y
lex.yy.c : lex.l
flex lex.l
grammar_symbols.h grammar_symbols.c : parse.y scan_grammar_symbols.rb
./scan_grammar_symbols.rb < parse.y
clean :
rm -f compiler *.o
rm -f parse.tab.c lex.yy.c parse.tab.h grammar_symbols.h grammar_symbols.c depend.mak
depend : grammar_symbols.h grammar_symbols.c parse.tab.c lex.yy.c
$(CC) $(CFLAFGS) -M $(C_SRCS) > depend.mak
$(CXX) $(CXXFLAGS) -M $(CXX_SRCS) >> depend.mak
depend.mak :
touch $@
include depend.mak