This repository has been archived by the owner on Mar 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
104 lines (78 loc) · 2.83 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
ASFLAGS += -g --64 -march=generic64+sse4.2
LDLIBS = -lm -ldl
AKEEM_HOME = $(PWD)
AKEEM = $(AKEEM_HOME)/akeem
RACKET = `which racket`
RACKET_HOME = ../racket
RACKET_BENCHMARKS_HOME = $(RACKET_HOME)/pkgs/racket-benchmarks/tests/racket/benchmarks/common
RACKET_BENCHMARKS = ctak nboyer nfa nothing nqueens puzzle scheme-c2 scheme-c takr2 tak takr
RUN_RACKET_BENCHMARKS = true
LARCENY_HOME = ../larceny
LARCENY_BENCHMARKS_HOME = $(LARCENY_HOME)/test/Benchmarking/R7RS
LARCENY_BENCHMARKS = ack array1 string sum1 cat tail wc
default: akeem
%.o: %.s constants.s macros.s boot.scm r7rs.scm init.scm Makefile
$(AS) $< $(ASFLAGS) -o $@
akeem: lisp.o
$(CC) $^ $(CFLAGS) $(LDLIBS) -o $@
# based on http://unix.stackexchange.com/a/79137
run-tests: akeem
./$< tests.scm 2>&1 | diff -y -W250 tests.out - | expand | grep --color=always -nEC1 '^.{123} [|<>]( |$$)'; \
if [ $$? -eq 0 ] ; then \
echo Tests FAILED ; false ; \
else \
echo `cat tests.out | grep -v ';;;' | wc -l` Tests PASSED ; \
fi
run-tests-catchsegv: akeem
catchsegv ./$< tests.scm
/usr/bin/rlwrap:
sudo apt-get install -y rlwrap
run-repl: akeem /usr/bin/rlwrap
@rlwrap -nm -q "\"" ./$<
/usr/bin/entr:
sudo apt-get install -y entr
retest: /usr/bin/entr
while true; do find . -name '*.s' -o -name '*.scm' -o -name Makefile -o -name tests.out | \
$< -r $(MAKE) -s run-tests ; done
valgrind: clean akeem
if [ -n "`which valgrind`" ] ; then \
echo "(exit 0)" | valgrind --suppressions=akeem.supp --error-exitcode=1 -q $(AKEEM) > /dev/null ; \
else \
echo "valgrind not found, skipping." ; \
fi
benchmark: clean akeem
cd $(RACKET_BENCHMARKS_HOME) ; \
for test in $(RACKET_BENCHMARKS) ; do \
test -n '$(RUN_RACKET_BENCHMARKS)' && (echo $$test.rkt ; $(RACKET) $$test.rkt) ; \
echo $$test.sch ; $(AKEEM) $(AKEEM_HOME)/benchmarks-prelude.scm $$test.sch ; \
done
larceny-benchmark: clean akeem
cd $(LARCENY_BENCHMARKS_HOME) ; \
mkdir outputs ; \
for test in $(LARCENY_BENCHMARKS) ; do \
echo $$test.scm ; $(AKEEM) src/$$test.scm src/common.scm < inputs/$$test.input ; \
done
profile: RACKET_BENCHMARKS = nqueens
profile: RUN_RACKET_BENCHMARKS =
profile: CFLAGS += -pg
profile: benchmark
gprof -b $(AKEEM) $(RACKET_BENCHMARKS_HOME)/gmon.out
profile-clean:
rm -f $(RACKET_BENCHMARKS_HOME)/gmon.out
jit-dissassmble:
objdump -b binary -D -mi386:x86-64 jit_code/jit_code_*.bin
jit-clean:
rm -rf jit_code
release: clean akeem run-tests valgrind
strip $(AKEEM)
clean: jit-clean profile-clean
rm -f $(AKEEM) *.o
check: run-tests
docker:
docker build -t akeem .
run-docker: docker
docker run --rm -i -t akeem
run-docker-shell: docker
docker run --rm -i -t akeem bash
.PHONY: run-tests run-tests-catchsegv run-repl retest benchmark profile jit-clean jit-dissassmble clean check release docker run-docker run-docker-shell
.SILENT: run-tests retest benchmark larceny-benchmark profile valgrind