From 95b7b7aab1f9b1504474bc2f85546ba1a26402b8 Mon Sep 17 00:00:00 2001 From: Mike Shal Date: Wed, 14 Aug 2013 09:34:18 -0400 Subject: [PATCH] Bug 903118 - set mozconfig environment variables for sub-makes; r=gps --- client.mk | 15 +++---------- config/makefiles/mozconfig.mk | 33 ++++++++++++++++++++++++++++ config/rules.mk | 4 ++++ js/src/config/makefiles/mozconfig.mk | 33 ++++++++++++++++++++++++++++ js/src/config/rules.mk | 4 ++++ 5 files changed, 77 insertions(+), 12 deletions(-) create mode 100644 config/makefiles/mozconfig.mk create mode 100644 js/src/config/makefiles/mozconfig.mk diff --git a/client.mk b/client.mk index 95a0e2513782..5eb3f221f1b3 100644 --- a/client.mk +++ b/client.mk @@ -104,18 +104,9 @@ endif # Load mozconfig Options # See build pages, http://www.mozilla.org/build/ for how to set up mozconfig. - -MOZCONFIG_LOADER := build/autoconf/mozconfig2client-mk - -define CR - - -endef - -# As $(shell) doesn't preserve newlines, use sed to replace them with an -# unlikely sequence (||), which is then replaced back to newlines by make -# before evaluation. -$(eval $(subst ||,$(CR),$(shell _PYMAKE=$(.PYMAKE) $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) 2> $(TOPSRCDIR)/.mozconfig.out | sed 's/$$/||/'))) +# mozconfig.mk needs to be loaded multiple times by configure, so we don't check +# for INCLUDED_MOZCONFIG_MK +include $(TOPSRCDIR)/config/makefiles/mozconfig.mk ifdef AUTOCLOBBER export AUTOCLOBBER=1 diff --git a/config/makefiles/mozconfig.mk b/config/makefiles/mozconfig.mk new file mode 100644 index 000000000000..21408c46af48 --- /dev/null +++ b/config/makefiles/mozconfig.mk @@ -0,0 +1,33 @@ +# -*- 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/. +# + +INCLUDED_MOZCONFIG_MK = 1 + +# We are pulling in the mozconfig exports, so we only need to run once for the +# whole make process tree (not for each sub-make). Export this so the sub-makes +# don't read mozconfig multiple times. +export INCLUDED_MOZCONFIG_MK + +MOZCONFIG_LOADER := build/autoconf/mozconfig2client-mk + +define CR + + +endef + +# topsrcdir is used by rules.mk (set from the generated Makefile), while +# TOPSRCDIR is used by client.mk +ifneq (,$(topsrcdir)) +top := $(topsrcdir) +else +top := $(TOPSRCDIR) +endif +# As $(shell) doesn't preserve newlines, use sed to replace them with an +# unlikely sequence (||), which is then replaced back to newlines by make +# before evaluation. +$(eval $(subst ||,$(CR),$(shell _PYMAKE=$(.PYMAKE) $(top)/$(MOZCONFIG_LOADER) $(top) 2> $(top)/.mozconfig.out | sed 's/$$/||/'))) diff --git a/config/rules.mk b/config/rules.mk index 1642368e71da..45ca4ea68a55 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -10,6 +10,10 @@ ifndef topsrcdir $(error topsrcdir was not set)) endif +ifndef INCLUDED_MOZCONFIG_MK +include $(topsrcdir)/config/makefiles/mozconfig.mk +endif + # Integrate with mozbuild-generated make files. We first verify that no # variables provided by the automatically generated .mk files are # present. If they are, this is a violation of the separation of diff --git a/js/src/config/makefiles/mozconfig.mk b/js/src/config/makefiles/mozconfig.mk new file mode 100644 index 000000000000..21408c46af48 --- /dev/null +++ b/js/src/config/makefiles/mozconfig.mk @@ -0,0 +1,33 @@ +# -*- 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/. +# + +INCLUDED_MOZCONFIG_MK = 1 + +# We are pulling in the mozconfig exports, so we only need to run once for the +# whole make process tree (not for each sub-make). Export this so the sub-makes +# don't read mozconfig multiple times. +export INCLUDED_MOZCONFIG_MK + +MOZCONFIG_LOADER := build/autoconf/mozconfig2client-mk + +define CR + + +endef + +# topsrcdir is used by rules.mk (set from the generated Makefile), while +# TOPSRCDIR is used by client.mk +ifneq (,$(topsrcdir)) +top := $(topsrcdir) +else +top := $(TOPSRCDIR) +endif +# As $(shell) doesn't preserve newlines, use sed to replace them with an +# unlikely sequence (||), which is then replaced back to newlines by make +# before evaluation. +$(eval $(subst ||,$(CR),$(shell _PYMAKE=$(.PYMAKE) $(top)/$(MOZCONFIG_LOADER) $(top) 2> $(top)/.mozconfig.out | sed 's/$$/||/'))) diff --git a/js/src/config/rules.mk b/js/src/config/rules.mk index 1642368e71da..45ca4ea68a55 100644 --- a/js/src/config/rules.mk +++ b/js/src/config/rules.mk @@ -10,6 +10,10 @@ ifndef topsrcdir $(error topsrcdir was not set)) endif +ifndef INCLUDED_MOZCONFIG_MK +include $(topsrcdir)/config/makefiles/mozconfig.mk +endif + # Integrate with mozbuild-generated make files. We first verify that no # variables provided by the automatically generated .mk files are # present. If they are, this is a violation of the separation of