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 ## NOTE: This is preliminary and will change in the future
8 include ${LEVEL}/Makefile.common
10 # Specify ENABLE_STATS on the command line to enable -stats output from gccas
19 # These files, which might be intermediate results, should not be deleted by
21 .PRECIOUS: Output/%.bc Output/%.ll
22 .PRECIOUS: Output/%.tbc Output/%.tll
23 .PRECIOUS: Output/.dir
24 .PRECIOUS: Output/%.llvm.bc
25 .PRECIOUS: Output/%.llvm
27 ifdef ENABLE_OPTIMIZED
28 TOOLS = $(BUILD_ROOT_TOP)/tools/Release
30 TOOLS = $(BUILD_ROOT_TOP)/tools/Debug
33 # LLVM Tool Definitions...
35 LCC = $(LLVMGCCDIR)/bin/llvm-gcc
36 LCC1 = $(LLVMGCCDIR)/lib/gcc-lib/llvm/3.1/cc1
40 LGCCAS = $(TOOLS)/gccas
41 LGCCLD = $(TOOLS)/gccld -L$(LLVMGCCDIR)/llvm/lib
45 LANALYZE = $(TOOLS)/analyze
46 LJELLO = $(TOOLS)/jello
47 LBUGPOINT= $(TOOLS)/bugpoint
51 FAILURE = $(LEVEL)/test/Failure.sh
52 TESTRUNR = $(LEVEL)/test/TestRunner.sh
54 # Native Tool Definitions
55 NATGCC = /usr/dcs/software/supported/bin/gcc
58 ifndef DISABLE_LLC_DIFFS
59 CC = /opt/SUNWspro/bin/cc
60 AS = /opt/SUNWspro/bin/cc
61 DIS = /usr/ccs/bin/dis
62 CFLAGS += -g -xarch=v9
67 LLCFLAGS += -trace basicblock
68 LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
71 LLCFLAGS += -trace function
72 LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
76 LLCLIBS := $(LLCLIBS) -lm
82 # Compile from X.c to Output/X.ll
83 Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
84 $(LCC) $(LCCFLAGS) -S $< -o $@
86 # LLVM Assemble from Output/X.ll to Output/X.bc. Output/X.ll must have come
87 # from GCC output, so use GCCAS.
89 Output/%.bc: Output/%.ll $(LGCCAS)
90 $(LGCCAS) $(STATS) $< -o $@
92 # LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from
93 # LLVM source, use the non-transforming assembler.
95 Output/%.bc: %.ll $(LAS) Output/.dir
98 # Compile a linked program to machine code for this processor.
100 Output/%.llc.s: Output/%.llvm.bc $(LLC)
101 $(LLC) $(LLCFLAGS) -f $< -o $@
103 # Assemble (and link) an LLVM-linked program using the system assembler...
105 Output/%.llc: Output/%.llc.s
106 $(CC) $(CFLAGS) $< $(LLCLIBS) -o $@
109 # Testing versions of provided utilities...
111 Output/%.tll: %.c $(LCC1) Output/.dir $(INCLUDES)
112 @echo "======== Compiling $<"
113 $(LCC) $(LCCFLAGS) -S $< -o $@ || \
114 ( rm -f $@; $(FAILURE) $@ )
116 Output/%.tbc: Output/%.tll $(LAS)
117 @echo "======== Assembling $<"
118 $(LAS) -f $< -o $@ || \
119 ( rm -f $@; $(FAILURE) $@ )
122 ## Cancel built-in implicit rules that override above rules