Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (51 loc) · 1.42 KB
/
Copy pathMakefile
File metadata and controls
71 lines (51 loc) · 1.42 KB
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
export FOO=BAR
export TEST=1
export NAME=Steve
PROGRAMS := $(basename $(wildcard *.lisp))
TESTS := $(addsuffix .test,$(PROGRAMS))
.PHONY: all clean test test-inception
all: $(PROGRAMS)
clean:
@rm -f *.asm *.o *.out *.test $(PROGRAMS)
@cd bf/ && make clean
#
# Compile each test, and compare the results of executing it with expected ones.
#
test: ../slisp
@$(MAKE) RUN='./$$@' $(TESTS)
#
# Compile each test, but ignore the result.
#
# Instead execute the test-case via the interpreter and compare the results with expected ones.
#
test-inception: ../inception
@$(MAKE) RUN='../inception $$< --eval="(main (list \"./example.test\"))"' $(TESTS)
# Ensure we have the compiler
../slisp:
cd .. && go build .
# Ensure we have the interpreter
../inception:
cd .. && make
# Generic rule
# "foo.lisp" becomes "foo"
# "foo" is executed to produce "foo.out"
# "foo.out" is compared to "foo.expected" which is the expected output
#
%: %.lisp ../slisp
@echo "compiling $@"
@../slisp -c $<
# dump needs a filename specified
dump.test:
echo "Skipping"
# wc needs a filename specified
wc.test: wc.lisp ../slisp
echo "Skipping"
life.test:
@echo "ignoring $@ - as it doesn't terminate"
# Generic rule for testing each binary
%.test: %.lisp ../slisp
@echo "compiling $@"
@../slisp -c -o $@ $<
@echo "testing $@"
@$(RUN) > $@.out 2>&1 || true
@cmp $@.out $@.expected || (echo "program $< did not match" ; cat $@.out ; exit 1)