-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMakefile_py
103 lines (81 loc) · 3.01 KB
/
Makefile_py
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
.SUFFIXES: # no built-in rules
DIR=build
QEMU = qemu-arm-static
$(info $(shell mkdir -p $(DIR)))
LOCAL_TESTS = malloc.a32.asm linkerdef.a32.asm
TESTS = int_op.asm \
reg_torture_f32.asm \
reg_torture.asm \
cmp.asm \
memaddr.32.asm \
switch.asm \
indirect.32.asm \
fib.asm \
fib_debug.asm \
queens.32.asm \
stack.asm \
multiple_results.asm \
multiple_results_f32.asm \
multiple_results_f64.asm \
pfannkuchen.32.asm
TEST_EXES = $(TESTS:%.asm=$(DIR)/%.asm.exe) $(LOCAL_TESTS:%.asm=$(DIR)/%.asm.exe)
tests: $(TEST_EXES) \
$(DIR)/queens.32.asm.s.exe \
$(DIR)/syscall.a32.asm.exe \
$(DIR)/cli.a32.asm.exe \
$(DIR)/isel_test \
$(DIR)/nanojpeg \
$(DIR)/threads.a32.asm.exe
@echo "[OK PY CODEGENA32]"
STD_LIB_NO_ARGV = ../StdLib/startup_no_argv.asm ../StdLib/syscall.a32.asm ../StdLib/std_lib.32.asm
STD_LIB_WITH_ARGV = ../StdLib/startup.a32.asm ../StdLib/syscall.a32.asm ../StdLib/std_lib.32.asm
############################################################
# Python
############################################################
# note we sneak in our poor man's std_lib here
$(DIR)/%.asm.exe: ../TestData/%.asm
@echo "[integration $@]"
cat $(STD_LIB_NO_ARGV) $< | $(PYPY) ./codegen.py -mode binary - $@ >$@.out
${QEMU} $@ > $@.actual.out
diff $@.actual.out $<.golden
# sames as above but local TestData dir
$(DIR)/%.asm.exe: TestData/%.asm
@echo "[integration $@]"
cat $(STD_LIB_NO_ARGV) $< | $(PYPY) ./codegen.py -mode binary - $@ >$@.out
${QEMU} $@ > $@.actual.out
diff $@.actual.out $<.golden
$(DIR)/syscall.a32.asm.exe: TestData/syscall.a32.asm
@echo "[integration $@]"
$(PYPY) ./codegen.py -mode binary $< $@
${QEMU} $@ > $@.actual.out
diff $@.actual.out $<.golden
$(DIR)/queens.32.asm.s.exe: ../TestData/queens.32.asm
@echo "[integration $@]"
cat $(STD_LIB_NO_ARGV) $< | $(PYPY) ./codegen.py -mode normal - $@.s
$(PYPY) ../CpuA32/assembler_tool.py assemble $@.s $@ > $@.out
${QEMU} $@ > $@.actual.out
diff $@.actual.out $<.golden
$(DIR)/cli.a32.asm.exe: TestData/cli.a32.asm
@echo "[integration $@]"
cat $(STD_LIB_WITH_ARGV) $< | $(PYPY) ./codegen.py -mode binary - $@ > $@.out
${QEMU} $@ 1 2 3 aa bbb ccc > $@.actual.out
diff $@.actual.out $<.golden
$(DIR)/isel_test:
@echo "[integration $@]"
$(PYPY) ./isel_tester.py < TestData/codegen_test.asm > $@.actual.out
diff $@.actual.out TestData/codegen_test.asm.golden
$(DIR)/threads.a32.asm.exe: ../TestData/threads.32.asm
@echo "[integration $@]"
cat $(STD_LIB_NO_ARGV) $< | $(PYPY) ./codegen.py -mode binary - $@ > $@.out
${QEMU} $@ > $@.actual.out
diff $@.actual.out $<.golden
$(DIR)/nanojpeg:
@echo "[$@]"
cat $(STD_LIB_WITH_ARGV) ../TestData/nano_jpeg.32.asm | $(PYPY) ./codegen.py -mode binary - $@.exe >$@.out
${QEMU} $@.exe ../TestData/ash_tree.jpg $@.ppm
md5sum $@.ppm > $@.actual
diff $@.actual TestData/nano_jpeg.golden
clean:
rm -f $(DIR)/*
bug:
cat $(STD_LIB) TestData/reg_test1.asm | $(PYPY) ./codegen.py normal - -