-## -*-Makefile-*-
-##------------------------------------------------------------------------
-## Common rules for generating, linking, and compiling via LLVM.
-##------------------------------------------------------------------------
-
-.PHONY: clean default
-
-## Special targets to build a program from multiple source files
-##
-ifdef PROG
-
-default: $(PROG).clean.bc $(PROG).native
- #.SECONDARY: $(PROG).clean.bc ## keep %.clean.bc from being deleted
-
-$(PROG).bc: $(OBJS)
- $(LLINK) -f $(OBJS) -o $@ $(CFLAGS)
-
-$(PROG).native: $(OBJS:.o=.c)
- gcc -o $@ $(OBJS:.o=.c) -O2 $(LOCAL_CFLAGS) -Wall
+##----------------------------------------------------------*- Makefile -*-===##
+##
+## Common rules for generating, linking, and compiling via LLVM. This is
+## used to implement a robust testing framework for LLVM
+##
+##-------------------------------------------------------------------------===##
+
+# If the user specified a TEST= option on the command line, we do not want to do
+# the default testing type. Instead, we change the default target to be the
+# test:: target.
+#
+ifdef TEST
+test::