This repository has been archived by the owner on Oct 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (54 loc) · 1.63 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
include src/Makefile.config
FLEX = flex
FLEX_OPTS = -PLatte
BISON = bison
BISON_OPTS = -t -pLatte
.PHONY: all
all: latc_x86_64 latc
@printf "\033[32mBuild finished\033[0m\n"
$(eval $(call add_generated_target, src/ByBnfc/Lexer.c, \
$$(FLEX) $$(FLEX_OPTS) -o$$@ $$<, \
src/ByBnfc/Latte.l Makefile \
))
$(eval $(call add_generated_target, src/ByBnfc/Parser.c, \
$$(BISON) $$(BISON_OPTS) $$< -o $$@, \
src/ByBnfc/Latte.y Makefile \
))
$(eval $(call add_generated_target, src/ast/build.cc, \
src/ast/build_gen.py $$< $$@, \
src/ast/build.cc.template src/ast/build_gen.py Makefile \
))
BNFC_SRCS := \
src/ByBnfc/Absyn.c \
src/ByBnfc/Lexer.c \
src/ByBnfc/Parser.c \
$(call SRCS_TO_OBJS, $(BNFC_SRCS)): override INTERNAL_EXTRA_C_FLAGS := -D_POSIX_C_SOURCE=200809L
define LATC_FLAGS
INTERNAL_EXTRA_CXX_FLAGS := -I. -Wno-extern-c-compat
endef
LATC_SOURCES := $(BNFC_SRCS) \
src/ast/build.cc \
src/backend/x86_64.cc \
src/frontend/global_symbols.cc \
src/frontend/static_analyzer.cc \
src/frontend/type_checker.cc \
src/ir/ast_to_ir.cc \
src/ir/bblock_pred_succ_info.cc \
src/ir/eliminate_dead_code.cc \
src/ir/eliminate_unnecessary_phis.cc \
src/ir/global_subexpression_elimination.cc \
src/ir/ir_printer.cc \
src/ir/make_ssa.cc \
src/ir/optimize.cc \
src/ir/propagate_constants.cc \
src/ir/propagate_copies.cc \
src/ir/remove_phis.cc \
src/latc_x86_64.cc \
$(eval $(call add_executable, latc_x86_64, $(LATC_FLAGS), $(LATC_SOURCES)))
$(eval $(call add_executable, latc, $(LATC_FLAGS), $(LATC_SOURCES)))
$(eval $(call add_executable, src/persistent_map_tester,, \
src/persistent_map_tester.cc \
))
.PHONY: format
format:
python3 format.py .