-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (40 loc) · 1.25 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
PYTHON=python3
SRC=./src
LEXER_TEST=./test/lexer
PARSER_TEST=./test/semantics
FINAL_TEST=./tests/final
install:
$(PYTHON) -m pip install --ignore-installed -r ./requirements.txt
lexer-tests:
mkdir -p out/lexer
for i in {1..5} ; do \
$(PYTHON) $(SRC)/lexer.py -o out/lexer/$$i.out $(LEXER_TEST)/test$$i.c; \
done
parser-tests:
mkdir -p out/tac out/symtab
mkdir -p dot/pdf
for i in {1..5} ; do \
$(PYTHON) -Wignore $(SRC)/parser.py $(PARSER_TEST)/test$$i.c; \
dot -Tpdf -o dot/pdf/$$i.pdf dot/$$i.dot; \
done
final-tests:
mkdir -p out/tac out/symtab out/exec out/assembly
for i in {1..33} ; do \
$(PYTHON) -Wignore $(SRC)/parser.py $(FINAL_TEST)/$$i.c; \
$(PYTHON) -Wignore $(SRC)/codegen.py out/tac/$$i.txt; \
gcc -w -m32 -o out/exec/$$i.out out/assembly/$$i.s src/lib.o -lm 2> /dev/null; \
done
compile:
mkdir -p out/tac out/symtab out/exec out/assembly
- rm out/tac/$(TEST).txt out/assembly/$(TEST).s out/exec/$(TEST).out
$(PYTHON) -Wignore $(SRC)/parser.py $(FINAL_TEST)/$(TEST).c
$(PYTHON) -Wignore $(SRC)/codegen.py out/tac/$(TEST).txt
gcc -w -m32 -o out/exec/$(TEST).out out/assembly/$(TEST).s src/lib.o -lm 2> /dev/null
make exec:
for i in {1..33} ; do \
./out/exec/$$i.out; \
done
clean:
-rm dot/*.dot
-rm dot/pdf/*.pdf
-rm -r out