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