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 # TARGET_FLAGS can come in from the command line, and tests may add to them,
22 # so use an internal target name to combine them. Just using += to add to
23 # TARGET_FLAGS in the TEST.* makefiles doesn't work out.
24 X_TARGET_FLAGS = $(TARGET_FLAGS) $(TEST_TARGET_FLAGS)
26 STATS = -stats -time-passes
30 # These files, which might be intermediate results, should not be deleted by
32 .PRECIOUS: Output/%.bc Output/%.ll
33 .PRECIOUS: Output/%.tbc Output/%.tll
34 .PRECIOUS: Output/.dir
35 .PRECIOUS: Output/%.llvm.bc
36 .PRECIOUS: Output/%.llvm
38 FAILURE = $(LLVM_SRC_ROOT)/test/Failure.sh
39 LLCLIBS := $(LLCLIBS) -lm
45 # Compile from X.c to Output/X.ll
46 Output/%.ll: %.c $(LCC_PROGRAMS) Output/.dir $(INCLUDES)
47 -$(LCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -S $< -o $@ $(LLVMCC_EMITIR_FLAG)
49 # Compile from X.cpp to Output/X.ll
50 Output/%.ll: %.cpp $(LCC_PROGRAMS) Output/.dir $(INCLUDES)
51 -$(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -S $< -o $@ $(LLVMCC_EMITIR_FLAG)
53 # Compile from X.cc to Output/X.ll
54 Output/%.ll: %.cc $(LCC_PROGRAMS) Output/.dir $(INCLUDES)
55 -$(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -S $< -o $@ $(LLVMCC_EMITIR_FLAG)
57 # Compile from X.C to Output/X.ll
58 Output/%.ll: %.C $(LCC_PROGRAMS) Output/.dir $(INCLUDES)
59 -$(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -S $< -o $@ $(LLVMCC_EMITIR_FLAG)
61 # Compile from X.m to Output/X.ll
62 Output/%.ll: %.m $(LCC_PROGRAMS) Output/.dir $(INCLUDES)
63 -$(LCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -S $< -o $@ $(LLVMCC_EMITIR_FLAG)
65 # Compile from X.mm to Output/X.ll
66 Output/%.ll: %.mm $(LCC_PROGRAMS) Output/.dir $(INCLUDES)
67 -$(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -S $< -o $@ $(LLVMCC_EMITIR_FLAG)
69 # Compile from X.ll to X.bc
73 # LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from
74 # LLVM source, use the non-transforming assembler.
76 Output/%.bc: %.ll $(LLVMAS) Output/.dir
79 ## Cancel built-in implicit rules that override above rules