Jello is going away
[oota-llvm.git] / test / Makefile.tests
1 ##-----------------------------------------------------------*-Makefile-*-
2 ## Common rules for generating, linking, and compiling via LLVM.  This is
3 ## used to implement a robust testing framework for LLVM
4 ##------------------------------------------------------------------------
5
6 ## NOTE: This is preliminary and will change in the future
7
8 include ${LEVEL}/Makefile.common
9
10 # Specify ENABLE_STATS on the command line to enable -stats output from gccas
11 # and gccld.
12 ifdef ENABLE_STATS
13 STATS = -stats
14 endif
15
16
17 .PHONY: clean default
18
19 # These files, which might be intermediate results, should not be deleted by
20 # make
21 .PRECIOUS: Output/%.bc  Output/%.ll
22 .PRECIOUS: Output/%.tbc Output/%.tll
23 .PRECIOUS: Output/.dir
24 .PRECIOUS: Output/%.llvm.bc
25 .PRECIOUS: Output/%.llvm
26
27 ifdef ENABLE_OPTIMIZED
28 TOOLS    = $(BUILD_ROOT_TOP)/tools/Release
29 else
30 TOOLS    = $(BUILD_ROOT_TOP)/tools/Debug
31 endif
32
33 # LLVM Tool Definitions...
34 #
35 LCC      = $(LLVMGCCDIR)/bin/llvm-gcc
36 LCC1     = $(LLVMGCCDIR)/lib/gcc-lib/llvm/3.1/cc1
37 LLI      = $(TOOLS)/lli
38 LLC      = $(TOOLS)/llc
39 LAS      = $(TOOLS)/as
40 LGCCAS   = $(TOOLS)/gccas
41 LGCCLD   = $(TOOLS)/gccld -L$(LLVMGCCDIR)/llvm/lib
42 LDIS     = $(TOOLS)/dis 
43 LOPT     = $(TOOLS)/opt
44 LLINK    = $(TOOLS)/link
45 LANALYZE = $(TOOLS)/analyze
46 LBUGPOINT= $(TOOLS)/bugpoint
47
48 LCCFLAGS  += -O2 -Wall
49 LLCFLAGS =
50 FAILURE  = $(LEVEL)/test/Failure.sh
51 TESTRUNR = $(LEVEL)/test/TestRunner.sh
52
53 # Native Tool Definitions
54 NATGCC  = /usr/dcs/software/supported/bin/gcc
55 CP      = /bin/cp -f
56
57 ifndef DISABLE_LLC_DIFFS
58 CC      = /opt/SUNWspro/bin/cc
59 AS      = /opt/SUNWspro/bin/cc
60 DIS     = /usr/ccs/bin/dis
61 CFLAGS  += -g -xarch=v9
62 endif
63
64
65 ifeq ($(TRACE), yes)
66     LLCFLAGS += -trace basicblock
67     LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
68 else
69     ifeq ($(TRACEM), yes)
70         LLCFLAGS += -trace function
71         LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
72     endif
73 endif
74
75 LLCLIBS := $(LLCLIBS) -lm
76
77 clean::
78         $(RM) a.out core
79         $(RM) -rf Output/
80
81 # Compile from X.c to Output/X.ll
82 Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
83         $(LCC) $(LCCFLAGS) -S $< -o $@
84
85 # LLVM Assemble from Output/X.ll to Output/X.bc.  Output/X.ll must have come
86 # from GCC output, so use GCCAS.
87 #
88 Output/%.bc: Output/%.ll $(LGCCAS)
89         $(LGCCAS) $(STATS) $< -o $@
90
91 # LLVM Assemble from X.ll to Output/X.bc.  Because we are coming directly from
92 # LLVM source, use the non-transforming assembler.
93 #
94 Output/%.bc: %.ll $(LAS) Output/.dir
95         $(LAS) -f $< -o $@
96
97 # Compile a linked program to machine code for this processor.
98 #
99 Output/%.llc.s: Output/%.llvm.bc $(LLC)
100         $(LLC) $(LLCFLAGS) -f $< -o $@
101
102 # Assemble (and link) an LLVM-linked program using the system assembler...
103 #
104 Output/%.llc: Output/%.llc.s
105         $(CC) $(CFLAGS) $< $(LLCLIBS) -o $@
106
107 #
108 # Testing versions of provided utilities...
109 #
110 Output/%.tll: %.c $(LCC1) Output/.dir $(INCLUDES)
111         @echo "======== Compiling $<"
112         $(LCC) $(LCCFLAGS) -S $< -o $@ || \
113             ( rm -f $@; $(FAILURE) $@ )
114
115 Output/%.tbc: Output/%.tll $(LAS)
116         @echo "======== Assembling $<"
117         $(LAS) -f $< -o $@ || \
118             ( rm -f $@; $(FAILURE) $@ )
119
120
121 ## Cancel built-in implicit rules that override above rules
122 %: %.s
123
124 %: %.c
125
126 %.o: %.c
127