Fix file mode.
[llvm-testsuite.git] / Makefile.tests
blob0d82c089caceb24d5baabb37df2ea4e3c41bd97f
1 ##----------------------------------------------------------*- Makefile -*-===##
2 ##
3 ## Common rules for generating, linking, and compiling via LLVM.  This is
4 ## used to implement a robust testing framework for LLVM
5 ##
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
10 # test:: target.
12 ifdef TEST
13 test::
14 endif
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
28 .PHONY: clean default
30 # These files, which might be intermediate results, should not be deleted by
31 # make
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
41 clean::
42         $(RM) -f a.out core
43         $(RM) -rf Output/
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
70 %.bc: %.ll $(LLVMAS)
71         $(LLVMAS) $< -o $@
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
77         -$(LLVMAS) $< -o $@
79 ## Cancel built-in implicit rules that override above rules
80 %: %.s
82 %: %.c
84 %.o: %.c
86 %.o: %.m
88 %.o: %.mm