| a/Makefile | b/Makefile | ||
|---|---|---|---|
| 1 | C2IEC=c99 |
||
| 2 | TEST_LOGS=$(patsubst %.c, %.test.log, $(wildcard test/*.c)) |
||
| 3 | |||
| 4 | check: |
||
| 5 | echo ${TEST_LOGS} |
||
| 6 | |||
| 1 | all: c99 |
7 | all: c99 |
| 2 | 8 | ||
| 3 | c99: lex.yy.c y.tab.c |
9 | c99: lex.yy.c y.tab.c |
| 4 | gcc -o $@ $^ |
10 | gcc -o $@ $^ |
| 5 | 11 | ||
... |
... |
||
| 7 | flex $^ |
13 | flex $^ |
| 8 | 14 | ||
| 9 | y.tab.c: c99.y |
15 | y.tab.c: c99.y |
| 10 | yacc -d $^ |
16 | yacc -d $^ |
| 11 | 17 | ||
| 12 | test: c99 |
18 | y.dot: c99.y |
| 13 | ./c99 < test.c |
19 | yacc -g $^ |
| 20 | |||
| 21 | |||
| 22 | .PHONY: test |
||
| 23 | test: ${TEST_LOGS} |
||
| 24 | grep failed $^ && false || true |
||
| 25 | |||
| 26 | %.test.log: %.test.txt |
||
| 27 | cat $< | tee $@ |
||
| 28 | |||
| 29 | %.test.txt: %.c ${C2IEC} |
||
| 30 | ./${C2IEC} < $< > $@ |
||
| 14 | 31 | ||
| 15 | test2: c99 |
32 | test2: c99 |
| 16 | ./c99 < test2.c |
33 | ./c99 < test2.c |
| 17 | 34 | ||
| 18 | test3: c99 |
35 | test3: c99 |
| 19 | ./c99 < test3.c |
36 | ./c99 < test3.c |
| 20 | 37 |