Bug 860957 - Support for invoking non-recursive targets during partial tree builds; r=glandium
authorGregory Szorc <gps@mozilla.com>
Fri, 17 May 2013 10:54:53 -0700
changeset 132259 4b3f1fe5c0971bfc6c13a5bd234b2a37896b0a0b
parent 132258 c98f7f0305a7c0d4984354779b4791be73003b88
child 132260 d14e9efe0b005c4b47234c12cd82e762eb17cb2f
push id28185
push usergszorc@mozilla.com
push dateFri, 17 May 2013 17:55:33 +0000
treeherdermozilla-inbound@d14e9efe0b00 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs860957
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 860957 - Support for invoking non-recursive targets during partial tree builds; r=glandium
Makefile.in
config/makefiles/nonrecursive.mk
config/rules.mk
js/src/Makefile.in
js/src/config/makefiles/nonrecursive.mk
js/src/config/rules.mk
--- a/Makefile.in
+++ b/Makefile.in
@@ -12,16 +12,18 @@ ifndef .PYMAKE
 ifeq (,$(MAKE_VERSION))
 $(error GNU Make is required)
 endif
 ifeq (,$(filter-out 3.78 3.79,$(MAKE_VERSION)))
 $(error GNU Make 3.80 or higher is required)
 endif
 endif
 
+export TOPLEVEL_BUILD := 1
+
 include $(DEPTH)/config/autoconf.mk
 
 default::
 
 ifdef COMPILE_ENVIRONMENT
 include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
 endif
 
new file mode 100644
--- /dev/null
+++ b/config/makefiles/nonrecursive.mk
@@ -0,0 +1,62 @@
+# -*- makefile -*-
+# vim:set ts=8 sw=8 sts=8 noet:
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# The purpose of this file is to pull in non-recursive targets when performing
+# a partial tree (not top-level) build. This will allow people to continue to
+# build individual directories while some of the targets may not be normally
+# defined in that make file.
+#
+# Non-recursive targets are attached to existing make targets. The
+# NONRECURSIVE_TARGETS variable lists the make targets that modified. For
+# each target in this list, the NONRECURSIVE_TARGET_<target> variable will
+# contain a list of partial variable names. We will then look in variables
+# named NONRECURSIVE_TARGETS_<target>_<fragment>_* for information describing
+# how to evaluate non-recursive make targets.
+#
+# Targets are defined by the following variables:
+#
+#   FILE - The make file to evaluate.
+#   TARGETS - Targets to evaluate in that make file.
+#
+# For example:
+#
+# NONRECURSIVE_TARGETS = export libs
+# NONRECURSIVE_TARGETS_export = headers
+# NONRECURSIVE_TARGETS_export_headers_FILE = /path/to/exports.mk
+# NONRECURSIVE_TARGETS_export_headers_TARGETS = $(DIST)/include/foo.h $(DIST)/include/bar.h
+# NONRECURSIVE_TARGETS_libs = cppsrcs
+# NONRECURSIVE_TARGETS_libs_cppsrcs_FILE = /path/to/compilation.mk
+# NONRECURSIVE_TARGETS_libs_cppsrcs_TARGETS = /path/to/foo.o /path/to/bar.o
+#
+# Will get turned into the following:
+#
+# exports::
+#     $(MAKE) -f /path/to/exports.mk $(DIST)/include/foo.h $(DIST)/include/bar.h
+#
+# libs::
+#     $(MAKE) -f /path/to/compilation.mk /path/to/foo.o /path/to/bar.o
+
+ifndef INCLUDED_NONRECURSIVE_MK
+
+define define_nonrecursive_target
+$(1)::
+	cd $$(DEPTH) && $$(MAKE) -f $(2) $(3)
+endef
+
+$(foreach target,$(NONRECURSIVE_TARGETS), \
+    $(foreach entry,$(NONRECURSIVE_TARGETS_$(target)), \
+        $(eval $(call define_nonrecursive_target, \
+            $(target), \
+            $(NONRECURSIVE_TARGETS_$(target)_$(entry)_FILE), \
+            $(NONRECURSIVE_TARGETS_$(target)_$(entry)_TARGETS) \
+        )) \
+    ) \
+)
+
+INCLUDED_NONRECURSIVE_MK := 1
+endif
+
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -1723,16 +1723,21 @@ endef
     $(eval $(call preprocess_file_template,					\
                   $(file),							\
                   $(or $($(category)_PATH),$(CURDIR))/$(notdir $(file:.in=)),	\
                   $(or $($(category)_TARGET),libs),				\
                   $($(category)_FLAGS)))					\
    )										\
  )
 
+# Pull in non-recursive targets if this is a partial tree build.
+ifndef TOPLEVEL_BUILD
+include $(topsrcdir)/config/makefiles/nonrecursive.mk
+endif
+
 ################################################################################
 # Special gmake rules.
 ################################################################################
 
 
 #
 # Re-define the list of default suffixes, so gmake won't have to churn through
 # hundreds of built-in suffix rules for stuff we don't need.
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -3,16 +3,18 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 
+TOPLEVEL_BUILD := 1
+
 run_for_side_effects := $(shell echo "MAKE: $(MAKE)")
 include $(DEPTH)/config/autoconf.mk
 
 ifdef JS_STANDALONE
 LIBRARY_NAME	= mozjs-@MOZJS_MAJOR_VERSION@.@MOZJS_MINOR_VERSION@@MOZJS_ALPHA@
 else
 LIBRARY_NAME	= mozjs
 endif
new file mode 100644
--- /dev/null
+++ b/js/src/config/makefiles/nonrecursive.mk
@@ -0,0 +1,62 @@
+# -*- makefile -*-
+# vim:set ts=8 sw=8 sts=8 noet:
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# The purpose of this file is to pull in non-recursive targets when performing
+# a partial tree (not top-level) build. This will allow people to continue to
+# build individual directories while some of the targets may not be normally
+# defined in that make file.
+#
+# Non-recursive targets are attached to existing make targets. The
+# NONRECURSIVE_TARGETS variable lists the make targets that modified. For
+# each target in this list, the NONRECURSIVE_TARGET_<target> variable will
+# contain a list of partial variable names. We will then look in variables
+# named NONRECURSIVE_TARGETS_<target>_<fragment>_* for information describing
+# how to evaluate non-recursive make targets.
+#
+# Targets are defined by the following variables:
+#
+#   FILE - The make file to evaluate.
+#   TARGETS - Targets to evaluate in that make file.
+#
+# For example:
+#
+# NONRECURSIVE_TARGETS = export libs
+# NONRECURSIVE_TARGETS_export = headers
+# NONRECURSIVE_TARGETS_export_headers_FILE = /path/to/exports.mk
+# NONRECURSIVE_TARGETS_export_headers_TARGETS = $(DIST)/include/foo.h $(DIST)/include/bar.h
+# NONRECURSIVE_TARGETS_libs = cppsrcs
+# NONRECURSIVE_TARGETS_libs_cppsrcs_FILE = /path/to/compilation.mk
+# NONRECURSIVE_TARGETS_libs_cppsrcs_TARGETS = /path/to/foo.o /path/to/bar.o
+#
+# Will get turned into the following:
+#
+# exports::
+#     $(MAKE) -f /path/to/exports.mk $(DIST)/include/foo.h $(DIST)/include/bar.h
+#
+# libs::
+#     $(MAKE) -f /path/to/compilation.mk /path/to/foo.o /path/to/bar.o
+
+ifndef INCLUDED_NONRECURSIVE_MK
+
+define define_nonrecursive_target
+$(1)::
+	cd $$(DEPTH) && $$(MAKE) -f $(2) $(3)
+endef
+
+$(foreach target,$(NONRECURSIVE_TARGETS), \
+    $(foreach entry,$(NONRECURSIVE_TARGETS_$(target)), \
+        $(eval $(call define_nonrecursive_target, \
+            $(target), \
+            $(NONRECURSIVE_TARGETS_$(target)_$(entry)_FILE), \
+            $(NONRECURSIVE_TARGETS_$(target)_$(entry)_TARGETS) \
+        )) \
+    ) \
+)
+
+INCLUDED_NONRECURSIVE_MK := 1
+endif
+
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -1723,16 +1723,21 @@ endef
     $(eval $(call preprocess_file_template,					\
                   $(file),							\
                   $(or $($(category)_PATH),$(CURDIR))/$(notdir $(file:.in=)),	\
                   $(or $($(category)_TARGET),libs),				\
                   $($(category)_FLAGS)))					\
    )										\
  )
 
+# Pull in non-recursive targets if this is a partial tree build.
+ifndef TOPLEVEL_BUILD
+include $(topsrcdir)/config/makefiles/nonrecursive.mk
+endif
+
 ################################################################################
 # Special gmake rules.
 ################################################################################
 
 
 #
 # Re-define the list of default suffixes, so gmake won't have to churn through
 # hundreds of built-in suffix rules for stuff we don't need.