2003-05-09 04:19:58 +00:00
|
|
|
##----------------------------------------------------------*- Makefile -*-===##
|
2003-07-25 22:26:17 +00:00
|
|
|
##
|
2002-01-22 16:56:41 +00:00
|
|
|
## Common rules for generating, linking, and compiling via LLVM. This is
|
|
|
|
## used to implement a robust testing framework for LLVM
|
2003-07-25 22:26:17 +00:00
|
|
|
##
|
2003-05-09 04:19:58 +00:00
|
|
|
##-------------------------------------------------------------------------===##
|
2001-12-15 01:13:42 +00:00
|
|
|
|
2003-01-16 20:26:29 +00: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 14:09:46 +00:00
|
|
|
# We do not want to make .d files for tests!
|
|
|
|
DISABLE_AUTO_DEPENDENCIES=1
|
|
|
|
|
2001-12-15 01:13:42 +00:00
|
|
|
include ${LEVEL}/Makefile.common
|
|
|
|
|
2003-01-21 21:31:29 +00:00
|
|
|
# Specify ENABLE_STATS on the command line to enable -stats and -time-passes
|
|
|
|
# output from gccas and gccld.
|
2002-09-30 19:23:55 +00:00
|
|
|
ifdef ENABLE_STATS
|
2003-01-21 21:31:29 +00:00
|
|
|
STATS = -stats -time-passes
|
2002-09-30 19:23:55 +00:00
|
|
|
endif
|
|
|
|
|
2001-11-05 00:18:30 +00:00
|
|
|
.PHONY: clean default
|
|
|
|
|
2002-01-23 21:36:59 +00: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 08:11:07 +00:00
|
|
|
.PRECIOUS: Output/%.llvm.bc
|
|
|
|
.PRECIOUS: Output/%.llvm
|
2002-01-23 21:36:59 +00:00
|
|
|
|
2003-06-16 19:16:32 +00:00
|
|
|
TOOLS = $(LLVMTOOLCURRENT)
|
2002-11-09 00:50:02 +00:00
|
|
|
|
2002-01-23 21:36:59 +00:00
|
|
|
# LLVM Tool Definitions...
|
|
|
|
#
|
2003-08-15 02:19:08 +00:00
|
|
|
LCC = $(LLVMGCC) ## FIXME: remove these definitions, use LLVMGCC directly
|
|
|
|
LCXX = $(LLVMGXX) ## FIXME: remove these definitions, use LLVMGXX directly
|
|
|
|
LAS = $(LLVMAS) ## FIXME: remove these definitions, use LLVMAS directly
|
|
|
|
|
2001-12-15 01:13:42 +00:00
|
|
|
LLI = $(TOOLS)/lli
|
2001-11-05 00:18:30 +00:00
|
|
|
LLC = $(TOOLS)/llc
|
2002-01-23 21:36:59 +00:00
|
|
|
LGCCAS = $(TOOLS)/gccas
|
2003-11-29 09:49:14 +00:00
|
|
|
LGCCLD = $(LGCCLDPROG) -L$(LLVMGCCDIR)/lib/gcc/$(LLVMGCCARCH) -L$(LLVMGCCDIR)/lib
|
2003-08-29 15:26:31 +00:00
|
|
|
LDIS = $(TOOLS)/llvm-dis
|
2001-11-05 00:18:30 +00:00
|
|
|
LOPT = $(TOOLS)/opt
|
2003-09-16 20:02:22 +00:00
|
|
|
LLINK = $(TOOLS)/llvm-link
|
2002-06-24 21:35:50 +00:00
|
|
|
LANALYZE = $(TOOLS)/analyze
|
2002-11-19 21:57:18 +00:00
|
|
|
LBUGPOINT= $(TOOLS)/bugpoint
|
2002-01-23 21:36:59 +00:00
|
|
|
|
|
|
|
LCCFLAGS += -O2 -Wall
|
2003-05-13 20:06:00 +00:00
|
|
|
LCXXFLAGS += -O2 -Wall
|
2001-11-05 00:18:30 +00:00
|
|
|
LLCFLAGS =
|
2003-09-06 15:12:21 +00:00
|
|
|
FAILURE = $(LLVM_SRC_ROOT)/test/Failure.sh
|
2003-06-28 22:35:46 +00:00
|
|
|
TESTRUNR = @echo Running test: $<; \
|
2003-09-06 15:12:21 +00:00
|
|
|
PATH=$(LLVMTOOLCURRENT):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH) \
|
|
|
|
$(LLVM_SRC_ROOT)/test/TestRunner.sh
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2002-01-23 21:36:59 +00:00
|
|
|
# Native Tool Definitions
|
2003-06-11 13:56:55 +00:00
|
|
|
NATGCC = $(CC)
|
2002-01-23 21:36:59 +00:00
|
|
|
CP = /bin/cp -f
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2003-06-03 18:56:57 +00:00
|
|
|
## If TRACE or TRACEM is "yes", set the appropriate llc flag (-trace or -tracem)
|
|
|
|
## mark that tracing on, and set the TRACELIBS variable.
|
2003-06-04 14:24:52 +00:00
|
|
|
TRACEFLAGS =
|
2001-11-05 00:18:30 +00:00
|
|
|
ifeq ($(TRACE), yes)
|
2003-07-25 22:26:17 +00:00
|
|
|
TRACEFLAGS = -trace
|
2003-07-08 18:39:51 +00:00
|
|
|
TRACELIBS := -L$(LEVEL)/test/Libraries/Output -linstr.$(ARCH)
|
2003-06-03 18:56:57 +00:00
|
|
|
endif
|
|
|
|
|
2003-07-25 22:26:17 +00:00
|
|
|
ifeq ($(TRACEM), yes)
|
|
|
|
TRACEFLAGS = -tracem
|
|
|
|
TRACELIBS := -L$(LEVEL)/test/Libraries/Output -linstr.$(ARCH)
|
|
|
|
endif
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2003-08-06 01:03:28 +00:00
|
|
|
LLCLIBS := $(LLCLIBS) -lm
|
2002-05-19 15:47:52 +00:00
|
|
|
|
2002-08-30 03:27:36 +00:00
|
|
|
clean::
|
2003-07-08 18:39:51 +00:00
|
|
|
$(RM) -f a.out core
|
2002-01-22 16:56:41 +00:00
|
|
|
$(RM) -rf Output/
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2002-02-12 15:39:38 +00:00
|
|
|
# Compile from X.c to Output/X.ll
|
2003-09-06 15:12:21 +00:00
|
|
|
Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
|
2003-05-17 22:33:18 +00:00
|
|
|
$(LCC) $(CPPFLAGS) $(LCCFLAGS) -S $< -o $@
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2003-05-13 20:06:00 +00:00
|
|
|
# Compile from X.cpp to Output/X.ll
|
2003-09-06 15:12:21 +00:00
|
|
|
Output/%.ll: %.cpp $(LCC1XX) Output/.dir $(INCLUDES)
|
2003-06-02 05:49:11 +00:00
|
|
|
$(LCXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
|
|
|
|
|
|
|
|
# Compile from X.cc to Output/X.ll
|
2003-09-06 15:12:21 +00:00
|
|
|
Output/%.ll: %.cc $(LCC1XX) Output/.dir $(INCLUDES)
|
2003-05-17 22:33:18 +00:00
|
|
|
$(LCXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
|
2003-05-13 20:06:00 +00:00
|
|
|
|
2002-02-12 15:39:38 +00: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-23 21:36:59 +00:00
|
|
|
Output/%.bc: Output/%.ll $(LGCCAS)
|
2002-09-30 19:23:55 +00:00
|
|
|
$(LGCCAS) $(STATS) $< -o $@
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2002-02-12 15:39:38 +00:00
|
|
|
# LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from
|
|
|
|
# LLVM source, use the non-transforming assembler.
|
|
|
|
#
|
2003-09-11 18:04:30 +00:00
|
|
|
Output/%.bc: %.ll $(LAS) Output/.dir
|
2002-01-31 00:27:32 +00:00
|
|
|
$(LAS) -f $< -o $@
|
2002-01-23 21:36:59 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Testing versions of provided utilities...
|
|
|
|
#
|
2002-05-19 15:47:52 +00:00
|
|
|
Output/%.tll: %.c $(LCC1) Output/.dir $(INCLUDES)
|
2002-01-23 21:36:59 +00:00
|
|
|
@echo "======== Compiling $<"
|
2003-05-17 22:33:18 +00:00
|
|
|
$(LCC) $(CPPFLAGS) $(LCCFLAGS) -S $< -o $@ || \
|
2002-01-23 21:36:59 +00:00
|
|
|
( rm -f $@; $(FAILURE) $@ )
|
|
|
|
|
2003-05-13 20:06:00 +00:00
|
|
|
Output/%.tll: %.cpp $(LCC1XX) Output/.dir $(INCLUDES)
|
|
|
|
@echo "======== Compiling $<"
|
2003-05-17 22:33:18 +00:00
|
|
|
$(LCXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@ || \
|
2003-05-13 20:06:00 +00:00
|
|
|
( rm -f $@; $(FAILURE) $@ )
|
|
|
|
|
2002-01-23 21:36:59 +00:00
|
|
|
Output/%.tbc: Output/%.tll $(LAS)
|
|
|
|
@echo "======== Assembling $<"
|
|
|
|
$(LAS) -f $< -o $@ || \
|
|
|
|
( rm -f $@; $(FAILURE) $@ )
|
2001-11-06 17:09:49 +00:00
|
|
|
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2001-11-06 17:09:49 +00:00
|
|
|
## Cancel built-in implicit rules that override above rules
|
2001-11-05 00:18:30 +00:00
|
|
|
%: %.s
|
|
|
|
|
2001-11-06 17:09:49 +00:00
|
|
|
%: %.c
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
|