Remove unneccesary path from link line now
[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
49 ifeq ($(TRACE), yes)
50     LLCFLAGS += -trace basicblock
51     LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
52 else
53     ifeq ($(TRACEM), yes)
54         LLCFLAGS += -trace function
55         LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
56     endif
57 endif
58
59 LLCLIBS := $(LLCLIBS) -lm
60
61 clean ::
62         $(RM) a.out core
63         $(RM) -rf Output/
64
65 # Compile from X.c to Output/X.ll
66 Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
67         $(LCC) $(LCCFLAGS) -S $< -o $@
68
69 # LLVM Assemble from Output/X.ll to Output/X.bc.  Output/X.ll must have come
70 # from GCC output, so use GCCAS.
71 #
72 Output/%.bc: Output/%.ll $(LGCCAS)
73         $(LGCCAS) $< -o $@
74
75 # LLVM Assemble from X.ll to Output/X.bc.  Because we are coming directly from
76 # LLVM source, use the non-transforming assembler.
77 #
78 Output/%.bc: %.ll $(LAS) Output/.dir
79         $(LAS) -f $< -o $@
80
81 # Compile a linked program to machine code for this processor.
82 #
83 Output/%.llc.s: Output/%.llvm.bc
84         $(LLC) $(LLCFLAGS) -f $< -o $@
85
86 # Assemble (and link) an LLVM-linked program using the system assembler...
87 #
88 Output/%.llc: Output/%.llc.s
89         $(CC) $(CFLAGS) $< $(LLCLIBS) -o $@
90
91 #
92 # Testing versions of provided utilities...
93 #
94 Output/%.tll: %.c $(LCC1) Output/.dir $(INCLUDES)
95         @echo "======== Compiling $<"
96         $(LCC) $(LCCFLAGS) -S $< -o $@ || \
97             ( rm -f $@; $(FAILURE) $@ )
98
99 Output/%.tbc: Output/%.tll $(LAS)
100         @echo "======== Assembling $<"
101         $(LAS) -f $< -o $@ || \
102             ( rm -f $@; $(FAILURE) $@ )
103
104
105 ## Cancel built-in implicit rules that override above rules
106 %: %.s
107
108 %: %.c
109
110 %.o: %.c
111