Makefile.tests revision 2a4d8d2461f2ead5da8440c438a79b3fb93bff00
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.PRECIOUS: Output/%.llvm.bc
19.PRECIOUS: Output/%.llvm
20
21# LLVM Tool Definitions...
22#
23LCC      = /home/vadve/lattner/cvs/gcc_install/bin/gcc
24LCC1     = /home/vadve/lattner/cvs/gcc_install/lib/gcc-lib/llvm/3.1/cc1
25TOOLS    = $(LEVEL)/tools/Debug
26LLI      = $(TOOLS)/lli
27LLC      = $(TOOLS)/llc
28LAS      = $(TOOLS)/as
29LGCCAS   = $(TOOLS)/gccas
30LGCCLD   = $(TOOLS)/gccld -L/home/vadve/lattner/cvs/gcc_install/lib/gcc-lib/llvm/3.1/ -L/home/vadve/vadve/Research/DynOpt/LLVM/llvm/test/Libraries/Output
31LDIS     = $(TOOLS)/dis 
32LOPT     = $(TOOLS)/opt
33LLINK    = $(TOOLS)/link
34
35LCCFLAGS  += -O2 -Wall
36LLCFLAGS =
37FAILURE  = $(LEVEL)/test/Failure.sh
38TESTRUNR = $(LEVEL)/test/TestRunner.sh
39
40# Native Tool Definitions
41NATGCC  = /usr/dcs/software/supported/bin/gcc
42CC      = /opt/SUNWspro/bin/cc
43AS	= /opt/SUNWspro/bin/cc
44DIS     = /usr/ccs/bin/dis
45CP	= /bin/cp -f
46CFLAGS  += -g -xarch=v9
47
48
49ifeq ($(TRACE), yes)
50    LLCFLAGS += -trace basicblock
51    LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
52else
53    ifeq ($(TRACEM), yes)
54        LLCFLAGS += -trace function
55	LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
56    endif
57endif
58
59LLCLIBS := $(LLCLIBS) -lm
60
61clean ::
62	$(RM) a.out core
63	$(RM) -rf Output/
64
65# Compile from X.c to Output/X.ll
66Output/%.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#
72Output/%.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#
78Output/%.bc: %.ll $(LAS) Output/.dir
79	$(LAS) -f $< -o $@
80
81# Compile a linked program to machine code for this processor.
82#
83Output/%.llc.s: Output/%.llvm.bc
84	$(LLC) $(LLCFLAGS) -f $< -o $@
85
86# Assemble (and link) an LLVM-linked program using the system assembler...
87#
88Output/%.llc: Output/%.llc.s
89	$(CC) $(CFLAGS) $< $(LLCLIBS) -o $@
90
91#
92# Testing versions of provided utilities...
93#
94Output/%.tll: %.c $(LCC1) Output/.dir $(INCLUDES)
95	@echo "======== Compiling $<"
96	$(LCC) $(LCCFLAGS) -S $< -o $@ || \
97	    ( rm -f $@; $(FAILURE) $@ )
98
99Output/%.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
112