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
|
|
|
|
#
|
2007-12-29 20:11:13 +00:00
|
|
|
# This file is distributed under the University of Illinois Open Source
|
|
|
|
# License. See LICENSE.TXT for details.
|
2009-01-08 02:11:55 +00:00
|
|
|
#
|
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
|
|
|
#
|
2006-02-14 04:27:15 +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
|
|
|
|
#--------------------------------------------------------------------
|
2009-09-13 22:39:27 +00:00
|
|
|
RecursiveTargets := all clean clean-all install uninstall install-bytecode \
|
|
|
|
unitcheck
|
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 \
|
2009-09-13 22:39:27 +00:00
|
|
|
install-bytecode-local
|
2007-09-26 06:10:47 +00:00
|
|
|
TopLevelTargets := check dist dist-check dist-clean dist-gzip dist-bzip2 \
|
2009-01-04 23:12:21 +00:00
|
|
|
dist-zip unittests
|
2004-10-30 09:19:36 +00:00
|
|
|
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
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
2007-06-29 14:02:07 +00:00
|
|
|
# Reset the list of suffixes we know how to build.
|
2004-10-26 22:26:33 +00:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
.SUFFIXES:
|
2013-07-25 20:25:31 +00:00
|
|
|
.SUFFIXES: .c .cpp .cc .h .hpp .o .a .td .ps .dot .m .mm
|
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
|
|
|
#--------------------------------------------------------------------
|
2009-01-08 02:11:55 +00:00
|
|
|
# Make sure all the user-target rules are double colon rules and
|
2004-10-26 22:26:33 +00:00
|
|
|
# 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
|
|
|
|
2011-11-03 22:46:21 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# LLVMBuild Integration
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# We use llvm-build to generate all the data required by the Makefile based
|
|
|
|
# build system in one swoop:
|
|
|
|
#
|
|
|
|
# - We generate a file (a Makefile fragment) in the object root which contains
|
|
|
|
# all the definitions that are required by Makefiles across the entire
|
|
|
|
# project.
|
|
|
|
#
|
|
|
|
# - We generate the library table used by llvm-config.
|
|
|
|
#
|
|
|
|
# - We generate the dependencies for the Makefile fragment, so that we will
|
|
|
|
# automatically reconfigure outselves.
|
|
|
|
|
|
|
|
# The path to the llvm-build tool itself.
|
|
|
|
LLVMBuildTool := $(PROJ_SRC_ROOT)/utils/llvm-build/llvm-build
|
|
|
|
|
|
|
|
# The files we are going to generate using llvm-build.
|
|
|
|
LLVMBuildMakeFrag := $(PROJ_OBJ_ROOT)/Makefile.llvmbuild
|
2014-02-09 16:37:02 +00:00
|
|
|
LLVMBuildCMakeFrag := $(PROJ_OBJ_ROOT)/LLVMBuild.cmake
|
|
|
|
LLVMBuildCMakeExportsFrag := $(PROJ_OBJ_ROOT)/cmake/modules/LLVMBuildExports.cmake
|
|
|
|
LLVMBuildMakeFrags := \
|
|
|
|
$(LLVMBuildMakeFrag) \
|
|
|
|
$(LLVMBuildCMakeFrag) \
|
|
|
|
$(LLVMBuildCMakeExportsFrag)
|
2011-11-03 22:46:21 +00:00
|
|
|
LLVMConfigLibraryDependenciesInc := \
|
2011-12-01 20:18:09 +00:00
|
|
|
$(PROJ_OBJ_ROOT)/tools/llvm-config/LibraryDependencies.inc
|
2011-11-03 22:46:21 +00:00
|
|
|
|
2011-11-12 00:18:02 +00:00
|
|
|
# This is for temporary backwards compatibility.
|
|
|
|
ifndef TARGET_NATIVE_ARCH
|
|
|
|
TARGET_NATIVE_ARCH := $(ARCH)
|
|
|
|
endif
|
|
|
|
|
2011-11-03 22:46:21 +00:00
|
|
|
# The rule to create the LLVMBuild Makefile fragment as well as the llvm-config
|
|
|
|
# library table.
|
|
|
|
#
|
|
|
|
# Note that this target gets its real dependencies generated for us by
|
|
|
|
# llvm-build.
|
2011-11-09 18:48:22 +00:00
|
|
|
#
|
|
|
|
# We include a dependency on this Makefile to ensure that changes to the
|
|
|
|
# generation command get picked up.
|
2014-02-09 16:37:02 +00:00
|
|
|
$(LLVMBuildMakeFrags): $(PROJ_SRC_ROOT)/Makefile.rules \
|
|
|
|
$(PROJ_OBJ_ROOT)/Makefile.config
|
2011-11-03 23:01:50 +00:00
|
|
|
$(Echo) Constructing LLVMBuild project information.
|
2013-01-30 04:07:37 +00:00
|
|
|
$(Verb)$(PYTHON) $(LLVMBuildTool) \
|
2011-11-12 00:18:02 +00:00
|
|
|
--native-target "$(TARGET_NATIVE_ARCH)" \
|
2011-11-10 01:16:48 +00:00
|
|
|
--enable-targets "$(TARGETS_TO_BUILD)" \
|
2012-05-07 19:38:40 +00:00
|
|
|
--enable-optional-components "$(OPTIONAL_COMPONENTS)" \
|
2011-11-03 22:46:21 +00:00
|
|
|
--write-library-table $(LLVMConfigLibraryDependenciesInc) \
|
2014-02-09 16:37:02 +00:00
|
|
|
--write-make-fragment $(LLVMBuildMakeFrag) \
|
|
|
|
--write-cmake-fragment $(LLVMBuildCMakeFrag) \
|
|
|
|
--write-cmake-exports-fragment $(LLVMBuildCMakeExportsFrag)
|
2011-11-03 22:46:21 +00:00
|
|
|
|
2011-11-09 18:48:22 +00:00
|
|
|
# For completeness, let Make know how the extra files are generated.
|
2014-02-09 16:37:02 +00:00
|
|
|
$(LLVMConfigLibraryDependenciesInc): $(LLVMBuildMakeFrags)
|
2011-11-09 18:48:22 +00:00
|
|
|
|
2011-11-03 22:46:21 +00:00
|
|
|
# Include the generated Makefile fragment.
|
|
|
|
#
|
|
|
|
# We currently only include the dependencies for the fragment itself if we are
|
|
|
|
# at the top-level. Otherwise, recursive invocations would ends up doing
|
|
|
|
# substantially more redundant stat'ing.
|
|
|
|
#
|
|
|
|
# This means that we won't properly regenerate things for developers used to
|
|
|
|
# building from a subdirectory, but that is always somewhat unreliable.
|
|
|
|
ifeq ($(LEVEL),.)
|
|
|
|
LLVMBUILD_INCLUDE_DEPENDENCIES := 1
|
2012-02-02 23:27:34 +00:00
|
|
|
|
|
|
|
# Clean the generated makefile fragment at the top-level.
|
|
|
|
clean-local::
|
2014-02-09 16:37:02 +00:00
|
|
|
-$(Verb) $(RM) -f $(LLVMBuildMakeFrags)
|
2011-11-03 22:46:21 +00:00
|
|
|
endif
|
|
|
|
-include $(LLVMBuildMakeFrag)
|
|
|
|
|
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
|
2006-09-04 05:23:20 +00:00
|
|
|
|
2005-01-16 02:20:54 +00:00
|
|
|
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
|
|
|
|
2007-02-07 19:13:19 +00:00
|
|
|
clean-all-local::
|
2004-10-26 22:26:33 +00:00
|
|
|
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
|
2005-12-21 23:17:06 +00:00
|
|
|
else
|
|
|
|
spotless:
|
|
|
|
$(EchoCmd) "spotless target not supported for objdir == srcdir"
|
2004-12-16 08:00:46 +00:00
|
|
|
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) && \
|
2004-12-16 18:26:53 +00:00
|
|
|
$(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
|
|
|
|
$(ConfigStatusScript)
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
.PRECIOUS: $(ConfigStatusScript)
|
2010-10-01 22:32:12 +00:00
|
|
|
$(ConfigStatusScript): $(ConfigureScript)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Reconfiguring with $<
|
2005-01-16 02:20:54 +00:00
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) && \
|
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
|
|
|
|
#------------------------------------------------------------------------
|
2010-09-09 17:38:11 +00:00
|
|
|
ifndef PROJ_MAKEFILE
|
|
|
|
PROJ_MAKEFILE := $(PROJ_SRC_DIR)/Makefile
|
|
|
|
endif
|
|
|
|
|
2005-01-16 02:20:54 +00:00
|
|
|
ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
|
2004-10-26 22:26:33 +00:00
|
|
|
|
2010-09-09 17:38:11 +00:00
|
|
|
Makefile: $(PROJ_MAKEFILE) $(ExtraMakefiles)
|
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.
|
2010-09-09 17:38:11 +00:00
|
|
|
$(PROJ_OBJ_DIR)/Makefile% : $(PROJ_MAKEFILE)%
|
2004-10-26 23:10:00 +00:00
|
|
|
@case '$?' in \
|
|
|
|
*Makefile.rules) ;; \
|
|
|
|
*.in) ;; \
|
2008-03-10 15:58:40 +00:00
|
|
|
*) $(EchoCmd) "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
|
2008-02-27 13:34:15 +00:00
|
|
|
|
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
|
2008-11-10 07:33:13 +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
|
2009-01-08 02:11:55 +00:00
|
|
|
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
|
|
|
|
2008-10-03 19:11:19 +00:00
|
|
|
# Variable for if this make is for a "cleaning" target
|
|
|
|
ifneq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),)
|
|
|
|
IS_CLEANING_TARGET=1
|
|
|
|
endif
|
|
|
|
|
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
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2007-07-10 07:19:53 +00:00
|
|
|
CPP.Defines :=
|
2009-04-17 14:49:22 +00:00
|
|
|
ifeq ($(ENABLE_OPTIMIZED),1)
|
|
|
|
BuildMode := Release
|
|
|
|
# Don't use -fomit-frame-pointer on Darwin or FreeBSD.
|
2013-10-31 14:35:00 +00:00
|
|
|
ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD))
|
2009-04-17 14:49:22 +00:00
|
|
|
OmitFramePointer := -fomit-frame-pointer
|
|
|
|
endif
|
|
|
|
|
|
|
|
CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
|
|
|
|
C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
|
|
|
|
LD.Flags += $(OPTIMIZE_OPTION)
|
2009-09-27 17:47:29 +00:00
|
|
|
ifdef DEBUG_SYMBOLS
|
2009-09-25 16:46:09 +00:00
|
|
|
BuildMode := $(BuildMode)+Debug
|
|
|
|
CXX.Flags += -g
|
|
|
|
C.Flags += -g
|
|
|
|
KEEP_SYMBOLS := 1
|
|
|
|
endif
|
2009-04-17 14:49:22 +00:00
|
|
|
else
|
2009-11-16 22:37:52 +00:00
|
|
|
ifdef NO_DEBUG_SYMBOLS
|
|
|
|
BuildMode := Unoptimized
|
|
|
|
CXX.Flags +=
|
|
|
|
C.Flags +=
|
|
|
|
KEEP_SYMBOLS := 1
|
|
|
|
else
|
|
|
|
BuildMode := Debug
|
2013-06-25 01:12:25 +00:00
|
|
|
ifeq ($(ENABLE_SPLIT_DWARF), 1)
|
|
|
|
CXX.Flags += -gsplit-dwarf
|
|
|
|
C.Flags += -gsplit-dwarf
|
|
|
|
else
|
2009-11-16 22:37:52 +00:00
|
|
|
CXX.Flags += -g
|
|
|
|
C.Flags += -g
|
2013-06-25 01:12:25 +00:00
|
|
|
endif
|
2009-11-16 22:37:52 +00:00
|
|
|
KEEP_SYMBOLS := 1
|
|
|
|
endif
|
2009-04-17 14:49:22 +00:00
|
|
|
endif
|
|
|
|
|
2011-11-11 22:51:42 +00:00
|
|
|
ifeq ($(ENABLE_LIBCPP),1)
|
|
|
|
CXX.Flags += -stdlib=libc++
|
|
|
|
LD.Flags += -stdlib=libc++
|
|
|
|
endif
|
2011-11-10 21:12:28 +00:00
|
|
|
|
2014-03-01 03:33:08 +00:00
|
|
|
ifeq ($(ENABLE_CXX1Y),1)
|
|
|
|
CXX.Flags += -std=c++1y
|
|
|
|
else
|
2014-03-12 20:01:15 +00:00
|
|
|
ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
|
|
|
# MinGW and Cygwin are a bit stricter and lack things like
|
|
|
|
# 'strdup', 'stricmp', etc in c++11 mode.
|
|
|
|
CXX.Flags += -std=gnu++11
|
|
|
|
else
|
|
|
|
CXX.Flags += -std=c++11
|
|
|
|
endif
|
2012-08-03 19:47:14 +00:00
|
|
|
endif
|
|
|
|
|
2012-08-03 19:58:20 +00:00
|
|
|
ifeq ($(ENABLE_WERROR),1)
|
|
|
|
CXX.Flags += -Werror
|
|
|
|
C.Flags += -Werror
|
|
|
|
endif
|
|
|
|
|
2009-04-17 14:49:22 +00:00
|
|
|
ifeq ($(ENABLE_PROFILING),1)
|
|
|
|
BuildMode := $(BuildMode)+Profile
|
|
|
|
CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
|
|
|
|
C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g
|
2013-06-25 00:40:03 +00:00
|
|
|
LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg
|
2009-04-17 14:49:22 +00:00
|
|
|
KEEP_SYMBOLS := 1
|
2003-03-14 20:25:22 +00:00
|
|
|
endif
|
|
|
|
|
2011-12-22 21:41:32 +00:00
|
|
|
ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
|
|
|
|
CXX.Flags += -fvisibility-inlines-hidden
|
|
|
|
endif
|
2008-09-02 17:35:16 +00:00
|
|
|
|
2010-01-24 20:20:40 +00:00
|
|
|
ifdef ENABLE_EXPENSIVE_CHECKS
|
|
|
|
# GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
|
|
|
|
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160
|
|
|
|
REQUIRES_RTTI := 1
|
|
|
|
endif
|
|
|
|
|
For PR797:
Final commit for this bug. This removes the last EH holdouts in LLVM
and turns off exception support by using the -fno-exceptions option. This
leads to the following reduction in library and executable sizes:
DEBUG BUILD RELEASE BUILD
before after delta before after delta
lib 162,328K 157,616K 4,712 17,864K 16,416K 1,448K
bin 571,444K 557,156K 14,288 63,296K 56,996K 6,300K
Debug Improvement: 19,000K (2.59%)
Release Improvement: 7,748K (9.55%)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29882 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-25 19:54:53 +00:00
|
|
|
# IF REQUIRES_EH=1 is specified then don't disable exceptions
|
2006-08-25 20:56:59 +00:00
|
|
|
ifndef REQUIRES_EH
|
|
|
|
CXX.Flags += -fno-exceptions
|
2010-01-24 20:21:50 +00:00
|
|
|
else
|
|
|
|
# If the library requires EH, it also requires RTTI.
|
|
|
|
REQUIRES_RTTI := 1
|
2006-08-25 20:56:59 +00:00
|
|
|
endif
|
For PR797:
Final commit for this bug. This removes the last EH holdouts in LLVM
and turns off exception support by using the -fno-exceptions option. This
leads to the following reduction in library and executable sizes:
DEBUG BUILD RELEASE BUILD
before after delta before after delta
lib 162,328K 157,616K 4,712 17,864K 16,416K 1,448K
bin 571,444K 557,156K 14,288 63,296K 56,996K 6,300K
Debug Improvement: 19,000K (2.59%)
Release Improvement: 7,748K (9.55%)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29882 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-25 19:54:53 +00:00
|
|
|
|
2009-08-19 22:04:44 +00:00
|
|
|
ifdef REQUIRES_FRAME_POINTER
|
|
|
|
CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags))
|
|
|
|
C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags))
|
|
|
|
LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags))
|
|
|
|
endif
|
|
|
|
|
2009-09-11 15:47:24 +00:00
|
|
|
# If REQUIRES_RTTI=1 is specified then don't disable run-time type id.
|
2010-01-24 20:43:08 +00:00
|
|
|
ifneq ($(REQUIRES_RTTI), 1)
|
|
|
|
CXX.Flags += -fno-rtti
|
2007-05-02 21:29:39 +00:00
|
|
|
endif
|
|
|
|
|
2010-10-22 12:54:34 +00:00
|
|
|
ifeq ($(ENABLE_COVERAGE),1)
|
2009-03-13 20:59:41 +00:00
|
|
|
BuildMode := $(BuildMode)+Coverage
|
2009-06-16 23:00:42 +00:00
|
|
|
CXX.Flags += -ftest-coverage -fprofile-arcs
|
|
|
|
C.Flags += -ftest-coverage -fprofile-arcs
|
2009-03-13 20:59:41 +00:00
|
|
|
endif
|
|
|
|
|
2006-04-10 16:46:04 +00:00
|
|
|
# If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
|
|
|
|
# then disable assertions by defining the appropriate preprocessor symbols.
|
2010-10-22 12:54:34 +00:00
|
|
|
ifeq ($(DISABLE_ASSERTIONS),1)
|
|
|
|
CPP.Defines += -DNDEBUG
|
|
|
|
else
|
2010-07-07 07:48:00 +00:00
|
|
|
BuildMode := $(BuildMode)+Asserts
|
2007-07-10 07:19:53 +00:00
|
|
|
CPP.Defines += -D_DEBUG
|
2006-03-21 01:06:41 +00:00
|
|
|
endif
|
|
|
|
|
2009-01-08 02:11:55 +00:00
|
|
|
# If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
|
|
|
|
# configured), then enable expensive checks by defining the
|
2007-06-29 03:36:21 +00:00
|
|
|
# appropriate preprocessor symbols.
|
2010-10-22 12:54:34 +00:00
|
|
|
ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
|
2007-06-28 19:36:08 +00:00
|
|
|
BuildMode := $(BuildMode)+Checks
|
2008-12-09 21:33:20 +00:00
|
|
|
CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
|
2007-06-28 19:36:08 +00:00
|
|
|
endif
|
|
|
|
|
2009-02-26 07:44:16 +00:00
|
|
|
# LOADABLE_MODULE implies several other things so we force them to be
|
|
|
|
# defined/on.
|
|
|
|
ifdef LOADABLE_MODULE
|
|
|
|
SHARED_LIBRARY := 1
|
|
|
|
LINK_LIBS_IN_SHARED := 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef SHARED_LIBRARY
|
|
|
|
ENABLE_PIC := 1
|
|
|
|
PIC_FLAG = "(PIC)"
|
|
|
|
endif
|
|
|
|
|
2006-12-16 22:07:52 +00:00
|
|
|
ifeq ($(ENABLE_PIC),1)
|
2009-08-18 00:40:33 +00:00
|
|
|
ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
2009-02-21 08:41:09 +00:00
|
|
|
# Nothing. Win32 defaults to PIC and warns when given -fPIC
|
|
|
|
else
|
2009-08-18 00:40:33 +00:00
|
|
|
ifeq ($(HOST_OS),Darwin)
|
2009-02-26 07:44:16 +00:00
|
|
|
# Common symbols not allowed in dylib files
|
2009-02-21 08:41:09 +00:00
|
|
|
CXX.Flags += -fno-common
|
|
|
|
C.Flags += -fno-common
|
|
|
|
else
|
|
|
|
# Linux and others; pass -fPIC
|
|
|
|
CXX.Flags += -fPIC
|
|
|
|
C.Flags += -fPIC
|
|
|
|
endif
|
|
|
|
endif
|
2009-05-08 23:08:58 +00:00
|
|
|
else
|
2009-08-18 00:40:33 +00:00
|
|
|
ifeq ($(HOST_OS),Darwin)
|
2009-05-08 23:08:58 +00:00
|
|
|
CXX.Flags += -mdynamic-no-pic
|
|
|
|
C.Flags += -mdynamic-no-pic
|
|
|
|
endif
|
2006-12-16 22:07:52 +00:00
|
|
|
endif
|
|
|
|
|
2010-05-10 20:11:56 +00:00
|
|
|
# Support makefile variable to disable any kind of timestamp/non-deterministic
|
|
|
|
# info from being used in the build.
|
|
|
|
ifeq ($(ENABLE_TIMESTAMPS),1)
|
|
|
|
DOTDIR_TIMESTAMP_COMMAND := $(DATE)
|
|
|
|
else
|
|
|
|
DOTDIR_TIMESTAMP_COMMAND := echo 'Created.'
|
|
|
|
endif
|
|
|
|
|
2010-01-16 14:06:58 +00:00
|
|
|
ifeq ($(HOST_OS),MingW)
|
|
|
|
# Work around PR4957
|
|
|
|
CPP.Defines += -D__NO_CTYPE_INLINE
|
|
|
|
ifeq ($(LLVM_CROSS_COMPILING),1)
|
|
|
|
# Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
|
|
|
|
ifdef TOOLNAME
|
|
|
|
LD.Flags += -Wl,--allow-multiple-definition
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2011-04-09 06:01:28 +00:00
|
|
|
CXX.Flags += -Woverloaded-virtual
|
2007-06-28 19:36:08 +00:00
|
|
|
CPP.BaseFlags += $(CPP.Defines)
|
2006-03-22 15:59:55 +00:00
|
|
|
AR.Flags := cru
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2006-07-27 18:19:51 +00:00
|
|
|
# Make Floating point IEEE compliant on Alpha.
|
2005-02-13 03:41:10 +00:00
|
|
|
ifeq ($(ARCH),Alpha)
|
2006-12-16 22:07:52 +00:00
|
|
|
CXX.Flags += -mieee
|
|
|
|
CPP.BaseFlags += -mieee
|
|
|
|
ifeq ($(ENABLE_PIC),0)
|
|
|
|
CXX.Flags += -fPIC
|
|
|
|
CPP.BaseFlags += -fPIC
|
|
|
|
endif
|
2005-02-13 03:41:10 +00:00
|
|
|
|
2007-01-26 13:34:50 +00:00
|
|
|
LD.Flags += -Wl,--no-relax
|
|
|
|
endif
|
|
|
|
|
2010-11-26 09:32:02 +00:00
|
|
|
# GNU ld/PECOFF accepts but ignores them below;
|
|
|
|
# --version-script
|
|
|
|
# --export-dynamic
|
|
|
|
# --rpath
|
|
|
|
# FIXME: autoconf should be aware of them.
|
|
|
|
ifneq (,$(filter $(HOST_OS),Cygwin MingW))
|
|
|
|
HAVE_LINK_VERSION_SCRIPT := 0
|
|
|
|
RPATH :=
|
|
|
|
RDYNAMIC := -Wl,--export-all-symbols
|
|
|
|
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
|
|
|
#--------------------------------------------------------------------
|
2008-10-02 22:56:44 +00:00
|
|
|
TargetMode :=
|
|
|
|
ifeq ($(LLVM_CROSS_COMPILING),1)
|
2008-11-10 07:33:13 +00:00
|
|
|
BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
|
2008-10-02 22:56:44 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
|
2008-11-10 07:33:13 +00:00
|
|
|
ObjDir := $(ObjRootDir)
|
|
|
|
LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
|
|
|
|
ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
|
|
|
|
ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
|
|
|
|
LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
|
|
|
|
LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
|
|
|
|
LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2010-08-17 19:03:03 +00:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Locations of shared libraries
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
|
|
|
SharedPrefix := lib
|
|
|
|
SharedLibDir := $(LibDir)
|
|
|
|
LLVMSharedLibDir := $(LLVMLibDir)
|
|
|
|
|
|
|
|
# Win32.DLL prefers to be located on the "PATH" of binaries.
|
|
|
|
ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
|
|
|
SharedLibDir := $(ToolDir)
|
|
|
|
LLVMSharedLibDir := $(LLVMToolDir)
|
|
|
|
|
|
|
|
ifeq ($(HOST_OS),Cygwin)
|
|
|
|
SharedPrefix := cyg
|
|
|
|
else
|
|
|
|
SharedPrefix :=
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
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
|
|
|
#--------------------------------------------------------------------
|
2011-11-11 22:59:45 +00:00
|
|
|
EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
|
|
|
|
ifdef BUILD_DIRS_ONLY
|
|
|
|
EchoCmd := $(EchoCmd) "(build tools)":
|
|
|
|
endif
|
|
|
|
|
|
|
|
Echo := @$(EchoCmd)
|
2004-10-30 09:19:36 +00:00
|
|
|
ifndef LLVMAS
|
|
|
|
LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
|
|
|
|
endif
|
2011-10-06 01:51:51 +00:00
|
|
|
ifndef LLVM_TBLGEN
|
2006-07-26 21:14:56 +00:00
|
|
|
ifeq ($(LLVM_CROSS_COMPILING),1)
|
2011-10-06 01:51:51 +00:00
|
|
|
LLVM_TBLGEN := $(BuildLLVMToolDir)/llvm-tblgen$(BUILD_EXEEXT)
|
2006-07-26 21:14:56 +00:00
|
|
|
else
|
2011-10-06 01:51:51 +00:00
|
|
|
LLVM_TBLGEN := $(LLVMToolDir)/llvm-tblgen$(EXEEXT)
|
2006-07-26 21:14:56 +00:00
|
|
|
endif
|
2004-10-30 09:19:36 +00:00
|
|
|
endif
|
2011-11-14 17:17:45 +00:00
|
|
|
ifeq ($(LLVM_CROSS_COMPILING),1)
|
2011-12-01 20:18:09 +00:00
|
|
|
LLVM_CONFIG := $(BuildLLVMToolDir)/llvm-config$(BUILD_EXEEXT)
|
2011-11-14 17:17:45 +00:00
|
|
|
else
|
2011-12-01 20:18:09 +00:00
|
|
|
LLVM_CONFIG := $(LLVMToolDir)/llvm-config$(EXEEXT)
|
2011-11-14 17:17:45 +00:00
|
|
|
endif
|
2006-09-04 05:23:20 +00:00
|
|
|
ifndef LLVMDIS
|
2012-08-28 01:17:46 +00:00
|
|
|
LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
|
2004-12-13 17:44:14 +00:00
|
|
|
endif
|
|
|
|
ifndef LLI
|
2012-08-28 01:17:46 +00:00
|
|
|
LLI := $(LLVMToolDir)/lli$(EXEEXT)
|
2004-12-13 17:44:14 +00:00
|
|
|
endif
|
2005-02-27 10:21:37 +00:00
|
|
|
ifndef LLC
|
2012-08-28 01:17:46 +00:00
|
|
|
LLC := $(LLVMToolDir)/llc$(EXEEXT)
|
2005-02-27 10:21:37 +00:00
|
|
|
endif
|
2004-12-13 17:44:14 +00:00
|
|
|
ifndef LOPT
|
2012-08-28 01:17:46 +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
|
2012-08-28 01:17:46 +00:00
|
|
|
LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
|
2005-02-02 00:40:15 +00:00
|
|
|
endif
|
2012-05-23 20:34:19 +00:00
|
|
|
ifndef LLVMLINK
|
2012-08-28 01:17:46 +00:00
|
|
|
LLVMLINK := $(LLVMToolDir)/llvm-link$(EXEEXT)
|
2012-05-23 20:34:19 +00:00
|
|
|
endif
|
2006-12-03 21:01:45 +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
|
|
|
|
2009-08-18 00:40:33 +00:00
|
|
|
ifeq ($(HOST_OS),Darwin)
|
2012-10-12 21:48:14 +00:00
|
|
|
ifdef MACOSX_DEPLOYMENT_TARGET
|
|
|
|
DARWIN_VERSION := $(MACOSX_DEPLOYMENT_TARGET)
|
|
|
|
else
|
2009-03-12 21:03:53 +00:00
|
|
|
DARWIN_VERSION := `sw_vers -productVersion`
|
2012-10-12 21:48:14 +00:00
|
|
|
endif
|
2009-03-12 21:03:53 +00:00
|
|
|
# Strip a number like 10.4.7 to 10.4
|
2013-11-14 18:31:30 +00:00
|
|
|
DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]+).*/\1/')
|
2009-03-12 21:03:53 +00:00
|
|
|
# Get "4" out of 10.4 for later pieces in the makefile.
|
2013-11-14 18:31:30 +00:00
|
|
|
DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]+).*/\1/')
|
2009-03-22 08:28:45 +00:00
|
|
|
|
2010-12-08 01:48:05 +00:00
|
|
|
LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
|
|
|
|
SharedLinkOptions := -dynamiclib
|
2013-02-05 17:29:03 +00:00
|
|
|
ifdef DEPLOYMENT_TARGET
|
|
|
|
SharedLinkOptions += $(DEPLOYMENT_TARGET)
|
|
|
|
else
|
|
|
|
ifneq ($(ARCH),ARM)
|
|
|
|
SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
|
|
|
|
endif
|
2009-09-08 18:52:20 +00:00
|
|
|
endif
|
2009-03-12 21:03:53 +00:00
|
|
|
else
|
2010-08-17 19:03:03 +00:00
|
|
|
SharedLinkOptions=-shared
|
2009-03-12 21:03:53 +00:00
|
|
|
endif
|
|
|
|
|
2009-08-18 00:40:33 +00:00
|
|
|
ifeq ($(TARGET_OS),Darwin)
|
2013-02-05 17:29:03 +00:00
|
|
|
ifdef DEPLOYMENT_TARGET
|
|
|
|
TargetCommonOpts += $(DEPLOYMENT_TARGET)
|
|
|
|
else
|
|
|
|
ifneq ($(ARCH),ARM)
|
|
|
|
TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
|
|
|
|
endif
|
2009-09-08 18:52:20 +00:00
|
|
|
endif
|
2009-08-18 00:40:33 +00:00
|
|
|
endif
|
|
|
|
|
2005-01-11 04:31:07 +00:00
|
|
|
ifdef SHARED_LIBRARY
|
2010-08-17 19:03:03 +00:00
|
|
|
ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
2010-05-16 03:05:14 +00:00
|
|
|
ifneq ($(HOST_OS),Darwin)
|
|
|
|
LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
|
2014-02-28 13:48:03 +00:00
|
|
|
else
|
|
|
|
LD.Flags += -Wl,-install_name -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
|
2003-07-31 20:58:51 +00:00
|
|
|
endif
|
2009-03-12 21:03:53 +00:00
|
|
|
endif
|
2010-05-16 03:05:14 +00:00
|
|
|
endif
|
2003-07-31 20:58:51 +00:00
|
|
|
|
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 := @
|
2007-07-23 08:20:46 +00:00
|
|
|
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
|
2009-01-08 02:11:55 +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)"
|
2011-10-26 02:28:32 +00:00
|
|
|
Install.StripFlag += -s
|
2002-09-18 11:55:13 +00:00
|
|
|
endif
|
|
|
|
|
2013-12-27 22:38:59 +00:00
|
|
|
# By default, strip dead symbols at link time
|
|
|
|
ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
|
|
|
ifneq ($(HOST_OS),Darwin)
|
2014-01-03 22:18:43 +00:00
|
|
|
ifneq ($(HOST_ARCH),Mips)
|
2013-12-27 22:38:59 +00:00
|
|
|
CXX.Flags += -ffunction-sections -fdata-sections
|
|
|
|
endif
|
|
|
|
endif
|
2014-01-03 22:18:43 +00:00
|
|
|
endif
|
2013-12-27 22:38:59 +00:00
|
|
|
ifndef NO_DEAD_STRIP
|
|
|
|
ifeq ($(HOST_OS),Darwin)
|
|
|
|
LD.Flags += -Wl,-dead_strip
|
|
|
|
else
|
|
|
|
ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
|
|
|
LD.Flags += -Wl,--gc-sections
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
# Adjust linker flags for building an executable
|
2010-08-02 03:16:19 +00:00
|
|
|
ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
2013-08-04 22:06:11 +00:00
|
|
|
ifndef TOOL_NO_EXPORTS
|
|
|
|
LD.Flags += $(RDYNAMIC)
|
|
|
|
endif
|
2012-10-05 00:22:46 +00:00
|
|
|
ifneq ($(HOST_OS), Darwin)
|
|
|
|
ifdef TOOLNAME
|
2013-08-04 22:06:11 +00:00
|
|
|
LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
|
2013-05-23 02:38:50 +00:00
|
|
|
endif
|
|
|
|
else
|
|
|
|
ifneq ($(DARWIN_MAJVERS),4)
|
|
|
|
LD.Flags += $(RPATH) -Wl,@executable_path/../lib
|
|
|
|
endif
|
|
|
|
ifeq ($(RC_XBS),YES)
|
|
|
|
TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)
|
|
|
|
LD.Flags += -Wl,-object_path_lto -Wl,$(TempFile)
|
2012-10-05 00:22:46 +00:00
|
|
|
endif
|
2010-02-25 06:34:33 +00:00
|
|
|
endif
|
2010-08-02 03:16:19 +00:00
|
|
|
endif
|
2010-07-15 06:36:57 +00:00
|
|
|
|
2009-02-26 07:44:16 +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
|
|
|
|
2011-06-16 22:30:38 +00:00
|
|
|
ifdef EXTRA_LD_OPTIONS
|
|
|
|
LD.Flags += $(EXTRA_LD_OPTIONS)
|
|
|
|
endif
|
|
|
|
|
2009-05-12 07:26:49 +00:00
|
|
|
ifndef NO_PEDANTIC
|
2013-03-15 00:43:00 +00:00
|
|
|
CompileCommonOpts += -pedantic -Wno-long-long
|
2009-05-12 07:26:49 +00:00
|
|
|
endif
|
2009-06-19 12:40:30 +00:00
|
|
|
CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
|
2013-01-09 22:11:13 +00:00
|
|
|
$(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT) \
|
2013-01-18 23:22:52 +00:00
|
|
|
$(NO_UNINITIALIZED) $(NO_MAYBE_UNINITIALIZED) \
|
|
|
|
$(NO_MISSING_FIELD_INITIALIZERS)
|
2010-04-19 18:33:28 +00:00
|
|
|
# Enable cast-qual for C++; the workaround is to use const_cast.
|
2013-05-14 21:52:01 +00:00
|
|
|
CXX.Flags += -Wcast-qual
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2009-08-18 00:40:33 +00:00
|
|
|
ifeq ($(HOST_OS),HP-UX)
|
2006-02-15 03:20:16 +00:00
|
|
|
CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
|
2005-05-16 06:38:09 +00:00
|
|
|
endif
|
|
|
|
|
2014-03-07 18:08:54 +00:00
|
|
|
# If we are building a universal binary on Mac OS X, pass extra options. This
|
2006-05-30 16:38:06 +00:00
|
|
|
# is useful to people that want to link the LLVM libraries into their universal
|
2006-06-29 19:38:04 +00:00
|
|
|
# apps.
|
|
|
|
#
|
|
|
|
# The following can be optionally specified:
|
|
|
|
# UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
|
2014-03-07 18:08:54 +00:00
|
|
|
# For Mac OS X 10.4 Intel machines, the traditional one is:
|
2006-06-29 19:38:04 +00:00
|
|
|
# UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
|
|
|
|
# UNIVERSAL_ARCH can be optionally specified to be a list of architectures
|
|
|
|
# to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to
|
|
|
|
# i386/ppc only.
|
2006-04-06 06:30:15 +00:00
|
|
|
ifdef UNIVERSAL
|
2006-06-29 19:38:04 +00:00
|
|
|
ifndef UNIVERSAL_ARCH
|
|
|
|
UNIVERSAL_ARCH := i386 ppc
|
|
|
|
endif
|
|
|
|
UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
|
2013-06-24 23:20:04 +00:00
|
|
|
TargetCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
|
2006-06-16 21:47:59 +00:00
|
|
|
ifdef UNIVERSAL_SDK_PATH
|
2013-06-24 23:20:04 +00:00
|
|
|
TargetCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
|
2006-06-16 21:47:59 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Building universal cannot compute dependencies automatically.
|
2006-04-06 06:30:15 +00:00
|
|
|
DISABLE_AUTO_DEPENDENCIES=1
|
2009-03-09 18:28:37 +00:00
|
|
|
else
|
2009-08-18 00:40:33 +00:00
|
|
|
ifeq ($(TARGET_OS),Darwin)
|
2009-03-12 04:10:09 +00:00
|
|
|
ifeq ($(ARCH),x86_64)
|
2009-03-23 03:45:56 +00:00
|
|
|
TargetCommonOpts = -m64
|
2009-03-12 04:10:09 +00:00
|
|
|
else
|
|
|
|
ifeq ($(ARCH),x86)
|
2009-03-23 03:45:56 +00:00
|
|
|
TargetCommonOpts = -m32
|
2009-03-12 04:10:09 +00:00
|
|
|
endif
|
2009-03-09 18:28:37 +00:00
|
|
|
endif
|
|
|
|
endif
|
2006-04-06 06:30:15 +00:00
|
|
|
endif
|
|
|
|
|
2009-08-18 00:40:33 +00:00
|
|
|
ifeq ($(HOST_OS),SunOS)
|
2010-11-29 18:16:10 +00:00
|
|
|
CPP.BaseFlags += -include llvm/Support/Solaris.h
|
2008-06-24 17:44:42 +00:00
|
|
|
endif
|
|
|
|
|
2009-10-14 05:55:03 +00:00
|
|
|
ifeq ($(HOST_OS),AuroraUX)
|
2010-11-29 18:16:10 +00:00
|
|
|
CPP.BaseFlags += -include llvm/Support/Solaris.h
|
2009-10-14 05:55:03 +00:00
|
|
|
endif # !HOST_OS - AuroraUX.
|
|
|
|
|
2012-02-18 10:03:19 +00:00
|
|
|
# On Windows, SharedLibDir != LibDir. The order is important.
|
|
|
|
ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
|
|
|
LD.Flags += -L$(SharedLibDir) -L$(LibDir) -L$(LLVMToolDir) -L$(LLVMLibDir)
|
|
|
|
else
|
|
|
|
LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
|
|
|
|
endif
|
|
|
|
|
2011-10-11 12:51:44 +00:00
|
|
|
CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
|
2006-03-22 15:59:55 +00:00
|
|
|
# All -I flags should go here, so that they don't confuse llvm-config.
|
2008-01-28 17:38:30 +00:00
|
|
|
CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
|
|
|
|
$(patsubst %,-I%/include,\
|
2008-01-28 04:18:41 +00:00
|
|
|
$(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
|
|
|
|
$(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
|
|
|
|
$(CPP.BaseFlags)
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2011-11-03 21:01:32 +00:00
|
|
|
ifeq ($(INCLUDE_BUILD_DIR),1)
|
|
|
|
CPP.Flags += -I$(ObjDir)
|
|
|
|
endif
|
|
|
|
|
2011-04-11 22:37:39 +00:00
|
|
|
# SHOW_DIAGNOSTICS support.
|
|
|
|
ifeq ($(SHOW_DIAGNOSTICS),1)
|
|
|
|
Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
|
|
|
|
CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
|
|
|
|
else
|
|
|
|
Compile.Wrapper :=
|
|
|
|
endif
|
|
|
|
|
2011-11-11 22:59:42 +00:00
|
|
|
Compile.C = $(Compile.Wrapper) \
|
2012-08-03 17:45:31 +00:00
|
|
|
$(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
|
2011-11-11 22:59:42 +00:00
|
|
|
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
|
|
|
Compile.CXX = $(Compile.Wrapper) \
|
2012-08-03 17:45:31 +00:00
|
|
|
$(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
|
2011-11-11 22:59:42 +00:00
|
|
|
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
|
|
|
Preprocess.CXX= $(Compile.Wrapper) \
|
2012-08-03 17:45:31 +00:00
|
|
|
$(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
|
2011-11-11 22:59:42 +00:00
|
|
|
$(CompileCommonOpts) $(CXX.Flags) -E
|
|
|
|
Link = $(Compile.Wrapper) \
|
2013-06-27 06:09:14 +00:00
|
|
|
$(CXX) $(CXXFLAGS) $(LD.Flags) $(LDFLAGS) \
|
|
|
|
$(TargetCommonOpts) $(Strip)
|
2008-10-02 22:56:44 +00:00
|
|
|
|
2009-08-18 03:23:40 +00:00
|
|
|
Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
|
2009-03-23 03:45:56 +00:00
|
|
|
$(TargetCommonOpts) $(CompileCommonOpts) -E
|
2005-10-05 00:28:41 +00:00
|
|
|
|
2009-01-08 02:11:55 +00:00
|
|
|
ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
|
|
|
|
ScriptInstall = $(INSTALL) -m 0755
|
2005-02-24 07:12:43 +00:00
|
|
|
DataInstall = $(INSTALL) -m 0644
|
2008-01-15 23:27:40 +00:00
|
|
|
|
|
|
|
# When compiling under Mingw/Cygwin, the tblgen tool expects Windows
|
|
|
|
# paths. In this case, the SYSPATH function (defined in
|
|
|
|
# Makefile.config) transforms Unix paths into Windows paths.
|
2011-10-06 01:51:51 +00:00
|
|
|
TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
|
2009-01-09 16:31:01 +00:00
|
|
|
-I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
|
2008-01-15 23:27:40 +00:00
|
|
|
-I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
|
|
|
|
-I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
|
2011-10-06 01:51:51 +00:00
|
|
|
LLVMTableGen = $(LLVM_TBLGEN) $(TableGen.Flags)
|
2008-01-15 23:27:40 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
Archive = $(AR) $(AR.Flags)
|
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
|
|
|
|
2014-03-03 15:22:00 +00:00
|
|
|
AliasTool = ln -sf
|
2009-11-19 00:14:53 +00:00
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
#----------------------------------------------------------
|
2009-01-08 02:11:55 +00:00
|
|
|
# Get the list of source files and compute object file
|
|
|
|
# names from them.
|
2004-10-23 20:04:14 +00:00
|
|
|
#----------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2006-01-27 22:13:12 +00:00
|
|
|
ifndef SOURCES
|
|
|
|
Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
|
2009-01-02 07:16:45 +00:00
|
|
|
$(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
|
2006-01-27 22:13:12 +00:00
|
|
|
else
|
|
|
|
Sources := $(SOURCES)
|
2009-01-08 02:11:55 +00:00
|
|
|
endif
|
2001-07-15 13:16:47 +00:00
|
|
|
|
2006-01-27 22:13:12 +00:00
|
|
|
ifdef BUILT_SOURCES
|
2009-01-02 07:16:45 +00:00
|
|
|
Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
|
2004-12-04 22:34:09 +00:00
|
|
|
endif
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2006-01-27 22:13:12 +00:00
|
|
|
BaseNameSources := $(sort $(basename $(Sources)))
|
2013-11-14 23:51:29 +00:00
|
|
|
SourceDirs := $(sort $(dir $(Sources)))
|
2006-01-27 22:13:12 +00:00
|
|
|
|
|
|
|
ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
|
2013-11-14 23:51:29 +00:00
|
|
|
ObjectDirs := $(SourceDirs:%=$(ObjDir)/%)
|
2006-01-27 22:13:12 +00:00
|
|
|
|
2011-03-08 12:25:10 +00:00
|
|
|
#----------------------------------------------------------
|
|
|
|
# For Mingw MSYS bash and Python/w32:
|
|
|
|
#
|
|
|
|
# $(ECHOPATH) prints DOSish pathstring.
|
|
|
|
# ex) $(ECHOPATH) /include/sys/types.h
|
|
|
|
# --> C:/mingw/include/sys/types.h
|
|
|
|
# built-in "echo" does not transform path to DOSish path.
|
|
|
|
#
|
|
|
|
# FIXME: It would not be needed when MSYS's python
|
|
|
|
# were provided.
|
|
|
|
#----------------------------------------------------------
|
|
|
|
|
|
|
|
ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
|
2013-01-30 04:07:37 +00:00
|
|
|
ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
|
2011-03-08 12:25:10 +00:00
|
|
|
else
|
|
|
|
ECHOPATH := $(Verb)$(ECHO)
|
|
|
|
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
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
2010-03-04 20:56:19 +00:00
|
|
|
$(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
|
2009-01-22 03:24:22 +00:00
|
|
|
$(Verb) $(MKDIR) $@
|
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
|
2010-05-10 20:11:56 +00:00
|
|
|
$(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
|
2004-10-30 09:19:36 +00:00
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
.PRECIOUS: $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
|
2004-11-18 10:03:46 +00:00
|
|
|
.PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
|
2004-10-28 09:15:28 +00:00
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Collect the object directories (as there may be more
|
|
|
|
# than one if the source code is spread across
|
|
|
|
# subdirectories).
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
|
|
|
OBJECT_DIRS := $(ObjDir)/.dir $(ObjectDirs:%=%/.dir)
|
|
|
|
.PRECIOUS: $(OBJECT_DIRS)
|
|
|
|
|
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
|
|
|
#---------------------------------------------------------
|
|
|
|
|
2009-01-08 02:11:55 +00:00
|
|
|
SubDirs :=
|
2002-09-18 04:29:30 +00:00
|
|
|
ifdef DIRS
|
2004-10-30 09:19:36 +00:00
|
|
|
SubDirs += $(DIRS)
|
2006-07-26 20:22:26 +00:00
|
|
|
|
|
|
|
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
|
2004-10-30 09:19:36 +00:00
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(DIRS); do \
|
2010-06-08 20:10:13 +00:00
|
|
|
if ([ ! -f $$dir/Makefile ] || \
|
2010-06-18 00:35:32 +00:00
|
|
|
command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
|
2004-10-22 21:01:56 +00:00
|
|
|
$(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; \
|
2006-05-17 22:55:35 +00:00
|
|
|
($(MAKE) -C $$dir $@ ) || exit 1; \
|
2002-09-17 23:35:02 +00:00
|
|
|
done
|
2006-07-26 20:22:26 +00:00
|
|
|
else
|
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(DIRS); do \
|
|
|
|
($(MAKE) -C $$dir $@ ) || exit 1; \
|
|
|
|
done
|
|
|
|
endif
|
|
|
|
|
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 \
|
2010-06-08 20:10:13 +00:00
|
|
|
if ([ ! -f $$dir/Makefile ] || \
|
2010-06-18 00:35:32 +00:00
|
|
|
command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
|
2004-10-23 20:04:14 +00:00
|
|
|
$(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; \
|
2006-05-17 22:55:35 +00:00
|
|
|
($(MAKE) -C $$dir $@ ) || exit 0; \
|
2004-10-23 20:04:14 +00:00
|
|
|
done
|
|
|
|
endif
|
|
|
|
|
2009-01-24 00:00:41 +00:00
|
|
|
#-----------------------------------------------------------
|
|
|
|
# Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
|
|
|
|
#-----------------------------------------------------------
|
|
|
|
ifdef OPTIONAL_PARALLEL_DIRS
|
2011-10-16 02:54:19 +00:00
|
|
|
PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) -o -f $(T)/Makefile && echo "$(T)"))
|
2009-01-24 00:00:41 +00:00
|
|
|
endif
|
|
|
|
|
2005-12-21 23:17:06 +00:00
|
|
|
#-----------------------------------------------------------
|
2004-10-23 20:04:14 +00:00
|
|
|
# Handle the PARALLEL_DIRS options for parallel construction
|
2005-12-21 23:17:06 +00:00
|
|
|
#-----------------------------------------------------------
|
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))
|
2009-09-13 22:39:27 +00:00
|
|
|
unitcheck:: $(addsuffix /.makeunitcheck,$(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) :
|
2011-10-16 02:54:19 +00:00
|
|
|
$(Verb) \
|
|
|
|
SD=$(PROJ_SRC_DIR)/$(@D); \
|
|
|
|
DD=$(@D); \
|
|
|
|
if [ ! -f $$SD/Makefile ]; then \
|
|
|
|
SD=$(@D); \
|
|
|
|
DD=$(notdir $(@D)); \
|
|
|
|
fi; \
|
|
|
|
if ([ ! -f $$DD/Makefile ] || \
|
|
|
|
command test $$DD/Makefile -ot \
|
|
|
|
$$SD/Makefile ); then \
|
|
|
|
$(MKDIR) $$DD; \
|
|
|
|
$(CP) $$SD/Makefile $$DD/Makefile; \
|
2003-11-25 19:32:22 +00:00
|
|
|
fi; \
|
2011-10-16 02:54:19 +00:00
|
|
|
$(MAKE) -C $$DD $(subst $(@D)/.make,,$@)
|
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
|
|
|
|
2006-07-26 20:22:26 +00:00
|
|
|
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
|
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\
|
2010-06-08 20:10:13 +00:00
|
|
|
if ([ ! -f $$dir/Makefile ] || \
|
2010-06-18 00:35:32 +00:00
|
|
|
command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
|
2004-10-22 21:01:56 +00:00
|
|
|
$(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; \
|
2006-05-17 22:55:35 +00:00
|
|
|
($(MAKE) -C$$dir $@ ) || exit 1; \
|
2004-10-22 21:01:56 +00:00
|
|
|
fi \
|
2003-06-27 16:58:44 +00:00
|
|
|
done
|
2006-07-26 20:22:26 +00:00
|
|
|
else
|
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(OPTIONAL_DIRS); do \
|
2011-02-20 03:51:07 +00:00
|
|
|
if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
|
|
|
|
($(MAKE) -C$$dir $@ ) || exit 1; \
|
|
|
|
fi \
|
2006-07-26 20:22:26 +00:00
|
|
|
done
|
|
|
|
endif
|
2003-06-27 16:58:44 +00:00
|
|
|
endif
|
|
|
|
|
2004-08-20 09:20:05 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle the CONFIG_FILES options
|
|
|
|
#---------------------------------------------------------
|
|
|
|
ifdef CONFIG_FILES
|
|
|
|
|
2007-02-06 18:53:14 +00:00
|
|
|
ifdef NO_INSTALL
|
|
|
|
install-local::
|
|
|
|
$(Echo) Install circumvented with NO_INSTALL
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) UnInstall circumvented with NO_INSTALL
|
|
|
|
else
|
2010-03-04 20:56:19 +00:00
|
|
|
install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
|
|
|
|
$(Echo) Installing Configuration Files To $(DESTDIR)$(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 \
|
2010-03-04 20:56:19 +00:00
|
|
|
$(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
|
2005-01-16 02:20:54 +00:00
|
|
|
elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
|
2010-03-04 20:56:19 +00:00
|
|
|
$(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(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::
|
2010-03-04 20:56:19 +00:00
|
|
|
$(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb)for file in $(CONFIG_FILES); do \
|
2010-03-04 20:56:19 +00:00
|
|
|
$(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
|
2004-10-24 07:53:21 +00:00
|
|
|
done
|
2007-02-06 18:53:14 +00:00
|
|
|
endif
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-08-20 09:20:05 +00:00
|
|
|
endif
|
|
|
|
|
2005-05-19 00:37:31 +00:00
|
|
|
###############################################################################
|
2010-06-21 23:49:08 +00:00
|
|
|
# Set up variables for building libraries
|
2005-05-19 00:37:31 +00:00
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Define various command line options pertaining to the
|
2009-01-08 02:11:55 +00:00
|
|
|
# libraries needed when linking. There are "Proj" libs
|
|
|
|
# (defined by the user's project) and "LLVM" libs (defined
|
2006-09-04 04:47:21 +00:00
|
|
|
# by the LLVM project).
|
2005-05-19 00:37:31 +00:00
|
|
|
#---------------------------------------------------------
|
2005-08-13 05:09:50 +00:00
|
|
|
|
2006-09-04 04:47:21 +00:00
|
|
|
ifdef USEDLIBS
|
2005-05-19 00:37:31 +00:00
|
|
|
ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
|
|
|
|
ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
|
2006-09-04 04:47:21 +00:00
|
|
|
ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
|
|
|
|
ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef LLVMLIBS
|
2005-05-19 00:37:31 +00:00
|
|
|
LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
|
|
|
|
LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
|
|
|
|
LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
|
|
|
|
LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
|
2006-09-04 04:47:21 +00:00
|
|
|
endif
|
|
|
|
|
2010-09-10 06:27:02 +00:00
|
|
|
# Loadable module for Win32 requires all symbols resolved for linking.
|
|
|
|
# Then all symbols in LLVM.dll will be available.
|
|
|
|
ifeq ($(ENABLE_SHARED),1)
|
2010-08-17 19:03:03 +00:00
|
|
|
ifdef LOADABLE_MODULE
|
2010-09-10 06:27:02 +00:00
|
|
|
ifneq (,$(filter $(HOST_OS),Cygwin MingW))
|
|
|
|
LINK_COMPONENTS += all
|
|
|
|
endif
|
2010-08-17 19:03:03 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2008-10-03 19:11:19 +00:00
|
|
|
ifndef IS_CLEANING_TARGET
|
2006-09-04 04:47:21 +00:00
|
|
|
ifdef LINK_COMPONENTS
|
2006-09-04 05:23:20 +00:00
|
|
|
|
|
|
|
# If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
|
|
|
|
# clean in tools, then do a make in tools (instead of at the top level).
|
|
|
|
$(LLVM_CONFIG):
|
|
|
|
@echo "*** llvm-config doesn't exist - rebuilding it."
|
|
|
|
@$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
|
2008-02-27 13:34:15 +00:00
|
|
|
|
2006-09-04 05:23:20 +00:00
|
|
|
$(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
|
|
|
|
|
2010-02-25 06:34:33 +00:00
|
|
|
ifeq ($(ENABLE_SHARED), 1)
|
2010-08-17 19:03:03 +00:00
|
|
|
# We can take the "auto-import" feature to get rid of using dllimport.
|
|
|
|
ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
|
|
|
LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
|
|
|
|
-L $(SharedLibDir)
|
|
|
|
endif
|
2010-02-25 06:34:33 +00:00
|
|
|
LLVMLibsOptions += -lLLVM-$(LLVMVersion)
|
2010-08-17 19:03:03 +00:00
|
|
|
LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT)
|
2010-02-25 06:34:33 +00:00
|
|
|
else
|
2010-09-01 16:11:17 +00:00
|
|
|
|
|
|
|
ifndef NO_LLVM_CONFIG
|
|
|
|
LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
|
|
|
|
ifeq ($(LLVMConfigLibs),Error)
|
|
|
|
$(error llvm-config --libs failed)
|
|
|
|
endif
|
|
|
|
LLVMLibsOptions += $(LLVMConfigLibs)
|
|
|
|
LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
|
|
|
|
ifeq ($(LLVMConfigLibfiles),Error)
|
|
|
|
$(error llvm-config --libfiles failed)
|
|
|
|
endif
|
|
|
|
LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
|
|
|
|
endif
|
|
|
|
|
2006-09-04 04:47:21 +00:00
|
|
|
endif
|
2006-09-04 04:50:10 +00:00
|
|
|
endif
|
2010-02-25 06:34:33 +00:00
|
|
|
endif
|
2005-05-19 00:37:31 +00:00
|
|
|
|
2010-04-15 20:54:25 +00:00
|
|
|
# Set up the library exports file.
|
|
|
|
ifdef EXPORTED_SYMBOL_FILE
|
|
|
|
|
|
|
|
# First, set up the native export file, which may differ from the source
|
|
|
|
# export file.
|
|
|
|
|
|
|
|
ifeq ($(HOST_OS),Darwin)
|
|
|
|
# Darwin convention prefixes symbols with underscores.
|
2010-04-15 23:08:00 +00:00
|
|
|
NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
|
2010-04-15 22:46:27 +00:00
|
|
|
$(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
|
2010-06-01 17:08:56 +00:00
|
|
|
$(Verb) sed -e 's/^/_/' < $< > $@
|
2010-04-15 20:54:25 +00:00
|
|
|
clean-local::
|
|
|
|
-$(Verb) $(RM) -f $(NativeExportsFile)
|
|
|
|
else
|
2010-06-01 14:56:56 +00:00
|
|
|
ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
|
|
|
|
# Gold and BFD ld require a version script rather than a plain list.
|
|
|
|
NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
|
|
|
|
$(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
|
|
|
|
$(Verb) echo "{" > $@
|
2012-03-12 20:58:14 +00:00
|
|
|
$(Verb) grep -q '[[:alnum:]_]' $< && echo " global:" >> $@ || :
|
2010-06-01 17:08:56 +00:00
|
|
|
$(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@
|
2011-02-21 18:38:56 +00:00
|
|
|
ifneq ($(HOST_OS),OpenBSD)
|
2010-06-01 14:56:56 +00:00
|
|
|
$(Verb) echo " local: *;" >> $@
|
2011-02-21 18:38:56 +00:00
|
|
|
endif
|
2010-06-01 14:56:56 +00:00
|
|
|
$(Verb) echo "};" >> $@
|
|
|
|
clean-local::
|
|
|
|
-$(Verb) $(RM) -f $(NativeExportsFile)
|
|
|
|
else
|
2010-08-17 19:03:03 +00:00
|
|
|
ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
2010-09-03 17:29:33 +00:00
|
|
|
# GNU ld Win32 accepts .DEF files that contain "DATA" entries.
|
2010-08-17 19:03:03 +00:00
|
|
|
NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
|
|
|
|
$(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
|
|
|
|
$(Echo) Generating $(notdir $@)
|
|
|
|
$(Verb) $(ECHO) "EXPORTS" > $@
|
|
|
|
$(Verb) $(CAT) $< >> $@
|
|
|
|
clean-local::
|
|
|
|
-$(Verb) $(RM) -f $(NativeExportsFile)
|
|
|
|
else
|
2010-09-03 17:29:33 +00:00
|
|
|
# Default behavior: just use the exports file verbatim.
|
|
|
|
NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Now add the linker command-line options to use the native export file.
|
|
|
|
|
|
|
|
# Darwin
|
|
|
|
ifeq ($(HOST_OS),Darwin)
|
|
|
|
LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
|
|
|
|
endif
|
2010-08-17 19:03:03 +00:00
|
|
|
|
2010-04-16 22:58:15 +00:00
|
|
|
# gold, bfd ld, etc.
|
2010-06-01 14:56:56 +00:00
|
|
|
ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
|
|
|
|
LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
|
2010-04-15 20:54:25 +00:00
|
|
|
endif
|
|
|
|
|
2010-09-03 17:29:33 +00:00
|
|
|
# Windows
|
|
|
|
ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
|
|
|
# LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
|
|
|
|
SharedLinkOptions += $(NativeExportsFile)
|
2010-04-15 20:54:25 +00:00
|
|
|
endif
|
|
|
|
|
2010-08-17 19:03:03 +00:00
|
|
|
endif
|
|
|
|
|
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-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
|
|
|
|
2009-08-17 15:31:24 +00:00
|
|
|
# Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
|
2002-09-16 22:34:56 +00:00
|
|
|
LIBRARYNAME := $(strip $(LIBRARYNAME))
|
2014-03-03 15:22:00 +00:00
|
|
|
LIBRARYALIASNAME := $(strip $(LIBRARYALIASNAME))
|
2005-01-11 04:31:07 +00:00
|
|
|
ifdef LOADABLE_MODULE
|
2011-02-03 22:01:15 +00:00
|
|
|
BaseLibName.A := $(LIBRARYNAME).a
|
|
|
|
BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
|
2014-03-03 15:22:00 +00:00
|
|
|
BaseAliasName.SO := $(LIBRARYALIASNAME)$(SHLIBEXT)
|
2005-01-11 04:31:07 +00:00
|
|
|
else
|
2011-02-03 22:01:15 +00:00
|
|
|
BaseLibName.A := lib$(LIBRARYNAME).a
|
|
|
|
BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
|
2014-03-03 15:22:00 +00:00
|
|
|
BaseAliasName.SO := $(SharedPrefix)$(LIBRARYALIASNAME)$(SHLIBEXT)
|
2009-02-26 07:44:16 +00:00
|
|
|
endif
|
2011-02-03 22:01:15 +00:00
|
|
|
LibName.A := $(LibDir)/$(BaseLibName.A)
|
|
|
|
LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
|
2014-03-03 15:22:00 +00:00
|
|
|
AliasName.SO := $(SharedLibDir)/$(BaseAliasName.SO)
|
2004-10-30 09:19:36 +00:00
|
|
|
LibName.O := $(LibDir)/$(LIBRARYNAME).o
|
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
|
|
|
|
2009-02-26 07:44:16 +00:00
|
|
|
all-local:: $(LibName.SO)
|
2002-08-02 18:34:12 +00:00
|
|
|
|
2010-04-15 20:54:25 +00:00
|
|
|
ifdef EXPORTED_SYMBOL_FILE
|
|
|
|
$(LibName.SO): $(NativeExportsFile)
|
|
|
|
endif
|
|
|
|
|
2005-05-19 00:37:31 +00:00
|
|
|
ifdef LINK_LIBS_IN_SHARED
|
2006-08-07 23:12:15 +00:00
|
|
|
ifdef LOADABLE_MODULE
|
2006-11-15 21:04:15 +00:00
|
|
|
SharedLibKindMessage := "Loadable Module"
|
2010-12-08 01:48:05 +00:00
|
|
|
SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
|
2006-08-07 23:12:15 +00:00
|
|
|
else
|
|
|
|
SharedLibKindMessage := "Shared Library"
|
|
|
|
endif
|
2010-08-17 19:03:03 +00:00
|
|
|
$(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
|
2006-08-07 23:12:15 +00:00
|
|
|
$(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
|
2010-07-26 20:15:47 +00:00
|
|
|
$(notdir $@)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
|
2009-05-26 19:11:47 +00:00
|
|
|
$(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
|
2005-05-19 00:37:31 +00:00
|
|
|
else
|
2010-08-17 19:03:03 +00:00
|
|
|
$(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
|
2010-07-26 20:15:47 +00:00
|
|
|
$(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
|
2005-05-19 00:37:31 +00:00
|
|
|
endif
|
2004-10-23 20:04:14 +00:00
|
|
|
|
|
|
|
clean-local::
|
2009-02-26 07:44:16 +00:00
|
|
|
ifneq ($(strip $(LibName.SO)),)
|
|
|
|
-$(Verb) $(RM) -f $(LibName.SO)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
|
|
|
|
2007-02-06 18:53:14 +00:00
|
|
|
ifdef NO_INSTALL
|
|
|
|
install-local::
|
|
|
|
$(Echo) Install circumvented with NO_INSTALL
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstall circumvented with NO_INSTALL
|
|
|
|
else
|
2010-05-16 03:13:23 +00:00
|
|
|
|
2010-08-17 19:03:03 +00:00
|
|
|
# Win32.DLL prefers to be located on the "PATH" of binaries.
|
|
|
|
ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
|
|
|
DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
|
2010-05-16 03:13:23 +00:00
|
|
|
else
|
2010-08-17 19:03:03 +00:00
|
|
|
DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
|
2010-05-16 03:13:23 +00:00
|
|
|
endif
|
2011-02-03 22:01:15 +00:00
|
|
|
DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
|
2014-03-03 15:22:00 +00:00
|
|
|
DestSharedAlias := $(DestSharedLibDir)/$(BaseAliasName.SO)
|
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
|
|
|
|
2010-08-17 19:03:03 +00:00
|
|
|
$(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
|
2014-03-03 15:22:00 +00:00
|
|
|
ifdef SHARED_ALIAS
|
|
|
|
$(Echo) Creating alias from $(DestSharedLib) to $(DestSharedAlias)
|
|
|
|
$(Verb) $(AliasTool) $(DestSharedLib) $(DestSharedAlias)
|
|
|
|
endif
|
2002-07-23 17:56:16 +00:00
|
|
|
|
2009-01-08 02:11:55 +00:00
|
|
|
uninstall-local::
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
|
2013-08-06 12:50:45 +00:00
|
|
|
-$(Verb) $(RM) -f $(DestSharedLib)
|
2007-02-06 18:53:14 +00:00
|
|
|
endif
|
2002-07-23 17:56:16 +00:00
|
|
|
endif
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
2009-06-16 23:00:42 +00:00
|
|
|
# Library Targets:
|
|
|
|
# If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
|
|
|
|
# building an archive.
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
2010-02-25 06:34:33 +00:00
|
|
|
ifndef NO_BUILD_ARCHIVE
|
2005-10-24 02:21:45 +00:00
|
|
|
ifndef BUILD_ARCHIVE
|
2009-06-16 23:00:42 +00:00
|
|
|
ifndef LOADABLE_MODULE
|
|
|
|
BUILD_ARCHIVE = 1
|
2007-02-06 18:53:14 +00:00
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
endif
|
2010-02-25 06:34:33 +00:00
|
|
|
endif
|
2003-12-18 20:57:48 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Archive Library Targets:
|
2009-01-08 02:11:55 +00:00
|
|
|
# If the user wanted a regular archive library built,
|
2004-10-30 09:19:36 +00:00
|
|
|
# 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 $@
|
2009-01-03 22:46:50 +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
|
|
|
|
|
2007-02-06 18:53:14 +00:00
|
|
|
ifdef NO_INSTALL
|
2010-04-30 20:04:53 +00:00
|
|
|
install-local::
|
|
|
|
$(Echo) Install circumvented with NO_INSTALL
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstall circumvented with NO_INSTALL
|
2010-04-30 22:00:17 +00:00
|
|
|
else
|
|
|
|
ifdef NO_INSTALL_ARCHIVES
|
2007-02-06 18:53:14 +00:00
|
|
|
install-local::
|
|
|
|
$(Echo) Install circumvented with NO_INSTALL
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstall circumvented with NO_INSTALL
|
|
|
|
else
|
2010-03-04 20:56:19 +00:00
|
|
|
DestArchiveLib := $(DESTDIR)$(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
|
|
|
|
2010-03-04 20:56:19 +00:00
|
|
|
$(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
|
2010-03-04 20:56:19 +00:00
|
|
|
$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Verb) $(INSTALL) $(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)
|
2007-02-06 18:53:14 +00:00
|
|
|
endif
|
2001-06-06 20:29:01 +00:00
|
|
|
endif
|
2010-04-30 22:00:17 +00:00
|
|
|
endif
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-24 07:53:21 +00:00
|
|
|
# endif LIBRARYNAME
|
2009-01-08 02:11:55 +00:00
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
|
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.
|
|
|
|
#---------------------------------------------------------
|
2009-11-19 00:14:53 +00:00
|
|
|
TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
|
2004-11-18 10:03:46 +00:00
|
|
|
ifdef EXAMPLE_TOOL
|
2009-11-19 00:14:53 +00:00
|
|
|
ToolBuildPath := $(ExmplDir)/$(TOOLEXENAME)
|
2004-11-18 10:03:46 +00:00
|
|
|
else
|
2009-11-19 00:14:53 +00:00
|
|
|
ToolBuildPath := $(ToolDir)/$(TOOLEXENAME)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# TOOLALIAS is a name to symlink (or copy) the tool to.
|
|
|
|
ifdef TOOLALIAS
|
|
|
|
ifdef EXAMPLE_TOOL
|
|
|
|
ToolAliasBuildPath := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
|
|
|
|
else
|
|
|
|
ToolAliasBuildPath := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
|
|
|
|
endif
|
2004-11-18 10:03:46 +00:00
|
|
|
endif
|
2003-05-29 16:18:20 +00:00
|
|
|
|
2009-02-26 17:47:49 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Prune Exports
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
|
|
|
# If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
|
|
|
|
# not exporting all of the weak symbols from the binary. This reduces dyld
|
|
|
|
# startup time by 4x on darwin in some cases.
|
|
|
|
ifdef TOOL_NO_EXPORTS
|
2009-08-18 00:40:33 +00:00
|
|
|
ifeq ($(HOST_OS),Darwin)
|
2009-03-10 17:15:56 +00:00
|
|
|
|
|
|
|
# Tiger tools don't support this.
|
|
|
|
ifneq ($(DARWIN_MAJVERS),4)
|
2010-04-16 22:58:15 +00:00
|
|
|
LD.Flags += -Wl,-exported_symbol,_main
|
2009-02-26 17:47:49 +00:00
|
|
|
endif
|
2009-03-10 17:15:56 +00:00
|
|
|
endif
|
2009-02-26 17:47:49 +00:00
|
|
|
|
2013-10-31 14:35:00 +00:00
|
|
|
ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux NetBSD FreeBSD GNU/kFreeBSD GNU))
|
2010-07-20 08:44:20 +00:00
|
|
|
ifneq ($(ARCH), Mips)
|
2009-10-25 03:22:00 +00:00
|
|
|
LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
|
2009-02-26 17:47:49 +00:00
|
|
|
endif
|
|
|
|
endif
|
2010-07-20 08:44:20 +00:00
|
|
|
endif
|
2009-02-26 17:47:49 +00:00
|
|
|
|
2010-09-16 00:42:32 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Tool Order File Support
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
|
|
|
ifeq ($(HOST_OS),Darwin)
|
2011-06-28 22:30:17 +00:00
|
|
|
ifdef TOOL_ORDER_FILE
|
2010-09-16 00:42:32 +00:00
|
|
|
|
|
|
|
LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
|
|
|
|
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2010-07-15 20:57:09 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Tool Version Info Support
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
|
|
|
ifeq ($(HOST_OS),Darwin)
|
|
|
|
ifdef TOOL_INFO_PLIST
|
|
|
|
|
|
|
|
LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
|
|
|
|
|
|
|
|
$(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
|
|
|
|
|
2010-07-15 21:51:52 +00:00
|
|
|
$(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
|
2010-07-15 20:57:09 +00:00
|
|
|
$(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
|
|
|
|
$(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
|
|
|
|
-e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
|
|
|
|
-e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
|
|
|
|
-e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
|
|
|
|
$< > $@
|
|
|
|
|
|
|
|
endif
|
|
|
|
endif
|
2009-02-26 17:47:49 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide targets for building the tools
|
|
|
|
#---------------------------------------------------------
|
2009-11-19 00:14:53 +00:00
|
|
|
all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
|
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
|
2009-11-19 00:14:53 +00:00
|
|
|
ifneq ($(strip $(ToolAliasBuildPath)),)
|
|
|
|
-$(Verb) $(RM) -f $(ToolAliasBuildPath)
|
|
|
|
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
|
|
|
|
|
2012-03-06 19:07:38 +00:00
|
|
|
ifdef CODESIGN_TOOLS
|
2013-04-25 01:17:54 +00:00
|
|
|
TOOL_CODESIGN_IDENTITY ?= -
|
|
|
|
|
2006-09-04 06:39:52 +00:00
|
|
|
$(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
|
2006-05-16 06:25:14 +00:00
|
|
|
$(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
|
2006-02-14 04:25:54 +00:00
|
|
|
$(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
|
2009-01-08 02:11:55 +00:00
|
|
|
$(StripWarnMsg)
|
2012-03-06 19:07:38 +00:00
|
|
|
$(Echo) ======= Code-Signing $(BuildMode) Executable $(TOOLNAME)
|
2013-04-25 01:17:54 +00:00
|
|
|
$(Verb) codesign -s $(TOOL_CODESIGN_IDENTITY) $@
|
2012-03-06 19:07:38 +00:00
|
|
|
else
|
|
|
|
$(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
|
|
|
|
$(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
|
|
|
|
$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
|
|
|
|
$(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
|
|
|
|
$(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
|
|
|
|
$(StripWarnMsg)
|
|
|
|
endif
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2009-11-19 00:14:53 +00:00
|
|
|
ifneq ($(strip $(ToolAliasBuildPath)),)
|
|
|
|
$(ToolAliasBuildPath): $(ToolBuildPath)
|
|
|
|
$(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
|
|
|
|
$(Verb) $(RM) -f $(ToolAliasBuildPath)
|
2012-10-04 00:47:59 +00:00
|
|
|
$(Verb) $(AliasTool) $(notdir $(ToolBuildPath)) $(ToolAliasBuildPath)
|
2010-08-18 01:35:53 +00:00
|
|
|
$(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
|
2009-11-19 00:14:53 +00:00
|
|
|
$(StripWarnMsg)
|
|
|
|
endif
|
|
|
|
|
2007-02-06 18:53:14 +00:00
|
|
|
ifdef NO_INSTALL
|
|
|
|
install-local::
|
|
|
|
$(Echo) Install circumvented with NO_INSTALL
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstall circumvented with NO_INSTALL
|
|
|
|
else
|
2011-11-28 07:59:52 +00:00
|
|
|
|
|
|
|
ifdef INTERNAL_TOOL
|
|
|
|
ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin
|
|
|
|
else
|
|
|
|
ToolBinDir = $(DESTDIR)$(PROJ_bindir)
|
|
|
|
endif
|
2012-10-01 18:40:32 +00:00
|
|
|
DestTool = $(ToolBinDir)/$(program_prefix)$(TOOLEXENAME)
|
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
|
|
|
|
2011-11-28 07:59:52 +00:00
|
|
|
$(DestTool): $(ToolBuildPath)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Installing $(BuildMode) $(DestTool)
|
2011-11-28 07:59:52 +00:00
|
|
|
$(Verb) $(MKDIR) $(ToolBinDir)
|
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)
|
2009-11-19 00:14:53 +00:00
|
|
|
|
|
|
|
# TOOLALIAS install.
|
|
|
|
ifdef TOOLALIAS
|
2012-10-01 18:40:32 +00:00
|
|
|
DestToolAlias = $(ToolBinDir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT)
|
2009-11-19 00:14:53 +00:00
|
|
|
|
|
|
|
install-local:: $(DestToolAlias)
|
|
|
|
|
2010-04-30 20:47:09 +00:00
|
|
|
$(DestToolAlias): $(DestTool)
|
2009-11-19 00:14:53 +00:00
|
|
|
$(Echo) Installing $(BuildMode) $(DestToolAlias)
|
|
|
|
$(Verb) $(RM) -f $(DestToolAlias)
|
2012-10-04 00:47:59 +00:00
|
|
|
$(Verb) $(AliasTool) $(notdir $(DestTool)) $(DestToolAlias)
|
2009-11-19 00:14:53 +00:00
|
|
|
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
|
|
|
|
-$(Verb) $(RM) -f $(DestToolAlias)
|
|
|
|
endif
|
|
|
|
|
2007-02-06 18:53:14 +00:00
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
###############################################################################
|
2009-01-08 02:11:55 +00:00
|
|
|
# Object Build Rules: Build object files based on sources
|
2004-10-30 09:19:36 +00:00
|
|
|
###############################################################################
|
|
|
|
|
2006-02-15 03:23:26 +00:00
|
|
|
# FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
|
2009-08-18 00:40:33 +00:00
|
|
|
ifeq ($(HOST_OS),HP-UX)
|
2006-02-15 03:23:26 +00:00
|
|
|
DISABLE_AUTO_DEPENDENCIES=1
|
|
|
|
endif
|
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
COMPILE_DEPS = $(OBJECT_DIRS) $(BUILT_SOURCES) $(PROJ_MAKEFILE)
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
# 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
|
|
|
#---------------------------------------------------------
|
2009-02-26 07:44:16 +00:00
|
|
|
# Create .o files in the ObjDir directory from the .cpp and .c files...
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2007-12-31 23:58:31 +00:00
|
|
|
DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
|
2009-02-26 07:44:16 +00:00
|
|
|
-MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
|
2008-02-27 13:34:15 +00:00
|
|
|
|
2009-05-12 06:35:50 +00:00
|
|
|
# If the build succeeded, move the dependency file over, otherwise
|
|
|
|
# remove it.
|
2007-12-31 23:58:31 +00:00
|
|
|
DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
|
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.o: %.cpp $(COMPILE_DEPS)
|
2009-10-04 17:54:36 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
2007-12-31 23:58:31 +00:00
|
|
|
$(DEPEND_MOVEFILE)
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.o: %.mm $(COMPILE_DEPS)
|
2010-07-13 18:47:09 +00:00
|
|
|
$(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
|
|
|
|
$(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
|
|
|
$(DEPEND_MOVEFILE)
|
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.o: %.cc $(COMPILE_DEPS)
|
2006-06-21 20:58:03 +00:00
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
2007-12-31 23:58:31 +00:00
|
|
|
$(DEPEND_MOVEFILE)
|
2005-02-04 21:28:50 +00:00
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.o: %.c $(COMPILE_DEPS)
|
2006-06-21 20:58:03 +00:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
2007-12-31 23:58:31 +00:00
|
|
|
$(DEPEND_MOVEFILE)
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.o: %.m $(COMPILE_DEPS)
|
2010-07-13 18:47:09 +00:00
|
|
|
$(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
|
|
|
|
$(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
|
|
|
$(DEPEND_MOVEFILE)
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
# 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
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.o: %.cpp $(COMPILE_DEPS)
|
2006-06-21 20:58:03 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Compile.CXX) $< -o $@
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.o: %.mm $(COMPILE_DEPS)
|
2010-07-13 18:47:09 +00:00
|
|
|
$(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
|
|
|
|
$(Compile.CXX) $< -o $@
|
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.o: %.cc $(COMPILE_DEPS)
|
2006-06-21 20:58:03 +00:00
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Compile.CXX) $< -o $@
|
2005-02-04 21:28:50 +00:00
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.o: %.c $(COMPILE_DEPS)
|
2006-06-21 20:58:03 +00:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Compile.C) $< -o $@
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.o: %.m $(COMPILE_DEPS)
|
2010-07-13 18:47:09 +00:00
|
|
|
$(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
|
|
|
|
$(Compile.C) $< -o $@
|
2006-01-27 22:13:12 +00:00
|
|
|
endif
|
2003-12-10 00:26:28 +00:00
|
|
|
|
2006-06-21 21:01:20 +00:00
|
|
|
|
|
|
|
## Rules for building preprocessed (.i/.ii) outputs.
|
2013-11-14 23:51:29 +00:00
|
|
|
$(BuildMode)/%.ii: %.cpp $(COMPILE_DEPS)
|
2006-06-21 21:01:20 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
|
|
|
|
$(Verb) $(Preprocess.CXX) $< -o $@
|
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(BuildMode)/%.ii: %.mm $(COMPILE_DEPS)
|
2010-07-13 18:47:09 +00:00
|
|
|
$(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
|
|
|
|
$(Verb) $(Preprocess.CXX) $< -o $@
|
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(BuildMode)/%.ii: %.cc $(COMPILE_DEPS)
|
2006-06-21 21:01:20 +00:00
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
|
|
|
|
$(Verb) $(Preprocess.CXX) $< -o $@
|
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(BuildMode)/%.i: %.c $(COMPILE_DEPS)
|
2006-06-21 21:01:20 +00:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
|
|
|
|
$(Verb) $(Preprocess.C) $< -o $@
|
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(BuildMode)/%.i: %.m $(COMPILE_DEPS)
|
2010-07-13 18:47:09 +00:00
|
|
|
$(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
|
|
|
|
$(Verb) $(Preprocess.C) $< -o $@
|
|
|
|
|
2006-06-21 21:01:20 +00:00
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.s: %.cpp $(COMPILE_DEPS)
|
2006-06-21 21:01:20 +00:00
|
|
|
$(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Compile.CXX) $< -o $@ -S
|
2006-06-21 21:01:20 +00:00
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.s: %.mm $(COMPILE_DEPS)
|
2010-07-13 18:47:09 +00:00
|
|
|
$(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
|
|
|
|
$(Compile.CXX) $< -o $@ -S
|
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.s: %.cc $(COMPILE_DEPS)
|
2006-06-21 21:01:20 +00:00
|
|
|
$(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Compile.CXX) $< -o $@ -S
|
2006-06-21 21:01:20 +00:00
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.s: %.c $(COMPILE_DEPS)
|
2006-06-21 21:01:20 +00:00
|
|
|
$(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 07:44:16 +00:00
|
|
|
$(Compile.C) $< -o $@ -S
|
2006-06-21 21:01:20 +00:00
|
|
|
|
2013-11-14 23:51:29 +00:00
|
|
|
$(ObjDir)/%.s: %.m $(COMPILE_DEPS)
|
2010-07-13 18:47:09 +00:00
|
|
|
$(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
|
|
|
|
$(Compile.C) $< -o $@ -S
|
|
|
|
|
2009-03-02 09:04:13 +00:00
|
|
|
###############################################################################
|
2009-03-02 09:42:59 +00:00
|
|
|
# TABLEGEN: Provide rules for running tblgen to produce *.inc files
|
2009-03-02 09:04:13 +00:00
|
|
|
###############################################################################
|
|
|
|
|
2009-03-02 09:42:59 +00:00
|
|
|
ifdef TARGET
|
|
|
|
TABLEGEN_INC_FILES_COMMON = 1
|
|
|
|
endif
|
2009-03-02 09:04:13 +00:00
|
|
|
|
2009-03-02 09:42:59 +00:00
|
|
|
ifdef TABLEGEN_INC_FILES_COMMON
|
2009-03-02 09:04:13 +00:00
|
|
|
|
|
|
|
INCFiles := $(filter %.inc,$(BUILT_SOURCES))
|
|
|
|
INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
|
|
|
|
.PRECIOUS: $(INCTMPFiles) $(INCFiles)
|
|
|
|
|
2009-03-02 09:42:59 +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 regenerated, but no
|
|
|
|
# dependencies of the .inc files are, unless the contents of the .inc file
|
|
|
|
# changes.
|
2009-03-02 09:04:13 +00:00
|
|
|
$(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
|
|
|
|
$(Verb) $(CMP) -s $@ $< || $(CP) $< $@
|
|
|
|
|
2009-03-02 09:42:59 +00:00
|
|
|
endif # TABLEGEN_INC_FILES_COMMON
|
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
|
|
|
|
2006-02-14 04:25:54 +00:00
|
|
|
TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
|
2008-11-24 07:34:46 +00:00
|
|
|
$(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
|
|
|
|
$(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
|
|
|
|
$(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
|
|
|
|
$(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
|
2006-10-24 20:32:44 +00:00
|
|
|
$(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
|
2013-01-02 11:36:10 +00:00
|
|
|
$(wildcard $(LLVM_SRC_ROOT)/include/llvm/IR/Intrinsics*.td)
|
2004-12-16 17:28:50 +00:00
|
|
|
|
2011-10-06 01:51:51 +00:00
|
|
|
# All .inc.tmp files depend on the .td files.
|
|
|
|
$(INCTMPFiles) : $(TDFiles)
|
2009-03-10 17:58:54 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) register info implementation with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
|
2002-09-22 02:47:15 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) instruction information with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
|
2003-06-30 21:59:07 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) assembly writer with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-12-16 17:34:04 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2004-12-16 17:34:04 +00:00
|
|
|
$(Echo) "Building $(<F) assembly writer #1 with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2009-07-13 18:35:35 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2009-07-13 18:35:35 +00:00
|
|
|
$(Echo) "Building $(<F) assembly matcher with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
|
2009-07-13 18:35:35 +00:00
|
|
|
|
2010-11-03 23:46:01 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2010-11-03 23:46:01 +00:00
|
|
|
$(Echo) "Building $(<F) MC code emitter with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
|
2010-11-03 23:46:01 +00:00
|
|
|
|
2011-07-08 17:36:35 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2011-07-08 17:36:35 +00:00
|
|
|
$(Echo) "Building $(<F) MC Pseudo instruction expander with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
|
2011-07-08 17:36:35 +00:00
|
|
|
|
2004-12-16 17:28:50 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) code emitter with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2005-09-03 01:15:25 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2008-08-13 20:19:35 +00:00
|
|
|
$(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
|
2005-09-03 01:15:25 +00:00
|
|
|
|
2009-11-25 04:46:58 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2009-11-25 04:46:58 +00:00
|
|
|
$(Echo) "Building $(<F) disassembly tables with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
|
2009-11-25 04:46:58 +00:00
|
|
|
|
2008-08-13 20:19:35 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2008-08-13 20:19:35 +00:00
|
|
|
$(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
|
2008-08-13 20:19:35 +00:00
|
|
|
|
2011-07-01 22:36:09 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2005-10-21 19:05:19 +00:00
|
|
|
$(Echo) "Building $(<F) subtarget information with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
|
2005-09-03 01:15:25 +00:00
|
|
|
|
2007-02-27 20:44:12 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2007-02-27 20:44:12 +00:00
|
|
|
$(Echo) "Building $(<F) calling convention information with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
|
2007-02-27 20:44:12 +00:00
|
|
|
|
2009-02-05 01:49:45 +00:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2009-10-15 18:48:47 +00:00
|
|
|
$(Echo) "Building $(<F) intrinsics information with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
|
2009-02-05 01:49:45 +00:00
|
|
|
|
2011-10-06 01:51:51 +00:00
|
|
|
$(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
2010-04-02 22:27:38 +00:00
|
|
|
$(Echo) "Building $(<F) decoder tables with tblgen"
|
2011-10-06 01:51:51 +00:00
|
|
|
$(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
|
2010-04-02 22:27:38 +00:00
|
|
|
|
2011-12-01 21:10:21 +00:00
|
|
|
$(ObjDir)/%GenDFAPacketizer.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
|
|
|
|
$(Echo) "Building $(<F) DFA packetizer tables with tblgen"
|
|
|
|
$(Verb) $(LLVMTableGen) -gen-dfa-packetizer -o $(call SYSPATH, $@) $<
|
2010-04-02 22:27:38 +00:00
|
|
|
|
2014-05-06 03:49:45 +00:00
|
|
|
# Dump all the records to <target>.td.expanded. This is useful for debugging.
|
|
|
|
$(TARGET:%=%.td.expanded): \
|
|
|
|
%.td.expanded : %.td $(LLVM_TBLGEN)
|
|
|
|
$(Echo) "Building a fully expanded version of $(<F)"
|
|
|
|
$(Verb) $(LLVMTableGen) -o $(call SYSPATH, $@) $<
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2014-05-06 03:49:45 +00:00
|
|
|
-$(Verb) $(RM) -f $(INCFiles) $(TARGET).td.expanded
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2009-03-02 09:42:59 +00:00
|
|
|
endif # TARGET
|
|
|
|
|
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
|
2009-01-08 02:11:55 +00:00
|
|
|
# very conservative approach ensuring that empty variables do not cause
|
2004-10-30 09:19:36 +00:00
|
|
|
# errors or disastrous removal.
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2008-10-02 22:56:44 +00:00
|
|
|
ifneq ($(strip $(ObjRootDir)),)
|
|
|
|
-$(Verb) $(RM) -rf $(ObjRootDir)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
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-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
|
2008-10-03 19:11:19 +00:00
|
|
|
ifndef IS_CLEANING_TARGET
|
2003-05-15 21:28:55 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
# Get the list of dependency files
|
2010-07-13 18:47:09 +00:00
|
|
|
DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
|
2009-05-12 06:35:50 +00:00
|
|
|
DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
|
|
|
|
|
2007-07-23 08:20:46 +00:00
|
|
|
-include $(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
|
|
|
|
2009-01-08 02:11:55 +00:00
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-12-06 05:35:13 +00:00
|
|
|
###############################################################################
|
|
|
|
# CHECK: Running the test suite
|
|
|
|
###############################################################################
|
|
|
|
|
2013-04-09 19:42:12 +00:00
|
|
|
check:: all
|
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
|
|
|
|
|
2012-06-28 00:03:13 +00:00
|
|
|
# An alias dating from when both lit and DejaGNU test runners were used.
|
2010-08-02 00:05:18 +00:00
|
|
|
check-lit:: check
|
|
|
|
|
2009-09-20 06:17:21 +00:00
|
|
|
check-all::
|
|
|
|
$(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
|
|
|
|
if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
|
|
|
|
$(EchoCmd) Running test suite ; \
|
|
|
|
$(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
|
|
|
|
else \
|
|
|
|
$(EchoCmd) No Makefile in test directory ; \
|
|
|
|
fi ; \
|
|
|
|
else \
|
|
|
|
$(EchoCmd) No test directory ; \
|
|
|
|
fi
|
|
|
|
|
2009-01-04 23:12:21 +00:00
|
|
|
###############################################################################
|
|
|
|
# UNITTESTS: Running the unittests test suite
|
|
|
|
###############################################################################
|
|
|
|
|
2009-04-09 18:26:57 +00:00
|
|
|
unittests::
|
2009-01-04 23:12:21 +00:00
|
|
|
$(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
|
|
|
|
if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
|
|
|
|
$(EchoCmd) Running unittests test suite ; \
|
2009-09-13 22:39:27 +00:00
|
|
|
$(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
|
2009-01-04 23:12:21 +00:00
|
|
|
else \
|
|
|
|
$(EchoCmd) No Makefile in unittests directory ; \
|
|
|
|
fi ; \
|
|
|
|
else \
|
|
|
|
$(EchoCmd) No unittests 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
|
|
|
|
2009-01-08 02:11:55 +00:00
|
|
|
dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
|
2011-04-15 05:18:47 +00:00
|
|
|
$(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
|
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 && \
|
2009-01-04 23:12:21 +00:00
|
|
|
$(MAKE) unittests && \
|
2004-10-26 07:09:33 +00:00
|
|
|
$(MAKE) install && \
|
|
|
|
$(MAKE) uninstall && \
|
|
|
|
$(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 ; \
|
2006-04-10 16:46:04 +00:00
|
|
|
$(MAKE) ENABLE_OPTIMIZED=1 all ; \
|
2004-10-26 07:09:33 +00:00
|
|
|
fi
|
2004-11-29 05:00:33 +00:00
|
|
|
$(Echo) Building Distribution Directory $(DistDir)
|
2009-01-08 02:11:55 +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; \
|
2006-04-10 16:46:04 +00:00
|
|
|
( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
|
2006-04-07 16:06:18 +00:00
|
|
|
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 ; \
|
2006-02-14 04:27:15 +00:00
|
|
|
$(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
|
|
|
#------------------------------------------------------------------------
|
2007-02-06 18:53:14 +00:00
|
|
|
ifdef NO_INSTALL
|
|
|
|
install-local::
|
|
|
|
$(Echo) Install circumvented with NO_INSTALL
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstall circumvented with NO_INSTALL
|
|
|
|
else
|
2004-10-24 07:53:21 +00:00
|
|
|
install-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Installing include files
|
2010-03-04 20:56:19 +00:00
|
|
|
$(Verb) $(MKDIR) $(DESTDIR)$(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 && \
|
2011-03-09 09:11:27 +00:00
|
|
|
for hdr in `find . -type f \
|
|
|
|
'(' -name LICENSE.TXT \
|
|
|
|
-o -name '*.def' \
|
|
|
|
-o -name '*.h' \
|
|
|
|
-o -name '*.inc' \
|
|
|
|
-o -name '*.td' \
|
|
|
|
')' -print | grep -v CVS | \
|
2007-04-09 19:08:58 +00:00
|
|
|
grep -v .svn` ; do \
|
2010-03-04 20:56:19 +00:00
|
|
|
instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
|
2005-02-24 03:56:32 +00:00
|
|
|
if test \! -d "$$instdir" ; then \
|
|
|
|
$(EchoCmd) Making install directory $$instdir ; \
|
|
|
|
$(MKDIR) $$instdir ;\
|
|
|
|
fi ; \
|
2010-03-04 20:56:19 +00:00
|
|
|
$(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
|
2005-02-16 15:54:03 +00:00
|
|
|
done ; \
|
2004-10-24 07:53:21 +00:00
|
|
|
fi
|
2005-12-23 22:27:56 +00:00
|
|
|
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
|
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 && \
|
2011-03-09 09:11:27 +00:00
|
|
|
for hdr in `find . -type f \
|
|
|
|
'(' -name LICENSE.TXT \
|
|
|
|
-o -name '*.def' \
|
|
|
|
-o -name '*.h' \
|
|
|
|
-o -name '*.inc' \
|
|
|
|
-o -name '*.td' \
|
|
|
|
')' -print | grep -v CVS | \
|
|
|
|
grep -v .svn` ; do \
|
|
|
|
instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
|
|
|
|
if test \! -d "$$instdir" ; then \
|
|
|
|
$(EchoCmd) Making install directory $$instdir ; \
|
|
|
|
$(MKDIR) $$instdir ;\
|
|
|
|
fi ; \
|
2010-03-04 20:56:19 +00:00
|
|
|
$(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
|
2005-02-16 15:54:03 +00:00
|
|
|
done ; \
|
2005-02-09 02:24:00 +00:00
|
|
|
fi
|
2005-12-23 22:27:56 +00:00
|
|
|
endif
|
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 \
|
2009-01-02 07:16:45 +00:00
|
|
|
'!' '(' -name '*~' -o -name '.#*' \
|
2006-02-14 04:25:54 +00:00
|
|
|
-o -name '*.in' ')' -print ')' | \
|
2010-03-04 20:56:19 +00:00
|
|
|
grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
|
2005-02-09 02:24:00 +00:00
|
|
|
cd $(PROJ_SRC_ROOT)/include && \
|
2006-02-14 04:25:54 +00:00
|
|
|
$(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
|
2010-03-04 20:56:19 +00:00
|
|
|
-print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
|
2005-02-09 02:24:00 +00:00
|
|
|
fi
|
2007-02-06 18:53:14 +00:00
|
|
|
endif
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
|
|
|
|
2007-04-14 23:35:45 +00:00
|
|
|
check-line-length:
|
2008-05-15 10:04:30 +00:00
|
|
|
@echo searching for overlength lines in files: $(Sources)
|
|
|
|
@echo
|
|
|
|
@echo
|
2008-08-28 22:32:39 +00:00
|
|
|
egrep -n '.{81}' $(Sources) /dev/null
|
2007-04-14 23:35:45 +00:00
|
|
|
|
2007-04-16 18:10:23 +00:00
|
|
|
check-for-tabs:
|
2008-05-15 10:04:30 +00:00
|
|
|
@echo searching for tabs in files: $(Sources)
|
|
|
|
@echo
|
|
|
|
@echo
|
2008-08-28 22:32:39 +00:00
|
|
|
egrep -n ' ' $(Sources) /dev/null
|
2008-05-15 10:04:30 +00:00
|
|
|
|
2007-05-02 21:29:39 +00:00
|
|
|
check-footprint:
|
|
|
|
@ls -l $(LibDir) | awk '\
|
|
|
|
BEGIN { sum = 0; } \
|
|
|
|
{ sum += $$5; } \
|
|
|
|
END { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
|
|
|
|
@ls -l $(ToolDir) | awk '\
|
|
|
|
BEGIN { sum = 0; } \
|
|
|
|
{ sum += $$5; } \
|
|
|
|
END { printf("Programs: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
|
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)'
|
2011-11-28 07:59:52 +00:00
|
|
|
$(Echo) "PROJ_internal_prefix : " '$(PROJ_internal_prefix)'
|
2005-01-16 02:20:54 +00:00
|
|
|
$(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)'
|
2006-04-09 23:41:14 +00:00
|
|
|
$(Echo) "SubDirs : " '$(SubDirs)'
|
2007-03-29 19:05:44 +00:00
|
|
|
$(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
|
|
|
|
$(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
|
2009-02-21 20:42:39 +00:00
|
|
|
|
|
|
|
###
|
|
|
|
# Debugging
|
|
|
|
|
2009-03-06 22:23:25 +00:00
|
|
|
# General debugging rule, use 'make dbg-print-XXX' to print the
|
2009-02-21 20:42:39 +00:00
|
|
|
# definition, value and origin of XXX.
|
2009-03-06 22:23:25 +00:00
|
|
|
make-print-%:
|
2009-02-21 20:42:39 +00:00
|
|
|
$(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))
|