--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,9 @@
+C2IEC=c99
+TEST_LOGS=$(patsubst %.c, %.test.log, $(wildcard test/*.c))
+
+check:
+	echo ${TEST_LOGS}
+
 all: c99
 
 c99: lex.yy.c y.tab.c
@@ -9,8 +15,19 @@
 y.tab.c: c99.y
 	yacc -d $^
 
-test: c99
-	./c99 < test.c
+y.dot: c99.y
+	yacc -g $^
+
+
+.PHONY: test
+test: ${TEST_LOGS}
+	grep failed $^ && false || true
+
+%.test.log: %.test.txt
+	cat $< | tee $@
+
+%.test.txt: %.c ${C2IEC}
+	./${C2IEC} < $< > $@
 
 test2: c99
 	./c99 < test2.c