Move LLVM tool definitions to Makefile.rules
[oota-llvm.git] / test / Makefile.tests
1 ##----------------------------------------------------------*- Makefile -*-===##
2 ##
3 ## Common rules for generating, linking, and compiling via LLVM.  This is
4 ## used to implement a robust testing framework for LLVM
5 ##
6 ##-------------------------------------------------------------------------===##
7
8 # If the user specified a TEST= option on the command line, we do not want to do
9 # the default testing type.  Instead, we change the default target to be the
10 # test:: target.
11 #
12 ifdef TEST
13 test::
14 endif
15
16 # We do not want to make .d files for tests! 
17 DISABLE_AUTO_DEPENDENCIES=1
18
19 include ${LEVEL}/Makefile.common
20
21 # Specify ENABLE_STATS on the command line to enable -stats and -time-passes
22 # output from gccas and gccld.
23 ifdef ENABLE_STATS
24 STATS = -stats -time-passes
25 endif
26
27 .PHONY: clean default
28
29 # These files, which might be intermediate results, should not be deleted by
30 # make
31 .PRECIOUS: Output/%.bc  Output/%.ll
32 .PRECIOUS: Output/%.tbc Output/%.tll
33 .PRECIOUS: Output/.dir
34 .PRECIOUS: Output/%.llvm.bc
35 .PRECIOUS: Output/%.llvm
36
37 LCCFLAGS  += -O2 -Wall
38 LCXXFLAGS += -O2 -Wall
39 LLCFLAGS =
40 FAILURE  = $(LLVM_SRC_ROOT)/test/Failure.sh
41 TESTRUNR = @echo Running test: $<; \
42              PATH=$(LLVMTOOLCURRENT):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH) \
43                   $(LLVM_SRC_ROOT)/test/TestRunner.sh
44
45 LLCLIBS := $(LLCLIBS) -lm
46
47 clean::
48         $(RM) -f a.out core
49         $(RM) -rf Output/
50
51 # Compile from X.c to Output/X.ll
52 Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
53         -$(LLVMGCC) $(CPPFLAGS) $(LCCFLAGS) -S $< -o $@
54
55 # Compile from X.cpp to Output/X.ll
56 Output/%.ll: %.cpp $(LCC1XX) Output/.dir $(INCLUDES)
57         -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
58
59 # Compile from X.cc to Output/X.ll
60 Output/%.ll: %.cc $(LCC1XX) Output/.dir $(INCLUDES)
61         -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
62
63 # LLVM Assemble from Output/X.ll to Output/X.bc.  Output/X.ll must have come
64 # from GCC output, so use GCCAS.
65 #
66 Output/%.bc: Output/%.ll $(LGCCAS)
67         -$(LGCCAS) $(STATS) $< -o $@
68
69 # LLVM Assemble from X.ll to Output/X.bc.  Because we are coming directly from
70 # LLVM source, use the non-transforming assembler.
71 #
72 Output/%.bc: %.ll $(LLVMAS) Output/.dir
73         -$(LLVMAS) -f $< -o $@
74
75 ## Cancel built-in implicit rules that override above rules
76 %: %.s
77
78 %: %.c
79
80 %.o: %.c
81