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 ##-------------------------------------------------------------------------===##
6 # If the user specified a TEST= option on the command line, we do not want to do
7 # the default testing type. Instead, we change the default target to be the
14 include ${LEVEL}/Makefile.common
16 # Specify ENABLE_STATS on the command line to enable -stats and -time-passes
17 # output from gccas and gccld.
19 STATS = -stats -time-passes
25 # These files, which might be intermediate results, should not be deleted by
27 .PRECIOUS: Output/%.bc Output/%.ll
28 .PRECIOUS: Output/%.tbc Output/%.tll
29 .PRECIOUS: Output/.dir
30 .PRECIOUS: Output/%.llvm.bc
31 .PRECIOUS: Output/%.llvm
33 ifdef ENABLE_OPTIMIZED
34 TOOLS = $(BUILD_ROOT_TOP)/tools/Release
36 TOOLS = $(BUILD_ROOT_TOP)/tools/Debug
39 # LLVM Tool Definitions...
41 ifdef LLVMGCCARCH # FIXME: Remove when new CFE is used on sparc as well!
42 LCC = $(LLVMGCCDIR)/bin/gcc
43 LCC1 = $(LLVMGCCDIR)/lib/gcc-lib/$(LLVMGCCARCH)/cc1
44 LGCCLD = $(TOOLS)/gccld -L$(LLVMGCCDIR)/lib/gcc-lib/$(LLVMGCCARCH) -L$(LLVMGCCDIR)/lib
46 LCC = $(LLVMGCCDIR)/bin/llvm-gcc
47 LCC1 = $(LLVMGCCDIR)/lib/gcc-lib/llvm/3.1/cc1
48 LGCCLD = $(TOOLS)/gccld -L$(LLVMGCCDIR)/llvm/lib
54 LGCCAS = $(TOOLS)/gccas
58 LANALYZE = $(TOOLS)/analyze
59 LBUGPOINT= $(TOOLS)/bugpoint
63 FAILURE = $(LEVEL)/test/Failure.sh
64 TESTRUNR = $(LEVEL)/test/TestRunner.sh
66 # Native Tool Definitions
67 NATGCC = /usr/dcs/software/supported/bin/gcc
71 LLCFLAGS += -trace basicblock
72 LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
75 LLCFLAGS += -trace function
76 LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
80 LLCLIBS := $(LLCLIBS) -lm
86 # Compile from X.c to Output/X.ll
87 Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
88 $(LCC) $(LCCFLAGS) -S $< -o $@
90 # LLVM Assemble from Output/X.ll to Output/X.bc. Output/X.ll must have come
91 # from GCC output, so use GCCAS.
93 Output/%.bc: Output/%.ll $(LGCCAS)
94 $(LGCCAS) $(STATS) $< -o $@
96 # LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from
97 # LLVM source, use the non-transforming assembler.
99 Output/%.bc: %.ll $(LAS) Output/.dir
103 # Testing versions of provided utilities...
105 Output/%.tll: %.c $(LCC1) Output/.dir $(INCLUDES)
106 @echo "======== Compiling $<"
107 $(LCC) $(LCCFLAGS) -S $< -o $@ || \
108 ( rm -f $@; $(FAILURE) $@ )
110 Output/%.tbc: Output/%.tll $(LAS)
111 @echo "======== Assembling $<"
112 $(LAS) -f $< -o $@ || \
113 ( rm -f $@; $(FAILURE) $@ )
116 ## Cancel built-in implicit rules that override above rules