2003-05-09 12:19:58 +08:00
|
|
|
##----------------------------------------------------------*- Makefile -*-===##
|
2003-07-26 06:26:17 +08:00
|
|
|
##
|
2002-01-23 00:56:41 +08:00
|
|
|
## Common rules for generating, linking, and compiling via LLVM. This is
|
|
|
|
## used to implement a robust testing framework for LLVM
|
2003-07-26 06:26:17 +08:00
|
|
|
##
|
2003-05-09 12:19:58 +08:00
|
|
|
##-------------------------------------------------------------------------===##
|
2001-12-15 09:13:42 +08:00
|
|
|
|
2003-01-17 04:26:29 +08:00
|
|
|
# If the user specified a TEST= option on the command line, we do not want to do
|
|
|
|
# the default testing type. Instead, we change the default target to be the
|
|
|
|
# test:: target.
|
|
|
|
#
|
|
|
|
ifdef TEST
|
|
|
|
test::
|
|
|
|
endif
|
|
|
|
|
2003-08-22 22:09:46 +08:00
|
|
|
# We do not want to make .d files for tests!
|
|
|
|
DISABLE_AUTO_DEPENDENCIES=1
|
|
|
|
|
2001-12-15 09:13:42 +08:00
|
|
|
include ${LEVEL}/Makefile.common
|
|
|
|
|
2003-01-22 05:31:29 +08:00
|
|
|
# Specify ENABLE_STATS on the command line to enable -stats and -time-passes
|
|
|
|
# output from gccas and gccld.
|
2002-10-01 03:23:55 +08:00
|
|
|
ifdef ENABLE_STATS
|
2003-01-22 05:31:29 +08:00
|
|
|
STATS = -stats -time-passes
|
2002-10-01 03:23:55 +08:00
|
|
|
endif
|
|
|
|
|
2001-11-05 08:18:30 +08:00
|
|
|
.PHONY: clean default
|
|
|
|
|
2002-01-24 05:36:59 +08:00
|
|
|
# These files, which might be intermediate results, should not be deleted by
|
|
|
|
# make
|
|
|
|
.PRECIOUS: Output/%.bc Output/%.ll
|
|
|
|
.PRECIOUS: Output/%.tbc Output/%.tll
|
|
|
|
.PRECIOUS: Output/.dir
|
2002-04-07 16:11:07 +08:00
|
|
|
.PRECIOUS: Output/%.llvm.bc
|
|
|
|
.PRECIOUS: Output/%.llvm
|
2002-01-24 05:36:59 +08:00
|
|
|
|
|
|
|
LCCFLAGS += -O2 -Wall
|
2003-05-14 04:06:00 +08:00
|
|
|
LCXXFLAGS += -O2 -Wall
|
2001-11-05 08:18:30 +08:00
|
|
|
LLCFLAGS =
|
2003-06-29 06:35:46 +08:00
|
|
|
TESTRUNR = @echo Running test: $<; \
|
2013-04-12 12:07:13 +08:00
|
|
|
PATH="$(LLVMTOOLCURRENT):$(PATH)" \
|
2003-09-06 23:12:21 +08:00
|
|
|
$(LLVM_SRC_ROOT)/test/TestRunner.sh
|
2001-11-05 08:18:30 +08:00
|
|
|
|
2003-08-06 09:03:28 +08:00
|
|
|
LLCLIBS := $(LLCLIBS) -lm
|
2002-05-19 23:47:52 +08:00
|
|
|
|
2002-08-30 11:27:36 +08:00
|
|
|
clean::
|
2003-07-09 02:39:51 +08:00
|
|
|
$(RM) -f a.out core
|
2002-01-23 00:56:41 +08:00
|
|
|
$(RM) -rf Output/
|
2001-11-05 08:18:30 +08:00
|
|
|
|
2002-02-12 23:39:38 +08:00
|
|
|
# Compile from X.c to Output/X.ll
|
2003-09-06 23:12:21 +08:00
|
|
|
Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
|
2010-02-23 18:28:06 +08:00
|
|
|
-$(LLVMCC) $(CPPFLAGS) $(LCCFLAGS) -S $< -o $@
|
2001-11-05 08:18:30 +08:00
|
|
|
|
2003-05-14 04:06:00 +08:00
|
|
|
# Compile from X.cpp to Output/X.ll
|
2003-09-06 23:12:21 +08:00
|
|
|
Output/%.ll: %.cpp $(LCC1XX) Output/.dir $(INCLUDES)
|
2010-02-23 18:28:06 +08:00
|
|
|
-$(LLVMCXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
|
2003-06-02 13:49:11 +08:00
|
|
|
|
|
|
|
# Compile from X.cc to Output/X.ll
|
2003-09-06 23:12:21 +08:00
|
|
|
Output/%.ll: %.cc $(LCC1XX) Output/.dir $(INCLUDES)
|
2010-02-23 18:28:06 +08:00
|
|
|
-$(LLVMCXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
|
2003-05-14 04:06:00 +08:00
|
|
|
|
2002-02-12 23:39:38 +08:00
|
|
|
# LLVM Assemble from Output/X.ll to Output/X.bc. Output/X.ll must have come
|
|
|
|
# from GCC output, so use GCCAS.
|
|
|
|
#
|
2002-01-24 05:36:59 +08:00
|
|
|
Output/%.bc: Output/%.ll $(LGCCAS)
|
2004-01-14 05:59:51 +08:00
|
|
|
-$(LGCCAS) $(STATS) $< -o $@
|
2001-11-05 08:18:30 +08:00
|
|
|
|
2002-02-12 23:39:38 +08:00
|
|
|
# LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from
|
|
|
|
# LLVM source, use the non-transforming assembler.
|
|
|
|
#
|
2004-01-14 05:56:30 +08:00
|
|
|
Output/%.bc: %.ll $(LLVMAS) Output/.dir
|
2009-08-25 23:38:29 +08:00
|
|
|
-$(LLVMAS) $< -o $@
|
2001-11-05 08:18:30 +08:00
|
|
|
|
2001-11-07 01:09:49 +08:00
|
|
|
## Cancel built-in implicit rules that override above rules
|
2001-11-05 08:18:30 +08:00
|
|
|
%: %.s
|
|
|
|
|
2001-11-07 01:09:49 +08:00
|
|
|
%: %.c
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
|