• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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##-------------------------------------------------------------------------===##
7
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.
11#
12ifdef TEST
13test::
14endif
15
16# We do not want to make .d files for tests!
17DISABLE_AUTO_DEPENDENCIES=1
18
19include ${LEVEL}/Makefile.common
20
21# Specify ENABLE_STATS on the command line to enable -stats and -time-passes
22# output from gccas and gccld.
23ifdef ENABLE_STATS
24STATS = -stats -time-passes
25endif
26
27.PHONY: clean default
28
29# These files, which might be intermediate results, should not be deleted by
30# make
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
36
37LCCFLAGS  += -O2 -Wall
38LCXXFLAGS += -O2 -Wall
39LLCFLAGS =
40TESTRUNR = @echo Running test: $<; \
41             PATH="$(LLVMTOOLCURRENT):$(PATH)" \
42                  $(LLVM_SRC_ROOT)/test/TestRunner.sh
43
44LLCLIBS := $(LLCLIBS) -lm
45
46clean::
47	$(RM) -f a.out core
48	$(RM) -rf Output/
49
50# LLVM Assemble from Output/X.ll to Output/X.bc.  Output/X.ll must have come
51# from GCC output, so use GCCAS.
52#
53Output/%.bc: Output/%.ll $(LGCCAS)
54	-$(LGCCAS) $(STATS) $< -o $@
55
56# LLVM Assemble from X.ll to Output/X.bc.  Because we are coming directly from
57# LLVM source, use the non-transforming assembler.
58#
59Output/%.bc: %.ll $(LLVMAS) Output/.dir
60	-$(LLVMAS) $< -o $@
61
62## Cancel built-in implicit rules that override above rules
63%: %.s
64
65%: %.c
66
67%.o: %.c
68
69