| a/Makefile | b/Makefile | ||
|---|---|---|---|
| 1 | C2IEC=c99 |
1 | C2IEC=c99 |
| 2 | TESTS=$(patsubst %.c, %.test, $(wildcard test/*.c)) |
||
| 2 | TEST_LOGS=$(patsubst %.c, %.test.log, $(wildcard test/*.c)) |
3 | TEST_LOGS=$(patsubst %.c, %.test.log, $(wildcard test/*.c)) |
| 3 | 4 | ||
| 4 | check: |
5 | check: |
| 5 | echo ${TEST_LOGS} |
6 | echo ${TEST_LOGS} |
| 6 | 7 | ||
... |
... |
||
| 16 | yacc -d $^ |
17 | yacc -d $^ |
| 17 | 18 | ||
| 18 | y.dot: c99.y |
19 | y.dot: c99.y |
| 19 | yacc -g $^ |
20 | yacc -g $^ |
| 20 | 21 | ||
| 21 | 22 | commit: ${TEST_LOGS} |
|
| 22 | .PHONY: test |
23 | for i in ${TEST_LOGS}; do \ |
| 23 | test: ${TEST_LOGS} |
24 | cp $$i $$(dirname $$i)/$$(basename $$i .log).expected; \ |
| 24 | grep failed $^ && false || true |
25 | done |
| 26 | |||
| 27 | .PHONY: test |
||
| 28 | test: ${TESTS} |
||
| 29 | |||
| 30 | %.test: %.test.log |
||
| 31 | diff $< $*.test.expected |
||
| 25 | 32 | ||
| 26 | %.test.log: %.test.txt |
33 | %.test.log: %.test.txt |
| 27 | cat $< | tee $@ |
34 | cat $< | tee $@ |
| 28 | 35 | ||
| 29 | %.test.txt: %.c ${C2IEC} |
36 | %.test.txt: %.c ${C2IEC} |
... |
... |
||
| 34 | 41 | ||
| 35 | test3: c99 |
42 | test3: c99 |
| 36 | ./c99 < test3.c |
43 | ./c99 < test3.c |
| 37 | 44 |