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/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)/lib/gcc-lib/llvm/3.1/
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
43 CC = /opt/SUNWspro/bin/cc
44 AS = /opt/SUNWspro/bin/cc
45 DIS = /usr/ccs/bin/dis
47 CFLAGS += -g -xarch=v9
51 LLCFLAGS += -trace basicblock
52 LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
55 LLCFLAGS += -trace function
56 LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64
60 LLCLIBS := $(LLCLIBS) -lm
66 # Compile from X.c to Output/X.ll
67 Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
68 $(LCC) $(LCCFLAGS) -S $< -o $@
70 # LLVM Assemble from Output/X.ll to Output/X.bc. Output/X.ll must have come
71 # from GCC output, so use GCCAS.
73 Output/%.bc: Output/%.ll $(LGCCAS)
76 # LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from
77 # LLVM source, use the non-transforming assembler.
79 Output/%.bc: %.ll $(LAS) Output/.dir
82 # Compile a linked program to machine code for this processor.
84 Output/%.llc.s: Output/%.llvm.bc
85 $(LLC) $(LLCFLAGS) -f $< -o $@
87 # Assemble (and link) an LLVM-linked program using the system assembler...
89 Output/%.llc: Output/%.llc.s
90 $(CC) $(CFLAGS) $< $(LLCLIBS) -o $@
93 # Testing versions of provided utilities...
95 Output/%.tll: %.c $(LCC1) Output/.dir $(INCLUDES)
96 @echo "======== Compiling $<"
97 $(LCC) $(LCCFLAGS) -S $< -o $@ || \
98 ( rm -f $@; $(FAILURE) $@ )
100 Output/%.tbc: Output/%.tll $(LAS)
101 @echo "======== Assembling $<"
102 $(LAS) -f $< -o $@ || \
103 ( rm -f $@; $(FAILURE) $@ )
106 ## Cancel built-in implicit rules that override above rules