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