-## -*-Makefile-*-
-##------------------------------------------------------------------------
-## Common rules for generating, linking, and compiling via LLVM.
-##------------------------------------------------------------------------
-
-.PHONY: clean default
-
-## keep %.linked.bc and %.s from being deleted while we're debugging
-.PRECIOUS: %.linked.bc %.s
-
-
-TOOLS = $(LEVEL)/tools/Debug
-
-LLC = $(TOOLS)/llc
-LAS = $(TOOLS)/as
-LDIS = $(TOOLS)/dis
-LOPT = $(TOOLS)/opt
-LLINK = $(TOOLS)/link
-LLCFLAGS =
-
-LCC = /home/vadve/lattner/cvs/gcc_install/bin/gcc
-LCFLAGS = -O2 $(LOCAL_CFLAGS) -Wall
-
-LLCLIB = $(LEVEL)/test/runtime.o
-LIBS = $(LLCLIB) $(LOCAL_LIBS)
-
-ifeq ($(TRACE), yes)
- LLCFLAGS := $(LLCFLAGS) -trace
-endif
-
-CC = /opt/SUNWspro/bin/cc
-AS = /opt/SUNWspro/bin/cc
-DIS = /usr/ccs/bin/dis
-CP = /bin/cp -p
-CFLAGS = -g -xarch=v9
-CCFLAGS = $(CFLAGS)
-LDFLAGS = $(CFLAGS)
-ASFLAGS = -c $(CFLAGS)
-
-## Special targets to build a program from multiple source files
-##
-ifdef PROG
-
- default: $(PROG) $(PROG).native
-
- ifeq ($(strip $(OBJS)),)
- BCOBJS = $(PROG).bc
- else
- BCOBJS = $(OBJS:.o=.bc)
- endif
-
- $(PROG).linked.bc: $(BCOBJS)
- $(LLINK) -f $(BCOBJS) -o $(PROG).tmp.bc
- $(LOPT) -cleangcc -raise -constprop -dce $(PROG).tmp.bc -o $@
-
- $(PROG).native: $(OBJS:.o=.c)
- gcc $(OBJS:.o=.c) -O2 $(LOCAL_CFLAGS) -Wall -o $@
+##----------------------------------------------------------*- 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::