diff --git a/Makefile b/Makefile
index a5c8f36..f11765f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+.PHONY: test
+
 ifeq (${DEBUG}, 1)
   LFLAGS   += --debug --trace
   YYFLAGS  += --debug -Wall -Wcounterexamples
@@ -26,6 +28,10 @@ GENSOURCE := $(addprefix object/,esql.tab.cpp esql.yy.cpp)
 
 GENOBJECT := $(subst .cpp,.o,${GENSOURCE})
 
+TEST.source := static_insert.sqc dynamic_insert.sqc
+TEST.out    := $(addprefix object/,$(addsuffix .out,${TEST.source}))
+TEST.source := $(addprefix debug/,${TEST.source})
+
 OUTPUT := esql
 
 object/%.yy.cpp: source/%.l
@@ -56,5 +62,15 @@ clean:
 	-rm object/*
 	-cd source/sqlfun/; make clean
 
-test:
-	esql debug/static_insert.sqc
+object/%.sqc.c: debug/%.sqc
+	bat $<
+	esql $< > $@
+
+object/%.sqc.out: object/%.sqc.c
+	bat $<
+	${CC} $< -o $@ -lsqlite3
+
+test.clean:
+	-rm object/*.sqc.*
+
+test: test.clean ${TEST.out}