2004-04-24 00:10:56 +00:00
|
|
|
#===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
|
|
|
|
#
|
2003-10-21 14:33:46 +00:00
|
|
|
# The LLVM Compiler Infrastructure
|
|
|
|
#
|
|
|
|
# This file was developed by the LLVM research group and is distributed under
|
|
|
|
# the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
#
|
2004-04-24 00:10:56 +00:00
|
|
|
#===------------------------------------------------------------------------===#
|
2001-06-06 20:29:01 +00:00
|
|
|
#
|
2004-10-23 20:04:14 +00:00
|
|
|
# This file is included by all of the LLVM makefiles. For details on how to use
|
|
|
|
# it properly, please see the document MakefileGuide.html in the docs directory.
|
2003-08-15 03:02:52 +00:00
|
|
|
#
|
2002-07-09 12:04:21 +00:00
|
|
|
#===-----------------------------------------------------------------------====
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
################################################################################
|
2004-10-23 20:04:14 +00:00
|
|
|
# TARGETS: Define standard targets that can be invoked
|
2004-10-30 09:19:36 +00:00
|
|
|
################################################################################
|
2003-06-11 13:55:44 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Define the various target sets
|
|
|
|
#--------------------------------------------------------------------
|
2004-12-03 21:05:57 +00:00
|
|
|
RecursiveTargets := all clean clean-all install uninstall install-bytecode
|
2004-12-06 05:35:13 +00:00
|
|
|
LocalTargets := all-local clean-local clean-all-local check-local \
|
2004-12-03 20:08:48 +00:00
|
|
|
install-local printvars uninstall-local \
|
|
|
|
install-bytecode-local
|
2004-12-06 05:35:13 +00:00
|
|
|
TopLevelTargets := check dist dist-check dist-clean tags dist-gzip dist-bzip2 \
|
2004-10-30 09:19:36 +00:00
|
|
|
dist-zip
|
|
|
|
UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
|
|
|
|
InternalTargets := preconditions distdir dist-hook
|
2003-08-14 21:10:25 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
################################################################################
|
2004-10-26 22:26:33 +00:00
|
|
|
# INITIALIZATION: Basic things the makefile needs
|
2004-10-30 09:19:36 +00:00
|
|
|
################################################################################
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Set the VPATH so that we can find source files.
|
|
|
|
#--------------------------------------------------------------------
|
2005-01-16 02:20:54 +00:00
|
|
|
VPATH=$(PROJ_SRC_DIR)
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Reset the list of suffixes we know how to build
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
.SUFFIXES:
|
2005-02-04 21:28:50 +00:00
|
|
|
.SUFFIXES: .c .cpp .cc .h .hpp .y .l .lo .o .a .bc .td .ps .dot
|
2004-10-30 09:19:36 +00:00
|
|
|
.SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
|
2004-10-26 22:26:33 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Mark all of these targets as phony to avoid implicit rule search
|
|
|
|
#--------------------------------------------------------------------
|
2004-10-30 09:19:36 +00:00
|
|
|
.PHONY: $(UserTargets) $(InternalTargets)
|
2003-05-29 16:18:20 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-26 22:26:33 +00:00
|
|
|
# Make sure all the user-target rules are double colon rules and
|
|
|
|
# they are defined first.
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2003-05-29 16:18:20 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(UserTargets)::
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# PRECONDITIONS: that which must be built/checked first
|
|
|
|
################################################################################
|
|
|
|
|
2004-12-03 20:08:48 +00:00
|
|
|
SrcMakefiles := $(filter %Makefile %Makefile.tests,\
|
2005-01-16 02:20:54 +00:00
|
|
|
$(wildcard $(PROJ_SRC_DIR)/Makefile*))
|
|
|
|
ObjMakefiles := $(subst $(PROJ_SRC_DIR),$(PROJ_OBJ_DIR),$(SrcMakefiles))
|
|
|
|
ConfigureScript := $(PROJ_SRC_ROOT)/configure
|
|
|
|
ConfigStatusScript := $(PROJ_OBJ_ROOT)/config.status
|
|
|
|
MakefileConfigIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.config.in))
|
|
|
|
MakefileCommonIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.common.in))
|
|
|
|
MakefileConfig := $(PROJ_OBJ_ROOT)/Makefile.config
|
|
|
|
MakefileCommon := $(PROJ_OBJ_ROOT)/Makefile.common
|
|
|
|
PreConditions := $(ConfigStatusScript) $(ObjMakefiles)
|
|
|
|
ifneq ($(MakefileCommonIn),)
|
|
|
|
PreConditions += $(MakefileCommon)
|
|
|
|
endif
|
|
|
|
ifneq ($(MakefileConfigIn),)
|
|
|
|
PreConditions += $(MakefileConfig)
|
|
|
|
endif
|
2004-10-26 22:26:33 +00:00
|
|
|
|
2005-08-25 04:59:49 +00:00
|
|
|
preconditions: $(PreConditions)
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Make sure the BUILT_SOURCES are built first
|
|
|
|
#------------------------------------------------------------------------
|
2004-12-16 07:15:16 +00:00
|
|
|
$(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES)
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
clean-local::
|
|
|
|
ifneq ($(strip $(BUILT_SOURCES)),)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(BUILT_SOURCES)
|
2004-10-26 22:26:33 +00:00
|
|
|
endif
|
|
|
|
|
2005-01-16 02:20:54 +00:00
|
|
|
ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT))
|
2004-12-16 08:00:46 +00:00
|
|
|
spotless:
|
|
|
|
$(Verb) if test -x config.status ; then \
|
2005-01-16 02:20:54 +00:00
|
|
|
$(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \
|
2004-12-17 07:45:03 +00:00
|
|
|
$(MKDIR) .spotless.save ; \
|
|
|
|
$(MV) config.status .spotless.save ; \
|
|
|
|
$(MV) mklib .spotless.save ; \
|
|
|
|
$(MV) projects .spotless.save ; \
|
2004-12-16 08:00:46 +00:00
|
|
|
$(RM) -rf * ; \
|
2004-12-17 07:45:03 +00:00
|
|
|
$(MV) .spotless.save/config.status . ; \
|
|
|
|
$(MV) .spotless.save/mklib . ; \
|
|
|
|
$(MV) .spotless.save/projects . ; \
|
|
|
|
$(RM) -rf .spotless.save ; \
|
2005-01-16 02:20:54 +00:00
|
|
|
$(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \
|
2004-12-17 07:45:03 +00:00
|
|
|
$(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
|
|
|
|
$(ConfigStatusScript) ; \
|
2004-12-16 08:00:46 +00:00
|
|
|
else \
|
2005-01-16 02:20:54 +00:00
|
|
|
$(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \
|
2004-12-16 08:00:46 +00:00
|
|
|
fi
|
|
|
|
endif
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(BUILT_SOURCES) : $(ObjMakefiles)
|
2004-10-28 00:41:43 +00:00
|
|
|
|
2004-10-26 22:26:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Make sure we're not using a stale configuration
|
|
|
|
#------------------------------------------------------------------------
|
2004-12-16 18:26:53 +00:00
|
|
|
reconfigure:
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Echo) Reconfiguring $(PROJ_OBJ_ROOT)
|
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) && \
|
|
|
|
if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \
|
|
|
|
$(RM) $(PROJ_OBJ_ROOT)/config.cache ; \
|
2004-12-24 03:36:31 +00:00
|
|
|
fi ; \
|
2004-12-16 18:26:53 +00:00
|
|
|
$(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
|
|
|
|
$(ConfigStatusScript)
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
.PRECIOUS: $(ConfigStatusScript)
|
|
|
|
$(ConfigStatusScript): $(ConfigureScript)
|
|
|
|
$(Echo) Reconfiguring with $<
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) && \
|
|
|
|
if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \
|
|
|
|
$(RM) $(PROJ_OBJ_ROOT)/config.cache ; \
|
2004-12-24 03:36:31 +00:00
|
|
|
fi ; \
|
2004-11-29 12:37:44 +00:00
|
|
|
$(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
|
|
|
|
$(ConfigStatusScript)
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Make sure the configuration makefile is up to date
|
|
|
|
#------------------------------------------------------------------------
|
2005-01-16 02:20:54 +00:00
|
|
|
ifneq ($(MakefileConfigIn),)
|
|
|
|
$(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
|
|
|
|
$(Echo) Regenerating $@
|
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(MakefileCommonIn),)
|
|
|
|
$(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Regenerating $@
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common
|
|
|
|
endif
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# If the Makefile in the source tree has been updated, copy it over into the
|
|
|
|
# build tree. But, only do this if the source and object makefiles differ
|
|
|
|
#------------------------------------------------------------------------
|
2005-01-16 02:20:54 +00:00
|
|
|
ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
|
2004-10-26 22:26:33 +00:00
|
|
|
|
2005-01-16 02:20:54 +00:00
|
|
|
Makefile: $(PROJ_SRC_DIR)/Makefile
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Updating Makefile"
|
|
|
|
$(Verb) $(MKDIR) $(@D)
|
2004-12-16 18:26:53 +00:00
|
|
|
$(Verb) $(CP) -f $< $@
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
# Copy the Makefile.* files unless we're in the root directory which avoids
|
|
|
|
# the copying of Makefile.config.in or other things that should be explicitly
|
|
|
|
# taken care of.
|
2005-01-16 02:20:54 +00:00
|
|
|
$(PROJ_OBJ_DIR)/Makefile% : $(PROJ_SRC_DIR)/Makefile%
|
2004-10-26 23:10:00 +00:00
|
|
|
@case '$?' in \
|
|
|
|
*Makefile.rules) ;; \
|
|
|
|
*.in) ;; \
|
2004-10-30 09:19:36 +00:00
|
|
|
*) $(Echo) "Updating $(@F)" ; \
|
2004-10-26 23:10:00 +00:00
|
|
|
$(MKDIR) $(@D) ; \
|
2004-12-16 18:26:53 +00:00
|
|
|
$(CP) -f $< $@ ;; \
|
2004-10-26 23:10:00 +00:00
|
|
|
esac
|
|
|
|
|
2004-10-26 22:26:33 +00:00
|
|
|
endif
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-26 22:26:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Set up the basic dependencies
|
|
|
|
#------------------------------------------------------------------------
|
2004-10-30 09:19:36 +00:00
|
|
|
$(UserTargets):: $(PreConditions)
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
all:: all-local
|
2004-10-23 20:04:14 +00:00
|
|
|
clean:: clean-local
|
2004-11-02 16:36:03 +00:00
|
|
|
clean-all:: clean-local clean-all-local
|
2004-10-26 22:26:33 +00:00
|
|
|
install:: install-local
|
|
|
|
uninstall:: uninstall-local
|
|
|
|
install-local:: all-local
|
2004-12-03 20:08:48 +00:00
|
|
|
install-bytecode:: install-bytecode-local
|
2004-10-23 20:04:14 +00:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# VARIABLES: Set up various variables based on configuration data
|
|
|
|
###############################################################################
|
2003-06-30 21:59:07 +00:00
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-23 20:04:14 +00:00
|
|
|
# Variables derived from configuration we are building
|
2001-06-06 20:29:01 +00:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2005-01-02 17:43:20 +00:00
|
|
|
|
2003-03-14 20:25:22 +00:00
|
|
|
ifdef ENABLE_PROFILING
|
2004-11-01 07:50:27 +00:00
|
|
|
BuildMode := Profile
|
2004-12-08 04:34:51 +00:00
|
|
|
CXX.Flags := -O3 -DNDEBUG -felide-constructors -finline-functions -pg
|
2004-10-30 09:19:36 +00:00
|
|
|
C.Flags := -O3 -DNDEBUG -pg
|
|
|
|
LD.Flags := -O3 -DNDEBUG -pg
|
2003-03-14 20:25:22 +00:00
|
|
|
else
|
|
|
|
ifdef ENABLE_OPTIMIZED
|
2004-11-01 07:50:27 +00:00
|
|
|
BuildMode := Release
|
2005-01-02 17:43:20 +00:00
|
|
|
# Don't use -fomit-frame-pointer on FreeBSD
|
|
|
|
ifneq ($(OS),FreeBSD)
|
|
|
|
OmitFramePointer := -fomit-frame-pointer
|
|
|
|
endif
|
|
|
|
CXX.Flags := -O3 -DNDEBUG -finline-functions -felide-constructors \
|
|
|
|
$(OmitFramePointer)
|
|
|
|
C.Flags := -O3 -DNDEBUG $(OmitFramePointer)
|
2004-10-30 09:19:36 +00:00
|
|
|
LD.Flags := -O3 -DNDEBUG
|
2003-03-14 20:25:22 +00:00
|
|
|
else
|
2004-11-01 07:50:27 +00:00
|
|
|
BuildMode := Debug
|
2004-12-08 04:34:51 +00:00
|
|
|
CXX.Flags := -g -D_DEBUG
|
2004-10-30 09:19:36 +00:00
|
|
|
C.Flags := -g -D_DEBUG
|
|
|
|
LD.Flags := -g -D_DEBUG
|
2004-10-22 21:01:56 +00:00
|
|
|
KEEP_SYMBOLS := 1
|
2003-03-14 20:25:22 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2005-10-23 04:51:22 +00:00
|
|
|
CXX.Flags += $(CXXFLAGS)
|
2004-10-30 09:19:36 +00:00
|
|
|
C.Flags += $(CFLAGS)
|
|
|
|
CPP.Flags += $(CPPFLAGS)
|
|
|
|
LD.Flags += $(LDFLAGS)
|
|
|
|
AR.Flags := cru
|
|
|
|
LibTool.Flags := --tag=CXX
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2005-02-13 03:41:10 +00:00
|
|
|
#Make Floating point ieee complient on alpha
|
|
|
|
ifeq ($(ARCH),Alpha)
|
|
|
|
CXX.Flags += -mieee
|
|
|
|
CPP.Flags += -mieee
|
|
|
|
endif
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
# Directory locations
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2005-01-16 02:20:54 +00:00
|
|
|
ObjDir := $(PROJ_OBJ_DIR)/$(BuildMode)
|
|
|
|
LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
|
|
|
|
ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
|
|
|
|
ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
|
2004-11-18 10:03:46 +00:00
|
|
|
LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
|
2004-11-18 20:04:39 +00:00
|
|
|
LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
|
2004-12-28 07:59:22 +00:00
|
|
|
LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
|
2004-12-22 05:57:21 +00:00
|
|
|
CFERuntimeLibDir := $(LLVMGCCDIR)/lib
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
# Full Paths To Compiled Tools and Utilities
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2005-01-14 16:33:36 +00:00
|
|
|
EchoCmd = $(ECHO) llvm[$(MAKELEVEL)]:
|
|
|
|
Echo = @$(EchoCmd)
|
2004-10-30 09:19:36 +00:00
|
|
|
ifndef LIBTOOL
|
2004-10-22 21:01:56 +00:00
|
|
|
LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
|
2004-10-30 09:19:36 +00:00
|
|
|
endif
|
|
|
|
ifndef LLVMAS
|
|
|
|
LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
|
|
|
|
endif
|
|
|
|
ifndef BURG
|
|
|
|
BURG := $(LLVMToolDir)/burg$(EXEEXT)
|
|
|
|
endif
|
|
|
|
ifndef TBLGEN
|
|
|
|
TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
|
|
|
|
endif
|
2004-11-29 19:47:58 +00:00
|
|
|
ifndef GCCAS
|
|
|
|
GCCAS := $(LLVMToolDir)/gccas$(EXEEXT)
|
|
|
|
endif
|
2004-10-30 09:19:36 +00:00
|
|
|
ifndef GCCLD
|
|
|
|
GCCLD := $(LLVMToolDir)/gccld$(EXEEXT)
|
|
|
|
endif
|
2004-12-13 17:44:14 +00:00
|
|
|
ifndef LDIS
|
|
|
|
LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
|
|
|
|
endif
|
|
|
|
ifndef LLI
|
|
|
|
LLI := $(LLVMToolDir)/lli$(EXEEXT)
|
|
|
|
endif
|
2005-02-27 10:21:37 +00:00
|
|
|
ifndef LLC
|
|
|
|
LLC := $(LLVMToolDir)/llc$(EXEEXT)
|
|
|
|
endif
|
2004-12-13 17:44:14 +00:00
|
|
|
ifndef LOPT
|
2004-12-13 18:08:29 +00:00
|
|
|
LOPT := $(LLVMToolDir)/opt$(EXEEXT)
|
2004-12-13 17:44:14 +00:00
|
|
|
endif
|
2005-02-02 00:40:15 +00:00
|
|
|
ifndef LBUGPOINT
|
|
|
|
LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
|
|
|
|
endif
|
|
|
|
|
2005-01-03 17:42:57 +00:00
|
|
|
LLVMGCCWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC)
|
|
|
|
LLVMGXXWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX)
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
# Adjust to user's request
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2003-06-11 13:55:44 +00:00
|
|
|
|
2005-01-11 04:31:07 +00:00
|
|
|
# Adjust LD.Flags and Libtool.Flags depending on the kind of library that is
|
|
|
|
# to be built. Note that if LOADABLE_MODULE is specified then the resulting
|
|
|
|
# shared library can be opened with dlopen
|
|
|
|
ifdef SHARED_LIBRARY
|
2004-10-30 09:19:36 +00:00
|
|
|
LD.Flags += -rpath $(LibDir)
|
2005-01-11 04:31:07 +00:00
|
|
|
ifdef LOADABLE_MODULE
|
|
|
|
LD.Flags += -module
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
LibTool.Flags += --tag=disable-shared
|
2003-07-31 20:58:51 +00:00
|
|
|
endif
|
|
|
|
|
2004-11-08 17:32:12 +00:00
|
|
|
ifdef TOOL_VERBOSE
|
|
|
|
C.Flags += -v
|
|
|
|
CXX.Flags += -v
|
|
|
|
LD.Flags += -v
|
|
|
|
VERBOSE := 1
|
|
|
|
endif
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
# Adjust settings for verbose mode
|
2003-03-14 20:25:22 +00:00
|
|
|
ifndef VERBOSE
|
2004-10-30 09:19:36 +00:00
|
|
|
Verb := @
|
|
|
|
LibTool.Flags += --silent
|
|
|
|
AR.Flags += >/dev/null 2>/dev/null
|
2005-01-16 02:20:54 +00:00
|
|
|
ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
|
2004-10-25 08:27:37 +00:00
|
|
|
else
|
2004-10-30 09:19:36 +00:00
|
|
|
ConfigureScriptFLAGS :=
|
2002-09-12 16:05:39 +00:00
|
|
|
endif
|
|
|
|
|
2002-09-18 11:55:13 +00:00
|
|
|
# By default, strip symbol information from executable
|
2003-03-14 20:25:22 +00:00
|
|
|
ifndef KEEP_SYMBOLS
|
2004-10-30 09:19:36 +00:00
|
|
|
Strip := $(PLATFORMSTRIPOPTS)
|
|
|
|
StripWarnMsg := "(without symbols)"
|
2005-02-24 07:12:43 +00:00
|
|
|
Install.StripFlag += -s
|
2002-09-18 11:55:13 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
# Adjust linker flags for building an executable
|
2004-10-22 21:01:56 +00:00
|
|
|
ifdef TOOLNAME
|
2004-11-18 10:03:46 +00:00
|
|
|
ifdef EXAMPLE_TOOL
|
|
|
|
LD.Flags += -rpath $(ExmplDir) -export-dynamic
|
|
|
|
else
|
2004-10-30 09:19:36 +00:00
|
|
|
LD.Flags += -rpath $(ToolDir) -export-dynamic
|
2003-10-29 14:28:35 +00:00
|
|
|
endif
|
2004-11-18 10:03:46 +00:00
|
|
|
endif
|
2003-10-29 14:28:35 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#----------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
# Options To Invoke Tools
|
2004-10-23 20:04:14 +00:00
|
|
|
#----------------------------------------------------------
|
2003-06-30 21:59:07 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2005-05-16 06:38:09 +00:00
|
|
|
ifeq ($(OS),HP-UX)
|
|
|
|
CompileCommonOpts += -D_REENTRANT -D_HPUX_SOURCE
|
|
|
|
endif
|
|
|
|
|
2005-02-14 21:54:08 +00:00
|
|
|
LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
|
2005-01-16 02:20:54 +00:00
|
|
|
CPP.Flags += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
|
|
|
|
-I$(PROJ_OBJ_ROOT)/include \
|
|
|
|
-I$(PROJ_SRC_ROOT)/include \
|
|
|
|
-I$(LLVM_OBJ_ROOT)/include \
|
|
|
|
-I$(LLVM_SRC_ROOT)/include \
|
|
|
|
-D_GNU_SOURCE -D__STDC_LIMIT_MACROS
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
|
|
|
|
LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
|
2004-12-22 05:57:21 +00:00
|
|
|
BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
|
|
|
|
$(C.Flags) -c
|
2005-10-05 00:28:41 +00:00
|
|
|
Preprocess.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -E $(C.Flags)
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
|
|
|
|
LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
|
2004-12-24 14:47:34 +00:00
|
|
|
BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
|
|
|
|
$(CXX.Flags) -c
|
2005-10-05 00:28:41 +00:00
|
|
|
Preprocess.CXX= $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -E
|
2004-10-30 09:19:36 +00:00
|
|
|
Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
|
|
|
|
$(CompileCommonOpts) $(LD.Flags) $(Strip)
|
|
|
|
Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
|
2004-10-28 09:15:28 +00:00
|
|
|
$(CompileCommonOpts)
|
2005-02-16 16:13:02 +00:00
|
|
|
LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \
|
|
|
|
$(Install.Flags)
|
2005-02-24 07:12:43 +00:00
|
|
|
ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
|
|
|
|
DataInstall = $(INSTALL) -m 0644
|
2005-01-16 02:20:54 +00:00
|
|
|
Burg = $(BURG) -I $(PROJ_SRC_DIR)
|
|
|
|
TableGen = $(TBLGEN) -I $(PROJ_SRC_DIR)
|
2004-10-30 09:19:36 +00:00
|
|
|
Archive = $(AR) $(AR.Flags)
|
2004-12-02 09:28:21 +00:00
|
|
|
LArchive = $(LLVMToolDir)/llvm-ar rcsf
|
2004-10-22 21:01:56 +00:00
|
|
|
ifdef RANLIB
|
2004-10-23 20:04:14 +00:00
|
|
|
Ranlib = $(RANLIB)
|
2004-10-22 21:01:56 +00:00
|
|
|
else
|
2004-10-23 20:04:14 +00:00
|
|
|
Ranlib = ranlib
|
2004-10-22 21:01:56 +00:00
|
|
|
endif
|
2001-06-06 20:29:01 +00:00
|
|
|
|
|
|
|
#----------------------------------------------------------
|
2004-12-04 22:34:09 +00:00
|
|
|
# Get the list of source files and compute object file
|
|
|
|
# names from them.
|
2004-10-23 20:04:14 +00:00
|
|
|
#----------------------------------------------------------
|
2004-12-04 22:34:09 +00:00
|
|
|
ifdef FAKE_SOURCES
|
|
|
|
Sources :=
|
|
|
|
FakeSources := $(FAKE_SOURCES)
|
|
|
|
ifdef BUILT_SOURCES
|
|
|
|
FakeSources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
|
|
|
|
endif
|
|
|
|
BaseNameSources := $(sort $(basename $(FakeSources)))
|
|
|
|
ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
|
|
|
|
ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
|
|
|
|
ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
|
2004-10-30 09:19:36 +00:00
|
|
|
else
|
2004-12-04 22:34:09 +00:00
|
|
|
ifndef SOURCES
|
2005-01-16 02:20:54 +00:00
|
|
|
Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
|
|
|
|
$(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c $(PROJ_SRC_DIR)/*.y \
|
|
|
|
$(PROJ_SRC_DIR)/*.l))
|
2004-12-04 22:34:09 +00:00
|
|
|
else
|
|
|
|
Sources := $(SOURCES)
|
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-12-04 22:34:09 +00:00
|
|
|
ifdef BUILT_SOURCES
|
|
|
|
Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
|
|
|
|
endif
|
2001-07-15 13:16:47 +00:00
|
|
|
|
2004-12-04 22:34:09 +00:00
|
|
|
BaseNameSources := $(sort $(basename $(Sources)))
|
|
|
|
ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
|
|
|
|
ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
|
|
|
|
ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
|
|
|
|
endif
|
2004-10-23 20:04:14 +00:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# DIRECTORIES: Handle recursive descent of directory structure
|
|
|
|
###############################################################################
|
2003-07-31 20:58:51 +00:00
|
|
|
|
2004-10-28 09:15:28 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide rules to make install dirs. This must be early
|
|
|
|
# in the file so they get built before dependencies
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
2005-05-19 20:26:14 +00:00
|
|
|
$(PROJ_bindir): $(PROJ_bindir)/.dir
|
|
|
|
$(PROJ_libdir): $(PROJ_libdir)/.dir
|
|
|
|
$(PROJ_includedir): $(PROJ_includedir)/.dir
|
|
|
|
$(PROJ_etcdir): $(PROJ_etcdir)/.dir
|
2004-10-28 09:15:28 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
# To create other directories, as needed, and timestamp their creation
|
|
|
|
%/.dir:
|
|
|
|
$(Verb) $(MKDIR) $* > /dev/null
|
2004-11-29 05:00:33 +00:00
|
|
|
$(Verb) $(DATE) > $@
|
2004-10-30 09:19:36 +00:00
|
|
|
|
2004-11-18 10:03:46 +00:00
|
|
|
.PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
|
|
|
|
.PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
|
2004-10-28 09:15:28 +00:00
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
#---------------------------------------------------------
|
2004-10-23 20:04:14 +00:00
|
|
|
# Handle the DIRS options for sequential construction
|
2001-06-06 20:29:01 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
SubDirs :=
|
2002-09-18 04:29:30 +00:00
|
|
|
ifdef DIRS
|
2004-10-30 09:19:36 +00:00
|
|
|
SubDirs += $(DIRS)
|
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(DIRS); do \
|
2004-10-22 21:01:56 +00:00
|
|
|
if [ ! -f $$dir/Makefile ]; then \
|
|
|
|
$(MKDIR) $$dir; \
|
2005-01-16 02:20:54 +00:00
|
|
|
$(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
|
2004-10-22 21:01:56 +00:00
|
|
|
fi; \
|
2004-12-08 22:58:34 +00:00
|
|
|
if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
|
|
|
|
($(MAKE) -C $$dir $@ ) || exit 1; \
|
|
|
|
fi ; \
|
2002-09-17 23:35:02 +00:00
|
|
|
done
|
2002-09-18 04:29:30 +00:00
|
|
|
endif
|
2002-09-18 03:22:27 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle the EXPERIMENTAL_DIRS options ensuring success
|
|
|
|
# after each directory is built.
|
|
|
|
#---------------------------------------------------------
|
|
|
|
ifdef EXPERIMENTAL_DIRS
|
2004-10-30 09:19:36 +00:00
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
|
2004-10-23 20:04:14 +00:00
|
|
|
if [ ! -f $$dir/Makefile ]; then \
|
|
|
|
$(MKDIR) $$dir; \
|
2005-01-16 02:20:54 +00:00
|
|
|
$(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
|
2004-10-23 20:04:14 +00:00
|
|
|
fi; \
|
2004-12-08 22:58:34 +00:00
|
|
|
if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
|
|
|
|
($(MAKE) -C $$dir $@ ) || exit 0; \
|
|
|
|
fi ; \
|
2004-10-23 20:04:14 +00:00
|
|
|
done
|
|
|
|
endif
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle the PARALLEL_DIRS options for parallel construction
|
|
|
|
#---------------------------------------------------------
|
2002-09-18 03:22:27 +00:00
|
|
|
ifdef PARALLEL_DIRS
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
SubDirs += $(PARALLEL_DIRS)
|
|
|
|
|
2004-12-03 20:08:48 +00:00
|
|
|
# Unfortunately, this list must be maintained if new recursive targets are added
|
2004-10-30 09:19:36 +00:00
|
|
|
all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
|
|
|
|
clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
|
2004-11-02 16:56:15 +00:00
|
|
|
clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
|
2004-10-30 09:19:36 +00:00
|
|
|
install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
|
2004-10-23 20:04:14 +00:00
|
|
|
uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
|
2004-12-03 20:08:48 +00:00
|
|
|
install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
|
2002-09-18 03:22:27 +00:00
|
|
|
|
2004-12-04 22:34:09 +00:00
|
|
|
ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2004-12-04 22:34:09 +00:00
|
|
|
$(ParallelTargets) :
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) if [ ! -f $(@D)/Makefile ]; then \
|
2004-10-22 21:01:56 +00:00
|
|
|
$(MKDIR) $(@D); \
|
2005-01-16 02:20:54 +00:00
|
|
|
$(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
|
2003-11-25 19:32:22 +00:00
|
|
|
fi; \
|
2004-12-08 22:58:34 +00:00
|
|
|
if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
|
|
|
|
$(MAKE) -C $(@D) $(subst $(@D)/.make,,$@) ; \
|
|
|
|
fi
|
2001-06-06 20:29:01 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle the OPTIONAL_DIRS options for directores that may
|
|
|
|
# or may not exist.
|
|
|
|
#---------------------------------------------------------
|
2003-06-27 16:58:44 +00:00
|
|
|
ifdef OPTIONAL_DIRS
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
SubDirs += $(OPTIONAL_DIRS)
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(OPTIONAL_DIRS); do \
|
2005-01-16 02:20:54 +00:00
|
|
|
if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
|
2004-10-22 21:01:56 +00:00
|
|
|
if [ ! -f $$dir/Makefile ]; then \
|
|
|
|
$(MKDIR) $$dir; \
|
2005-01-16 02:20:54 +00:00
|
|
|
$(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
|
2004-10-22 21:01:56 +00:00
|
|
|
fi; \
|
2004-12-08 22:58:34 +00:00
|
|
|
if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
|
|
|
|
($(MAKE) -C$$dir $@ ) || exit 1; \
|
|
|
|
fi ; \
|
2004-10-22 21:01:56 +00:00
|
|
|
fi \
|
2003-06-27 16:58:44 +00:00
|
|
|
done
|
|
|
|
endif
|
|
|
|
|
2004-08-20 09:20:05 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle the CONFIG_FILES options
|
|
|
|
#---------------------------------------------------------
|
|
|
|
ifdef CONFIG_FILES
|
|
|
|
|
2005-01-16 02:20:54 +00:00
|
|
|
install-local:: $(PROJ_etcdir) $(CONFIG_FILES)
|
|
|
|
$(Echo) Installing Configuration Files To $(PROJ_etcdir)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb)for file in $(CONFIG_FILES); do \
|
2005-01-16 02:20:54 +00:00
|
|
|
if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
|
2005-02-24 03:56:32 +00:00
|
|
|
$(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \
|
2005-01-16 02:20:54 +00:00
|
|
|
elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
|
2005-02-24 03:56:32 +00:00
|
|
|
$(DataInstall) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \
|
2004-11-23 05:59:53 +00:00
|
|
|
else \
|
|
|
|
$(ECHO) Error: cannot find config file $${file}. ; \
|
|
|
|
fi \
|
2004-08-20 09:20:05 +00:00
|
|
|
done
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
uninstall-local::
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Echo) Uninstalling Configuration Files From $(PROJ_etcdir)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb)for file in $(CONFIG_FILES); do \
|
2005-01-16 02:20:54 +00:00
|
|
|
$(RM) -f $(PROJ_etcdir)/$${file} ; \
|
2004-10-24 07:53:21 +00:00
|
|
|
done
|
|
|
|
|
2004-08-20 09:20:05 +00:00
|
|
|
endif
|
|
|
|
|
2005-05-19 00:37:31 +00:00
|
|
|
###############################################################################
|
|
|
|
# Set up variables for building libararies
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle the special "JIT" value for LLVM_LIBS which is a
|
|
|
|
# shorthand for a bunch of libraries that get the correct
|
|
|
|
# JIT support for a library or a tool that runs JIT.
|
|
|
|
#---------------------------------------------------------
|
|
|
|
ifeq ($(LLVMLIBS),JIT)
|
|
|
|
|
|
|
|
# Make sure we can get our own symbols in the tool
|
|
|
|
Link += -dlopen self
|
|
|
|
|
|
|
|
# Generic JIT libraries
|
|
|
|
JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
|
|
|
|
|
|
|
|
# You can enable the X86 JIT on a non-X86 host by setting the flag
|
|
|
|
# ENABLE_X86_JIT on the make command line. If not, it will still be
|
|
|
|
# enabled automagically on an X86 host.
|
|
|
|
ifeq ($(ARCH), x86)
|
|
|
|
ENABLE_X86_JIT = 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
# What the X86 JIT requires
|
|
|
|
ifdef ENABLE_X86_JIT
|
|
|
|
JIT_LIBS += LLVMX86 LLVMSelectionDAG
|
|
|
|
endif
|
|
|
|
|
|
|
|
# You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
|
|
|
|
# ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
|
|
|
|
# enabled automagically on an SparcV9 host.
|
|
|
|
ifeq ($(ARCH), Sparc)
|
|
|
|
ENABLE_SPARCV9_JIT = 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
# What the Sparc JIT requires
|
|
|
|
ifdef ENABLE_SPARCV9_JIT
|
|
|
|
JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
|
|
|
|
LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
|
|
|
|
LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
|
|
|
|
LLVMDataStructure.a LLVMSparcV9RegAlloc
|
|
|
|
endif
|
|
|
|
|
|
|
|
# You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
|
|
|
|
# ENABLE_PPC_JIT on the make command line. If not, it will still be
|
|
|
|
# enabled automagically on an PowerPC host.
|
|
|
|
ifeq ($(ARCH), PowerPC)
|
|
|
|
ENABLE_PPC_JIT = 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
# What the PowerPC JIT requires
|
|
|
|
ifdef ENABLE_PPC_JIT
|
|
|
|
JIT_LIBS += LLVMPowerPC LLVMSelectionDAG
|
|
|
|
endif
|
|
|
|
|
2005-07-22 20:54:01 +00:00
|
|
|
# You can enable the Alpha JIT on a non-Alpha host by setting the flag
|
|
|
|
# ENABLE_ALPHA_JIT on the make command line. If not, it will still be
|
2005-07-22 22:43:40 +00:00
|
|
|
# enabled automagically on an Alpha host.
|
2005-07-22 20:54:01 +00:00
|
|
|
ifeq ($(ARCH), Alpha)
|
|
|
|
ENABLE_ALPHA_JIT = 1
|
|
|
|
endif
|
|
|
|
|
2005-07-22 22:00:24 +00:00
|
|
|
# What the Alpha JIT requires
|
2005-07-22 20:54:01 +00:00
|
|
|
ifdef ENABLE_ALPHA_JIT
|
|
|
|
JIT_LIBS += LLVMAlpha LLVMSelectionDAG
|
|
|
|
endif
|
|
|
|
|
2005-10-24 01:15:14 +00:00
|
|
|
LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts.a LLVMAnalysis.a LLVMTransformUtils.a \
|
2005-05-19 00:37:31 +00:00
|
|
|
LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
|
|
|
|
LLVMSystem.a $(PLATFORMLIBDL)
|
|
|
|
endif
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Define various command line options pertaining to the
|
|
|
|
# libraries needed when linking. There are "Proj" libs
|
|
|
|
# (defined by the user's project) and "LLVM" libs (defined
|
|
|
|
# by the # LLVM project).
|
|
|
|
#---------------------------------------------------------
|
2005-08-17 02:38:56 +00:00
|
|
|
# Some versions of gcc on Alpha produce too many symbols, so use a .a file
|
2005-08-13 05:09:50 +00:00
|
|
|
ifeq ($(ARCH),Alpha)
|
|
|
|
USEDLIBS := $(subst LLVMCore, LLVMCore.a, $(USEDLIBS))
|
|
|
|
LLVMLIBS := $(subst LLVMCore, LLVMCore.a, $(LLVMLIBS))
|
|
|
|
endif
|
|
|
|
|
2005-05-19 00:37:31 +00:00
|
|
|
ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
|
|
|
|
ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
|
|
|
|
LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
|
|
|
|
LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
|
|
|
|
ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
|
|
|
|
LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
|
|
|
|
ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
|
|
|
|
LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
###############################################################################
|
|
|
|
# Library Build Rules: Four ways to build a library
|
|
|
|
###############################################################################
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-12-05 05:17:22 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Bytecode Module Targets:
|
|
|
|
# If the user set MODULE_NAME then they want to build a
|
|
|
|
# bytecode module from the sources. We compile all the
|
|
|
|
# sources and link it together into a single bytecode
|
|
|
|
# module.
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
|
|
|
ifdef MODULE_NAME
|
2005-02-14 21:54:08 +00:00
|
|
|
ifeq ($(strip $(LLVMGCC)),)
|
2005-05-13 18:32:54 +00:00
|
|
|
$(warning Modules require llvm-gcc but no llvm-gcc is available ****)
|
2005-02-14 21:54:08 +00:00
|
|
|
else
|
2004-12-05 05:17:22 +00:00
|
|
|
|
|
|
|
Module := $(LibDir)/$(MODULE_NAME).bc
|
2004-12-22 05:57:21 +00:00
|
|
|
LinkModule := $(LLVMGCCWITHPATH) -shared -nostdlib
|
2004-12-05 05:17:22 +00:00
|
|
|
|
|
|
|
ifdef EXPORTED_SYMBOL_FILE
|
2005-01-28 19:52:32 +00:00
|
|
|
LinkModule += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
|
2004-12-05 05:17:22 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
$(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
|
2005-05-13 18:32:54 +00:00
|
|
|
$(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
|
2004-12-05 05:17:22 +00:00
|
|
|
$(Verb) $(LinkModule) -o $@ $(ObjectsBC)
|
|
|
|
|
|
|
|
all-local:: $(Module)
|
|
|
|
|
|
|
|
clean-local::
|
|
|
|
ifneq ($(strip $(Module)),)
|
|
|
|
-$(Verb) $(RM) -f $(Module)
|
|
|
|
endif
|
|
|
|
|
2004-12-13 07:38:07 +00:00
|
|
|
ifdef BYTECODE_DESTINATION
|
|
|
|
ModuleDestDir := $(BYTECODE_DESTINATION)
|
|
|
|
else
|
2005-01-16 02:20:54 +00:00
|
|
|
ModuleDestDir := $(PROJ_libdir)
|
2004-12-13 07:38:07 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
|
2004-12-05 05:17:22 +00:00
|
|
|
|
2004-12-13 07:38:07 +00:00
|
|
|
install-module:: $(DestModule)
|
2004-12-05 05:17:22 +00:00
|
|
|
install-local:: $(DestModule)
|
|
|
|
|
2004-12-13 07:38:07 +00:00
|
|
|
$(DestModule): $(ModuleDestDir) $(Module)
|
2004-12-05 05:17:22 +00:00
|
|
|
$(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
|
2005-02-24 21:30:37 +00:00
|
|
|
$(Verb) $(DataInstall) $(Module) $(DestModule)
|
2004-12-05 05:17:22 +00:00
|
|
|
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
|
|
|
|
-$(Verb) $(RM) -f $(DestModule)
|
|
|
|
|
|
|
|
endif
|
2005-02-14 21:54:08 +00:00
|
|
|
endif
|
2004-01-22 22:53:48 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
# if we're building a library ...
|
2001-06-06 20:29:01 +00:00
|
|
|
ifdef LIBRARYNAME
|
2001-07-15 13:16:47 +00:00
|
|
|
|
2002-09-16 22:36:42 +00:00
|
|
|
# Make sure there isn't any extranous whitespace on the LIBRARYNAME option
|
2002-09-16 22:34:56 +00:00
|
|
|
LIBRARYNAME := $(strip $(LIBRARYNAME))
|
2005-01-11 04:31:07 +00:00
|
|
|
ifdef LOADABLE_MODULE
|
|
|
|
LibName.LA := $(LibDir)/$(LIBRARYNAME).la
|
|
|
|
else
|
2004-10-30 09:19:36 +00:00
|
|
|
LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
|
2005-01-11 04:31:07 +00:00
|
|
|
endif
|
2004-10-30 09:19:36 +00:00
|
|
|
LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
|
|
|
|
LibName.O := $(LibDir)/$(LIBRARYNAME).o
|
2004-12-02 09:28:21 +00:00
|
|
|
LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
|
2002-09-16 22:34:56 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Shared Library Targets:
|
|
|
|
# If the user asked for a shared library to be built
|
|
|
|
# with the SHARED_LIBRARY variable, then we provide
|
|
|
|
# targets for building them.
|
|
|
|
#---------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
ifdef SHARED_LIBRARY
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
all-local:: $(LibName.LA)
|
2002-08-02 18:34:12 +00:00
|
|
|
|
2005-05-19 00:37:31 +00:00
|
|
|
ifdef LINK_LIBS_IN_SHARED
|
|
|
|
$(LibName.LA): $(ObjectsLO) $(LibDir)/.dir
|
|
|
|
$(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
|
|
|
|
$(Verb) $(Link) -o $@ $(ObjectsLO) \
|
|
|
|
$(ProjLibsOptions) $(LLVMLibsOptions)
|
|
|
|
$(Verb) $(LTInstall) $@ $(LibDir)
|
|
|
|
else
|
2004-12-16 07:36:08 +00:00
|
|
|
$(LibName.LA): $(ObjectsLO) $(LibDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(Link) -o $@ $(ObjectsLO)
|
|
|
|
$(Verb) $(LTInstall) $@ $(LibDir)
|
2005-05-19 00:37:31 +00:00
|
|
|
endif
|
2004-10-23 20:04:14 +00:00
|
|
|
|
|
|
|
clean-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
ifneq ($(strip $(LibName.LA)),)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(LibName.LA)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
|
|
|
|
2005-01-16 02:20:54 +00:00
|
|
|
DestSharedLib = $(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
install-local:: $(DestSharedLib)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2005-01-16 02:20:54 +00:00
|
|
|
$(DestSharedLib): $(PROJ_libdir) $(LibName.LA)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Verb) $(LIBTOOL) --finish $(PROJ_libdir)
|
2002-07-23 17:56:16 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
uninstall-local::
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
|
2005-01-16 02:20:54 +00:00
|
|
|
-$(Verb) $(RM) -f $(PROJ_libdir)/lib$(LIBRARYNAME).*
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2002-07-23 17:56:16 +00:00
|
|
|
endif
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Bytecode Library Targets:
|
|
|
|
# If the user asked for a bytecode library to be built
|
|
|
|
# with the BYTECODE_LIBRARY variable, then we provide
|
|
|
|
# targets for building them.
|
|
|
|
#---------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
ifdef BYTECODE_LIBRARY
|
2005-02-14 21:54:08 +00:00
|
|
|
ifeq ($(strip $(LLVMGCC)),)
|
2005-05-13 18:32:54 +00:00
|
|
|
$(warning Bytecode libraries require llvm-gcc which could not be found ****)
|
2005-02-14 21:54:08 +00:00
|
|
|
else
|
2003-06-30 21:59:07 +00:00
|
|
|
|
2004-12-03 06:04:35 +00:00
|
|
|
# make the C and C++ compilers strip debug info out of bytecode libraries.
|
|
|
|
BCCompile.C += -Wa,-strip-debug
|
|
|
|
BCCompile.CXX += -Wa,-strip-debug
|
|
|
|
|
2004-12-02 09:28:21 +00:00
|
|
|
all-local:: $(LibName.BCA)
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-12-02 09:28:21 +00:00
|
|
|
ifdef EXPORTED_SYMBOL_FILE
|
2004-12-22 05:57:21 +00:00
|
|
|
BCLinkLib = $(LLVMGCCWITHPATH) -shared -nostdlib -Xlinker \
|
2004-12-02 09:28:21 +00:00
|
|
|
-internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-12-16 07:36:08 +00:00
|
|
|
$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(GCCLD) \
|
2004-12-15 17:14:06 +00:00
|
|
|
$(LLVMToolDir)/llvm-ar
|
2004-12-02 09:28:21 +00:00
|
|
|
$(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
|
|
|
|
"(internalize)"
|
2004-12-02 21:23:43 +00:00
|
|
|
$(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
|
2004-12-13 03:59:35 +00:00
|
|
|
$(Verb) $(RM) -f $@
|
2004-12-02 09:28:21 +00:00
|
|
|
$(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
|
|
|
|
else
|
2004-12-16 07:36:08 +00:00
|
|
|
$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
|
2004-12-15 17:14:06 +00:00
|
|
|
$(LLVMToolDir)/llvm-ar
|
2004-12-02 09:28:21 +00:00
|
|
|
$(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
|
2004-12-13 03:59:35 +00:00
|
|
|
$(Verb) $(RM) -f $@
|
2004-12-02 09:28:21 +00:00
|
|
|
$(Verb) $(LArchive) $@ $(ObjectsBC)
|
|
|
|
|
|
|
|
endif
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2004-12-02 09:28:21 +00:00
|
|
|
ifneq ($(strip $(LibName.BCA)),)
|
|
|
|
-$(Verb) $(RM) -f $(LibName.BCA)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
|
|
|
|
2004-12-13 07:28:21 +00:00
|
|
|
ifdef BYTECODE_DESTINATION
|
|
|
|
BytecodeDestDir := $(BYTECODE_DESTINATION)
|
|
|
|
else
|
2005-01-16 02:20:54 +00:00
|
|
|
BytecodeDestDir := $(PROJ_libdir)
|
2004-12-13 07:28:21 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).a
|
2004-12-02 09:28:21 +00:00
|
|
|
|
2004-12-03 20:08:48 +00:00
|
|
|
install-bytecode-local:: $(DestBytecodeLib)
|
2004-10-26 07:09:33 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
install-local:: $(DestBytecodeLib)
|
2002-09-20 14:03:13 +00:00
|
|
|
|
2004-12-13 07:28:21 +00:00
|
|
|
$(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA)
|
2004-12-02 09:28:21 +00:00
|
|
|
$(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
|
2005-02-24 21:36:32 +00:00
|
|
|
$(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
uninstall-local::
|
2004-12-02 09:28:21 +00:00
|
|
|
$(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(DestBytecodeLib)
|
2003-12-18 20:57:48 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
endif
|
2005-02-14 21:54:08 +00:00
|
|
|
endif
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# ReLinked Library Targets:
|
|
|
|
# If the user didn't explicitly forbid building a
|
|
|
|
# relinked then we provide targets for building them.
|
|
|
|
#---------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
ifndef DONT_BUILD_RELINKED
|
2002-07-23 17:56:16 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
all-local:: $(LibName.O)
|
|
|
|
|
2004-12-16 07:36:08 +00:00
|
|
|
$(LibName.O): $(ObjectsO) $(LibDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Linking $(BuildMode) Object Library $(notdir $@)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(Relink) -o $@ $(ObjectsO)
|
2002-09-20 14:03:13 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
ifneq ($(strip $(LibName.O)),)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(LibName.O)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
|
|
|
|
2005-01-16 02:20:54 +00:00
|
|
|
DestRelinkedLib = $(PROJ_libdir)/$(LIBRARYNAME).o
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
install-local:: $(DestRelinkedLib)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2005-01-16 02:20:54 +00:00
|
|
|
$(DestRelinkedLib): $(PROJ_libdir) $(LibName.O)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
uninstall-local::
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(DestRelinkedLib)
|
2004-10-22 21:01:56 +00:00
|
|
|
|
|
|
|
endif
|
2003-12-18 20:57:48 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Archive Library Targets:
|
|
|
|
# If the user wanted a regular archive library built,
|
|
|
|
# then we provide targets for building them.
|
|
|
|
#---------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
ifdef BUILD_ARCHIVE
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
all-local:: $(LibName.A)
|
|
|
|
|
2004-12-16 07:36:08 +00:00
|
|
|
$(LibName.A): $(ObjectsO) $(LibDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Building $(BuildMode) Archive Library $(notdir $@)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $@
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(Archive) $@ $(ObjectsO)
|
|
|
|
$(Verb) $(Ranlib) $@
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
ifneq ($(strip $(LibName.A)),)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(LibName.A)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
|
|
|
|
2005-01-16 02:20:54 +00:00
|
|
|
DestArchiveLib := $(PROJ_libdir)/lib$(LIBRARYNAME).a
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
install-local:: $(DestArchiveLib)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2005-01-16 02:20:54 +00:00
|
|
|
$(DestArchiveLib): $(PROJ_libdir) $(LibName.A)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Verb) $(MKDIR) $(PROJ_libdir)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
uninstall-local::
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(DestArchiveLib)
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-24 07:53:21 +00:00
|
|
|
# endif LIBRARYNAME
|
2004-10-22 21:01:56 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-24 08:21:04 +00:00
|
|
|
###############################################################################
|
|
|
|
# Tool Build Rules: Build executable tool based on TOOLNAME option
|
|
|
|
###############################################################################
|
|
|
|
|
2001-09-07 22:57:58 +00:00
|
|
|
ifdef TOOLNAME
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Set up variables for building a tool.
|
|
|
|
#---------------------------------------------------------
|
2004-11-18 10:03:46 +00:00
|
|
|
ifdef EXAMPLE_TOOL
|
2005-05-19 21:03:11 +00:00
|
|
|
ToolBuildPath := $(ExmplDir)/$(strip $(TOOLNAME))$(EXEEXT)
|
2004-11-18 10:03:46 +00:00
|
|
|
else
|
2005-05-19 21:03:11 +00:00
|
|
|
ToolBuildPath := $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT)
|
2004-11-18 10:03:46 +00:00
|
|
|
endif
|
2003-05-29 16:18:20 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Tell make that we need to rebuild subdirectories before
|
|
|
|
# we can link the tool. This affects things like LLI which
|
|
|
|
# has library subdirectories.
|
|
|
|
#---------------------------------------------------------
|
|
|
|
$(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
|
2003-01-22 16:13:31 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide targets for building the tools
|
|
|
|
#---------------------------------------------------------
|
|
|
|
all-local:: $(ToolBuildPath)
|
2003-06-27 16:58:44 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
ifneq ($(strip $(ToolBuildPath)),)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(ToolBuildPath)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-11-18 10:03:46 +00:00
|
|
|
ifdef EXAMPLE_TOOL
|
|
|
|
$(ToolBuildPath): $(ExmplDir)/.dir
|
|
|
|
else
|
|
|
|
$(ToolBuildPath): $(ToolDir)/.dir
|
|
|
|
endif
|
|
|
|
|
2004-12-16 07:36:08 +00:00
|
|
|
$(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
|
2005-02-14 21:54:08 +00:00
|
|
|
$(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2005-01-16 02:20:54 +00:00
|
|
|
DestTool = $(PROJ_bindir)/$(TOOLNAME)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
install-local:: $(DestTool)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2005-01-16 02:20:54 +00:00
|
|
|
$(DestTool): $(PROJ_bindir) $(ToolBuildPath)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Installing $(BuildMode) $(DestTool)
|
2005-02-24 03:56:32 +00:00
|
|
|
$(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
uninstall-local::
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Uninstalling $(BuildMode) $(DestTool)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(DestTool)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
###############################################################################
|
|
|
|
# Object Build Rules: Build object files based on sources
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
# Provide rule sets for when dependency generation is enabled
|
2004-10-22 21:01:56 +00:00
|
|
|
ifndef DISABLE_AUTO_DEPENDENCIES
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Create .lo files in the ObjDir directory from the .cpp and .c files...
|
|
|
|
#---------------------------------------------------------
|
2004-10-23 20:04:14 +00:00
|
|
|
ifdef SHARED_LIBRARY
|
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
|
|
|
|
then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2005-02-04 21:28:50 +00:00
|
|
|
$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)"
|
|
|
|
$(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
|
|
|
|
then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
|
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
|
|
|
|
then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Create .o files in the ObjDir directory from the .cpp and .c files...
|
|
|
|
#---------------------------------------------------------
|
2004-10-23 20:04:14 +00:00
|
|
|
else
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
|
|
|
|
then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2005-02-04 21:28:50 +00:00
|
|
|
$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build"
|
|
|
|
$(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
|
|
|
|
then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
|
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
|
|
|
|
then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
|
2004-10-23 20:04:14 +00:00
|
|
|
|
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2005-10-05 00:28:41 +00:00
|
|
|
## Rules for building preprocessed (.i/.ii) outputs.
|
|
|
|
$(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
|
|
|
|
$(Verb) $(Preprocess.CXX) $< -o $@
|
|
|
|
|
|
|
|
$(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
|
|
|
|
$(Verb) $(Preprocess.CXX) $< -o $@
|
|
|
|
|
|
|
|
$(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
|
|
|
|
$(Verb) $(Preprocess.C) $< -o $@
|
|
|
|
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
2005-02-04 21:28:50 +00:00
|
|
|
# Create .bc files in the ObjDir directory from .cpp .cc and .c files...
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
2004-12-16 17:28:50 +00:00
|
|
|
$(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
|
|
|
|
then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
|
|
|
|
|
2005-02-04 21:28:50 +00:00
|
|
|
$(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
|
|
|
|
$(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
|
|
|
|
then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
|
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
|
|
|
|
then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
|
|
|
|
|
|
|
|
# Provide alternate rule sets if dependencies are disabled
|
2004-10-22 21:01:56 +00:00
|
|
|
else
|
2001-09-07 22:57:58 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
ifdef SHARED_LIBRARY
|
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
|
2004-10-23 20:04:14 +00:00
|
|
|
$(LTCompile.CXX) $< -o $@
|
|
|
|
|
2005-02-04 21:28:50 +00:00
|
|
|
$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)"
|
|
|
|
$(LTCompile.CXX) $< -o $@
|
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
|
2004-12-16 18:26:53 +00:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
|
2004-10-23 20:04:14 +00:00
|
|
|
$(LTCompile.C) $< -o $@
|
|
|
|
|
|
|
|
else
|
2001-09-07 22:57:58 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build"
|
2004-10-23 20:04:14 +00:00
|
|
|
$(Compile.CXX) $< -o $@
|
2002-09-20 14:03:13 +00:00
|
|
|
|
2005-02-04 21:28:50 +00:00
|
|
|
$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build"
|
|
|
|
$(Compile.CXX) $< -o $@
|
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
|
2004-12-16 18:26:53 +00:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build"
|
2004-10-23 20:04:14 +00:00
|
|
|
$(Compile.C) $< -o $@
|
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
|
2004-10-31 18:52:15 +00:00
|
|
|
$(BCCompile.CXX) $< -o $@
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2005-02-04 21:28:50 +00:00
|
|
|
$(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
|
|
|
|
$(BCCompile.CXX) $< -o $@
|
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
|
2004-10-31 18:52:15 +00:00
|
|
|
$(BCCompile.C) $< -o $@
|
2003-12-10 00:26:28 +00:00
|
|
|
|
2001-09-07 22:57:58 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide rule to build .bc files from .ll sources,
|
|
|
|
# regardless of dependencies
|
|
|
|
#---------------------------------------------------------
|
|
|
|
$(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.ll for $(BuildMode) build"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(LLVMAS) $< -f -o $@
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# TABLEGEN: Provide rules for running tblgen to produce *.inc files
|
|
|
|
###############################################################################
|
2001-09-07 22:57:58 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
ifdef TARGET
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2005-10-14 06:31:58 +00:00
|
|
|
TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td $(LLVM_SRC_ROOT)/lib/Target/TargetSelectionDAG.td)
|
2004-10-30 09:19:36 +00:00
|
|
|
INCFiles := $(filter %.inc,$(BUILT_SOURCES))
|
2004-12-16 17:28:50 +00:00
|
|
|
INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
|
|
|
|
.PRECIOUS: $(INCTMPFiles) $(INCFiles)
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
# All of these files depend on tblgen and the .td files.
|
|
|
|
$(INCTMPFiles) : $(TBLGEN) $(TDFiles)
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-12-16 17:38:56 +00:00
|
|
|
# INCFiles rule: All of the tblgen generated files are emitted to
|
|
|
|
# $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
|
|
|
|
# us to only "touch" the real file if the contents of it change. IOW, if
|
|
|
|
# tblgen is modified, all of the .inc.tmp files are regereated, but no
|
|
|
|
# dependencies of the .inc files are, unless the contents of the .inc file
|
|
|
|
# changes.
|
|
|
|
$(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
|
2004-12-16 18:26:53 +00:00
|
|
|
$(Verb) $(CMP) -s $@ $< || $(CP) $< $@
|
2004-12-16 17:28:50 +00:00
|
|
|
|
|
|
|
$(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) register names with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-register-enums -o $@ $<
|
2001-07-15 13:16:47 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenRegisterInfo.h.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenRegisterInfo.h.inc.tmp : %.td $(ObjDir)/.dir
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) register information header with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
|
2002-09-20 14:03:13 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) register info implementation with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-register-desc -o $@ $<
|
2002-09-22 02:47:15 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenInstrNames.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenInstrNames.inc.tmp : %.td $(ObjDir)/.dir
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) instruction names with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-instr-enums -o $@ $<
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) instruction information with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-instr-desc -o $@ $<
|
2003-06-30 21:59:07 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) assembly writer with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-asm-writer -o $@ $<
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-12-16 17:34:04 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir
|
|
|
|
$(Echo) "Building $(<F) assembly writer #1 with tblgen"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) code emitter with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-emitter -o $@ $<
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2005-09-03 01:15:25 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir
|
|
|
|
$(Echo) "Building $(<F) instruction selector implementation with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-dag-isel -o $@ $<
|
|
|
|
|
2005-10-21 19:05:19 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenSubtarget.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenSubtarget.inc.tmp : %.td $(ObjDir)/.dir
|
|
|
|
$(Echo) "Building $(<F) subtarget information with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-subtarget -o $@ $<
|
2005-09-03 01:15:25 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(INCFiles)
|
2004-10-22 21:01:56 +00:00
|
|
|
|
|
|
|
endif
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
###############################################################################
|
|
|
|
# LEX AND YACC: Provide rules for generating sources with lex and yacc
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide rules for generating a .cpp source file from
|
|
|
|
# (f)lex input sources.
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
2004-11-02 16:36:03 +00:00
|
|
|
LexFiles := $(filter %.l,$(Sources))
|
2004-10-30 09:19:36 +00:00
|
|
|
|
2004-11-02 16:36:03 +00:00
|
|
|
ifneq ($(LexFiles),)
|
|
|
|
|
2005-08-27 18:50:39 +00:00
|
|
|
# Cancel built-in rules for lex
|
|
|
|
%.c: %.l
|
|
|
|
%.cpp: %.l
|
2004-10-30 09:19:36 +00:00
|
|
|
|
|
|
|
# Note the extra sed filtering here, used to cut down on the warnings emited
|
|
|
|
# by GCC. The last line is a gross hack to work around flex aparently not
|
|
|
|
# being able to resize the buffer on a large token input. Currently, for
|
|
|
|
# uninitialized string buffers in LLVM we can generate very long tokens, so
|
|
|
|
# this is a hack around it.
|
2003-08-15 20:00:47 +00:00
|
|
|
# FIXME. (f.e. char Buffer[10000] )
|
2005-08-27 18:50:39 +00:00
|
|
|
$(PROJ_SRC_DIR)/%.cpp: $(PROJ_SRC_DIR)/%.l
|
2004-12-10 19:44:16 +00:00
|
|
|
$(Echo) Flexing $*.l
|
2005-08-27 18:50:39 +00:00
|
|
|
$(Verb) $(FLEX) -t $(PROJ_SRC_DIR)/$*.l | \
|
2004-10-22 21:01:56 +00:00
|
|
|
$(SED) 's/void yyunput/inline void yyunput/' | \
|
|
|
|
$(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
|
|
|
|
$(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
|
2005-08-27 18:50:39 +00:00
|
|
|
> $(PROJ_SRC_DIR)/$*.cpp
|
|
|
|
$(Echo) "*** DON'T FORGET TO CHECK IN $*.cpp (generated file)"
|
|
|
|
|
|
|
|
LexObjs := $(patsubst %.l,$(ObjDir)/%.o,$(LexFiles))
|
|
|
|
$(LexObjs): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-11-01 07:50:27 +00:00
|
|
|
clean-local::
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(LexOutput)
|
2004-11-02 16:36:03 +00:00
|
|
|
$(Verb) $(RM) -f $(LexOutput)
|
2004-11-01 07:50:27 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide rules for generating a .cpp and .h source files
|
|
|
|
# from yacc (bison) input sources.
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
2004-11-02 16:36:03 +00:00
|
|
|
YaccFiles := $(filter %.y,$(Sources))
|
|
|
|
ifneq ($(YaccFiles),)
|
2005-08-27 18:50:39 +00:00
|
|
|
YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.output)
|
2004-10-30 09:19:36 +00:00
|
|
|
|
|
|
|
.PRECIOUS: $(YaccOutput)
|
|
|
|
|
|
|
|
# Cancel built-in rules for yacc
|
|
|
|
%.c: %.y
|
|
|
|
%.cpp: %.y
|
|
|
|
%.h: %.y
|
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
# Rule for building the bison parsers...
|
2005-08-27 18:50:39 +00:00
|
|
|
$(PROJ_SRC_DIR)/%.cpp $(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.y
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Bisoning $*.y"
|
2005-08-27 18:50:39 +00:00
|
|
|
$(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
|
|
|
|
$(Verb) $(MV) -f $*.tab.c $(PROJ_SRC_DIR)/$*.cpp
|
|
|
|
$(Verb) $(MV) -f $*.tab.h $(PROJ_SRC_DIR)/$*.h
|
|
|
|
$(Echo) "*** DON'T FORGET TO CHECK IN $*.cpp and $*.h (generated files)"
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-11-01 07:50:27 +00:00
|
|
|
clean-local::
|
2004-11-02 16:36:03 +00:00
|
|
|
$(Verb) $(RM) -f $(YaccOutput)
|
2004-10-30 09:19:36 +00:00
|
|
|
endif
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
###############################################################################
|
|
|
|
# OTHER RULES: Other rules needed
|
|
|
|
###############################################################################
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2003-01-16 21:06:18 +00:00
|
|
|
# To create postscript files from dot files...
|
2003-10-02 19:02:02 +00:00
|
|
|
ifneq ($(DOT),false)
|
2003-06-30 21:59:07 +00:00
|
|
|
%.ps: %.dot
|
2004-10-22 21:01:56 +00:00
|
|
|
$(DOT) -Tps < $< > $@
|
2003-06-30 21:59:07 +00:00
|
|
|
else
|
2003-01-16 21:06:18 +00:00
|
|
|
%.ps: %.dot
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Cannot build $@: The program dot is not installed"
|
2003-06-30 21:59:07 +00:00
|
|
|
endif
|
2003-01-16 21:06:18 +00:00
|
|
|
|
2003-09-06 14:44:17 +00:00
|
|
|
# This rules ensures that header files that are removed still have a rule for
|
|
|
|
# which they can be "generated." This allows make to ignore them and
|
|
|
|
# reproduce the dependency lists.
|
2003-09-18 18:37:08 +00:00
|
|
|
%.h:: ;
|
2005-02-04 21:28:50 +00:00
|
|
|
%.hpp:: ;
|
2003-09-06 14:44:17 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
# Define clean-local to clean the current directory. Note that this uses a
|
|
|
|
# very conservative approach ensuring that empty variables do not cause
|
|
|
|
# errors or disastrous removal.
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
ifneq ($(strip $(ObjDir)),)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -rf $(ObjDir)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
|
2004-01-21 19:53:11 +00:00
|
|
|
ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f *$(SHLIBEXT)
|
2004-01-21 19:53:11 +00:00
|
|
|
endif
|
2003-06-30 21:59:07 +00:00
|
|
|
|
2004-11-02 16:36:03 +00:00
|
|
|
clean-all-local::
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -rf Debug Release Profile
|
2004-11-02 16:36:03 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
# Build tags database for Emacs/Xemacs:
|
2004-11-12 02:27:36 +00:00
|
|
|
tags:: TAGS CTAGS
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
TAGS:
|
2005-01-16 02:20:54 +00:00
|
|
|
find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
|
|
|
|
$(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
|
|
|
|
$(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
|
|
|
|
$(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
|
2004-11-12 02:27:36 +00:00
|
|
|
-name '*.cpp' -o -name '*.h' | \
|
2004-10-30 09:19:36 +00:00
|
|
|
$(ETAGS) $(ETAGSFLAGS) -
|
|
|
|
|
2004-11-12 02:27:36 +00:00
|
|
|
CTAGS:
|
2005-01-16 02:20:54 +00:00
|
|
|
find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
|
|
|
|
$(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
|
|
|
|
$(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
|
|
|
|
$(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
|
2004-11-12 02:27:36 +00:00
|
|
|
\( -name '*.cpp' -o -name '*.h' \) -print | \
|
2005-01-16 02:20:54 +00:00
|
|
|
ctags -ImtT -o $(PROJ_OBJ_ROOT)/CTAGS -L -
|
2004-11-12 02:27:36 +00:00
|
|
|
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
###############################################################################
|
|
|
|
# DEPENDENCIES: Include the dependency files if we should
|
|
|
|
###############################################################################
|
2003-08-22 14:10:16 +00:00
|
|
|
ifndef DISABLE_AUTO_DEPENDENCIES
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
# If its not one of the cleaning targets
|
2004-10-30 09:19:36 +00:00
|
|
|
ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
|
2003-05-15 21:28:55 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
# Get the list of dependency files
|
2004-10-30 09:19:36 +00:00
|
|
|
DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
|
2005-01-16 02:20:54 +00:00
|
|
|
DependFiles := $(patsubst %,$(PROJ_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
|
2004-10-23 20:04:14 +00:00
|
|
|
|
|
|
|
-include /dev/null $(DependFiles)
|
2003-11-09 21:36:19 +00:00
|
|
|
|
2003-08-12 18:51:51 +00:00
|
|
|
endif
|
2003-08-18 17:27:40 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-12-06 05:35:13 +00:00
|
|
|
###############################################################################
|
|
|
|
# CHECK: Running the test suite
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
check::
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
|
|
|
|
if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
|
2004-12-06 05:35:13 +00:00
|
|
|
$(EchoCmd) Running test suite ; \
|
2005-01-16 02:20:54 +00:00
|
|
|
$(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
|
2004-12-06 05:35:13 +00:00
|
|
|
TESTSUITE=$(TESTSUITE) ; \
|
|
|
|
else \
|
|
|
|
$(EchoCmd) No Makefile in test directory ; \
|
|
|
|
fi ; \
|
|
|
|
else \
|
|
|
|
$(EchoCmd) No test directory ; \
|
|
|
|
fi
|
|
|
|
|
2004-10-24 07:53:21 +00:00
|
|
|
###############################################################################
|
2004-10-30 09:19:36 +00:00
|
|
|
# DISTRIBUTION: Handle construction of a distribution tarball
|
2004-10-24 07:53:21 +00:00
|
|
|
###############################################################################
|
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Define distribution related variables
|
|
|
|
#------------------------------------------------------------------------
|
2005-01-16 02:20:54 +00:00
|
|
|
DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
|
|
|
|
DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
|
|
|
|
TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
|
|
|
|
DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
|
|
|
|
DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
|
|
|
|
DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
|
2004-10-26 07:09:33 +00:00
|
|
|
DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
|
|
|
|
ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
|
|
|
|
Makefile.config.in configure autoconf
|
|
|
|
DistOther := $(notdir $(wildcard \
|
2005-01-16 02:20:54 +00:00
|
|
|
$(PROJ_SRC_DIR)/*.h \
|
|
|
|
$(PROJ_SRC_DIR)/*.td \
|
|
|
|
$(PROJ_SRC_DIR)/*.def \
|
|
|
|
$(PROJ_SRC_DIR)/*.ll \
|
|
|
|
$(PROJ_SRC_DIR)/*.in))
|
2004-10-30 09:19:36 +00:00
|
|
|
DistSubDirs := $(SubDirs)
|
2004-11-29 05:00:33 +00:00
|
|
|
DistSources = $(Sources) $(EXTRA_DIST)
|
|
|
|
DistFiles = $(DistAlways) $(DistSources) $(DistOther)
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# We MUST build distribution with OBJ_DIR != SRC_DIR
|
|
|
|
#------------------------------------------------------------------------
|
2005-01-16 02:20:54 +00:00
|
|
|
ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
|
2004-10-25 08:27:37 +00:00
|
|
|
dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
|
2004-10-25 08:27:37 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Prevent attempt to run dist targets from anywhere but the top level
|
|
|
|
#------------------------------------------------------------------------
|
2004-10-25 08:27:37 +00:00
|
|
|
ifneq ($(LEVEL),.)
|
|
|
|
dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
|
2004-10-25 08:27:37 +00:00
|
|
|
else
|
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Provide the top level targets
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
dist-gzip:: $(DistTarGZip)
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-12-04 22:34:09 +00:00
|
|
|
$(DistTarGZip) : $(TopDistDir)/.makedistdir
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Packing gzipped distribution tar file.
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
|
2004-11-29 05:00:33 +00:00
|
|
|
$(GZIP) -c > "$(DistTarGZip)"
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
dist-bzip2:: $(DistTarBZ2)
|
2004-10-26 07:09:33 +00:00
|
|
|
|
2004-12-04 22:34:09 +00:00
|
|
|
$(DistTarBZ2) : $(TopDistDir)/.makedistdir
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Packing bzipped distribution tar file.
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
|
2004-11-29 05:00:33 +00:00
|
|
|
$(BZIP2) -c >$(DistTarBZ2)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
dist-zip:: $(DistZip)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-12-04 22:34:09 +00:00
|
|
|
$(DistZip) : $(TopDistDir)/.makedistdir
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Packing zipped distribution file.
|
|
|
|
$(Verb) rm -f $(DistZip)
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
|
2004-10-26 07:09:33 +00:00
|
|
|
|
|
|
|
dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2005-01-28 19:52:32 +00:00
|
|
|
DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
|
2004-10-26 07:09:33 +00:00
|
|
|
|
2004-12-04 22:34:09 +00:00
|
|
|
dist-check:: $(DistTarGZip)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Checking distribution tar file.
|
|
|
|
$(Verb) if test -d $(DistCheckDir) ; then \
|
2004-10-26 07:09:33 +00:00
|
|
|
$(RM) -rf $(DistCheckDir) ; \
|
|
|
|
fi
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(MKDIR) $(DistCheckDir)
|
|
|
|
$(Verb) cd $(DistCheckDir) && \
|
2004-10-26 07:09:33 +00:00
|
|
|
$(MKDIR) $(DistCheckDir)/build && \
|
|
|
|
$(MKDIR) $(DistCheckDir)/install && \
|
|
|
|
gunzip -c $(DistTarGZip) | $(TAR) xf - && \
|
|
|
|
cd build && \
|
|
|
|
../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
|
2005-05-24 02:33:20 +00:00
|
|
|
--srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
|
2004-12-04 22:34:09 +00:00
|
|
|
$(MAKE) all && \
|
2004-10-26 07:09:33 +00:00
|
|
|
$(MAKE) check && \
|
|
|
|
$(MAKE) install && \
|
|
|
|
$(MAKE) uninstall && \
|
|
|
|
$(MAKE) dist && \
|
|
|
|
$(MAKE) clean && \
|
|
|
|
$(MAKE) dist-clean && \
|
2004-10-30 09:19:36 +00:00
|
|
|
$(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
|
2004-10-25 08:27:37 +00:00
|
|
|
|
|
|
|
dist-clean::
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Cleaning distribution files
|
2004-12-04 22:34:09 +00:00
|
|
|
-$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
|
|
|
|
$(DistCheckDir)
|
2004-10-25 08:27:37 +00:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Provide the recursive distdir target for building the distribution directory
|
|
|
|
#------------------------------------------------------------------------
|
2004-12-04 22:34:09 +00:00
|
|
|
distdir: $(DistDir)/.makedistdir
|
|
|
|
$(DistDir)/.makedistdir: $(DistSources)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
|
2004-10-26 07:09:33 +00:00
|
|
|
if test -d "$(DistDir)" ; then \
|
|
|
|
find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
|
|
|
|
exit 1 ; \
|
|
|
|
fi ; \
|
2004-12-04 22:34:09 +00:00
|
|
|
$(EchoCmd) Removing old $(DistDir) ; \
|
2004-10-26 07:09:33 +00:00
|
|
|
$(RM) -rf $(DistDir); \
|
2004-12-06 05:35:13 +00:00
|
|
|
$(EchoCmd) Making 'all' to verify build ; \
|
2004-12-04 22:34:09 +00:00
|
|
|
$(MAKE) all ; \
|
2004-10-26 07:09:33 +00:00
|
|
|
fi
|
2004-11-29 05:00:33 +00:00
|
|
|
$(Echo) Building Distribution Directory $(DistDir)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(MKDIR) $(DistDir)
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
|
|
|
|
srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
|
2004-10-25 08:27:37 +00:00
|
|
|
for file in $(DistFiles) ; do \
|
|
|
|
case "$$file" in \
|
2005-01-16 02:20:54 +00:00
|
|
|
$(PROJ_SRC_DIR)/*) \
|
2004-12-04 22:34:09 +00:00
|
|
|
file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
|
|
|
|
;; \
|
2005-01-16 02:20:54 +00:00
|
|
|
$(PROJ_SRC_ROOT)/*) \
|
2004-12-04 22:34:09 +00:00
|
|
|
file=`echo "$$file" | \
|
|
|
|
sed "s#^$$srcrootstrip/##"` \
|
|
|
|
;; \
|
2004-10-25 08:27:37 +00:00
|
|
|
esac; \
|
2005-01-16 02:20:54 +00:00
|
|
|
if test -f "$(PROJ_SRC_DIR)/$$file" || \
|
|
|
|
test -d "$(PROJ_SRC_DIR)/$$file" ; then \
|
|
|
|
from_dir="$(PROJ_SRC_DIR)" ; \
|
2004-12-04 22:34:09 +00:00
|
|
|
elif test -f "$$file" || test -d "$$file" ; then \
|
2004-10-25 08:27:37 +00:00
|
|
|
from_dir=. ; \
|
2004-12-04 22:34:09 +00:00
|
|
|
fi ; \
|
|
|
|
to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
|
2004-10-25 08:27:37 +00:00
|
|
|
if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
|
|
|
|
to_dir="$(DistDir)/$$dir"; \
|
|
|
|
$(MKDIR) "$$to_dir" ; \
|
|
|
|
else \
|
|
|
|
to_dir="$(DistDir)"; \
|
|
|
|
fi; \
|
|
|
|
mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
|
|
|
|
if test -n "$$mid_dir" ; then \
|
2004-10-26 07:09:33 +00:00
|
|
|
$(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
|
2004-10-25 08:27:37 +00:00
|
|
|
fi ; \
|
|
|
|
if test -d "$$from_dir/$$file"; then \
|
2005-01-16 02:20:54 +00:00
|
|
|
if test -d "$(PROJ_SRC_DIR)/$$file" && \
|
|
|
|
test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
|
2005-05-24 02:33:20 +00:00
|
|
|
cd $(PROJ_SRC_DIR) ; \
|
|
|
|
$(TAR) cf - $$file --exclude .svn --exclude CVS | \
|
|
|
|
( cd $$to_dir ; $(TAR) xf - ) ; \
|
|
|
|
cd $(PROJ_OBJ_DIR) ; \
|
|
|
|
else \
|
|
|
|
cd $$from_dir ; \
|
|
|
|
$(TAR) cf - $$file --exclude .svn --exclude CVS | \
|
|
|
|
( cd $$to_dir ; $(TAR) xf - ) ; \
|
|
|
|
cd $(PROJ_OBJ_DIR) ; \
|
2004-10-25 08:27:37 +00:00
|
|
|
fi; \
|
|
|
|
elif test -f "$$from_dir/$$file" ; then \
|
2004-12-16 18:26:53 +00:00
|
|
|
$(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
|
2004-10-25 08:27:37 +00:00
|
|
|
elif test -L "$$from_dir/$$file" ; then \
|
2004-12-16 18:26:53 +00:00
|
|
|
$(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
|
2004-10-25 08:27:37 +00:00
|
|
|
elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
|
2004-12-04 22:34:09 +00:00
|
|
|
$(EchoCmd) "===== WARNING: Distribution Source " \
|
|
|
|
"$$from_dir/$$file Not Found!" ; \
|
2004-10-30 09:19:36 +00:00
|
|
|
elif test "$(Verb)" != '@' ; then \
|
|
|
|
$(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
|
2004-10-25 08:27:37 +00:00
|
|
|
fi; \
|
|
|
|
done
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) for subdir in $(DistSubDirs) ; do \
|
2004-10-25 08:27:37 +00:00
|
|
|
if test "$$subdir" \!= "." ; then \
|
|
|
|
new_distdir="$(DistDir)/$$subdir" ; \
|
2004-10-26 07:09:33 +00:00
|
|
|
test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
|
2004-12-04 22:34:09 +00:00
|
|
|
( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || \
|
|
|
|
exit 1; \
|
2004-10-25 08:27:37 +00:00
|
|
|
fi; \
|
|
|
|
done
|
2004-12-04 22:34:09 +00:00
|
|
|
$(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
|
2005-05-24 02:33:20 +00:00
|
|
|
$(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
|
|
|
|
$(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o -name .svn \) -print` ;\
|
2004-12-04 22:34:09 +00:00
|
|
|
$(MAKE) dist-hook ; \
|
|
|
|
$(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
|
|
|
|
-o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
|
|
|
|
-o ! -type d ! -perm -400 -exec chmod a+r {} \; \
|
|
|
|
-o ! -type d ! -perm -444 -exec \
|
|
|
|
$(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
|
|
|
|
|| chmod -R a+r $(DistDir) ; \
|
|
|
|
fi
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
# This is invoked by distdir target, define it as a no-op to avoid errors if not
|
|
|
|
# defined by user.
|
2004-10-25 08:27:37 +00:00
|
|
|
dist-hook::
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# TOP LEVEL - targets only to apply at the top level directory
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
ifeq ($(LEVEL),.)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
2004-12-06 05:35:13 +00:00
|
|
|
# Install support for the project's include files:
|
2004-10-24 07:53:21 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
install-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Installing include files
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Verb) $(MKDIR) $(PROJ_includedir)
|
2005-02-24 03:56:32 +00:00
|
|
|
$(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
|
2005-01-16 02:20:54 +00:00
|
|
|
cd $(PROJ_SRC_ROOT)/include && \
|
2005-02-16 15:54:03 +00:00
|
|
|
for hdr in `find . -type f '!' '(' -name '*~' -o -name '.cvsignore' \
|
|
|
|
-o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS ` ; do \
|
2005-02-24 03:56:32 +00:00
|
|
|
instdir=`dirname "$(PROJ_includedir)/$$hdr"` ; \
|
|
|
|
if test \! -d "$$instdir" ; then \
|
|
|
|
$(EchoCmd) Making install directory $$instdir ; \
|
|
|
|
$(MKDIR) $$instdir ;\
|
|
|
|
fi ; \
|
|
|
|
$(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
|
2005-02-16 15:54:03 +00:00
|
|
|
done ; \
|
2004-10-24 07:53:21 +00:00
|
|
|
fi
|
2005-02-24 03:56:32 +00:00
|
|
|
$(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
|
2005-02-16 15:54:03 +00:00
|
|
|
cd $(PROJ_OBJ_ROOT)/include && \
|
|
|
|
for hdr in `find . -type f -print` ; do \
|
2005-02-24 03:56:32 +00:00
|
|
|
$(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
|
2005-02-16 15:54:03 +00:00
|
|
|
done ; \
|
2005-02-09 02:24:00 +00:00
|
|
|
fi
|
2004-10-24 07:53:21 +00:00
|
|
|
|
|
|
|
uninstall-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Uninstalling include files
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
|
|
|
|
cd $(PROJ_SRC_ROOT)/include && \
|
2004-10-24 07:53:21 +00:00
|
|
|
$(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
|
2005-02-09 02:24:00 +00:00
|
|
|
'!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' -o -name '*.in' ')' \
|
2005-01-16 02:20:54 +00:00
|
|
|
-print ')' | grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \
|
2005-02-09 02:24:00 +00:00
|
|
|
cd $(PROJ_SRC_ROOT)/include && \
|
|
|
|
$(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' -print ')' \
|
|
|
|
| sed 's#\.in$$##;s#^#$(PROJ_includedir)/#'` ; \
|
|
|
|
fi
|
2004-10-24 07:53:21 +00:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Print out the directories used for building
|
2004-10-30 09:19:36 +00:00
|
|
|
#------------------------------------------------------------------------
|
2004-10-23 20:04:14 +00:00
|
|
|
printvars::
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Echo) "BuildMode : " '$(BuildMode)'
|
|
|
|
$(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
|
|
|
|
$(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
|
|
|
|
$(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
|
|
|
|
$(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
|
|
|
|
$(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
|
|
|
|
$(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
|
|
|
|
$(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
|
|
|
|
$(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
|
|
|
|
$(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
|
|
|
|
$(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
|
2005-02-16 16:13:02 +00:00
|
|
|
$(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Echo) "UserTargets : " '$(UserTargets)'
|
|
|
|
$(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
|
|
|
|
$(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
|
|
|
|
$(Echo) "ObjDir : " '$(ObjDir)'
|
|
|
|
$(Echo) "LibDir : " '$(LibDir)'
|
|
|
|
$(Echo) "ToolDir : " '$(ToolDir)'
|
|
|
|
$(Echo) "ExmplDir : " '$(ExmplDir)'
|
|
|
|
$(Echo) "Sources : " '$(Sources)'
|
|
|
|
$(Echo) "TDFiles : " '$(TDFiles)'
|
|
|
|
$(Echo) "INCFiles : " '$(INCFiles)'
|
|
|
|
$(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
|
2005-03-01 16:27:06 +00:00
|
|
|
$(Echo) "PreConditions: " '$(PreConditions)'
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Echo) "Compile.CXX : " '$(Compile.CXX)'
|
|
|
|
$(Echo) "Compile.C : " '$(Compile.C)'
|
|
|
|
$(Echo) "Archive : " '$(Archive)'
|
|
|
|
$(Echo) "YaccFiles : " '$(YaccFiles)'
|
|
|
|
$(Echo) "LexFiles : " '$(LexFiles)'
|
|
|
|
$(Echo) "Module : " '$(Module)'
|
2005-08-24 10:43:10 +00:00
|
|
|
$(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
|