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 # LLVM Tool Definitions...
29 LCC = $(LLVMGCCDIR)/bin/llvm-gcc
30 LCC1 = $(LLVMGCCDIR)/lib/gcc-lib/llvm/3.1/cc1
31 TOOLS = $(BUILD_ROOT_TOP)/tools/Debug
35 LGCCAS = $(TOOLS)/gccas
36 LGCCLD = $(TOOLS)/gccld -L$(LLVMGCCDIR)/llvm/lib
40 LANALYZE = $(TOOLS)/analyze
41 LJELLO = $(TOOLS)/jello
45 FAILURE = $(LEVEL)/test/Failure.sh
46 TESTRUNR = $(LEVEL)/test/TestRunner.sh
48 # Native Tool Definitions
49 NATGCC = /usr/dcs/software/supported/bin/gcc
52 ifndef DISABLE_LLC_DIFFS
53 CC = /opt/SUNWspro/bin/cc
54 AS = /opt/SUNWspro/bin/cc
55 DIS = /usr/ccs/bin/dis
56 CFLAGS += -g -xarch=v9
61 LLCFLAGS += -trace basicblock
62 LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
65 LLCFLAGS += -trace function
66 LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
70 LLCLIBS := $(LLCLIBS) -lm
76 # Compile from X.c to Output/X.ll
77 Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
78 $(LCC) $(LCCFLAGS) -S $< -o $@
80 # LLVM Assemble from Output/X.ll to Output/X.bc. Output/X.ll must have come
81 # from GCC output, so use GCCAS.
83 Output/%.bc: Output/%.ll $(LGCCAS)
84 $(LGCCAS) $(STATS) $< -o $@
86 # LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from
87 # LLVM source, use the non-transforming assembler.
89 Output/%.bc: %.ll $(LAS) Output/.dir
92 # Compile a linked program to machine code for this processor.
94 Output/%.llc.s: Output/%.llvm.bc $(LLC)
95 $(LLC) $(LLCFLAGS) -f $< -o $@
97 # Assemble (and link) an LLVM-linked program using the system assembler...
99 Output/%.llc: Output/%.llc.s
100 $(CC) $(CFLAGS) $< $(LLCLIBS) -o $@
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