Expose a LJELLO variable
[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 # LLVM Tool Definitions...
28 #
29 LCC      = $(LLVMGCCDIR)/bin/llvm-gcc
30 LCC1     = $(LLVMGCCDIR)/lib/gcc-lib/llvm/3.1/cc1
31 TOOLS    = $(BUILD_ROOT_TOP)/tools/Debug
32 LLI      = $(TOOLS)/lli
33 LLC      = $(TOOLS)/llc
34 LAS      = $(TOOLS)/as
35 LGCCAS   = $(TOOLS)/gccas
36 LGCCLD   = $(TOOLS)/gccld -L$(LLVMGCCDIR)/llvm/lib
37 LDIS     = $(TOOLS)/dis 
38 LOPT     = $(TOOLS)/opt
39 LLINK    = $(TOOLS)/link
40 LANALYZE = $(TOOLS)/analyze
41 LJELLO   = $(TOOLS)/jello
42
43 LCCFLAGS  += -O2 -Wall
44 LLCFLAGS =
45 FAILURE  = $(LEVEL)/test/Failure.sh
46 TESTRUNR = $(LEVEL)/test/TestRunner.sh
47
48 # Native Tool Definitions
49 NATGCC  = /usr/dcs/software/supported/bin/gcc
50 CP      = /bin/cp -f
51
52 ifndef DISABLE_LLC_DIFFS
53 CC      = /opt/SUNWspro/bin/cc
54 AS      = /opt/SUNWspro/bin/cc
55 DIS     = /usr/ccs/bin/dis
56 CFLAGS  += -g -xarch=v9
57 endif
58
59
60 ifeq ($(TRACE), yes)
61     LLCFLAGS += -trace basicblock
62     LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
63 else
64     ifeq ($(TRACEM), yes)
65         LLCFLAGS += -trace function
66         LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
67     endif
68 endif
69
70 LLCLIBS := $(LLCLIBS) -lm
71
72 clean::
73         $(RM) a.out core
74         $(RM) -rf Output/
75
76 # Compile from X.c to Output/X.ll
77 Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
78         $(LCC) $(LCCFLAGS) -S $< -o $@
79
80 # LLVM Assemble from Output/X.ll to Output/X.bc.  Output/X.ll must have come
81 # from GCC output, so use GCCAS.
82 #
83 Output/%.bc: Output/%.ll $(LGCCAS)
84         $(LGCCAS) $(STATS) $< -o $@
85
86 # LLVM Assemble from X.ll to Output/X.bc.  Because we are coming directly from
87 # LLVM source, use the non-transforming assembler.
88 #
89 Output/%.bc: %.ll $(LAS) Output/.dir
90         $(LAS) -f $< -o $@
91
92 # Compile a linked program to machine code for this processor.
93 #
94 Output/%.llc.s: Output/%.llvm.bc $(LLC)
95         $(LLC) $(LLCFLAGS) -f $< -o $@
96
97 # Assemble (and link) an LLVM-linked program using the system assembler...
98 #
99 Output/%.llc: Output/%.llc.s
100         $(CC) $(CFLAGS) $< $(LLCLIBS) -o $@
101
102 #
103 # Testing versions of provided utilities...
104 #
105 Output/%.tll: %.c $(LCC1) Output/.dir $(INCLUDES)
106         @echo "======== Compiling $<"
107         $(LCC) $(LCCFLAGS) -S $< -o $@ || \
108             ( rm -f $@; $(FAILURE) $@ )
109
110 Output/%.tbc: Output/%.tll $(LAS)
111         @echo "======== Assembling $<"
112         $(LAS) -f $< -o $@ || \
113             ( rm -f $@; $(FAILURE) $@ )
114
115
116 ## Cancel built-in implicit rules that override above rules
117 %: %.s
118
119 %: %.c
120
121 %.o: %.c
122