-## -*-Makefile-*-
-##------------------------------------------------------------------------
-## Common rules for generating, linking, and compiling via LLVM.
-##------------------------------------------------------------------------
-
-## NOTE: This is preliminary and will change in the future
-
-
-include ${LEVEL}/Makefile.common
-
-.PHONY: clean default
-
-## keep %.linked.bc and %.s from being deleted while we're debugging
-.PRECIOUS: %.bc %.s %.ll
-
-
-TOOLS = $(LEVEL)/tools/Debug
-
-LLI = $(TOOLS)/lli
-LLC = $(TOOLS)/llc
-LAS = $(TOOLS)/gccas
-LDIS = $(TOOLS)/dis
-LOPT = $(TOOLS)/opt
-LLINK = $(TOOLS)/link
-LLCFLAGS =
-
-LCC = /home/vadve/lattner/cvs/gcc_install/bin/gcc
-LCFLAGS = -O2 $(LOCAL_LCFLAGS) -Wall
-
-LLCLIB = $(LEVEL)/test/runtime.o
-LIBS = $(LLCLIB) $(LOCAL_LIBS)
-
-ifeq ($(TRACE), yes)
- LLCFLAGS := $(LLCFLAGS) -trace
+##----------------------------------------------------------*- 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::