forked from cantora/pyc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
173 lines (150 loc) · 3.51 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
TMPDIR := /tmp/pyc
SRCS = $(filter-out ./parsetab.py, $(wildcard ./*.py) )
P0TESTS = $(wildcard ./p0tests/grader_tests/*.py) #\
#$(filter-out %stack_test.py, $(wildcard ./p0tests/mytests/*.py) ) \
#$(wildcard ./p0tests/student_tests/*.py)
P1TESTS = $(wildcard ./p1tests/grader_tests/*.py) $(wildcard ./p1tests/my_tests/*.py)
P2TESTS = $(wildcard ./p2tests/grader_tests/*.py) $(wildcard ./p2tests/my_tests/*.py)
P3TESTS = $(wildcard ./p3tests/grader_tests/*.py) $(wildcard ./p3tests/my_tests/*.py)
.PHONY: pkg
pkg: hw.zip
hw.zip: ply $(SRCS) makefile
rm -rf /tmp/pyc
mkdir $(TMPDIR)
cp pyc $(TMPDIR)/compile.py
cp $(SRCS) $(TMPDIR)/
cp clib/*.c $(TMPDIR)/
cp clib/*.h $(TMPDIR)/
cp -R ./ply $(TMPDIR)/ply
cd $(TMPDIR) && zip -r hw.zip *
mv $(TMPDIR)/hw.zip ./
ply:
wget 'http://www.dabeaz.com/ply/ply-3.4.tar.gz'
tar -xzvf ./ply-3.4.tar.gz
mv ply-3.4 ply
rm ply-3.4.tar.gz
.PHONY: clib
clib:
make -C ./clib
.PHONY: tests
tests: p0tests p1tests p2tests p3tests
.PHONY: ir-tests
ir-tests: p0-irtests p1-irtests p2-irtests p3-irtests
.PHONY: ir-line-tests
ir-line-tests: p0-ir-linetests p1-ir-linetests p2-ir-linetests p3-ir-linetests
.PHONY: p0tests
p0tests:
@for i in $(P0TESTS); do \
VERBOSE=0 ./test.sh $$i; \
if [ $$? -ne 0 ]; then \
echo "FAILED: $$(basename $$i)"; \
break; \
fi; \
done
.PHONY: p1tests
p1tests:
@for i in $(P1TESTS); do \
VERBOSE=0 ./test.sh $$i; \
if [ $$? -ne 0 ]; then \
echo "FAILED: $$(basename $$i)"; \
break; \
fi; \
done
.PHONY: p2tests
p2tests:
@for i in $(P2TESTS); do \
VERBOSE=0 ./test.sh $$i; \
if [ $$? -ne 0 ]; then \
echo "FAILED: $$(basename $$i)"; \
break; \
fi; \
done
.PHONY: p3tests
p3tests:
@for i in $(P3TESTS); do \
VERBOSE=0 ./test.sh $$i; \
if [ $$? -ne 0 ]; then \
echo "FAILED: $$(basename $$i)"; \
break; \
fi; \
done
.PHONY: p0-irtests
p0-irtests:
@for i in $(P0TESTS); do \
VERBOSE=0 ./test-ir.sh $$i; \
if [ $$? -ne 0 ]; then \
echo "FAILED: $$(basename $$i)"; \
break; \
fi; \
done
.PHONY: p1-irtests
p1-irtests:
@for i in $(P1TESTS); do \
VERBOSE=0 ./test-ir.sh $$i; \
if [ $$? -ne 0 ]; then \
echo "FAILED: $$(basename $$i)"; \
break; \
fi; \
done
.PHONY: p2-irtests
p2-irtests:
@for i in $(P2TESTS); do \
VERBOSE=0 ./test-ir.sh $$i; \
if [ $$? -ne 0 ]; then \
echo "FAILED: $$(basename $$i)"; \
break; \
fi; \
done
.PHONY: p3-irtests
p3-irtests:
@for i in $(P3TESTS); do \
VERBOSE=0 ./test-ir.sh $$i; \
if [ $$? -ne 0 ]; then \
echo "FAILED: $$(basename $$i)"; \
break; \
fi; \
done
.PHONY: p0-ir-linetests
p0-ir-linetests:
@for i in $(P0TESTS); do \
VERBOSE=0 ./test-ir-line.sh $$i; \
if [ $$? -ne 0 ]; then \
echo "FAILED: $$(basename $$i)"; \
break; \
fi; \
done
.PHONY: p1-ir-linetests
p1-ir-linetests:
@for i in $(P1TESTS); do \
VERBOSE=0 ./test-ir-line.sh $$i; \
if [ $$? -ne 0 ]; then \
echo "FAILED: $$(basename $$i)"; \
break; \
fi; \
done
.PHONY: p2-ir-linetests
p2-ir-linetests:
@for i in $(P2TESTS); do \
VERBOSE=0 ./test-ir-line.sh $$i; \
if [ $$? -ne 0 ]; then \
echo "FAILED: $$(basename $$i)"; \
break; \
fi; \
done
.PHONY: p3-ir-linetests
p3-ir-linetests:
@for i in $(P3TESTS); do \
VERBOSE=0 ./test-ir-line.sh $$i; \
if [ $$? -ne 0 ]; then \
echo "FAILED: $$(basename $$i)"; \
break; \
fi; \
done
.PHONY: clean
clean:
rm -fv hw.zip
rm -fv output
rm -fv ./clib/*.o
rm -fv *.pyc
for i in $$(find ./p0tests/ -regex '.*\.\(\(expected\)\|\(out\)\|\(s\)\)'); do rm -v $$i; done
if [ -d ./ply ]; then rm -rv ./ply; fi