-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·60 lines (53 loc) · 1.75 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
all: Analyser
Analyser: lex.yy.c NodeDecl.cpp Visitor.cpp TypeClass.cpp main.cpp Analyser.tab.cpp Analyser.tab.h CodeGeneration/CodeGenerator.h CodeGeneration/CodeGenerator.cpp CILCodeGeneration/CodeGenerator.h CILCodeGeneration/CodeGenerator.cpp
c++ lex.yy.c NodeDecl.cpp Visitor.cpp CodeGeneration/CodeGenerator.cpp CILCodeGeneration/CodeGenerator.cpp TypeClass.cpp main.cpp -o Analyser
lex.yy.c: Analyser.lex
lex Analyser.lex
Analyser.tab.cpp Analyser.tab.h: Analyser.y
bison -d Analyser.y
clean:
rm -f *.o
test: Analyser
@echo "Running good tests..."
@for file in tests/*.txt; do \
output=$$(./Analyser $$file); \
exit_code=$$?; \
last_line=$$(echo "$$output" | tail -n 1); \
if [ $$exit_code -eq 0 ]; then \
echo "\033[0;32mOK\033[0m in $$file: \033[01;30m($$last_line)\033[0m"; \
else \
echo "\033[0;31mERROR_CODE=($$exit_code) in $$file: ($$last_line)\033[0m"; \
fi; \
done
@echo "Running bad tests..."
@for file in bad_tests/*.txt; do \
output=$$(./Analyser $$file); \
exit_code=$$?; \
last_line=$$(echo "$$output" | tail -n 1); \
if [ $$exit_code -eq 0 ]; then \
echo "\033[0;31mERROR in $$file: because bad test is successful: \033[01;30m($$last_line)\033[0m"; \
else \
echo "\033[0;32mOK\033[0m in $$file: \033[01;30m($$last_line)\033[0m"; \
fi; \
done
run: Analyser
ifeq ($(file),)
cd Result/ && dotnet new console --force
./Analyser
cd Result/ && dotnet run
else
cd Result/ && dotnet new console --force
./Analyser $(file)
cd Result/ && dotnet run
endif
run-cil: Analyser
ifeq ($(file),)
cd Result/ && dotnet new console --force
./Analyser
else
cd Result/ && dotnet new console --force
./Analyser $(file)
endif
ilasm Result/Program.il /output=Result/program.exe
chmod 755 Result/program.exe
./Result/program.exe