-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
78 lines (58 loc) · 1.71 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
66
67
68
69
70
71
72
73
74
75
76
77
78
CC= cc
DEBUG= -T
COMMON= parser.c interpreter.c main.c \
scan.c ast.c generator.c statement.c \
helper.c symbol_table.c types.c declaration.c \
optimizer.c
HSRCS= data.h parser.h interpreter.h \
scan.h ast.h generator.h statement.h \
helper.h symbol_table.h types.h declaration.h \
optimizer.h
SRCS= $(COMMON) generator_core.c
ARM_SRCS= $(COMMON) generator_core_arm.c
TEST_CASE_NAME= 153
TEST_CASE= test/input$(TEST_CASE_NAME).zc
INCLUDE_DIRECTORY= /tmp/include
BINARAY_DIRECTORY= /tmp
incdir.h:
echo "#define INCDIR \"$(INCLUDE_DIRECTORY)\"" > incdir.h
clean:
rm -f parser parser0 parser1 parser2 parser_arm *.o *.s out test/out *.out test/*.s
install: parser
sudo mkdir -p $(INCLUDE_DIRECTORY)
sudo rsync -a include/. $(INCLUDE_DIRECTORY)
sudo cp parser $(BINARAY_DIRECTORY)
sudo chmod +x $(BINARAY_DIRECTORY)/parser
parser: $(SRCS) $(HSRCS)
$(CC) -o parser -g $(SRCS)
parser_arm: $(ARM_SRCS) $(HSRCS)
$(CC) -o parser -g $(ARM_SRCS)
cp parser_arm parser
gen: test/make_test
(cd test; chmod +x make_test; ./make_test)
test: install test/run_test
(cd test; chmod +x run_test; ./run_test)
test_arm: parser_arm test/run_test
(cd test; chmod +x run_test; ./run_test)
t: parser $(TEST_CASE)
./parser -o out $(TEST_CASE)
./out
t0: parser0 $(TEST_CASE)
./parser0 -o out $(TEST_CASE)
./out
t_arm: parser_arm $(TEST_CASE) $(LIB)
./parser -o out $(TEST_CASE)
./out
# 编译自举
test0: install test/run_test parser0
(cd test; chmod +x run_test; ./run_test 0)
triple: parser1
size parser[01]
quad: parser2
size parser[012]
parser2: parser1 $(SRCS) $(HSRCS)
./parser1 -o parser2 $(SRCS)
parser1: parser0 $(SRCS) $(HSRCS)
./parser0 -o parser1 $(SRCS)
parser0: install $(SRCS) $(HSRCS)
./parser -o parser0 $(SRCS)