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
9 include ${LEVEL}/Makefile.common
13 # These files, which might be intermediate results, should not be deleted by
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
21 # LLVM Tool Definitions...
23 LCC = $(LLVMGCCDIR)/bin/llvm-gcc
24 LCC1 = $(LLVMGCCDIR)/lib/gcc-lib/llvm/3.1/cc1
25 TOOLS = $(BUILD_ROOT_TOP)/tools/Debug
29 LGCCAS = $(TOOLS)/gccas
30 LGCCLD = $(TOOLS)/gccld -L$(LLVMGCCDIR)/llvm/lib
34 LANALYZE = $(TOOLS)/analyze
38 FAILURE = $(LEVEL)/test/Failure.sh
39 TESTRUNR = $(LEVEL)/test/TestRunner.sh
41 # Native Tool Definitions
42 NATGCC = /usr/dcs/software/supported/bin/gcc
45 ifndef DISABLE_LLC_DIFFS
46 CC = /opt/SUNWspro/bin/cc
47 AS = /opt/SUNWspro/bin/cc
48 DIS = /usr/ccs/bin/dis
49 CFLAGS += -g -xarch=v9
54 LLCFLAGS += -trace basicblock
55 LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
58 LLCFLAGS += -trace function
59 LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
63 LLCLIBS := $(LLCLIBS) -lm
69 # Compile from X.c to Output/X.ll
70 Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
71 $(LCC) $(LCCFLAGS) -S $< -o $@
73 # LLVM Assemble from Output/X.ll to Output/X.bc. Output/X.ll must have come
74 # from GCC output, so use GCCAS.
76 Output/%.bc: Output/%.ll $(LGCCAS)
79 # LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from
80 # LLVM source, use the non-transforming assembler.
82 Output/%.bc: %.ll $(LAS) Output/.dir
85 # Compile a linked program to machine code for this processor.
87 Output/%.llc.s: Output/%.llvm.bc
88 $(LLC) $(LLCFLAGS) -f $< -o $@
90 # Assemble (and link) an LLVM-linked program using the system assembler...
92 Output/%.llc: Output/%.llc.s
93 $(CC) $(CFLAGS) $< $(LLCLIBS) -o $@
96 # Testing versions of provided utilities...
98 Output/%.tll: %.c $(LCC1) Output/.dir $(INCLUDES)
99 @echo "======== Compiling $<"
100 $(LCC) $(LCCFLAGS) -S $< -o $@ || \
101 ( rm -f $@; $(FAILURE) $@ )
103 Output/%.tbc: Output/%.tll $(LAS)
104 @echo "======== Assembling $<"
105 $(LAS) -f $< -o $@ || \
106 ( rm -f $@; $(FAILURE) $@ )
109 ## Cancel built-in implicit rules that override above rules