2004-04-24 02:10:56 +02:00
|
|
|
#===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
|
|
|
|
#
|
2003-10-21 16:33:46 +02:00
|
|
|
# The LLVM Compiler Infrastructure
|
|
|
|
#
|
2007-12-29 21:11:13 +01:00
|
|
|
# This file is distributed under the University of Illinois Open Source
|
|
|
|
# License. See LICENSE.TXT for details.
|
2009-01-08 03:11:55 +01:00
|
|
|
#
|
2004-04-24 02:10:56 +02:00
|
|
|
#===------------------------------------------------------------------------===#
|
2001-06-06 22:29:01 +02:00
|
|
|
#
|
2004-10-23 22:04:14 +02: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 05:02:52 +02:00
|
|
|
#
|
2006-02-14 05:27:15 +01:00
|
|
|
#===-----------------------------------------------------------------------====#
|
2001-06-06 22:29:01 +02:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
################################################################################
|
2004-10-23 22:04:14 +02:00
|
|
|
# TARGETS: Define standard targets that can be invoked
|
2004-10-30 11:19:36 +02:00
|
|
|
################################################################################
|
2003-06-11 15:55:44 +02:00
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Define the various target sets
|
|
|
|
#--------------------------------------------------------------------
|
2004-12-03 22:05:57 +01:00
|
|
|
RecursiveTargets := all clean clean-all install uninstall install-bytecode
|
2004-12-06 06:35:13 +01:00
|
|
|
LocalTargets := all-local clean-local clean-all-local check-local \
|
2004-12-03 21:08:48 +01:00
|
|
|
install-local printvars uninstall-local \
|
2009-01-05 00:12:21 +01:00
|
|
|
install-bytecode-local unittests
|
2007-09-26 08:10:47 +02:00
|
|
|
TopLevelTargets := check dist dist-check dist-clean dist-gzip dist-bzip2 \
|
2009-01-05 00:12:21 +01:00
|
|
|
dist-zip unittests
|
2004-10-30 11:19:36 +02:00
|
|
|
UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
|
|
|
|
InternalTargets := preconditions distdir dist-hook
|
2003-08-14 23:10:25 +02:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
################################################################################
|
2004-10-27 00:26:33 +02:00
|
|
|
# INITIALIZATION: Basic things the makefile needs
|
2004-10-30 11:19:36 +02:00
|
|
|
################################################################################
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Set the VPATH so that we can find source files.
|
|
|
|
#--------------------------------------------------------------------
|
2005-01-16 03:20:54 +01:00
|
|
|
VPATH=$(PROJ_SRC_DIR)
|
2004-10-27 00:26:33 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
2007-06-29 16:02:07 +02:00
|
|
|
# Reset the list of suffixes we know how to build.
|
2004-10-27 00:26:33 +02:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
.SUFFIXES:
|
2009-02-26 08:44:16 +01:00
|
|
|
.SUFFIXES: .c .cpp .cc .h .hpp .o .a .bc .td .ps .dot .ll
|
2004-10-30 11:19:36 +02:00
|
|
|
.SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
|
2004-10-27 00:26:33 +02:00
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Mark all of these targets as phony to avoid implicit rule search
|
|
|
|
#--------------------------------------------------------------------
|
2004-10-30 11:19:36 +02:00
|
|
|
.PHONY: $(UserTargets) $(InternalTargets)
|
2003-05-29 18:18:20 +02:00
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
#--------------------------------------------------------------------
|
2009-01-08 03:11:55 +01:00
|
|
|
# Make sure all the user-target rules are double colon rules and
|
2004-10-27 00:26:33 +02:00
|
|
|
# they are defined first.
|
2004-10-23 22:04:14 +02:00
|
|
|
#--------------------------------------------------------------------
|
2003-05-29 18:18:20 +02:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
$(UserTargets)::
|
2004-10-27 00:26:33 +02:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# PRECONDITIONS: that which must be built/checked first
|
|
|
|
################################################################################
|
|
|
|
|
2004-12-03 21:08:48 +01:00
|
|
|
SrcMakefiles := $(filter %Makefile %Makefile.tests,\
|
2005-01-16 03:20:54 +01: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 07:23:20 +02:00
|
|
|
|
2005-01-16 03:20:54 +01:00
|
|
|
ifneq ($(MakefileConfigIn),)
|
|
|
|
PreConditions += $(MakefileConfig)
|
|
|
|
endif
|
2004-10-27 00:26:33 +02:00
|
|
|
|
2005-08-25 06:59:49 +02:00
|
|
|
preconditions: $(PreConditions)
|
2004-10-27 00:26:33 +02:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Make sure the BUILT_SOURCES are built first
|
|
|
|
#------------------------------------------------------------------------
|
2004-12-16 08:15:16 +01:00
|
|
|
$(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES)
|
2004-10-27 00:26:33 +02:00
|
|
|
|
2007-02-07 20:13:19 +01:00
|
|
|
clean-all-local::
|
2004-10-27 00:26:33 +02:00
|
|
|
ifneq ($(strip $(BUILT_SOURCES)),)
|
2004-11-02 17:56:15 +01:00
|
|
|
-$(Verb) $(RM) -f $(BUILT_SOURCES)
|
2004-10-27 00:26:33 +02:00
|
|
|
endif
|
|
|
|
|
2005-01-16 03:20:54 +01:00
|
|
|
ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT))
|
2004-12-16 09:00:46 +01:00
|
|
|
spotless:
|
|
|
|
$(Verb) if test -x config.status ; then \
|
2005-01-16 03:20:54 +01:00
|
|
|
$(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \
|
2004-12-17 08:45:03 +01:00
|
|
|
$(MKDIR) .spotless.save ; \
|
|
|
|
$(MV) config.status .spotless.save ; \
|
|
|
|
$(MV) mklib .spotless.save ; \
|
|
|
|
$(MV) projects .spotless.save ; \
|
2004-12-16 09:00:46 +01:00
|
|
|
$(RM) -rf * ; \
|
2004-12-17 08:45:03 +01:00
|
|
|
$(MV) .spotless.save/config.status . ; \
|
|
|
|
$(MV) .spotless.save/mklib . ; \
|
|
|
|
$(MV) .spotless.save/projects . ; \
|
|
|
|
$(RM) -rf .spotless.save ; \
|
2005-01-16 03:20:54 +01:00
|
|
|
$(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \
|
2004-12-17 08:45:03 +01:00
|
|
|
$(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
|
|
|
|
$(ConfigStatusScript) ; \
|
2004-12-16 09:00:46 +01:00
|
|
|
else \
|
2005-01-16 03:20:54 +01:00
|
|
|
$(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \
|
2004-12-16 09:00:46 +01:00
|
|
|
fi
|
2005-12-22 00:17:06 +01:00
|
|
|
else
|
|
|
|
spotless:
|
|
|
|
$(EchoCmd) "spotless target not supported for objdir == srcdir"
|
2004-12-16 09:00:46 +01:00
|
|
|
endif
|
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
$(BUILT_SOURCES) : $(ObjMakefiles)
|
2004-10-28 02:41:43 +02:00
|
|
|
|
2004-10-27 00:26:33 +02:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Make sure we're not using a stale configuration
|
|
|
|
#------------------------------------------------------------------------
|
2004-12-16 19:26:53 +01:00
|
|
|
reconfigure:
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Echo) Reconfiguring $(PROJ_OBJ_ROOT)
|
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) && \
|
|
|
|
if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \
|
|
|
|
$(RM) $(PROJ_OBJ_ROOT)/config.cache ; \
|
2004-12-24 04:36:31 +01:00
|
|
|
fi ; \
|
2004-12-16 19:26:53 +01:00
|
|
|
$(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
|
|
|
|
$(ConfigStatusScript)
|
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
.PRECIOUS: $(ConfigStatusScript)
|
|
|
|
$(ConfigStatusScript): $(ConfigureScript)
|
|
|
|
$(Echo) Reconfiguring with $<
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) && \
|
|
|
|
if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \
|
|
|
|
$(RM) $(PROJ_OBJ_ROOT)/config.cache ; \
|
2004-12-24 04:36:31 +01:00
|
|
|
fi ; \
|
2004-11-29 13:37:44 +01:00
|
|
|
$(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
|
|
|
|
$(ConfigStatusScript)
|
2004-10-27 00:26:33 +02:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Make sure the configuration makefile is up to date
|
|
|
|
#------------------------------------------------------------------------
|
2005-01-16 03:20:54 +01: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 11:19:36 +02:00
|
|
|
$(Echo) Regenerating $@
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common
|
|
|
|
endif
|
2004-10-27 00:26:33 +02:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# If the Makefile in the source tree has been updated, copy it over into the
|
|
|
|
# build tree. But, only do this if the source and object makefiles differ
|
|
|
|
#------------------------------------------------------------------------
|
2005-01-16 03:20:54 +01:00
|
|
|
ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
|
2004-10-27 00:26:33 +02:00
|
|
|
|
2008-03-10 16:58:40 +01:00
|
|
|
Makefile: $(PROJ_SRC_DIR)/Makefile $(ExtraMakefiles)
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) "Updating Makefile"
|
|
|
|
$(Verb) $(MKDIR) $(@D)
|
2004-12-16 19:26:53 +01:00
|
|
|
$(Verb) $(CP) -f $< $@
|
2004-10-27 00:26:33 +02:00
|
|
|
|
|
|
|
# Copy the Makefile.* files unless we're in the root directory which avoids
|
|
|
|
# the copying of Makefile.config.in or other things that should be explicitly
|
|
|
|
# taken care of.
|
2005-01-16 03:20:54 +01:00
|
|
|
$(PROJ_OBJ_DIR)/Makefile% : $(PROJ_SRC_DIR)/Makefile%
|
2004-10-27 01:10:00 +02:00
|
|
|
@case '$?' in \
|
|
|
|
*Makefile.rules) ;; \
|
|
|
|
*.in) ;; \
|
2008-03-10 16:58:40 +01:00
|
|
|
*) $(EchoCmd) "Updating $(@F)" ; \
|
2004-10-27 01:10:00 +02:00
|
|
|
$(MKDIR) $(@D) ; \
|
2004-12-16 19:26:53 +01:00
|
|
|
$(CP) -f $< $@ ;; \
|
2004-10-27 01:10:00 +02:00
|
|
|
esac
|
2008-02-27 14:34:15 +01:00
|
|
|
|
2004-10-27 00:26:33 +02:00
|
|
|
endif
|
2004-10-25 10:27:37 +02:00
|
|
|
|
2004-10-27 00:26:33 +02:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Set up the basic dependencies
|
|
|
|
#------------------------------------------------------------------------
|
2004-10-30 11:19:36 +02:00
|
|
|
$(UserTargets):: $(PreConditions)
|
2004-10-27 00:26:33 +02:00
|
|
|
|
|
|
|
all:: all-local
|
2008-11-10 08:33:13 +01:00
|
|
|
clean:: clean-local
|
2004-11-02 17:36:03 +01:00
|
|
|
clean-all:: clean-local clean-all-local
|
2004-10-27 00:26:33 +02:00
|
|
|
install:: install-local
|
|
|
|
uninstall:: uninstall-local
|
2009-01-08 03:11:55 +01:00
|
|
|
install-local:: all-local
|
2004-12-03 21:08:48 +01:00
|
|
|
install-bytecode:: install-bytecode-local
|
2004-10-23 22:04:14 +02:00
|
|
|
|
2009-03-02 10:04:13 +01:00
|
|
|
###############################################################################
|
|
|
|
# LLVMC: Provide rules for compiling llvmc plugins
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
ifdef LLVMC_PLUGIN
|
|
|
|
|
|
|
|
LIBRARYNAME := $(patsubst %,plugin_llvmc_%,$(LLVMC_PLUGIN))
|
2009-06-23 22:46:48 +02:00
|
|
|
CPP.Flags += -DLLVMC_PLUGIN_NAME=$(LLVMC_PLUGIN)
|
2009-03-02 10:04:13 +01:00
|
|
|
REQUIRES_EH := 1
|
2009-07-03 05:52:47 +02:00
|
|
|
|
|
|
|
ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
|
|
|
|
LD.Flags += -lCompilerDriver
|
|
|
|
endif
|
2009-03-02 10:04:13 +01:00
|
|
|
|
|
|
|
# Build a dynamic library if the user runs `make` directly from the plugin
|
|
|
|
# directory.
|
|
|
|
ifndef LLVMC_BUILTIN_PLUGIN
|
2009-07-03 05:52:47 +02:00
|
|
|
LOADABLE_MODULE = 1
|
2009-03-02 10:04:13 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
# TableGen stuff...
|
|
|
|
ifneq ($(BUILT_SOURCES),)
|
2009-07-03 05:52:47 +02:00
|
|
|
LLVMC_BUILD_AUTOGENERATED_INC=1
|
2009-03-02 10:04:13 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
endif # LLVMC_PLUGIN
|
|
|
|
|
2009-06-25 03:07:00 +02:00
|
|
|
ifdef LLVMC_BASED_DRIVER
|
|
|
|
|
|
|
|
TOOLNAME = $(LLVMC_BASED_DRIVER)
|
2009-07-03 05:52:47 +02:00
|
|
|
|
2009-06-25 03:07:00 +02:00
|
|
|
REQUIRES_EH := 1
|
2009-07-03 05:52:47 +02:00
|
|
|
|
|
|
|
ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
|
|
|
|
LD.Flags += -lCompilerDriver
|
|
|
|
else
|
|
|
|
LLVMLIBS = CompilerDriver.a
|
|
|
|
LINK_COMPONENTS = support system
|
|
|
|
endif
|
2009-06-25 03:07:00 +02:00
|
|
|
|
|
|
|
# Preprocessor magic that generates references to static variables in built-in
|
|
|
|
# plugins.
|
|
|
|
ifneq ($(LLVMC_BUILTIN_PLUGINS),)
|
|
|
|
|
|
|
|
USEDLIBS += $(patsubst %,plugin_llvmc_%.a,$(LLVMC_BUILTIN_PLUGINS))
|
|
|
|
|
|
|
|
LLVMC_BUILTIN_PLUGIN_1 = $(word 1, $(LLVMC_BUILTIN_PLUGINS))
|
|
|
|
LLVMC_BUILTIN_PLUGIN_2 = $(word 2, $(LLVMC_BUILTIN_PLUGINS))
|
|
|
|
LLVMC_BUILTIN_PLUGIN_3 = $(word 3, $(LLVMC_BUILTIN_PLUGINS))
|
|
|
|
LLVMC_BUILTIN_PLUGIN_4 = $(word 4, $(LLVMC_BUILTIN_PLUGINS))
|
|
|
|
LLVMC_BUILTIN_PLUGIN_5 = $(word 5, $(LLVMC_BUILTIN_PLUGINS))
|
|
|
|
|
|
|
|
ifneq ($(LLVMC_BUILTIN_PLUGIN_1),)
|
|
|
|
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_1=$(LLVMC_BUILTIN_PLUGIN_1)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(LLVMC_BUILTIN_PLUGIN_2),)
|
|
|
|
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_2=$(LLVMC_BUILTIN_PLUGIN_2)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(LLVMC_BUILTIN_PLUGIN_3),)
|
|
|
|
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_3=$(LLVMC_BUILTIN_PLUGIN_3)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(LLVMC_BUILTIN_PLUGIN_4),)
|
|
|
|
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_4=$(LLVMC_BUILTIN_PLUGIN_4)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(LLVMC_BUILTIN_PLUGIN_5),)
|
|
|
|
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_5=$(LLVMC_BUILTIN_PLUGIN_5)
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif # LLVMC_BASED_DRIVER
|
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
###############################################################################
|
|
|
|
# VARIABLES: Set up various variables based on configuration data
|
|
|
|
###############################################################################
|
2003-06-30 23:59:07 +02:00
|
|
|
|
2008-10-03 21:11:19 +02: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 22:29:01 +02:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-23 22:04:14 +02:00
|
|
|
# Variables derived from configuration we are building
|
2001-06-06 22:29:01 +02:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2007-07-10 09:19:53 +02:00
|
|
|
CPP.Defines :=
|
2006-05-25 01:02:40 +02:00
|
|
|
# OPTIMIZE_OPTION - The optimization level option we want to build LLVM with
|
|
|
|
# this can be overridden on the make command line.
|
2009-04-21 00:16:40 +02:00
|
|
|
ifndef OPTIMIZE_OPTION
|
|
|
|
ifneq ($(OS),MingW)
|
|
|
|
OPTIMIZE_OPTION := -O3
|
|
|
|
else
|
|
|
|
OPTIMIZE_OPTION := -O2
|
|
|
|
endif
|
2006-06-01 21:03:21 +02:00
|
|
|
endif
|
2006-05-25 01:02:40 +02:00
|
|
|
|
2009-04-17 16:49:22 +02:00
|
|
|
ifeq ($(ENABLE_OPTIMIZED),1)
|
|
|
|
BuildMode := Release
|
|
|
|
# Don't use -fomit-frame-pointer on Darwin or FreeBSD.
|
|
|
|
ifneq ($(OS),FreeBSD)
|
|
|
|
ifneq ($(OS),Darwin)
|
|
|
|
OmitFramePointer := -fomit-frame-pointer
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Darwin requires -fstrict-aliasing to be explicitly enabled.
|
2009-04-21 00:49:59 +02:00
|
|
|
# Avoid -fstrict-aliasing on Darwin for now, there are unresolved issues
|
|
|
|
# with -fstrict-aliasing and ipa-type-escape radr://6756684
|
2009-04-21 00:16:40 +02:00
|
|
|
#ifeq ($(OS),Darwin)
|
|
|
|
# EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing
|
|
|
|
#endif
|
2009-04-17 16:49:22 +02:00
|
|
|
CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
|
|
|
|
C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
|
|
|
|
LD.Flags += $(OPTIMIZE_OPTION)
|
|
|
|
else
|
|
|
|
BuildMode := Debug
|
|
|
|
CXX.Flags += -g
|
|
|
|
C.Flags += -g
|
|
|
|
LD.Flags += -g
|
|
|
|
KEEP_SYMBOLS := 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
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
|
|
|
|
LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg -g
|
|
|
|
KEEP_SYMBOLS := 1
|
2003-03-14 21:25:22 +01:00
|
|
|
endif
|
|
|
|
|
2008-09-02 19:35:16 +02:00
|
|
|
#ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
|
|
|
|
# CXX.Flags += -fvisibility-inlines-hidden
|
|
|
|
#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%)
llvm-svn: 29882
2006-08-25 21:54:53 +02:00
|
|
|
# IF REQUIRES_EH=1 is specified then don't disable exceptions
|
2006-08-25 22:56:59 +02:00
|
|
|
ifndef REQUIRES_EH
|
|
|
|
CXX.Flags += -fno-exceptions
|
|
|
|
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%)
llvm-svn: 29882
2006-08-25 21:54:53 +02:00
|
|
|
|
2007-05-02 23:29:39 +02:00
|
|
|
# IF REQUIRES_RTTI=1 is specified then don't disable run-time type id
|
|
|
|
ifndef REQUIRES_RTTI
|
2007-05-02 23:31:09 +02:00
|
|
|
# CXX.Flags += -fno-rtti
|
2007-05-02 23:29:39 +02:00
|
|
|
endif
|
|
|
|
|
2009-03-13 21:59:41 +01:00
|
|
|
ifdef ENABLE_COVERAGE
|
|
|
|
BuildMode := $(BuildMode)+Coverage
|
2009-06-17 01:00:42 +02:00
|
|
|
CXX.Flags += -ftest-coverage -fprofile-arcs
|
|
|
|
C.Flags += -ftest-coverage -fprofile-arcs
|
2009-03-13 21:59:41 +01:00
|
|
|
endif
|
|
|
|
|
2006-04-10 18:46:04 +02:00
|
|
|
# If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
|
|
|
|
# then disable assertions by defining the appropriate preprocessor symbols.
|
2006-04-10 01:41:14 +02:00
|
|
|
ifdef DISABLE_ASSERTIONS
|
2009-03-27 12:35:00 +01:00
|
|
|
# Indicate that assertions are turned off using a minus sign
|
|
|
|
BuildMode := $(BuildMode)-Asserts
|
2007-07-10 09:19:53 +02:00
|
|
|
CPP.Defines += -DNDEBUG
|
2006-04-10 01:41:14 +02:00
|
|
|
else
|
2007-07-10 09:19:53 +02:00
|
|
|
CPP.Defines += -D_DEBUG
|
2006-03-21 02:06:41 +01:00
|
|
|
endif
|
|
|
|
|
2009-01-08 03:11:55 +01:00
|
|
|
# If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
|
|
|
|
# configured), then enable expensive checks by defining the
|
2007-06-29 05:36:21 +02:00
|
|
|
# appropriate preprocessor symbols.
|
2007-06-28 21:36:08 +02:00
|
|
|
ifdef ENABLE_EXPENSIVE_CHECKS
|
|
|
|
BuildMode := $(BuildMode)+Checks
|
2008-12-09 22:33:20 +01:00
|
|
|
CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
|
2007-06-28 21:36:08 +02:00
|
|
|
endif
|
|
|
|
|
2009-02-26 08:44:16 +01: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 23:07:52 +01:00
|
|
|
ifeq ($(ENABLE_PIC),1)
|
2009-03-03 04:36:50 +01:00
|
|
|
ifeq ($(OS), $(filter $(OS), Cygwin MingW))
|
2009-02-21 09:41:09 +01:00
|
|
|
# Nothing. Win32 defaults to PIC and warns when given -fPIC
|
|
|
|
else
|
|
|
|
ifeq ($(OS),Darwin)
|
2009-02-26 08:44:16 +01:00
|
|
|
# Common symbols not allowed in dylib files
|
2009-02-21 09:41:09 +01: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-09 01:08:58 +02:00
|
|
|
else
|
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
CXX.Flags += -mdynamic-no-pic
|
|
|
|
C.Flags += -mdynamic-no-pic
|
|
|
|
endif
|
2006-12-16 23:07:52 +01:00
|
|
|
endif
|
|
|
|
|
2006-08-28 03:02:49 +02:00
|
|
|
CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual
|
2006-03-22 16:59:55 +01:00
|
|
|
C.Flags += $(CFLAGS)
|
2007-06-28 21:36:08 +02:00
|
|
|
CPP.Defines += $(CPPFLAGS)
|
|
|
|
CPP.BaseFlags += $(CPP.Defines)
|
2006-03-22 16:59:55 +01:00
|
|
|
LD.Flags += $(LDFLAGS)
|
|
|
|
AR.Flags := cru
|
2004-10-23 22:04:14 +02:00
|
|
|
|
2006-07-27 20:19:51 +02:00
|
|
|
# Make Floating point IEEE compliant on Alpha.
|
2005-02-13 04:41:10 +01:00
|
|
|
ifeq ($(ARCH),Alpha)
|
2006-12-16 23:07:52 +01:00
|
|
|
CXX.Flags += -mieee
|
|
|
|
CPP.BaseFlags += -mieee
|
|
|
|
ifeq ($(ENABLE_PIC),0)
|
|
|
|
CXX.Flags += -fPIC
|
|
|
|
CPP.BaseFlags += -fPIC
|
|
|
|
endif
|
2005-02-13 04:41:10 +01:00
|
|
|
endif
|
|
|
|
|
2007-01-26 14:34:50 +01:00
|
|
|
ifeq ($(ARCH),Alpha)
|
|
|
|
LD.Flags += -Wl,--no-relax
|
|
|
|
endif
|
|
|
|
|
2009-05-04 12:25:30 +02:00
|
|
|
ifeq ($(OS),MingW)
|
|
|
|
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
|
|
|
|
|
2009-05-15 20:13:31 +02: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
|
|
|
|
CXX.Flags := $(filter-out -fno-rtti,$(CXX.Flags))
|
|
|
|
endif
|
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-22 23:01:56 +02:00
|
|
|
# Directory locations
|
2004-10-23 22:04:14 +02:00
|
|
|
#--------------------------------------------------------------------
|
2008-10-03 00:56:44 +02:00
|
|
|
TargetMode :=
|
|
|
|
ifeq ($(LLVM_CROSS_COMPILING),1)
|
2008-11-10 08:33:13 +01:00
|
|
|
BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
|
2008-10-03 00:56:44 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
|
2008-11-10 08:33:13 +01: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-12-22 06:57:21 +01:00
|
|
|
CFERuntimeLibDir := $(LLVMGCCDIR)/lib
|
2004-10-22 23:01:56 +02:00
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-22 23:01:56 +02:00
|
|
|
# Full Paths To Compiled Tools and Utilities
|
2004-10-23 22:04:14 +02:00
|
|
|
#--------------------------------------------------------------------
|
2005-01-14 17:33:36 +01:00
|
|
|
EchoCmd = $(ECHO) llvm[$(MAKELEVEL)]:
|
|
|
|
Echo = @$(EchoCmd)
|
2004-10-30 11:19:36 +02:00
|
|
|
ifndef LLVMAS
|
|
|
|
LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
|
|
|
|
endif
|
|
|
|
ifndef TBLGEN
|
2006-07-26 23:14:56 +02:00
|
|
|
ifeq ($(LLVM_CROSS_COMPILING),1)
|
2008-11-10 08:33:13 +01:00
|
|
|
TBLGEN := $(BuildLLVMToolDir)/tblgen$(BUILD_EXEEXT)
|
2006-07-26 23:14:56 +02:00
|
|
|
else
|
|
|
|
TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
|
|
|
|
endif
|
2004-10-30 11:19:36 +02:00
|
|
|
endif
|
2009-01-08 03:11:55 +01:00
|
|
|
LLVM_CONFIG := $(LLVMToolDir)/llvm-config
|
2007-02-09 16:52:07 +01:00
|
|
|
ifndef LLVMLD
|
2007-02-09 18:09:14 +01:00
|
|
|
LLVMLD := $(LLVMToolDir)/llvm-ld$(EXEEXT)
|
2004-10-30 11:19:36 +02:00
|
|
|
endif
|
2006-09-04 07:23:20 +02:00
|
|
|
ifndef LLVMDIS
|
2004-12-13 18:44:14 +01:00
|
|
|
LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
|
|
|
|
endif
|
|
|
|
ifndef LLI
|
|
|
|
LLI := $(LLVMToolDir)/lli$(EXEEXT)
|
|
|
|
endif
|
2005-02-27 11:21:37 +01:00
|
|
|
ifndef LLC
|
|
|
|
LLC := $(LLVMToolDir)/llc$(EXEEXT)
|
|
|
|
endif
|
2004-12-13 18:44:14 +01:00
|
|
|
ifndef LOPT
|
2004-12-13 19:08:29 +01:00
|
|
|
LOPT := $(LLVMToolDir)/opt$(EXEEXT)
|
2004-12-13 18:44:14 +01:00
|
|
|
endif
|
2005-02-02 01:40:15 +01:00
|
|
|
ifndef LBUGPOINT
|
|
|
|
LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
|
|
|
|
endif
|
2006-12-03 22:01:45 +01:00
|
|
|
ifndef LUPGRADE
|
|
|
|
LUPGRADE := $(LLVMToolDir)/llvm-upgrade$(EXEEXT)
|
|
|
|
endif
|
|
|
|
ifeq ($(LLVMGCC_MAJVERS),3)
|
2006-12-10 05:56:38 +01:00
|
|
|
LLVMGCCWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC)
|
|
|
|
LLVMGXXWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX)
|
2006-12-03 22:01:45 +01:00
|
|
|
else
|
2006-12-10 05:56:38 +01:00
|
|
|
LLVMGCCWITHPATH := $(LLVMGCC)
|
|
|
|
LLVMGXXWITHPATH := $(LLVMGXX)
|
2006-12-03 22:01:45 +01:00
|
|
|
endif
|
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-22 23:01:56 +02:00
|
|
|
# Adjust to user's request
|
2004-10-23 22:04:14 +02:00
|
|
|
#--------------------------------------------------------------------
|
2003-06-11 15:55:44 +02:00
|
|
|
|
2009-03-12 22:03:53 +01:00
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
DARWIN_VERSION := `sw_vers -productVersion`
|
|
|
|
# Strip a number like 10.4.7 to 10.4
|
|
|
|
DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
|
|
|
|
# Get "4" out of 10.4 for later pieces in the makefile.
|
|
|
|
DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
|
2009-03-22 09:28:45 +01:00
|
|
|
|
2009-03-27 19:18:00 +01:00
|
|
|
SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress \
|
|
|
|
-dynamiclib -mmacosx-version-min=$(DARWIN_VERSION)
|
2009-03-23 04:45:56 +01:00
|
|
|
TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
|
2009-03-12 22:03:53 +01:00
|
|
|
else
|
|
|
|
ifeq ($(OS),Cygwin)
|
|
|
|
SharedLinkOptions=-shared -nostdlib -Wl,--export-all-symbols \
|
2009-07-03 05:52:47 +02:00
|
|
|
-Wl,--enable-auto-import -Wl,--enable-auto-image-base
|
2009-03-12 22:03:53 +01:00
|
|
|
else
|
|
|
|
SharedLinkOptions=-shared
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2009-02-26 08:44:16 +01:00
|
|
|
# Adjust LD.Flags depending on the kind of library that is to be built. Note
|
|
|
|
# that if LOADABLE_MODULE is specified then the resulting shared library can
|
|
|
|
# be opened with dlopen.
|
2006-08-08 01:12:15 +02:00
|
|
|
ifdef LOADABLE_MODULE
|
|
|
|
LD.Flags += -module
|
|
|
|
endif
|
|
|
|
|
2005-01-11 05:31:07 +01:00
|
|
|
ifdef SHARED_LIBRARY
|
2009-03-12 22:03:53 +01:00
|
|
|
ifneq ($(DARWIN_MAJVERS),4)
|
2009-03-03 05:55:15 +01:00
|
|
|
LD.Flags += $(RPATH) -Wl,$(LibDir)
|
2003-07-31 22:58:51 +02:00
|
|
|
endif
|
2009-03-12 22:03:53 +01:00
|
|
|
endif
|
2003-07-31 22:58:51 +02:00
|
|
|
|
2004-11-08 18:32:12 +01:00
|
|
|
ifdef TOOL_VERBOSE
|
|
|
|
C.Flags += -v
|
|
|
|
CXX.Flags += -v
|
|
|
|
LD.Flags += -v
|
|
|
|
VERBOSE := 1
|
|
|
|
endif
|
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
# Adjust settings for verbose mode
|
2003-03-14 21:25:22 +01:00
|
|
|
ifndef VERBOSE
|
2004-10-30 11:19:36 +02:00
|
|
|
Verb := @
|
2007-07-23 10:20:46 +02:00
|
|
|
AR.Flags += >/dev/null 2>/dev/null
|
2005-01-16 03:20:54 +01:00
|
|
|
ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
|
2004-10-25 10:27:37 +02:00
|
|
|
else
|
2009-01-08 03:11:55 +01:00
|
|
|
ConfigureScriptFLAGS :=
|
2002-09-12 18:05:39 +02:00
|
|
|
endif
|
|
|
|
|
2002-09-18 13:55:13 +02:00
|
|
|
# By default, strip symbol information from executable
|
2003-03-14 21:25:22 +01:00
|
|
|
ifndef KEEP_SYMBOLS
|
2004-10-30 11:19:36 +02:00
|
|
|
Strip := $(PLATFORMSTRIPOPTS)
|
|
|
|
StripWarnMsg := "(without symbols)"
|
2005-02-24 08:12:43 +01:00
|
|
|
Install.StripFlag += -s
|
2002-09-18 13:55:13 +02:00
|
|
|
endif
|
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
# Adjust linker flags for building an executable
|
2009-02-26 09:03:36 +01:00
|
|
|
ifneq ($(OS),Darwin)
|
2009-03-12 22:03:53 +01:00
|
|
|
ifneq ($(DARWIN_MAJVERS),4)
|
2004-10-22 23:01:56 +02:00
|
|
|
ifdef TOOLNAME
|
2004-11-18 11:03:46 +01:00
|
|
|
ifdef EXAMPLE_TOOL
|
2009-03-07 23:17:05 +01:00
|
|
|
LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(RDYNAMIC)
|
2004-11-18 11:03:46 +01:00
|
|
|
else
|
2009-03-07 23:17:05 +01:00
|
|
|
LD.Flags += $(RPATH) -Wl,$(ToolDir) $(RDYNAMIC)
|
2009-02-26 08:44:16 +01:00
|
|
|
endif
|
2003-10-29 15:28:35 +01:00
|
|
|
endif
|
2004-11-18 11:03:46 +01:00
|
|
|
endif
|
2009-02-26 08:44:16 +01:00
|
|
|
endif
|
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
#----------------------------------------------------------
|
2004-10-22 23:01:56 +02:00
|
|
|
# Options To Invoke Tools
|
2004-10-23 22:04:14 +02:00
|
|
|
#----------------------------------------------------------
|
2003-06-30 23:59:07 +02:00
|
|
|
|
2009-05-12 09:26:49 +02:00
|
|
|
ifndef NO_PEDANTIC
|
2009-06-19 14:40:30 +02:00
|
|
|
CompileCommonOpts += -pedantic -Wno-long-long
|
2009-05-12 09:26:49 +02:00
|
|
|
endif
|
2009-06-19 14:40:30 +02:00
|
|
|
CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
|
|
|
|
$(EXTRA_OPTIONS)
|
2001-06-06 22:29:01 +02:00
|
|
|
|
2005-05-16 08:38:09 +02:00
|
|
|
ifeq ($(OS),HP-UX)
|
2006-02-15 04:20:16 +01:00
|
|
|
CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
|
2005-05-16 08:38:09 +02:00
|
|
|
endif
|
|
|
|
|
2006-05-30 18:38:06 +02:00
|
|
|
# If we are building a universal binary on Mac OS/X, pass extra options. This
|
|
|
|
# is useful to people that want to link the LLVM libraries into their universal
|
2006-06-29 21:38:04 +02:00
|
|
|
# apps.
|
|
|
|
#
|
|
|
|
# The following can be optionally specified:
|
|
|
|
# UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
|
|
|
|
# For Mac OS/X 10.4 Intel machines, the traditional one is:
|
|
|
|
# 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 08:30:15 +02:00
|
|
|
ifdef UNIVERSAL
|
2006-06-29 21:38:04 +02:00
|
|
|
ifndef UNIVERSAL_ARCH
|
|
|
|
UNIVERSAL_ARCH := i386 ppc
|
|
|
|
endif
|
|
|
|
UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
|
|
|
|
CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
|
2006-06-16 23:47:59 +02:00
|
|
|
ifdef UNIVERSAL_SDK_PATH
|
|
|
|
CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Building universal cannot compute dependencies automatically.
|
2006-04-06 08:30:15 +02:00
|
|
|
DISABLE_AUTO_DEPENDENCIES=1
|
2009-03-09 19:28:37 +01:00
|
|
|
else
|
2009-03-12 05:10:09 +01:00
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
ifeq ($(ARCH),x86_64)
|
2009-03-23 04:45:56 +01:00
|
|
|
TargetCommonOpts = -m64
|
2009-03-12 05:10:09 +01:00
|
|
|
else
|
|
|
|
ifeq ($(ARCH),x86)
|
2009-03-23 04:45:56 +01:00
|
|
|
TargetCommonOpts = -m32
|
2009-03-12 05:10:09 +01:00
|
|
|
endif
|
2009-03-09 19:28:37 +01:00
|
|
|
endif
|
|
|
|
endif
|
2006-04-06 08:30:15 +02:00
|
|
|
endif
|
|
|
|
|
2008-06-24 19:44:42 +02:00
|
|
|
ifeq ($(OS),SunOS)
|
|
|
|
CPP.BaseFlags += -include llvm/System/Solaris.h
|
|
|
|
endif
|
|
|
|
|
2009-01-08 03:11:55 +01:00
|
|
|
LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
|
2008-10-17 03:33:43 +02:00
|
|
|
CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
|
2006-03-22 16:59:55 +01:00
|
|
|
# All -I flags should go here, so that they don't confuse llvm-config.
|
2008-01-28 18:38:30 +01:00
|
|
|
CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
|
|
|
|
$(patsubst %,-I%/include,\
|
2008-01-28 05:18:41 +01:00
|
|
|
$(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
|
|
|
|
$(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
|
|
|
|
$(CPP.BaseFlags)
|
2004-10-22 23:01:56 +02:00
|
|
|
|
2009-03-13 21:59:41 +01:00
|
|
|
ifeq ($(BUILD_COMPONENT), 1)
|
2009-06-17 01:00:42 +02:00
|
|
|
Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) \
|
2009-03-23 04:45:56 +01:00
|
|
|
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
2009-06-17 01:00:42 +02:00
|
|
|
Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) \
|
2009-03-23 04:45:56 +01:00
|
|
|
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
|
|
|
Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(TargetCommonOpts) \
|
2009-06-17 01:00:42 +02:00
|
|
|
$(CompileCommonOpts) $(CXX.Flags) -E
|
|
|
|
Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) \
|
2009-03-23 04:45:56 +01:00
|
|
|
$(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip)
|
2008-10-03 00:56:44 +02:00
|
|
|
else
|
2009-06-17 01:00:42 +02:00
|
|
|
Compile.C = $(CC) $(CPP.Flags) $(C.Flags) \
|
2009-03-23 04:45:56 +01:00
|
|
|
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
2009-06-17 01:00:42 +02:00
|
|
|
Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) \
|
2009-03-23 04:45:56 +01:00
|
|
|
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
|
|
|
Preprocess.CXX= $(CXX) $(CPP.Flags) $(TargetCommonOpts) \
|
2009-06-17 01:00:42 +02:00
|
|
|
$(CompileCommonOpts) $(CXX.Flags) -E
|
|
|
|
Link = $(CXX) $(CPP.Flags) $(CXX.Flags) \
|
2009-03-23 04:45:56 +01:00
|
|
|
$(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip)
|
2008-10-03 00:56:44 +02:00
|
|
|
endif
|
|
|
|
|
2009-03-23 04:45:56 +01:00
|
|
|
BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) \
|
|
|
|
$(TargetCommonOpts) $(CompileCommonOpts)
|
|
|
|
Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) \
|
|
|
|
$(TargetCommonOpts) $(CompileCommonOpts) -E
|
2005-10-05 02:28:41 +02:00
|
|
|
|
2006-09-29 20:47:13 +02:00
|
|
|
BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CXX.Flags) \
|
2009-03-23 04:45:56 +01:00
|
|
|
$(TargetCommonOpts) $(CompileCommonOpts)
|
2006-09-29 20:47:13 +02:00
|
|
|
|
2009-01-08 03:11:55 +01:00
|
|
|
ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
|
|
|
|
ScriptInstall = $(INSTALL) -m 0755
|
2005-02-24 08:12:43 +01:00
|
|
|
DataInstall = $(INSTALL) -m 0644
|
2008-01-16 00:27:40 +01: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.
|
|
|
|
TableGen = $(TBLGEN) -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
|
2009-01-09 17:31:01 +01:00
|
|
|
-I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
|
2008-01-16 00:27:40 +01:00
|
|
|
-I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
|
|
|
|
-I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
|
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
Archive = $(AR) $(AR.Flags)
|
2004-12-02 10:28:21 +01:00
|
|
|
LArchive = $(LLVMToolDir)/llvm-ar rcsf
|
2004-10-22 23:01:56 +02:00
|
|
|
ifdef RANLIB
|
2004-10-23 22:04:14 +02:00
|
|
|
Ranlib = $(RANLIB)
|
2004-10-22 23:01:56 +02:00
|
|
|
else
|
2004-10-23 22:04:14 +02:00
|
|
|
Ranlib = ranlib
|
2004-10-22 23:01:56 +02:00
|
|
|
endif
|
2001-06-06 22:29:01 +02:00
|
|
|
|
|
|
|
#----------------------------------------------------------
|
2009-01-08 03:11:55 +01:00
|
|
|
# Get the list of source files and compute object file
|
|
|
|
# names from them.
|
2004-10-23 22:04:14 +02:00
|
|
|
#----------------------------------------------------------
|
2004-10-22 23:01:56 +02:00
|
|
|
|
2006-01-27 23:13:12 +01:00
|
|
|
ifndef SOURCES
|
|
|
|
Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
|
2009-01-02 08:16:45 +01:00
|
|
|
$(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
|
2006-01-27 23:13:12 +01:00
|
|
|
else
|
|
|
|
Sources := $(SOURCES)
|
2009-01-08 03:11:55 +01:00
|
|
|
endif
|
2001-07-15 15:16:47 +02:00
|
|
|
|
2006-01-27 23:13:12 +01:00
|
|
|
ifdef BUILT_SOURCES
|
2009-01-02 08:16:45 +01:00
|
|
|
Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
|
2004-12-04 23:34:09 +01:00
|
|
|
endif
|
2004-10-23 22:04:14 +02:00
|
|
|
|
2006-01-27 23:13:12 +01:00
|
|
|
BaseNameSources := $(sort $(basename $(Sources)))
|
|
|
|
|
|
|
|
ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
|
|
|
|
ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
|
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
###############################################################################
|
|
|
|
# DIRECTORIES: Handle recursive descent of directory structure
|
|
|
|
###############################################################################
|
2003-07-31 22:58:51 +02:00
|
|
|
|
2004-10-28 11:15:28 +02:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide rules to make install dirs. This must be early
|
|
|
|
# in the file so they get built before dependencies
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
2009-02-13 00:45:11 +01:00
|
|
|
$(PROJ_bindir) $(PROJ_libdir) $(PROJ_includedir) $(PROJ_etcdir)::
|
2009-01-22 04:24:22 +01:00
|
|
|
$(Verb) $(MKDIR) $@
|
2004-10-28 11:15:28 +02:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
# To create other directories, as needed, and timestamp their creation
|
|
|
|
%/.dir:
|
|
|
|
$(Verb) $(MKDIR) $* > /dev/null
|
2004-11-29 06:00:33 +01:00
|
|
|
$(Verb) $(DATE) > $@
|
2004-10-30 11:19:36 +02:00
|
|
|
|
2004-11-18 11:03:46 +01:00
|
|
|
.PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
|
|
|
|
.PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
|
2004-10-28 11:15:28 +02:00
|
|
|
|
2001-06-06 22:29:01 +02:00
|
|
|
#---------------------------------------------------------
|
2004-10-23 22:04:14 +02:00
|
|
|
# Handle the DIRS options for sequential construction
|
2001-06-06 22:29:01 +02:00
|
|
|
#---------------------------------------------------------
|
|
|
|
|
2009-01-08 03:11:55 +01:00
|
|
|
SubDirs :=
|
2002-09-18 06:29:30 +02:00
|
|
|
ifdef DIRS
|
2004-10-30 11:19:36 +02:00
|
|
|
SubDirs += $(DIRS)
|
2006-07-26 22:22:26 +02:00
|
|
|
|
|
|
|
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
|
2004-10-30 11:19:36 +02:00
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(DIRS); do \
|
2004-10-22 23:01:56 +02:00
|
|
|
if [ ! -f $$dir/Makefile ]; then \
|
|
|
|
$(MKDIR) $$dir; \
|
2005-01-16 03:20:54 +01:00
|
|
|
$(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
|
2004-10-22 23:01:56 +02:00
|
|
|
fi; \
|
2006-05-18 00:55:35 +02:00
|
|
|
($(MAKE) -C $$dir $@ ) || exit 1; \
|
2002-09-18 01:35:02 +02:00
|
|
|
done
|
2006-07-26 22:22:26 +02:00
|
|
|
else
|
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(DIRS); do \
|
|
|
|
($(MAKE) -C $$dir $@ ) || exit 1; \
|
|
|
|
done
|
|
|
|
endif
|
|
|
|
|
2002-09-18 06:29:30 +02:00
|
|
|
endif
|
2002-09-18 05:22:27 +02:00
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle the EXPERIMENTAL_DIRS options ensuring success
|
|
|
|
# after each directory is built.
|
|
|
|
#---------------------------------------------------------
|
|
|
|
ifdef EXPERIMENTAL_DIRS
|
2004-10-30 11:19:36 +02:00
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
|
2004-10-23 22:04:14 +02:00
|
|
|
if [ ! -f $$dir/Makefile ]; then \
|
|
|
|
$(MKDIR) $$dir; \
|
2005-01-16 03:20:54 +01:00
|
|
|
$(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
|
2004-10-23 22:04:14 +02:00
|
|
|
fi; \
|
2006-05-18 00:55:35 +02:00
|
|
|
($(MAKE) -C $$dir $@ ) || exit 0; \
|
2004-10-23 22:04:14 +02:00
|
|
|
done
|
|
|
|
endif
|
|
|
|
|
2009-01-24 01:00:41 +01:00
|
|
|
#-----------------------------------------------------------
|
|
|
|
# Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
|
|
|
|
#-----------------------------------------------------------
|
|
|
|
ifdef OPTIONAL_PARALLEL_DIRS
|
|
|
|
PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) && echo "$(T)"))
|
|
|
|
endif
|
|
|
|
|
2005-12-22 00:17:06 +01:00
|
|
|
#-----------------------------------------------------------
|
2004-10-23 22:04:14 +02:00
|
|
|
# Handle the PARALLEL_DIRS options for parallel construction
|
2005-12-22 00:17:06 +01:00
|
|
|
#-----------------------------------------------------------
|
2002-09-18 05:22:27 +02:00
|
|
|
ifdef PARALLEL_DIRS
|
2004-10-23 22:04:14 +02:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
SubDirs += $(PARALLEL_DIRS)
|
|
|
|
|
2004-12-03 21:08:48 +01:00
|
|
|
# Unfortunately, this list must be maintained if new recursive targets are added
|
2004-10-30 11:19:36 +02:00
|
|
|
all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
|
|
|
|
clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
|
2004-11-02 17:56:15 +01:00
|
|
|
clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
|
2004-10-30 11:19:36 +02:00
|
|
|
install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
|
2004-10-23 22:04:14 +02:00
|
|
|
uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
|
2004-12-03 21:08:48 +01:00
|
|
|
install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
|
2002-09-18 05:22:27 +02:00
|
|
|
|
2004-12-04 23:34:09 +01:00
|
|
|
ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
|
2004-10-23 22:04:14 +02:00
|
|
|
|
2004-12-04 23:34:09 +01:00
|
|
|
$(ParallelTargets) :
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Verb) if [ ! -f $(@D)/Makefile ]; then \
|
2004-10-22 23:01:56 +02:00
|
|
|
$(MKDIR) $(@D); \
|
2005-01-16 03:20:54 +01:00
|
|
|
$(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
|
2003-11-25 20:32:22 +01:00
|
|
|
fi; \
|
2007-02-07 04:29:29 +01:00
|
|
|
$(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
|
2001-06-06 22:29:01 +02:00
|
|
|
endif
|
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle the OPTIONAL_DIRS options for directores that may
|
|
|
|
# or may not exist.
|
|
|
|
#---------------------------------------------------------
|
2003-06-27 18:58:44 +02:00
|
|
|
ifdef OPTIONAL_DIRS
|
2004-10-25 10:27:37 +02:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
SubDirs += $(OPTIONAL_DIRS)
|
2004-10-25 10:27:37 +02:00
|
|
|
|
2006-07-26 22:22:26 +02:00
|
|
|
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
|
2004-10-30 11:19:36 +02:00
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(OPTIONAL_DIRS); do \
|
2005-01-16 03:20:54 +01:00
|
|
|
if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
|
2004-10-22 23:01:56 +02:00
|
|
|
if [ ! -f $$dir/Makefile ]; then \
|
|
|
|
$(MKDIR) $$dir; \
|
2005-01-16 03:20:54 +01:00
|
|
|
$(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
|
2004-10-22 23:01:56 +02:00
|
|
|
fi; \
|
2006-05-18 00:55:35 +02:00
|
|
|
($(MAKE) -C$$dir $@ ) || exit 1; \
|
2004-10-22 23:01:56 +02:00
|
|
|
fi \
|
2003-06-27 18:58:44 +02:00
|
|
|
done
|
2006-07-26 22:22:26 +02:00
|
|
|
else
|
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(OPTIONAL_DIRS); do \
|
|
|
|
($(MAKE) -C$$dir $@ ) || exit 1; \
|
|
|
|
done
|
|
|
|
endif
|
2003-06-27 18:58:44 +02:00
|
|
|
endif
|
|
|
|
|
2004-08-20 11:20:05 +02:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle the CONFIG_FILES options
|
|
|
|
#---------------------------------------------------------
|
|
|
|
ifdef CONFIG_FILES
|
|
|
|
|
2007-02-06 19:53:14 +01:00
|
|
|
ifdef NO_INSTALL
|
|
|
|
install-local::
|
|
|
|
$(Echo) Install circumvented with NO_INSTALL
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) UnInstall circumvented with NO_INSTALL
|
|
|
|
else
|
2005-01-16 03:20:54 +01:00
|
|
|
install-local:: $(PROJ_etcdir) $(CONFIG_FILES)
|
|
|
|
$(Echo) Installing Configuration Files To $(PROJ_etcdir)
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Verb)for file in $(CONFIG_FILES); do \
|
2005-01-16 03:20:54 +01:00
|
|
|
if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
|
2005-02-24 04:56:32 +01:00
|
|
|
$(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \
|
2005-01-16 03:20:54 +01:00
|
|
|
elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
|
2005-02-24 04:56:32 +01:00
|
|
|
$(DataInstall) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \
|
2004-11-23 06:59:53 +01:00
|
|
|
else \
|
|
|
|
$(ECHO) Error: cannot find config file $${file}. ; \
|
|
|
|
fi \
|
2004-08-20 11:20:05 +02:00
|
|
|
done
|
2004-10-23 22:04:14 +02:00
|
|
|
|
2004-10-28 09:57:28 +02:00
|
|
|
uninstall-local::
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Echo) Uninstalling Configuration Files From $(PROJ_etcdir)
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Verb)for file in $(CONFIG_FILES); do \
|
2005-01-16 03:20:54 +01:00
|
|
|
$(RM) -f $(PROJ_etcdir)/$${file} ; \
|
2004-10-24 09:53:21 +02:00
|
|
|
done
|
2007-02-06 19:53:14 +01:00
|
|
|
endif
|
2004-10-24 09:53:21 +02:00
|
|
|
|
2004-08-20 11:20:05 +02:00
|
|
|
endif
|
|
|
|
|
2005-05-19 02:37:31 +02:00
|
|
|
###############################################################################
|
|
|
|
# Set up variables for building libararies
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Define various command line options pertaining to the
|
2009-01-08 03:11:55 +01:00
|
|
|
# libraries needed when linking. There are "Proj" libs
|
|
|
|
# (defined by the user's project) and "LLVM" libs (defined
|
2006-09-04 06:47:21 +02:00
|
|
|
# by the LLVM project).
|
2005-05-19 02:37:31 +02:00
|
|
|
#---------------------------------------------------------
|
2005-08-13 07:09:50 +02:00
|
|
|
|
2006-09-04 06:47:21 +02:00
|
|
|
ifdef USEDLIBS
|
2005-05-19 02:37:31 +02:00
|
|
|
ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
|
|
|
|
ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
|
2006-09-04 06:47:21 +02:00
|
|
|
ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
|
|
|
|
ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef LLVMLIBS
|
2005-05-19 02:37:31 +02: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 06:47:21 +02:00
|
|
|
endif
|
|
|
|
|
2008-10-03 21:11:19 +02:00
|
|
|
ifndef IS_CLEANING_TARGET
|
2006-09-04 06:47:21 +02:00
|
|
|
ifdef LINK_COMPONENTS
|
2006-09-04 07:23:20 +02: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 14:34:15 +01:00
|
|
|
|
2006-09-04 07:23:20 +02:00
|
|
|
$(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
|
|
|
|
|
2009-03-03 11:03:27 +01:00
|
|
|
LLVMLibsOptions += $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS))
|
|
|
|
LLVMLibsPaths += $(LLVM_CONFIG) \
|
2006-09-04 08:39:52 +02:00
|
|
|
$(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS))
|
2006-09-04 06:47:21 +02:00
|
|
|
endif
|
2006-09-04 06:50:10 +02:00
|
|
|
endif
|
2005-05-19 02:37:31 +02:00
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
###############################################################################
|
|
|
|
# Library Build Rules: Four ways to build a library
|
|
|
|
###############################################################################
|
2001-06-06 22:29:01 +02:00
|
|
|
|
2004-12-05 06:17:22 +01:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Bytecode Module Targets:
|
|
|
|
# If the user set MODULE_NAME then they want to build a
|
|
|
|
# bytecode module from the sources. We compile all the
|
|
|
|
# sources and link it together into a single bytecode
|
|
|
|
# module.
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
|
|
|
ifdef MODULE_NAME
|
2005-02-14 22:54:08 +01:00
|
|
|
ifeq ($(strip $(LLVMGCC)),)
|
2005-05-13 20:32:54 +02:00
|
|
|
$(warning Modules require llvm-gcc but no llvm-gcc is available ****)
|
2005-02-14 22:54:08 +01:00
|
|
|
else
|
2004-12-05 06:17:22 +01:00
|
|
|
|
|
|
|
Module := $(LibDir)/$(MODULE_NAME).bc
|
2008-02-25 23:41:55 +01:00
|
|
|
LinkModule := $(LLVMLD) -L$(CFERuntimeLibDir) -r
|
2006-04-12 20:21:35 +02:00
|
|
|
|
2004-12-05 06:17:22 +01:00
|
|
|
|
|
|
|
ifdef EXPORTED_SYMBOL_FILE
|
2006-01-27 23:13:12 +01:00
|
|
|
LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
|
2004-12-05 06:17:22 +01:00
|
|
|
endif
|
|
|
|
|
2007-02-09 16:52:07 +01:00
|
|
|
$(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLD)
|
2005-05-13 20:32:54 +02:00
|
|
|
$(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
|
2004-12-05 06:17:22 +01:00
|
|
|
$(Verb) $(LinkModule) -o $@ $(ObjectsBC)
|
|
|
|
|
|
|
|
all-local:: $(Module)
|
|
|
|
|
|
|
|
clean-local::
|
|
|
|
ifneq ($(strip $(Module)),)
|
|
|
|
-$(Verb) $(RM) -f $(Module)
|
|
|
|
endif
|
|
|
|
|
2004-12-13 08:38:07 +01:00
|
|
|
ifdef BYTECODE_DESTINATION
|
|
|
|
ModuleDestDir := $(BYTECODE_DESTINATION)
|
|
|
|
else
|
2005-01-16 03:20:54 +01:00
|
|
|
ModuleDestDir := $(PROJ_libdir)
|
2004-12-13 08:38:07 +01:00
|
|
|
endif
|
|
|
|
|
2007-02-06 19:53:14 +01:00
|
|
|
ifdef NO_INSTALL
|
|
|
|
install-local::
|
|
|
|
$(Echo) Install circumvented with NO_INSTALL
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstall circumvented with NO_INSTALL
|
|
|
|
else
|
2004-12-13 08:38:07 +01:00
|
|
|
DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
|
2004-12-05 06:17:22 +01:00
|
|
|
|
2004-12-13 08:38:07 +01:00
|
|
|
install-module:: $(DestModule)
|
2004-12-05 06:17:22 +01:00
|
|
|
install-local:: $(DestModule)
|
|
|
|
|
2009-01-08 03:11:55 +01:00
|
|
|
$(DestModule): $(ModuleDestDir) $(Module)
|
2004-12-05 06:17:22 +01:00
|
|
|
$(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
|
2005-02-24 22:30:37 +01:00
|
|
|
$(Verb) $(DataInstall) $(Module) $(DestModule)
|
2004-12-05 06:17:22 +01:00
|
|
|
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
|
|
|
|
-$(Verb) $(RM) -f $(DestModule)
|
2007-02-06 19:53:14 +01:00
|
|
|
endif
|
2004-12-05 06:17:22 +01:00
|
|
|
|
|
|
|
endif
|
2005-02-14 22:54:08 +01:00
|
|
|
endif
|
2004-01-22 23:53:48 +01:00
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
# if we're building a library ...
|
2001-06-06 22:29:01 +02:00
|
|
|
ifdef LIBRARYNAME
|
2001-07-15 15:16:47 +02:00
|
|
|
|
2002-09-17 00:36:42 +02:00
|
|
|
# Make sure there isn't any extranous whitespace on the LIBRARYNAME option
|
2002-09-17 00:34:56 +02:00
|
|
|
LIBRARYNAME := $(strip $(LIBRARYNAME))
|
2005-01-11 05:31:07 +01:00
|
|
|
ifdef LOADABLE_MODULE
|
2009-02-26 08:44:16 +01:00
|
|
|
LibName.A := $(LibDir)/$(LIBRARYNAME).a
|
|
|
|
LibName.SO := $(LibDir)/$(LIBRARYNAME)$(SHLIBEXT)
|
2005-01-11 05:31:07 +01:00
|
|
|
else
|
2004-10-30 11:19:36 +02:00
|
|
|
LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
|
2009-02-26 08:44:16 +01:00
|
|
|
LibName.SO := $(LibDir)/lib$(LIBRARYNAME)$(SHLIBEXT)
|
|
|
|
endif
|
2004-10-30 11:19:36 +02:00
|
|
|
LibName.O := $(LibDir)/$(LIBRARYNAME).o
|
2004-12-02 10:28:21 +01:00
|
|
|
LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
|
2002-09-17 00:34:56 +02:00
|
|
|
|
2004-10-23 22:04:14 +02: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 23:01:56 +02:00
|
|
|
ifdef SHARED_LIBRARY
|
2003-08-15 04:18:35 +02:00
|
|
|
|
2009-02-26 08:44:16 +01:00
|
|
|
all-local:: $(LibName.SO)
|
2002-08-02 20:34:12 +02:00
|
|
|
|
2005-05-19 02:37:31 +02:00
|
|
|
ifdef LINK_LIBS_IN_SHARED
|
2006-08-08 01:12:15 +02:00
|
|
|
ifdef LOADABLE_MODULE
|
2006-11-15 22:04:15 +01:00
|
|
|
SharedLibKindMessage := "Loadable Module"
|
2006-08-08 01:12:15 +02:00
|
|
|
else
|
|
|
|
SharedLibKindMessage := "Shared Library"
|
|
|
|
endif
|
2009-02-26 08:44:16 +01:00
|
|
|
$(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(LibDir)/.dir
|
2006-08-08 01:12:15 +02:00
|
|
|
$(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
|
|
|
|
$(LIBRARYNAME)$(SHLIBEXT)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
|
2009-05-26 21:11:47 +02:00
|
|
|
$(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
|
2005-05-19 02:37:31 +02:00
|
|
|
else
|
2009-02-26 08:44:16 +01:00
|
|
|
$(LibName.SO): $(ObjectsO) $(LibDir)/.dir
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
|
2005-05-19 02:37:31 +02:00
|
|
|
endif
|
2004-10-23 22:04:14 +02:00
|
|
|
|
|
|
|
clean-local::
|
2009-02-26 08:44:16 +01:00
|
|
|
ifneq ($(strip $(LibName.SO)),)
|
|
|
|
-$(Verb) $(RM) -f $(LibName.SO)
|
2004-10-24 09:53:21 +02:00
|
|
|
endif
|
|
|
|
|
2007-02-06 19:53:14 +01:00
|
|
|
ifdef NO_INSTALL
|
|
|
|
install-local::
|
|
|
|
$(Echo) Install circumvented with NO_INSTALL
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstall circumvented with NO_INSTALL
|
|
|
|
else
|
2005-01-16 03:20:54 +01:00
|
|
|
DestSharedLib = $(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
|
2004-10-24 09:53:21 +02:00
|
|
|
|
2004-10-28 09:57:28 +02:00
|
|
|
install-local:: $(DestSharedLib)
|
2004-10-24 09:53:21 +02:00
|
|
|
|
2009-02-26 08:44:16 +01:00
|
|
|
$(DestSharedLib): $(LibName.SO) $(PROJ_libdir)
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
|
2002-07-23 19:56:16 +02:00
|
|
|
|
2009-01-08 03:11:55 +01:00
|
|
|
uninstall-local::
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
|
2005-01-16 03:20:54 +01:00
|
|
|
-$(Verb) $(RM) -f $(PROJ_libdir)/lib$(LIBRARYNAME).*
|
2007-02-06 19:53:14 +01:00
|
|
|
endif
|
2002-07-23 19:56:16 +02:00
|
|
|
endif
|
2001-06-06 22:29:01 +02:00
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Bytecode Library Targets:
|
|
|
|
# If the user asked for a bytecode library to be built
|
2009-01-08 03:11:55 +01:00
|
|
|
# with the BYTECODE_LIBRARY variable, then we provide
|
2004-10-23 22:04:14 +02:00
|
|
|
# targets for building them.
|
|
|
|
#---------------------------------------------------------
|
2004-10-22 23:01:56 +02:00
|
|
|
ifdef BYTECODE_LIBRARY
|
2005-02-14 22:54:08 +01:00
|
|
|
ifeq ($(strip $(LLVMGCC)),)
|
2005-05-13 20:32:54 +02:00
|
|
|
$(warning Bytecode libraries require llvm-gcc which could not be found ****)
|
2005-02-14 22:54:08 +01:00
|
|
|
else
|
2003-06-30 23:59:07 +02:00
|
|
|
|
2004-12-02 10:28:21 +01:00
|
|
|
all-local:: $(LibName.BCA)
|
2003-08-15 04:18:35 +02:00
|
|
|
|
2004-12-02 10:28:21 +01:00
|
|
|
ifdef EXPORTED_SYMBOL_FILE
|
2007-02-09 16:52:07 +01:00
|
|
|
BCLinkLib = $(LLVMLD) -L$(CFERuntimeLibDir) \
|
2006-05-30 18:38:06 +02:00
|
|
|
-internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
|
2003-08-15 04:18:35 +02:00
|
|
|
|
2007-02-09 16:52:07 +01:00
|
|
|
$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLD) \
|
2004-12-15 18:14:06 +01:00
|
|
|
$(LLVMToolDir)/llvm-ar
|
2004-12-02 10:28:21 +01:00
|
|
|
$(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
|
|
|
|
"(internalize)"
|
2004-12-02 22:23:43 +01:00
|
|
|
$(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
|
2004-12-13 04:59:35 +01:00
|
|
|
$(Verb) $(RM) -f $@
|
2004-12-02 10:28:21 +01:00
|
|
|
$(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
|
|
|
|
else
|
2004-12-16 08:36:08 +01:00
|
|
|
$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
|
2004-12-15 18:14:06 +01:00
|
|
|
$(LLVMToolDir)/llvm-ar
|
2004-12-02 10:28:21 +01:00
|
|
|
$(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
|
2004-12-13 04:59:35 +01:00
|
|
|
$(Verb) $(RM) -f $@
|
2004-12-02 10:28:21 +01:00
|
|
|
$(Verb) $(LArchive) $@ $(ObjectsBC)
|
|
|
|
|
|
|
|
endif
|
2001-06-06 22:29:01 +02:00
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
clean-local::
|
2004-12-02 10:28:21 +01:00
|
|
|
ifneq ($(strip $(LibName.BCA)),)
|
|
|
|
-$(Verb) $(RM) -f $(LibName.BCA)
|
2004-10-24 09:53:21 +02:00
|
|
|
endif
|
|
|
|
|
2004-12-13 08:28:21 +01:00
|
|
|
ifdef BYTECODE_DESTINATION
|
|
|
|
BytecodeDestDir := $(BYTECODE_DESTINATION)
|
|
|
|
else
|
2005-01-16 03:20:54 +01:00
|
|
|
BytecodeDestDir := $(PROJ_libdir)
|
2004-12-13 08:28:21 +01:00
|
|
|
endif
|
|
|
|
|
2009-05-12 07:35:40 +02:00
|
|
|
DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca
|
2004-12-02 10:28:21 +01:00
|
|
|
|
2004-12-03 21:08:48 +01:00
|
|
|
install-bytecode-local:: $(DestBytecodeLib)
|
2004-10-26 09:09:33 +02:00
|
|
|
|
2007-02-06 19:53:14 +01:00
|
|
|
ifdef NO_INSTALL
|
|
|
|
install-local::
|
|
|
|
$(Echo) Install circumvented with NO_INSTALL
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstall circumvented with NO_INSTALL
|
|
|
|
else
|
2004-10-28 09:57:28 +02:00
|
|
|
install-local:: $(DestBytecodeLib)
|
2002-09-20 16:03:13 +02:00
|
|
|
|
2009-02-13 00:45:11 +01:00
|
|
|
$(DestBytecodeLib): $(LibName.BCA) $(BytecodeDestDir)
|
2004-12-02 10:28:21 +01:00
|
|
|
$(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
|
2005-02-24 22:36:32 +01:00
|
|
|
$(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
|
2001-06-06 22:29:01 +02:00
|
|
|
|
2004-10-28 09:57:28 +02:00
|
|
|
uninstall-local::
|
2004-12-02 10:28:21 +01:00
|
|
|
$(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
|
2004-11-02 17:56:15 +01:00
|
|
|
-$(Verb) $(RM) -f $(DestBytecodeLib)
|
2007-02-06 19:53:14 +01:00
|
|
|
endif
|
2004-10-22 23:01:56 +02:00
|
|
|
endif
|
2005-02-14 22:54:08 +01:00
|
|
|
endif
|
2003-08-15 04:18:35 +02:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
#---------------------------------------------------------
|
2009-06-17 01:00:42 +02:00
|
|
|
# Library Targets:
|
|
|
|
# If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
|
|
|
|
# building an archive.
|
2004-10-30 11:19:36 +02:00
|
|
|
#---------------------------------------------------------
|
2005-10-24 04:21:45 +02:00
|
|
|
ifndef BUILD_ARCHIVE
|
2009-06-17 01:00:42 +02:00
|
|
|
ifndef LOADABLE_MODULE
|
|
|
|
BUILD_ARCHIVE = 1
|
2007-02-06 19:53:14 +01:00
|
|
|
endif
|
2004-10-22 23:01:56 +02:00
|
|
|
endif
|
2003-12-18 21:57:48 +01:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Archive Library Targets:
|
2009-01-08 03:11:55 +01:00
|
|
|
# If the user wanted a regular archive library built,
|
2004-10-30 11:19:36 +02:00
|
|
|
# then we provide targets for building them.
|
|
|
|
#---------------------------------------------------------
|
2004-10-22 23:01:56 +02:00
|
|
|
ifdef BUILD_ARCHIVE
|
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
all-local:: $(LibName.A)
|
|
|
|
|
2004-12-16 08:36:08 +01:00
|
|
|
$(LibName.A): $(ObjectsO) $(LibDir)/.dir
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) Building $(BuildMode) Archive Library $(notdir $@)
|
2004-11-02 17:56:15 +01:00
|
|
|
-$(Verb) $(RM) -f $@
|
2009-01-03 23:46:50 +01:00
|
|
|
$(Verb) $(Archive) $@ $(ObjectsO)
|
|
|
|
$(Verb) $(Ranlib) $@
|
2004-10-22 23:01:56 +02:00
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
clean-local::
|
2004-10-30 11:19:36 +02:00
|
|
|
ifneq ($(strip $(LibName.A)),)
|
2004-11-02 17:56:15 +01:00
|
|
|
-$(Verb) $(RM) -f $(LibName.A)
|
2004-10-24 09:53:21 +02:00
|
|
|
endif
|
|
|
|
|
2007-02-06 19:53:14 +01:00
|
|
|
ifdef NO_INSTALL
|
|
|
|
install-local::
|
|
|
|
$(Echo) Install circumvented with NO_INSTALL
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstall circumvented with NO_INSTALL
|
|
|
|
else
|
2005-01-16 03:20:54 +01:00
|
|
|
DestArchiveLib := $(PROJ_libdir)/lib$(LIBRARYNAME).a
|
2004-10-24 09:53:21 +02:00
|
|
|
|
2004-10-28 09:57:28 +02:00
|
|
|
install-local:: $(DestArchiveLib)
|
2004-10-24 09:53:21 +02:00
|
|
|
|
2009-02-13 00:45:11 +01:00
|
|
|
$(DestArchiveLib): $(LibName.A) $(PROJ_libdir)
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Verb) $(MKDIR) $(PROJ_libdir)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
|
2004-10-24 09:53:21 +02:00
|
|
|
|
2004-10-28 09:57:28 +02:00
|
|
|
uninstall-local::
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
|
2004-11-02 17:56:15 +01:00
|
|
|
-$(Verb) $(RM) -f $(DestArchiveLib)
|
2007-02-06 19:53:14 +01:00
|
|
|
endif
|
2001-06-06 22:29:01 +02:00
|
|
|
endif
|
|
|
|
|
2004-10-24 09:53:21 +02:00
|
|
|
# endif LIBRARYNAME
|
2009-01-08 03:11:55 +01:00
|
|
|
endif
|
2004-10-22 23:01:56 +02:00
|
|
|
|
2004-10-24 10:21:04 +02:00
|
|
|
###############################################################################
|
|
|
|
# Tool Build Rules: Build executable tool based on TOOLNAME option
|
|
|
|
###############################################################################
|
|
|
|
|
2001-09-08 00:57:58 +02:00
|
|
|
ifdef TOOLNAME
|
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Set up variables for building a tool.
|
|
|
|
#---------------------------------------------------------
|
2004-11-18 11:03:46 +01:00
|
|
|
ifdef EXAMPLE_TOOL
|
2005-05-19 23:03:11 +02:00
|
|
|
ToolBuildPath := $(ExmplDir)/$(strip $(TOOLNAME))$(EXEEXT)
|
2004-11-18 11:03:46 +01:00
|
|
|
else
|
2005-05-19 23:03:11 +02:00
|
|
|
ToolBuildPath := $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT)
|
2004-11-18 11:03:46 +01:00
|
|
|
endif
|
2003-05-29 18:18:20 +02:00
|
|
|
|
2009-02-26 18:47:49 +01: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
|
|
|
|
ifeq ($(OS),Darwin)
|
2009-03-10 18:15:56 +01:00
|
|
|
|
|
|
|
# Tiger tools don't support this.
|
|
|
|
ifneq ($(DARWIN_MAJVERS),4)
|
2009-02-26 18:47:49 +01:00
|
|
|
LD.Flags += -Wl,-exported_symbol -Wl,_main
|
|
|
|
endif
|
2009-03-10 18:15:56 +01:00
|
|
|
endif
|
2009-02-26 18:47:49 +01:00
|
|
|
|
|
|
|
ifeq ($(OS), $(filter $(OS), Linux NetBSD FreeBSD))
|
2009-02-26 19:38:40 +01:00
|
|
|
LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
|
2009-02-26 18:47:49 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide targets for building the tools
|
|
|
|
#---------------------------------------------------------
|
|
|
|
all-local:: $(ToolBuildPath)
|
2003-06-27 18:58:44 +02:00
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
clean-local::
|
2004-10-30 11:19:36 +02:00
|
|
|
ifneq ($(strip $(ToolBuildPath)),)
|
2004-11-02 17:56:15 +01:00
|
|
|
-$(Verb) $(RM) -f $(ToolBuildPath)
|
2004-10-24 09:53:21 +02:00
|
|
|
endif
|
2004-10-22 23:01:56 +02:00
|
|
|
|
2004-11-18 11:03:46 +01:00
|
|
|
ifdef EXAMPLE_TOOL
|
|
|
|
$(ToolBuildPath): $(ExmplDir)/.dir
|
|
|
|
else
|
|
|
|
$(ToolBuildPath): $(ToolDir)/.dir
|
|
|
|
endif
|
|
|
|
|
2006-09-04 08:39:52 +02:00
|
|
|
$(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
|
2006-05-16 08:25:14 +02:00
|
|
|
$(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
|
2006-02-14 05:25:54 +01:00
|
|
|
$(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
|
2009-01-08 03:11:55 +01:00
|
|
|
$(StripWarnMsg)
|
2004-10-24 09:53:21 +02:00
|
|
|
|
2007-02-06 19:53:14 +01:00
|
|
|
ifdef NO_INSTALL
|
|
|
|
install-local::
|
|
|
|
$(Echo) Install circumvented with NO_INSTALL
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstall circumvented with NO_INSTALL
|
|
|
|
else
|
2005-01-16 03:20:54 +01:00
|
|
|
DestTool = $(PROJ_bindir)/$(TOOLNAME)
|
2004-10-24 09:53:21 +02:00
|
|
|
|
2004-10-28 09:57:28 +02:00
|
|
|
install-local:: $(DestTool)
|
2004-10-24 09:53:21 +02:00
|
|
|
|
2009-02-13 00:45:11 +01:00
|
|
|
$(DestTool): $(ToolBuildPath) $(PROJ_bindir)
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) Installing $(BuildMode) $(DestTool)
|
2005-02-24 04:56:32 +01:00
|
|
|
$(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
|
2004-10-24 09:53:21 +02:00
|
|
|
|
2004-10-28 09:57:28 +02:00
|
|
|
uninstall-local::
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) Uninstalling $(BuildMode) $(DestTool)
|
2004-11-02 17:56:15 +01:00
|
|
|
-$(Verb) $(RM) -f $(DestTool)
|
2007-02-06 19:53:14 +01:00
|
|
|
endif
|
2004-10-22 23:01:56 +02:00
|
|
|
endif
|
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
###############################################################################
|
2009-01-08 03:11:55 +01:00
|
|
|
# Object Build Rules: Build object files based on sources
|
2004-10-30 11:19:36 +02:00
|
|
|
###############################################################################
|
|
|
|
|
2006-02-15 04:23:26 +01:00
|
|
|
# FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
|
|
|
|
ifeq ($(OS),HP-UX)
|
|
|
|
DISABLE_AUTO_DEPENDENCIES=1
|
|
|
|
endif
|
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
# Provide rule sets for when dependency generation is enabled
|
2004-10-22 23:01:56 +02:00
|
|
|
ifndef DISABLE_AUTO_DEPENDENCIES
|
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
#---------------------------------------------------------
|
2009-02-26 08:44:16 +01:00
|
|
|
# Create .o files in the ObjDir directory from the .cpp and .c files...
|
2004-10-30 11:19:36 +02:00
|
|
|
#---------------------------------------------------------
|
2004-10-23 22:04:14 +02:00
|
|
|
|
2008-01-01 00:58:31 +01:00
|
|
|
DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
|
2009-02-26 08:44:16 +01:00
|
|
|
-MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
|
2008-02-27 14:34:15 +01:00
|
|
|
|
2009-05-12 08:35:50 +02:00
|
|
|
# If the build succeeded, move the dependency file over, otherwise
|
|
|
|
# remove it.
|
2008-01-01 00:58:31 +01:00
|
|
|
DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
|
|
|
|
|
2009-02-26 08:44:16 +01:00
|
|
|
$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
|
2006-06-21 22:58:03 +02:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build " $(PIC_FLAG)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
2008-01-01 00:58:31 +01:00
|
|
|
$(DEPEND_MOVEFILE)
|
2004-10-23 22:04:14 +02:00
|
|
|
|
2009-02-26 08:44:16 +01:00
|
|
|
$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
|
2006-06-21 22:58:03 +02:00
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
2008-01-01 00:58:31 +01:00
|
|
|
$(DEPEND_MOVEFILE)
|
2005-02-04 22:28:50 +01:00
|
|
|
|
2009-02-26 08:44:16 +01:00
|
|
|
$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
|
2006-06-21 22:58:03 +02:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
2008-01-01 00:58:31 +01:00
|
|
|
$(DEPEND_MOVEFILE)
|
2004-10-23 22:04:14 +02:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
#---------------------------------------------------------
|
2005-02-04 22:28:50 +01:00
|
|
|
# Create .bc files in the ObjDir directory from .cpp .cc and .c files...
|
2004-10-30 11:19:36 +02:00
|
|
|
#---------------------------------------------------------
|
2006-01-27 23:13:12 +01:00
|
|
|
|
2009-05-12 08:35:50 +02:00
|
|
|
BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \
|
|
|
|
-MT "$(ObjDir)/$*.ll" -MT "$(ObjDir)/$*.bc.d"
|
|
|
|
|
|
|
|
# If the build succeeded, move the dependency file over, otherwise
|
|
|
|
# remove it.
|
|
|
|
BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \
|
|
|
|
else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi
|
|
|
|
|
2006-12-30 17:31:02 +01:00
|
|
|
$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
|
2009-05-12 08:35:50 +02:00
|
|
|
$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
|
|
|
|
$< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
|
|
|
|
$(BC_DEPEND_MOVEFILE)
|
2004-10-30 11:19:36 +02:00
|
|
|
|
2006-12-30 17:31:02 +01:00
|
|
|
$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
|
2005-02-04 22:28:50 +01:00
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
|
2009-05-12 08:35:50 +02:00
|
|
|
$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
|
|
|
|
$< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
|
|
|
|
$(BC_DEPEND_MOVEFILE)
|
2005-02-04 22:28:50 +01:00
|
|
|
|
2006-12-30 17:31:02 +01:00
|
|
|
$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGCC)
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
|
2009-05-12 08:35:50 +02:00
|
|
|
$(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
|
|
|
|
$< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
|
|
|
|
$(BC_DEPEND_MOVEFILE)
|
2004-10-30 11:19:36 +02:00
|
|
|
|
|
|
|
# Provide alternate rule sets if dependencies are disabled
|
2004-10-22 23:01:56 +02:00
|
|
|
else
|
2001-09-08 00:57:58 +02:00
|
|
|
|
2009-02-26 08:44:16 +01:00
|
|
|
$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
|
2006-06-21 22:58:03 +02:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Compile.CXX) $< -o $@
|
2004-10-23 22:04:14 +02:00
|
|
|
|
2009-02-26 08:44:16 +01:00
|
|
|
$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
|
2006-06-21 22:58:03 +02:00
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Compile.CXX) $< -o $@
|
2005-02-04 22:28:50 +01:00
|
|
|
|
2009-02-26 08:44:16 +01:00
|
|
|
$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
|
2006-06-21 22:58:03 +02:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Compile.C) $< -o $@
|
2004-10-22 23:01:56 +02:00
|
|
|
|
2006-12-30 17:31:02 +01:00
|
|
|
$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
|
2006-01-27 23:13:12 +01:00
|
|
|
$(BCCompile.CXX) $< -o $@ -S -emit-llvm
|
2004-10-22 23:01:56 +02:00
|
|
|
|
2006-12-30 17:31:02 +01:00
|
|
|
$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
|
2005-02-04 22:28:50 +01:00
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
|
2006-01-27 23:13:12 +01:00
|
|
|
$(BCCompile.CXX) $< -o $@ -S -emit-llvm
|
2005-02-04 22:28:50 +01:00
|
|
|
|
2006-12-30 17:31:02 +01:00
|
|
|
$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGCC)
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
|
2006-01-27 23:13:12 +01:00
|
|
|
$(BCCompile.C) $< -o $@ -S -emit-llvm
|
|
|
|
|
|
|
|
endif
|
2003-12-10 01:26:28 +01:00
|
|
|
|
2006-06-21 23:01:20 +02:00
|
|
|
|
|
|
|
## Rules for building preprocessed (.i/.ii) outputs.
|
|
|
|
$(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
|
|
|
|
$(Verb) $(Preprocess.CXX) $< -o $@
|
|
|
|
|
|
|
|
$(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
|
|
|
|
$(Verb) $(Preprocess.CXX) $< -o $@
|
|
|
|
|
2006-12-10 05:56:38 +01:00
|
|
|
$(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
|
2006-06-21 23:01:20 +02:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
|
|
|
|
$(Verb) $(Preprocess.C) $< -o $@
|
|
|
|
|
|
|
|
|
|
|
|
$(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Compile.CXX) $< -o $@ -S
|
2006-06-21 23:01:20 +02:00
|
|
|
|
|
|
|
$(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Compile.CXX) $< -o $@ -S
|
2006-06-21 23:01:20 +02:00
|
|
|
|
|
|
|
$(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
|
|
|
|
$(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
|
2009-02-26 08:44:16 +01:00
|
|
|
$(Compile.C) $< -o $@ -S
|
2006-06-21 23:01:20 +02:00
|
|
|
|
2006-11-17 04:32:33 +01:00
|
|
|
|
2006-01-27 23:13:12 +01:00
|
|
|
# make the C and C++ compilers strip debug info out of bytecode libraries.
|
2006-11-17 04:32:33 +01:00
|
|
|
ifdef DEBUG_RUNTIME
|
2007-02-09 16:52:07 +01:00
|
|
|
$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LLVMAS) $(LOPT)
|
2006-11-17 04:32:33 +01:00
|
|
|
$(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
|
2007-02-09 18:09:14 +01:00
|
|
|
$(Verb) $(LLVMAS) $< -o - | $(LOPT) -std-compile-opts -o $@ -f
|
2006-11-17 04:32:33 +01:00
|
|
|
else
|
2007-02-09 16:52:07 +01:00
|
|
|
$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LLVMAS) $(LOPT)
|
2006-01-27 23:13:12 +01:00
|
|
|
$(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
|
2007-02-09 16:52:07 +01:00
|
|
|
$(Verb) $(LLVMAS) $< -o - | \
|
2007-02-09 18:09:14 +01:00
|
|
|
$(LOPT) -std-compile-opts -strip-debug -o $@ -f
|
2006-11-17 04:32:33 +01:00
|
|
|
endif
|
|
|
|
|
2006-01-27 23:13:12 +01:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide rule to build .bc files from .ll sources,
|
|
|
|
# regardless of dependencies
|
|
|
|
#---------------------------------------------------------
|
|
|
|
$(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
|
2004-11-01 08:50:27 +01:00
|
|
|
$(Echo) "Compiling $*.ll for $(BuildMode) build"
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Verb) $(LLVMAS) $< -f -o $@
|
|
|
|
|
2009-03-02 10:04:13 +01:00
|
|
|
###############################################################################
|
2009-03-02 10:42:59 +01:00
|
|
|
# TABLEGEN: Provide rules for running tblgen to produce *.inc files
|
2009-03-02 10:04:13 +01:00
|
|
|
###############################################################################
|
|
|
|
|
2009-03-02 10:42:59 +01:00
|
|
|
ifdef TARGET
|
|
|
|
TABLEGEN_INC_FILES_COMMON = 1
|
|
|
|
endif
|
2009-03-02 10:04:13 +01:00
|
|
|
|
2009-03-02 10:42:59 +01:00
|
|
|
ifdef LLVMC_BUILD_AUTOGENERATED_INC
|
|
|
|
TABLEGEN_INC_FILES_COMMON = 1
|
|
|
|
endif
|
2009-03-02 10:04:13 +01:00
|
|
|
|
2009-03-02 10:42:59 +01:00
|
|
|
ifdef TABLEGEN_INC_FILES_COMMON
|
2009-03-02 10:04:13 +01:00
|
|
|
|
|
|
|
INCFiles := $(filter %.inc,$(BUILT_SOURCES))
|
|
|
|
INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
|
|
|
|
.PRECIOUS: $(INCTMPFiles) $(INCFiles)
|
|
|
|
|
2009-03-02 10:42:59 +01: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 10:04:13 +01:00
|
|
|
$(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
|
|
|
|
$(Verb) $(CMP) -s $@ $< || $(CP) $< $@
|
|
|
|
|
2009-03-02 10:42:59 +01:00
|
|
|
endif # TABLEGEN_INC_FILES_COMMON
|
2001-09-08 00:57:58 +02:00
|
|
|
|
2004-10-22 23:01:56 +02:00
|
|
|
ifdef TARGET
|
2001-06-06 22:29:01 +02:00
|
|
|
|
2006-02-14 05:25:54 +01:00
|
|
|
TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
|
2008-11-24 08:34:46 +01: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 22:32:44 +02:00
|
|
|
$(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
|
|
|
|
$(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td)
|
2004-12-16 18:28:50 +01:00
|
|
|
|
2009-03-10 18:58:54 +01:00
|
|
|
# All of these files depend on tblgen and the .td files.
|
|
|
|
$(INCTMPFiles) : $(TBLGEN) $(TDFiles)
|
|
|
|
|
2004-12-16 18:28:50 +01:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) "Building $(<F) register names with tblgen"
|
2008-01-16 00:27:40 +01:00
|
|
|
$(Verb) $(TableGen) -gen-register-enums -o $(call SYSPATH, $@) $<
|
2001-07-15 15:16:47 +02:00
|
|
|
|
2004-12-16 18:28:50 +01:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenRegisterInfo.h.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenRegisterInfo.h.inc.tmp : %.td $(ObjDir)/.dir
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) "Building $(<F) register information header with tblgen"
|
2008-01-16 00:27:40 +01:00
|
|
|
$(Verb) $(TableGen) -gen-register-desc-header -o $(call SYSPATH, $@) $<
|
2002-09-20 16:03:13 +02:00
|
|
|
|
2004-12-16 18:28:50 +01:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) "Building $(<F) register info implementation with tblgen"
|
2008-01-16 00:27:40 +01:00
|
|
|
$(Verb) $(TableGen) -gen-register-desc -o $(call SYSPATH, $@) $<
|
2002-09-22 04:47:15 +02:00
|
|
|
|
2004-12-16 18:28:50 +01:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenInstrNames.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenInstrNames.inc.tmp : %.td $(ObjDir)/.dir
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) "Building $(<F) instruction names with tblgen"
|
2008-01-16 00:27:40 +01:00
|
|
|
$(Verb) $(TableGen) -gen-instr-enums -o $(call SYSPATH, $@) $<
|
2001-06-06 22:29:01 +02:00
|
|
|
|
2004-12-16 18:28:50 +01:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) "Building $(<F) instruction information with tblgen"
|
2008-01-16 00:27:40 +01:00
|
|
|
$(Verb) $(TableGen) -gen-instr-desc -o $(call SYSPATH, $@) $<
|
2003-06-30 23:59:07 +02:00
|
|
|
|
2004-12-16 18:28:50 +01:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) "Building $(<F) assembly writer with tblgen"
|
2008-01-16 00:27:40 +01:00
|
|
|
$(Verb) $(TableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
|
2003-08-15 04:18:35 +02:00
|
|
|
|
2004-12-16 18:34:04 +01:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir
|
|
|
|
$(Echo) "Building $(<F) assembly writer #1 with tblgen"
|
2009-01-08 03:11:55 +01:00
|
|
|
$(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
|
2004-10-22 23:01:56 +02:00
|
|
|
|
2009-07-13 20:35:35 +02:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir
|
|
|
|
$(Echo) "Building $(<F) assembly matcher with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
|
|
|
|
|
2004-12-16 18:28:50 +01:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) "Building $(<F) code emitter with tblgen"
|
2008-01-16 00:27:40 +01:00
|
|
|
$(Verb) $(TableGen) -gen-emitter -o $(call SYSPATH, $@) $<
|
2004-10-22 23:01:56 +02:00
|
|
|
|
2005-09-03 03:15:25 +02:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir
|
2008-08-13 22:19:35 +02:00
|
|
|
$(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
|
2008-01-16 00:27:40 +01:00
|
|
|
$(Verb) $(TableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
|
2005-09-03 03:15:25 +02:00
|
|
|
|
2008-08-13 22:19:35 +02:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir
|
|
|
|
$(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
|
|
|
|
|
2005-10-21 21:05:19 +02:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenSubtarget.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenSubtarget.inc.tmp : %.td $(ObjDir)/.dir
|
|
|
|
$(Echo) "Building $(<F) subtarget information with tblgen"
|
2008-01-16 00:27:40 +01:00
|
|
|
$(Verb) $(TableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
|
2005-09-03 03:15:25 +02:00
|
|
|
|
2007-02-27 21:44:12 +01:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir
|
|
|
|
$(Echo) "Building $(<F) calling convention information with tblgen"
|
2008-01-16 00:27:40 +01:00
|
|
|
$(Verb) $(TableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
|
2007-02-27 21:44:12 +01:00
|
|
|
|
2009-02-05 02:49:45 +01:00
|
|
|
$(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
|
|
|
|
$(ObjDir)/%GenIntrinsics.inc.tmp : Intrinsics%.td $(ObjDir)/.dir
|
|
|
|
$(Echo) "Building $(<F) calling convention information with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
|
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
clean-local::
|
2004-11-02 17:56:15 +01:00
|
|
|
-$(Verb) $(RM) -f $(INCFiles)
|
2004-10-22 23:01:56 +02:00
|
|
|
|
2009-03-02 10:42:59 +01:00
|
|
|
endif # TARGET
|
|
|
|
|
|
|
|
ifdef LLVMC_BUILD_AUTOGENERATED_INC
|
|
|
|
|
2009-04-21 21:46:10 +02:00
|
|
|
LLVMCPluginSrc := $(sort $(strip $(wildcard $(PROJ_SRC_DIR)/*.td)) \
|
|
|
|
$(strip $(wildcard $(PROJ_OBJ_DIR)/*.td)))
|
2009-03-02 10:42:59 +01:00
|
|
|
|
|
|
|
TDFiles := $(LLVMCPluginSrc) \
|
|
|
|
$(strip $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td))
|
|
|
|
|
|
|
|
$(ObjDir)/AutoGenerated.inc.tmp: $(LLVMCPluginSrc) $(ObjDir)/.dir \
|
|
|
|
$(TBLGEN) $(TD_COMMON)
|
|
|
|
$(Echo) "Building LLVMC configuration library with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-llvmc -o $(call SYSPATH, $@) $<
|
|
|
|
|
|
|
|
endif # LLVMC_BUILD_AUTOGENERATED_INC
|
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
###############################################################################
|
|
|
|
# OTHER RULES: Other rules needed
|
|
|
|
###############################################################################
|
2004-10-22 23:01:56 +02:00
|
|
|
|
2003-01-16 22:06:18 +01:00
|
|
|
# To create postscript files from dot files...
|
2003-10-02 21:02:02 +02:00
|
|
|
ifneq ($(DOT),false)
|
2003-06-30 23:59:07 +02:00
|
|
|
%.ps: %.dot
|
2004-10-22 23:01:56 +02:00
|
|
|
$(DOT) -Tps < $< > $@
|
2003-06-30 23:59:07 +02:00
|
|
|
else
|
2003-01-16 22:06:18 +01:00
|
|
|
%.ps: %.dot
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) "Cannot build $@: The program dot is not installed"
|
2003-06-30 23:59:07 +02:00
|
|
|
endif
|
2003-01-16 22:06:18 +01:00
|
|
|
|
2003-09-06 16:44:17 +02: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 20:37:08 +02:00
|
|
|
%.h:: ;
|
2005-02-04 22:28:50 +01:00
|
|
|
%.hpp:: ;
|
2003-09-06 16:44:17 +02:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
# Define clean-local to clean the current directory. Note that this uses a
|
2009-01-08 03:11:55 +01:00
|
|
|
# very conservative approach ensuring that empty variables do not cause
|
2004-10-30 11:19:36 +02:00
|
|
|
# errors or disastrous removal.
|
2004-10-23 22:04:14 +02:00
|
|
|
clean-local::
|
2008-10-03 00:56:44 +02:00
|
|
|
ifneq ($(strip $(ObjRootDir)),)
|
|
|
|
-$(Verb) $(RM) -rf $(ObjRootDir)
|
2004-10-24 09:53:21 +02:00
|
|
|
endif
|
2004-11-02 17:56:15 +01:00
|
|
|
-$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
|
2004-01-21 20:53:11 +01:00
|
|
|
ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
|
2004-11-02 17:56:15 +01:00
|
|
|
-$(Verb) $(RM) -f *$(SHLIBEXT)
|
2004-01-21 20:53:11 +01:00
|
|
|
endif
|
2003-06-30 23:59:07 +02:00
|
|
|
|
2004-11-02 17:36:03 +01:00
|
|
|
clean-all-local::
|
2004-11-02 17:56:15 +01:00
|
|
|
-$(Verb) $(RM) -rf Debug Release Profile
|
2004-11-02 17:36:03 +01:00
|
|
|
|
2004-11-12 03:27:36 +01:00
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
###############################################################################
|
|
|
|
# DEPENDENCIES: Include the dependency files if we should
|
|
|
|
###############################################################################
|
2003-08-22 16:10:16 +02:00
|
|
|
ifndef DISABLE_AUTO_DEPENDENCIES
|
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
# If its not one of the cleaning targets
|
2008-10-03 21:11:19 +02:00
|
|
|
ifndef IS_CLEANING_TARGET
|
2003-05-15 23:28:55 +02:00
|
|
|
|
2004-10-23 22:04:14 +02:00
|
|
|
# Get the list of dependency files
|
2009-05-12 08:35:50 +02:00
|
|
|
DependSourceFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
|
|
|
|
DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
|
|
|
|
|
|
|
|
# Include bitcode dependency files if using bitcode libraries
|
|
|
|
ifdef BYTECODE_LIBRARY
|
|
|
|
DependFiles += $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.bc.d)
|
|
|
|
endif
|
2004-10-23 22:04:14 +02:00
|
|
|
|
2007-07-23 10:20:46 +02:00
|
|
|
-include $(DependFiles) ""
|
2003-11-09 22:36:19 +01:00
|
|
|
|
2003-08-12 20:51:51 +02:00
|
|
|
endif
|
2003-08-18 19:27:40 +02:00
|
|
|
|
2009-01-08 03:11:55 +01:00
|
|
|
endif
|
2004-10-22 23:01:56 +02:00
|
|
|
|
2004-12-06 06:35:13 +01:00
|
|
|
###############################################################################
|
|
|
|
# CHECK: Running the test suite
|
|
|
|
###############################################################################
|
|
|
|
|
2009-04-09 20:26:57 +02:00
|
|
|
check::
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
|
|
|
|
if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
|
2004-12-06 06:35:13 +01:00
|
|
|
$(EchoCmd) Running test suite ; \
|
2005-01-16 03:20:54 +01:00
|
|
|
$(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
|
2004-12-06 06:35:13 +01:00
|
|
|
TESTSUITE=$(TESTSUITE) ; \
|
|
|
|
else \
|
|
|
|
$(EchoCmd) No Makefile in test directory ; \
|
|
|
|
fi ; \
|
|
|
|
else \
|
|
|
|
$(EchoCmd) No test directory ; \
|
|
|
|
fi
|
|
|
|
|
2009-01-05 00:12:21 +01:00
|
|
|
###############################################################################
|
|
|
|
# UNITTESTS: Running the unittests test suite
|
|
|
|
###############################################################################
|
|
|
|
|
2009-04-09 20:26:57 +02:00
|
|
|
unittests::
|
2009-01-05 00:12:21 +01:00
|
|
|
$(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
|
|
|
|
if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
|
|
|
|
$(EchoCmd) Running unittests test suite ; \
|
|
|
|
$(MAKE) -C $(PROJ_OBJ_ROOT)/unittests ; \
|
|
|
|
else \
|
|
|
|
$(EchoCmd) No Makefile in unittests directory ; \
|
|
|
|
fi ; \
|
|
|
|
else \
|
|
|
|
$(EchoCmd) No unittests directory ; \
|
|
|
|
fi
|
|
|
|
|
2004-10-24 09:53:21 +02:00
|
|
|
###############################################################################
|
2004-10-30 11:19:36 +02:00
|
|
|
# DISTRIBUTION: Handle construction of a distribution tarball
|
2004-10-24 09:53:21 +02:00
|
|
|
###############################################################################
|
|
|
|
|
2004-10-26 09:09:33 +02:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Define distribution related variables
|
|
|
|
#------------------------------------------------------------------------
|
2005-01-16 03:20:54 +01: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 09:09:33 +02: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 03:20:54 +01:00
|
|
|
$(PROJ_SRC_DIR)/*.h \
|
|
|
|
$(PROJ_SRC_DIR)/*.td \
|
|
|
|
$(PROJ_SRC_DIR)/*.def \
|
|
|
|
$(PROJ_SRC_DIR)/*.ll \
|
|
|
|
$(PROJ_SRC_DIR)/*.in))
|
2004-10-30 11:19:36 +02:00
|
|
|
DistSubDirs := $(SubDirs)
|
2004-11-29 06:00:33 +01:00
|
|
|
DistSources = $(Sources) $(EXTRA_DIST)
|
|
|
|
DistFiles = $(DistAlways) $(DistSources) $(DistOther)
|
2004-10-25 10:27:37 +02:00
|
|
|
|
2004-10-26 09:09:33 +02:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# We MUST build distribution with OBJ_DIR != SRC_DIR
|
|
|
|
#------------------------------------------------------------------------
|
2005-01-16 03:20:54 +01:00
|
|
|
ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
|
2004-10-25 10:27:37 +02:00
|
|
|
dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
|
2004-10-25 10:27:37 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2004-10-26 09:09:33 +02:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Prevent attempt to run dist targets from anywhere but the top level
|
|
|
|
#------------------------------------------------------------------------
|
2004-10-25 10:27:37 +02:00
|
|
|
ifneq ($(LEVEL),.)
|
|
|
|
dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
|
2004-10-25 10:27:37 +02:00
|
|
|
else
|
|
|
|
|
2004-10-26 09:09:33 +02:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Provide the top level targets
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
dist-gzip:: $(DistTarGZip)
|
2004-10-25 10:27:37 +02:00
|
|
|
|
2004-12-04 23:34:09 +01:00
|
|
|
$(DistTarGZip) : $(TopDistDir)/.makedistdir
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) Packing gzipped distribution tar file.
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
|
2004-11-29 06:00:33 +01:00
|
|
|
$(GZIP) -c > "$(DistTarGZip)"
|
2004-10-25 10:27:37 +02:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
dist-bzip2:: $(DistTarBZ2)
|
2004-10-26 09:09:33 +02:00
|
|
|
|
2004-12-04 23:34:09 +01:00
|
|
|
$(DistTarBZ2) : $(TopDistDir)/.makedistdir
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) Packing bzipped distribution tar file.
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
|
2004-11-29 06:00:33 +01:00
|
|
|
$(BZIP2) -c >$(DistTarBZ2)
|
2004-10-24 09:53:21 +02:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
dist-zip:: $(DistZip)
|
2004-10-24 09:53:21 +02:00
|
|
|
|
2004-12-04 23:34:09 +01:00
|
|
|
$(DistZip) : $(TopDistDir)/.makedistdir
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) Packing zipped distribution file.
|
|
|
|
$(Verb) rm -f $(DistZip)
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
|
2004-10-26 09:09:33 +02:00
|
|
|
|
2009-01-08 03:11:55 +01:00
|
|
|
dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
|
2004-10-25 10:27:37 +02:00
|
|
|
|
2005-01-28 20:52:32 +01:00
|
|
|
DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
|
2004-10-26 09:09:33 +02:00
|
|
|
|
2004-12-04 23:34:09 +01:00
|
|
|
dist-check:: $(DistTarGZip)
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) Checking distribution tar file.
|
|
|
|
$(Verb) if test -d $(DistCheckDir) ; then \
|
2004-10-26 09:09:33 +02:00
|
|
|
$(RM) -rf $(DistCheckDir) ; \
|
|
|
|
fi
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Verb) $(MKDIR) $(DistCheckDir)
|
|
|
|
$(Verb) cd $(DistCheckDir) && \
|
2004-10-26 09:09:33 +02:00
|
|
|
$(MKDIR) $(DistCheckDir)/build && \
|
|
|
|
$(MKDIR) $(DistCheckDir)/install && \
|
|
|
|
gunzip -c $(DistTarGZip) | $(TAR) xf - && \
|
|
|
|
cd build && \
|
|
|
|
../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
|
2005-05-24 04:33:20 +02:00
|
|
|
--srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
|
2004-12-04 23:34:09 +01:00
|
|
|
$(MAKE) all && \
|
2004-10-26 09:09:33 +02:00
|
|
|
$(MAKE) check && \
|
2009-01-05 00:12:21 +01:00
|
|
|
$(MAKE) unittests && \
|
2004-10-26 09:09:33 +02:00
|
|
|
$(MAKE) install && \
|
|
|
|
$(MAKE) uninstall && \
|
|
|
|
$(MAKE) dist-clean && \
|
2004-10-30 11:19:36 +02:00
|
|
|
$(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
|
2004-10-25 10:27:37 +02:00
|
|
|
|
|
|
|
dist-clean::
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) Cleaning distribution files
|
2004-12-04 23:34:09 +01:00
|
|
|
-$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
|
|
|
|
$(DistCheckDir)
|
2004-10-25 10:27:37 +02:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2004-10-26 09:09:33 +02:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Provide the recursive distdir target for building the distribution directory
|
|
|
|
#------------------------------------------------------------------------
|
2004-12-04 23:34:09 +01:00
|
|
|
distdir: $(DistDir)/.makedistdir
|
|
|
|
$(DistDir)/.makedistdir: $(DistSources)
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
|
2004-10-26 09:09:33 +02:00
|
|
|
if test -d "$(DistDir)" ; then \
|
|
|
|
find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
|
|
|
|
exit 1 ; \
|
|
|
|
fi ; \
|
2004-12-04 23:34:09 +01:00
|
|
|
$(EchoCmd) Removing old $(DistDir) ; \
|
2004-10-26 09:09:33 +02:00
|
|
|
$(RM) -rf $(DistDir); \
|
2004-12-06 06:35:13 +01:00
|
|
|
$(EchoCmd) Making 'all' to verify build ; \
|
2006-04-10 18:46:04 +02:00
|
|
|
$(MAKE) ENABLE_OPTIMIZED=1 all ; \
|
2004-10-26 09:09:33 +02:00
|
|
|
fi
|
2004-11-29 06:00:33 +01:00
|
|
|
$(Echo) Building Distribution Directory $(DistDir)
|
2009-01-08 03:11:55 +01:00
|
|
|
$(Verb) $(MKDIR) $(DistDir)
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
|
|
|
|
srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
|
2004-10-25 10:27:37 +02:00
|
|
|
for file in $(DistFiles) ; do \
|
|
|
|
case "$$file" in \
|
2005-01-16 03:20:54 +01:00
|
|
|
$(PROJ_SRC_DIR)/*) \
|
2004-12-04 23:34:09 +01:00
|
|
|
file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
|
|
|
|
;; \
|
2005-01-16 03:20:54 +01:00
|
|
|
$(PROJ_SRC_ROOT)/*) \
|
2004-12-04 23:34:09 +01:00
|
|
|
file=`echo "$$file" | \
|
|
|
|
sed "s#^$$srcrootstrip/##"` \
|
|
|
|
;; \
|
2004-10-25 10:27:37 +02:00
|
|
|
esac; \
|
2005-01-16 03:20:54 +01:00
|
|
|
if test -f "$(PROJ_SRC_DIR)/$$file" || \
|
|
|
|
test -d "$(PROJ_SRC_DIR)/$$file" ; then \
|
|
|
|
from_dir="$(PROJ_SRC_DIR)" ; \
|
2004-12-04 23:34:09 +01:00
|
|
|
elif test -f "$$file" || test -d "$$file" ; then \
|
2004-10-25 10:27:37 +02:00
|
|
|
from_dir=. ; \
|
2004-12-04 23:34:09 +01:00
|
|
|
fi ; \
|
|
|
|
to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
|
2004-10-25 10:27:37 +02: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 09:09:33 +02:00
|
|
|
$(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
|
2004-10-25 10:27:37 +02:00
|
|
|
fi ; \
|
|
|
|
if test -d "$$from_dir/$$file"; then \
|
2005-01-16 03:20:54 +01:00
|
|
|
if test -d "$(PROJ_SRC_DIR)/$$file" && \
|
|
|
|
test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
|
2005-05-24 04:33:20 +02: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 10:27:37 +02:00
|
|
|
fi; \
|
|
|
|
elif test -f "$$from_dir/$$file" ; then \
|
2004-12-16 19:26:53 +01:00
|
|
|
$(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
|
2004-10-25 10:27:37 +02:00
|
|
|
elif test -L "$$from_dir/$$file" ; then \
|
2004-12-16 19:26:53 +01:00
|
|
|
$(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
|
2004-10-25 10:27:37 +02:00
|
|
|
elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
|
2004-12-04 23:34:09 +01:00
|
|
|
$(EchoCmd) "===== WARNING: Distribution Source " \
|
|
|
|
"$$from_dir/$$file Not Found!" ; \
|
2004-10-30 11:19:36 +02:00
|
|
|
elif test "$(Verb)" != '@' ; then \
|
|
|
|
$(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
|
2004-10-25 10:27:37 +02:00
|
|
|
fi; \
|
|
|
|
done
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Verb) for subdir in $(DistSubDirs) ; do \
|
2004-10-25 10:27:37 +02:00
|
|
|
if test "$$subdir" \!= "." ; then \
|
|
|
|
new_distdir="$(DistDir)/$$subdir" ; \
|
2004-10-26 09:09:33 +02:00
|
|
|
test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
|
2006-04-10 18:46:04 +02:00
|
|
|
( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
|
2006-04-07 18:06:18 +02:00
|
|
|
DistDir="$$new_distdir" distdir ) || exit 1; \
|
2004-10-25 10:27:37 +02:00
|
|
|
fi; \
|
|
|
|
done
|
2004-12-04 23:34:09 +01:00
|
|
|
$(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
|
2005-05-24 04:33:20 +02:00
|
|
|
$(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
|
2006-02-14 05:27:15 +01:00
|
|
|
$(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
|
|
|
|
-name .svn \) -print` ;\
|
2004-12-04 23:34:09 +01: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 10:27:37 +02:00
|
|
|
|
2004-10-30 11:19:36 +02:00
|
|
|
# This is invoked by distdir target, define it as a no-op to avoid errors if not
|
|
|
|
# defined by user.
|
2004-10-25 10:27:37 +02:00
|
|
|
dist-hook::
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# TOP LEVEL - targets only to apply at the top level directory
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
ifeq ($(LEVEL),.)
|
2004-10-24 09:53:21 +02:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
2004-12-06 06:35:13 +01:00
|
|
|
# Install support for the project's include files:
|
2004-10-24 09:53:21 +02:00
|
|
|
#------------------------------------------------------------------------
|
2007-02-06 19:53:14 +01:00
|
|
|
ifdef NO_INSTALL
|
|
|
|
install-local::
|
|
|
|
$(Echo) Install circumvented with NO_INSTALL
|
|
|
|
uninstall-local::
|
|
|
|
$(Echo) Uninstall circumvented with NO_INSTALL
|
|
|
|
else
|
2004-10-24 09:53:21 +02:00
|
|
|
install-local::
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) Installing include files
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Verb) $(MKDIR) $(PROJ_includedir)
|
2005-02-24 04:56:32 +01:00
|
|
|
$(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
|
2005-01-16 03:20:54 +01:00
|
|
|
cd $(PROJ_SRC_ROOT)/include && \
|
2009-01-02 08:16:45 +01:00
|
|
|
for hdr in `find . -type f '!' '(' -name '*~' \
|
2007-04-09 21:08:58 +02:00
|
|
|
-o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS | \
|
|
|
|
grep -v .svn` ; do \
|
2005-02-24 04:56:32 +01:00
|
|
|
instdir=`dirname "$(PROJ_includedir)/$$hdr"` ; \
|
|
|
|
if test \! -d "$$instdir" ; then \
|
|
|
|
$(EchoCmd) Making install directory $$instdir ; \
|
|
|
|
$(MKDIR) $$instdir ;\
|
|
|
|
fi ; \
|
|
|
|
$(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
|
2005-02-16 16:54:03 +01:00
|
|
|
done ; \
|
2004-10-24 09:53:21 +02:00
|
|
|
fi
|
2005-12-23 23:27:56 +01:00
|
|
|
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
|
2005-02-24 04:56:32 +01:00
|
|
|
$(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
|
2005-02-16 16:54:03 +01:00
|
|
|
cd $(PROJ_OBJ_ROOT)/include && \
|
2005-12-23 23:27:56 +01:00
|
|
|
for hdr in `find . -type f -print | grep -v CVS` ; do \
|
2005-02-24 04:56:32 +01:00
|
|
|
$(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
|
2005-02-16 16:54:03 +01:00
|
|
|
done ; \
|
2005-02-09 03:24:00 +01:00
|
|
|
fi
|
2005-12-23 23:27:56 +01:00
|
|
|
endif
|
2004-10-24 09:53:21 +02:00
|
|
|
|
|
|
|
uninstall-local::
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) Uninstalling include files
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
|
|
|
|
cd $(PROJ_SRC_ROOT)/include && \
|
2004-10-24 09:53:21 +02:00
|
|
|
$(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
|
2009-01-02 08:16:45 +01:00
|
|
|
'!' '(' -name '*~' -o -name '.#*' \
|
2006-02-14 05:25:54 +01:00
|
|
|
-o -name '*.in' ')' -print ')' | \
|
|
|
|
grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \
|
2005-02-09 03:24:00 +01:00
|
|
|
cd $(PROJ_SRC_ROOT)/include && \
|
2006-02-14 05:25:54 +01:00
|
|
|
$(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
|
|
|
|
-print ')' | sed 's#\.in$$##;s#^#$(PROJ_includedir)/#'` ; \
|
2005-02-09 03:24:00 +01:00
|
|
|
fi
|
2007-02-06 19:53:14 +01:00
|
|
|
endif
|
2004-10-24 09:53:21 +02:00
|
|
|
endif
|
|
|
|
|
2007-04-15 01:35:45 +02:00
|
|
|
check-line-length:
|
2008-05-15 12:04:30 +02:00
|
|
|
@echo searching for overlength lines in files: $(Sources)
|
|
|
|
@echo
|
|
|
|
@echo
|
2008-08-29 00:32:39 +02:00
|
|
|
egrep -n '.{81}' $(Sources) /dev/null
|
2007-04-15 01:35:45 +02:00
|
|
|
|
2007-04-16 20:10:23 +02:00
|
|
|
check-for-tabs:
|
2008-05-15 12:04:30 +02:00
|
|
|
@echo searching for tabs in files: $(Sources)
|
|
|
|
@echo
|
|
|
|
@echo
|
2008-08-29 00:32:39 +02:00
|
|
|
egrep -n ' ' $(Sources) /dev/null
|
2008-05-15 12:04:30 +02:00
|
|
|
|
2007-05-02 23:29:39 +02: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 23:01:56 +02:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Print out the directories used for building
|
2004-10-30 11:19:36 +02:00
|
|
|
#------------------------------------------------------------------------
|
2004-10-23 22:04:14 +02:00
|
|
|
printvars::
|
2005-01-16 03:20:54 +01:00
|
|
|
$(Echo) "BuildMode : " '$(BuildMode)'
|
|
|
|
$(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
|
|
|
|
$(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
|
|
|
|
$(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
|
|
|
|
$(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
|
|
|
|
$(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
|
|
|
|
$(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
|
|
|
|
$(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
|
|
|
|
$(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
|
|
|
|
$(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
|
|
|
|
$(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
|
2005-02-16 17:13:02 +01:00
|
|
|
$(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
|
2005-01-16 03:20:54 +01: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 17:27:06 +01:00
|
|
|
$(Echo) "PreConditions: " '$(PreConditions)'
|
2005-01-16 03:20:54 +01: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 12:43:10 +02:00
|
|
|
$(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
|
2006-04-10 01:41:14 +02:00
|
|
|
$(Echo) "SubDirs : " '$(SubDirs)'
|
2007-03-29 21:05:44 +02:00
|
|
|
$(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
|
|
|
|
$(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
|
2009-02-21 21:42:39 +01:00
|
|
|
|
|
|
|
###
|
|
|
|
# Debugging
|
|
|
|
|
2009-03-06 23:23:25 +01:00
|
|
|
# General debugging rule, use 'make dbg-print-XXX' to print the
|
2009-02-21 21:42:39 +01:00
|
|
|
# definition, value and origin of XXX.
|
2009-03-06 23:23:25 +01:00
|
|
|
make-print-%:
|
2009-02-21 21:42:39 +01:00
|
|
|
$(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))
|