-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (41 loc) · 1.72 KB
/
Makefile
File metadata and controls
56 lines (41 loc) · 1.72 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
55
56
CXX = g++
CXXFLAGS = -g -Wall -std=c++17 -I.
GENERATED_SRCS = parse.tab.cpp lex.yy.cpp grammar_symbols.cpp \
ast.cpp ast_visitor.cpp highlevel.cpp
GENERATED_HDRS = parse.tab.h lex.yy.h grammar_symbols.h ast_visitor.h highlevel.h
SRCS = node.cpp node_base.cpp location.cpp treeprint.cpp \
main.cpp context.cpp type.cpp symtab.cpp semantic_analysis.cpp \
literal_value.cpp operand.cpp instruction.cpp instruction_seq.cpp \
formatter.cpp highlevel_formatter.cpp print_instruction_seq.cpp module_collector.cpp \
local_storage_allocation.cpp highlevel_codegen.cpp storage.cpp \
print_code.cpp print_highlevel_code.cpp print_lowlevel_code.cpp \
lowlevel.cpp lowlevel_formatter.cpp lowlevel_codegen.cpp \
cfg.cpp cfg_transform.cpp print_cfg.cpp highlevel_defuse.cpp \
yyerror.cpp exceptions.cpp cpputil.cpp optimizations.cpp \
$(GENERATED_SRCS)
OBJS = $(SRCS:%.cpp=%.o)
PARSER_SRC = parse_buildast.y
EXE = nearly_cc
%.o : %.cpp
$(CXX) $(CXXFLAGS) -c $*.cpp -o $*.o
all : $(EXE)
$(EXE) : $(GENERATED_SRCS) $(GENERATED_HDRS) $(OBJS)
$(CXX) -o $@ $(OBJS)
parse.tab.h parse.tab.cpp : $(PARSER_SRC)
bison -v --output-file=parse.tab.cpp --defines=parse.tab.h $(PARSER_SRC)
lex.yy.cpp lex.yy.h : lex.l
flex --outfile=lex.yy.cpp --header-file=lex.yy.h lex.l
grammar_symbols.h grammar_symbols.cpp : $(PARSER_SRC) scan_grammar_symbols.rb
./scan_grammar_symbols.rb < $(PARSER_SRC)
ast.cpp ast_visitor.h ast_visitor.cpp : ast.h gen_ast_code.rb
./gen_ast_code.rb < ast.h
highlevel.h highlevel.cpp : gen_highlevel_ir.rb
./gen_highlevel_ir.rb
depend : $(GENERATED_SRCS)
$(CXX) $(CXXFLAGS) -M $(SRCS) > depend.mak
depend.mak :
touch $@
clean :
rm -f *.o depend.mak $(GENERATED_SRCS) $(GENERATED_HDRS) \
-f parse.output $(EXE)
include depend.mak