summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2011-11-03 22:46:21 +0000
committerDaniel Dunbar <daniel@zuster.org>2011-11-03 22:46:21 +0000
commite29c3167d45577c604f5029760175f83e2d1d295 (patch)
tree4689bb518cfbaebd2eda498b7e872d63fcd8b259
parent02271a7b42ab658115c19d5041eaed2001b9537c (diff)
downloadllvm-e29c3167d45577c604f5029760175f83e2d1d295.tar.gz
llvm-e29c3167d45577c604f5029760175f83e2d1d295.tar.bz2
llvm-e29c3167d45577c604f5029760175f83e2d1d295.tar.xz
build/Make: Integrate llvm-build into Makefiles.
- Basically, we coordinate with llvm-build to create a Makefile fragment we can easily use. For now, nothing is wired in except the support to automatically regenerate this file when necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143662 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Makefile.rules48
1 files changed, 48 insertions, 0 deletions
diff --git a/Makefile.rules b/Makefile.rules
index c0ded8e07a..4fb672237e 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -57,6 +57,54 @@ VPATH=$(PROJ_SRC_DIR)
$(UserTargets)::
+#------------------------------------------------------------------------
+# LLVMBuild Integration
+#------------------------------------------------------------------------
+#
+# We use llvm-build to generate all the data required by the Makefile based
+# build system in one swoop:
+#
+# - We generate a file (a Makefile fragment) in the object root which contains
+# all the definitions that are required by Makefiles across the entire
+# project.
+#
+# - We generate the library table used by llvm-config.
+#
+# - We generate the dependencies for the Makefile fragment, so that we will
+# automatically reconfigure outselves.
+
+# The path to the llvm-build tool itself.
+LLVMBuildTool := $(PROJ_SRC_ROOT)/utils/llvm-build/llvm-build
+
+# The files we are going to generate using llvm-build.
+LLVMBuildMakeFrag := $(PROJ_OBJ_ROOT)/Makefile.llvmbuild
+LLVMConfigLibraryDependenciesInc := \
+ $(PROJ_OBJ_ROOT)/tools/llvm-config/LibraryDependencies.inc
+
+# The rule to create the LLVMBuild Makefile fragment as well as the llvm-config
+# library table.
+#
+# Note that this target gets its real dependencies generated for us by
+# llvm-build.
+$(LLVMBuildMakeFrag):
+ $(EchoCmd) Constructing LLVMBuild project information. ; \
+ $(LLVMBuildTool) \
+ --write-library-table $(LLVMConfigLibraryDependenciesInc) \
+ --write-make-fragment $(LLVMBuildMakeFrag)
+
+# Include the generated Makefile fragment.
+#
+# We currently only include the dependencies for the fragment itself if we are
+# at the top-level. Otherwise, recursive invocations would ends up doing
+# substantially more redundant stat'ing.
+#
+# This means that we won't properly regenerate things for developers used to
+# building from a subdirectory, but that is always somewhat unreliable.
+ifeq ($(LEVEL),.)
+LLVMBUILD_INCLUDE_DEPENDENCIES := 1
+endif
+-include $(LLVMBuildMakeFrag)
+
################################################################################
# PRECONDITIONS: that which must be built/checked first
################################################################################