1 ##----------------------------------------------------------*- Makefile -*-===##
3 ## Common rules for generating, linking, and compiling via LLVM. This is
4 ## used to implement a robust testing framework for LLVM
6 ##-------------------------------------------------------------------------===##
8 # If the user specified a TEST= option on the command line, we do not want to do
9 # the default testing type. Instead, we change the default target to be the
16 # We do not want to make .d files for tests!
17 DISABLE_AUTO_DEPENDENCIES=1
19 include ${LEVEL}/Makefile.common
21 # Specify ENABLE_STATS on the command line to enable -stats and -time-passes
22 # output from gccas and gccld.
24 STATS = -stats -time-passes
29 # These files, which might be intermediate results, should not be deleted by
31 .PRECIOUS: Output/%.bc Output/%.ll
32 .PRECIOUS: Output/%.tbc Output/%.tll
33 .PRECIOUS: Output/.dir
34 .PRECIOUS: Output/%.llvm.bc
35 .PRECIOUS: Output/%.llvm
37 # Find the location of the platform specific LLVM GCC libraries
38 LLVMGCCLIBDIR=$(dir $(shell $(LLVMGCC) -print-file-name=libgcc.a))
40 # LLVM Tool Definitions (LLVMGCC, LLVMGXX, LLVMAS are provided by Makefile.rules)
41 LLI = $(LLVMTOOLCURRENT)/lli$(EXEEXT)
42 LLC = $(LLVMTOOLCURRENT)/llc$(EXEEXT)
43 LGCCAS = $(LLVMTOOLCURRENT)/gccas$(EXEEXT)
44 LGCCLD = $(LGCCLDPROG) -L$(LLVMGCCLIBDIR) -L$(LLVMGCCDIR)/lib
45 LDIS = $(LLVMTOOLCURRENT)/llvm-dis$(EXEEXT)
46 LOPT = $(LLVMTOOLCURRENT)/opt$(EXEEXT)
47 LLINK = $(LLVMTOOLCURRENT)/llvm-link$(EXEEXT)
48 LPROF = $(LLVMTOOLCURRENT)/llvm-prof$(EXEEXT)
49 LANALYZE = $(LLVMTOOLCURRENT)/analyze$(EXEEXT)
50 LBUGPOINT= $(LLVMTOOLCURRENT)/bugpoint$(EXEEXT)
53 LCXXFLAGS += -O2 -Wall
55 FAILURE = $(LLVM_SRC_ROOT)/test/Failure.sh
56 TESTRUNR = @echo Running test: $<; \
57 PATH=$(LLVMTOOLCURRENT):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH) \
58 $(LLVM_SRC_ROOT)/test/TestRunner.sh
60 LLCLIBS := $(LLCLIBS) -lm
66 # Compile from X.c to Output/X.ll
67 Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
68 -$(LLVMGCC) $(CPPFLAGS) $(LCCFLAGS) -S $< -o $@
70 # Compile from X.cpp to Output/X.ll
71 Output/%.ll: %.cpp $(LCC1XX) Output/.dir $(INCLUDES)
72 -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
74 # Compile from X.cc to Output/X.ll
75 Output/%.ll: %.cc $(LCC1XX) Output/.dir $(INCLUDES)
76 -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
78 # LLVM Assemble from Output/X.ll to Output/X.bc. Output/X.ll must have come
79 # from GCC output, so use GCCAS.
81 Output/%.bc: Output/%.ll $(LGCCAS)
82 -$(LGCCAS) $(STATS) $< -o $@
84 # LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from
85 # LLVM source, use the non-transforming assembler.
87 Output/%.bc: %.ll $(LLVMAS) Output/.dir
88 -$(LLVMAS) -f $< -o $@
90 ## Cancel built-in implicit rules that override above rules