Added POOLFLAGS option to run pool allocation
[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 include ${LEVEL}/Makefile.common
17
18 # Specify ENABLE_STATS on the command line to enable -stats and -time-passes
19 # output from gccas and gccld.
20 ifdef ENABLE_STATS
21 STATS = -stats -time-passes
22 endif
23
24
25 .PHONY: clean default
26
27 # These files, which might be intermediate results, should not be deleted by
28 # make
29 .PRECIOUS: Output/%.bc  Output/%.ll
30 .PRECIOUS: Output/%.tbc Output/%.tll
31 .PRECIOUS: Output/.dir
32 .PRECIOUS: Output/%.llvm.bc
33 .PRECIOUS: Output/%.llvm
34
35 TOOLS    = $(LLVMTOOLCURRENT)
36
37 # LLVM Tool Definitions...
38 #
39 LCC      = $(LLVMGCCDIR)/bin/gcc
40 LCC1     = $(LLVMGCCDIR)/lib/gcc-lib/$(LLVMGCCARCH)/cc1
41 LCXX     = $(LLVMGCCDIR)/bin/g++
42 LCC1XX   = $(LLVMGCCDIR)/lib/gcc-lib/$(LLVMGCCARCH)/cc1plus
43 LLI      = $(TOOLS)/lli
44 LLC      = $(TOOLS)/llc
45 LAS      = $(TOOLS)/as
46 LGCCAS   = $(TOOLS)/gccas
47 LGCCLD   = $(TOOLS)/gccld -L$(LLVMGCCDIR)/lib/gcc-lib/$(LLVMGCCARCH) -L$(LLVMGCCDIR)/lib
48 LGCCLDPROG = $(TOOLS)/gccld
49 LDIS     = $(TOOLS)/dis 
50 LOPT     = $(TOOLS)/opt
51 LLINK    = $(TOOLS)/link
52 LANALYZE = $(TOOLS)/analyze
53 LBUGPOINT= $(TOOLS)/bugpoint
54
55 LCCFLAGS  += -O2 -Wall
56 LCXXFLAGS += -O2 -Wall
57 LLCFLAGS =
58 FAILURE  = $(LEVEL)/test/Failure.sh
59 TESTRUNR = @echo Running test: $<; \
60              PATH=$(LLVMTOOLCURRENT):$(LEVEL)/test/Scripts:$(PATH) \
61                   $(LEVEL)/test/TestRunner.sh
62
63 # Native Tool Definitions
64 NATGCC  = $(CC)
65 CP      = /bin/cp -f
66
67 ## If TRACE or TRACEM is "yes", set the appropriate llc flag (-trace or -tracem)
68 ## mark that tracing on, and set the TRACELIBS variable.
69 TRACEFLAGS = 
70 ifeq ($(TRACE), yes)
71     TRACEFLAGS = -trace
72     TRACELIBS := -L$(LEVEL)/test/Libraries/Output -linstr.$(ARCH)
73 endif
74
75 ifeq ($(TRACEM), yes)
76     TRACEFLAGS = -tracem
77     TRACELIBS := -L$(LEVEL)/test/Libraries/Output -linstr.$(ARCH)
78 endif
79
80 POOLFLAGS =
81 DOPOOLALLOC =
82 ## If POOLALLOC is "yes", set the opt flag and the POOLLIBS varoab;e
83 ifeq ($(POOLALLOC), yes)
84     POOLFLAGS += -poolalloc
85     DOPOOLALLOC = yes
86     POOLLIBS := -L$(LEVEL)/test/Libraries/Output
87 endif
88
89 LLCLIBS := $(LLCLIBS) -lm
90
91 clean::
92         $(RM) -f a.out core
93         $(RM) -rf Output/
94
95 # Compile from X.c to Output/X.ll
96 Output/%.ll: $(SourceDir)%.c $(LCC1) Output/.dir $(INCLUDES)
97         $(LCC) $(CPPFLAGS) $(LCCFLAGS) -S $< -o $@
98
99 # Compile from X.cpp to Output/X.ll
100 Output/%.ll: $(SourceDir)%.cpp $(LCC1XX) Output/.dir $(INCLUDES)
101         $(LCXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
102
103 # Compile from X.cc to Output/X.ll
104 Output/%.ll: $(SourceDir)%.cc $(LCC1XX) Output/.dir $(INCLUDES)
105         $(LCXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
106
107 # LLVM Assemble from Output/X.ll to Output/X.bc.  Output/X.ll must have come
108 # from GCC output, so use GCCAS.
109 #
110 Output/%.bc: Output/%.ll $(LGCCAS)
111         $(LGCCAS) $(STATS) $< -o $@
112
113 # LLVM Assemble from X.ll to Output/X.bc.  Because we are coming directly from
114 # LLVM source, use the non-transforming assembler.
115 #
116 Output/%.bc: %.ll $(LAS) Output/.dir
117         $(LAS) -f $< -o $@
118
119 #
120 # Testing versions of provided utilities...
121 #
122 Output/%.tll: %.c $(LCC1) Output/.dir $(INCLUDES)
123         @echo "======== Compiling $<"
124         $(LCC) $(CPPFLAGS) $(LCCFLAGS) -S $< -o $@ || \
125             ( rm -f $@; $(FAILURE) $@ )
126
127 Output/%.tll: %.cpp $(LCC1XX) Output/.dir $(INCLUDES)
128         @echo "======== Compiling $<"
129         $(LCXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@ || \
130             ( rm -f $@; $(FAILURE) $@ )
131
132 Output/%.tbc: Output/%.tll $(LAS)
133         @echo "======== Assembling $<"
134         $(LAS) -f $< -o $@ || \
135             ( rm -f $@; $(FAILURE) $@ )
136
137
138 ## Cancel built-in implicit rules that override above rules
139 %: %.s
140
141 %: %.c
142
143 %.o: %.c
144