-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (68 loc) · 2.91 KB
/
Makefile
File metadata and controls
91 lines (68 loc) · 2.91 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Made to work with clang
# clang flags
CFLAGS = -std=c11
CFLAGS += -Wall
CFLAGS += -Werror
CFLAGS += -Wextra
CFLAGS += -pedantic
CFLAGS += -Werror
CFLAGS += -Wmissing-declarations
CFLAGS += -g
#CFLAGS += -Weverything
ASANFLAGS =
all: clean out/GCC
# ASan flags
debug: clean
debug: ASANFLAGS += -fsanitize=address
debug: ASANFLAGS += -fno-common
debug: ASANFLAGS += -fno-omit-frame-pointer
debug: ASANFLAGS += -fsanitize-address-use-after-scope
debug: export ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1
#debug: CFLAGS += -g
debug: out/GCC
out/GCC: out/parser.o out/hipo.o
clang $(CFLAGS) $(ASANFLAGS) src/main.c out/*.o -o out/GCC
out/hipo.o: out/code_gen.o
clang $(CFLAGS) -c src/hipo_interpreter/hipo_interpreter.c -o out/hipo.o
out/parser.o: out/syntactic_analyzer.o
clang $(CFLAGS) -c src/parser/parser.c -o out/parser.o
out/syntactic_analyzer.o: out/lexical_analyzer.o out/cli.o out/source_file.o out/code_gen.o #out/semantic_actions.o
clang $(CFLAGS) -c src/syntactic/syntactic_analyzer.c -o out/syntactic_analyzer.o
out/source_file.o: out/st.o out/cli.o out/lexical_token.o
clang $(CFLAGS) -c src/source_file/source_file.c -o out/source_file.o
out/st.o: out/sprint.o
clang $(CFLAGS) -c src/symbol_table/symbol_table.c -o out/st.o
out/sprint.o: out/s_mem_alloc.o
clang $(CFLAGS) -c src/cache_printf/cache_printf.c -o out/sprint.o
out/lexical_analyzer.o: out/lexical_token.o
clang $(CFLAGS) -c src/lexical/lexical_analyzer.c -o out/lexical_analyzer.o
out/lexical_token.o: out/file_handler.o
clang $(CFLAGS) -c src/lexical/lexical_token.c -o out/lexical_token.o
out/file_handler.o: out/string.o
clang $(CFLAGS) -c src/file_handler/file_handler.c -o out/file_handler.o
out/cli.o: out/s_mem_alloc.o
clang $(CFLAGS) -c src/cli/cli.c -o out/cli.o
out/code_gen.o: out/exp.o
clang $(CFLAGS) -c src/code_generation/code_generation.c -o out/code_gen.o
out/exp.o: out/string.o out/st.o
clang $(CFLAGS) -c src/expression_handler/expression_handler.c -o out/exp.o
out/string.o: out/s_mem_alloc.o
clang $(CFLAGS) -c src/string/string.c -o out/string.o
out/s_mem_alloc.o : out/exceptions_handler.o
clang $(CFLAGS) -c src/s_mem_alloc/s_mem_alloc.c -o out/s_mem_alloc.o
out/exceptions_handler.o: out/logs.o
clang $(CFLAGS) -c src/exceptions/exceptions_handler.c -o out/exceptions_handler.o
out/logs.o:
clang $(CFLAGS) -c src/logs/logs.c -o out/logs.o
.PHONY : tests
tests : debug
clang ${CFLAGS} tests/lexical_tests.c out/logs.o out/exceptions_handler.o -o out/lexical_tests
@./out/lexical_tests
clang ${CFLAGS} tests/syntactic_tests.c out/logs.o out/exceptions_handler.o -o out/syntactic_tests
@./out/syntactic_tests
clang ${CFLAGS} tests/semantic_tests.c out/logs.o out/exceptions_handler.o -o out/semantic_tests
@./out/semantic_tests
.PHONY : clean
clean:
-rm out/GCC* out/*.o tests/outputs/*.txt out/lexical_tests out/hipo out/*_tests*
-rm tests/outputs/*/*.txt