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