don't delete intermediate files!
[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
9 include ${LEVEL}/Makefile.common
10
11 .PHONY: clean default
12
13 # These files, which might be intermediate results, should not be deleted by
14 # make
15 .PRECIOUS: Output/%.bc  Output/%.ll
16 .PRECIOUS: Output/%.tbc Output/%.tll
17 .PRECIOUS: Output/.dir
18 .PRECIOUS: Output/%.llvm.bc
19 .PRECIOUS: Output/%.llvm
20
21 # LLVM Tool Definitions...
22 #
23 LCC      = /home/vadve/lattner/cvs/gcc_install/bin/gcc
24 LCC1     = /home/vadve/lattner/cvs/gcc_install/lib/gcc-lib/llvm/3.1/cc1
25 TOOLS    = $(LEVEL)/tools/Debug
26 LLI      = $(TOOLS)/lli
27 LLC      = $(TOOLS)/llc
28 LAS      = $(TOOLS)/as
29 LGCCAS   = $(TOOLS)/gccas
30 LGCCLD   = $(TOOLS)/gccld -L/home/vadve/lattner/cvs/gcc_install/lib/gcc-lib/llvm/3.1/
31 LDIS     = $(TOOLS)/dis 
32 LOPT     = $(TOOLS)/opt
33 LLINK    = $(TOOLS)/link
34
35 LCCFLAGS  += -O2 -Wall
36 LLCFLAGS =
37 FAILURE  = $(LEVEL)/test/Failure.sh
38 TESTRUNR = $(LEVEL)/test/TestRunner.sh
39
40 # Native Tool Definitions
41 NATGCC  = /usr/dcs/software/supported/bin/gcc
42 CC      = /opt/SUNWspro/bin/cc
43 AS      = /opt/SUNWspro/bin/cc
44 DIS     = /usr/ccs/bin/dis
45 CP      = /bin/cp -f
46 CFLAGS  += -g -xarch=v9
47
48 #LLCLIB   = $(LEVEL)/test/Libraries/runtime.o
49 #LIBS    += $(LLCLIB)
50
51
52
53 ifeq ($(TRACE), yes)
54     LLCFLAGS += -trace
55 endif
56 ifeq ($(TRACEM), yes)
57     LLCFLAGS += -tracem
58 endif
59
60 clean ::
61         $(RM) a.out core
62         $(RM) -rf Output/
63
64 # Compile from X.c to Output/X.ll
65 Output/%.ll: %.c $(LCC1) Output/.dir
66         $(LCC) $(LCCFLAGS) -S $< -o $@
67
68 # LLVM Assemble from Output/X.ll to Output/X.bc.  Output/X.ll must have come
69 # from GCC output, so use GCCAS.
70 #
71 Output/%.bc: Output/%.ll $(LGCCAS)
72         $(LGCCAS) $< -o $@
73
74 # LLVM Assemble from X.ll to Output/X.bc.  Because we are coming directly from
75 # LLVM source, use the non-transforming assembler.
76 #
77 Output/%.bc: %.ll $(LAS) Output/.dir
78         $(LAS) -f $< -o $@
79
80 # Compile a linked program to machine code for this processor.
81 #
82 Output/%.llc.s: Output/%.llvm.bc
83         $(LLC) $(LLCFLAGS) -f $< -o $@
84
85 # Assemble (and link) an LLVM-linked program using the system assembler...
86 #
87 Output/%.llc: Output/%.llc.s
88         $(CC) $(CFLAGS) $< $(LIBS) -o $@
89
90 #
91 # Testing versions of provided utilities...
92 #
93 Output/%.tll: %.c $(LCC1) Output/.dir
94         @echo "======== Compiling $<"
95         $(LCC) $(LCCFLAGS) -S $< -o $@ || \
96             ( rm -f $@; $(FAILURE) $@ )
97
98 Output/%.tbc: Output/%.tll $(LAS)
99         @echo "======== Assembling $<"
100         $(LAS) -f $< -o $@ || \
101             ( rm -f $@; $(FAILURE) $@ )
102
103
104 ## Cancel built-in implicit rules that override above rules
105 %: %.s
106
107 %: %.c
108
109 %.o: %.c
110