a/Makefile | b/Makefile | ||
---|---|---|---|
1 | C2IEC=c99 |
1 | C2IEC=c99 |
2 | TESTS=$(patsubst %.c, %.test, $(wildcard test/*.c)) |
2 | TESTS=$(patsubst %.c, %.test, $(wildcard test/*.c)) |
3 | TEST_LOGS=$(patsubst %.c, %.test.log, $(wildcard test/*.c)) |
3 | TEST_LOGS=$(patsubst %.c, %.test.log, $(wildcard test/*.c)) |
4 | 4 | ||
5 | check: |
||
6 | echo ${TEST_LOGS} |
||
7 | |||
8 | all: c99 |
5 | all: c99 |
9 | 6 | ||
10 | c99: lex.yy.c y.tab.c |
7 | c99: lex.yy.c y.tab.c |
11 | gcc -o $@ $^ |
8 | gcc -o $@ $^ |
12 | 9 | ||
... |
... |
||
20 | yacc -g $^ |
17 | yacc -g $^ |
21 | 18 | ||
22 | commit: ${TEST_LOGS} |
19 | commit: ${TEST_LOGS} |
23 | for i in ${TEST_LOGS}; do \ |
20 | for i in ${TEST_LOGS}; do \ |
24 | cp $$i $$(dirname $$i)/$$(basename $$i .log).expected; \ |
21 | cp $$i $$(dirname $$i)/$$(basename $$i .log).expected; \ |
25 | done |
22 | done |
23 | clean: |
||
24 | rm -f ${C2IEC} |
||
25 | rm -f ${TEST_LOGS} |
||
26 | 26 | ||
27 | .PHONY: test |
27 | .PHONY: test |
28 | test: ${TESTS} |
28 | test: ${TESTS} |
29 | 29 | ||
30 | %.test: %.test.log |
30 | %.test: %.test.log |
31 | diff $< $*.test.expected |
31 | @echo "========================================" |
32 | 32 | @echo "checking output of test $*" |
|
33 | %.test.log: %.test.txt |
33 | @diff $< $*.test.expected |
34 | cat $< | tee $@ |
34 | |
35 | %.test.log: %.test.txt |
||
36 | @echo "========================================" |
||
37 | @echo "output of test $*" |
||
38 | @echo "========================================" |
||
39 | @cat $< | tee $@ |
||
35 | 40 | ||
36 | %.test.txt: %.c ${C2IEC} |
41 | %.test.txt: %.c ${C2IEC} |
37 | ./${C2IEC} < $< > $@ |
42 | ./${C2IEC} < $< > $@ |
38 | 43 | ||
39 | test2: c99 |
44 | test2: c99 |
... |
... |
||
44 | 49 |