-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (31 loc) · 760 Bytes
/
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
.PHONY: clean check
EXE=bf
$(EXE): .FORCE
.FORCE:
go build -o $(EXE) src/*.go
clean:
rm -f $(EXE)
rm -f a.out
rm -f *.x
rm -f *.s
rm -f OUT.*
rm -f test/*.x
rm -f test/*.x.s
TEST_FILES=hello_world add rot13 pi
TESTS=$(patsubst %, test/%, $(TEST_FILES))
check: $(EXE) $(TESTS) test/test_opt
test/%: test/%.0.x test/%.1.x
test ! -f [email protected] || ./$< < [email protected] > OUT.0
test -f [email protected] || ./$< > OUT.0
diff -q [email protected] OUT.0
test ! -f [email protected] || ./$(word 2,$^) < [email protected] > OUT.1
test -f [email protected] || ./$(word 2,$^) > OUT.1
diff -q [email protected] OUT.1
test ! -f [email protected] || diff -q [email protected] $(word 2,$^).s
test/test_opt: test/test_opt.bf
./$(EXE) -S -O1 $<
diff -q [email protected] a.out.s
test/%.0.x: test/%.bf
./$(EXE) -o $@ -O0 $<
test/%.1.x: test/%.bf
./$(EXE) -o $@ -O1 -S $<