From 15ddc7aed774e65580009a1247eebc8c813af789 Mon Sep 17 00:00:00 2001 From: Joey Armstrong Date: Tue, 3 Apr 2012 16:08:16 -0400 Subject: [PATCH] Bug 738404 - Makefile.in edits to use threadsafe mkdir (bug 680246) - r=ted --- b2g/app/Makefile.in | 12 ++-- build/win32/Makefile.in | 13 +++-- client.mk | 16 ++++-- config/Makefile.in | 56 ++++++++++++++++--- config/config.mk | 2 +- config/makefiles/autotargets.mk | 10 +++- config/makefiles/makeutils.mk | 14 ----- config/makefiles/test/Makefile.in | 34 ----------- config/rules.mk | 24 ++++---- config/tests/makefiles/autodeps/Makefile.in | 3 - config/tests/makefiles/autodeps/testor.tmpl | 1 + .../test/extensions/bootstrap/Makefile.in | 3 +- .../test/extensions/traditional/Makefile.in | 3 +- js/src/config/Makefile.in | 5 +- js/src/config/config.mk | 2 +- js/src/config/makefiles/autotargets.mk | 10 +++- js/src/config/makefiles/makeutils.mk | 14 ----- js/src/config/rules.mk | 24 ++++---- 18 files changed, 128 insertions(+), 118 deletions(-) diff --git a/b2g/app/Makefile.in b/b2g/app/Makefile.in index 85764cb0e7d6..b2ecaef1c7c3 100644 --- a/b2g/app/Makefile.in +++ b/b2g/app/Makefile.in @@ -127,10 +127,14 @@ else APPFILES = MacOS endif -libs repackage:: - mkdir -p $(DIST)/$(APP_NAME).app/Contents/MacOS +libs-preqs = \ + $(call mkdir_deps,$(DIST)/$(APP_NAME).app/Contents/MacOS) \ + $(call mkdir_deps,$(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj) \ + $(NULL) + +.PHONY: repackage +libs repackage:: $(libs-preqs) rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app --exclude English.lproj - mkdir -p $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj sed -e "s/%MOZ_APP_VERSION%/$(MOZ_APP_VERSION)/" -e "s/%MOZ_APP_NAME%/$(MOZ_APP_NAME)/" -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" -e "s/%APP_BINARY%/$(APP_BINARY)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj/InfoPlist.strings @@ -140,7 +144,7 @@ ifdef LIBXUL_SDK cp $(LIBXUL_DIST)/bin/xulrunner$(BIN_SUFFIX) $(DIST)/$(APP_NAME).app/Contents/MacOS/$(APP_BINARY) rsync -a --exclude nsinstall --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(APP_NAME).app/Contents/Frameworks else - rm -f $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM) + $(RM) $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM) rsync -aL $(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS endif printf "APPLMOZB" > $(DIST)/$(APP_NAME).app/Contents/PkgInfo diff --git a/build/win32/Makefile.in b/build/win32/Makefile.in index 034fa7c8f563..f4bbafa81125 100644 --- a/build/win32/Makefile.in +++ b/build/win32/Makefile.in @@ -35,10 +35,10 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../.. +DEPTH = ../.. topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk @@ -102,8 +102,11 @@ REDIST_FILES = \ endif ifdef REDIST_FILES -libs:: - mkdir -p $(FINAL_TARGET) +libs-preqs = \ + $(call mkdir_deps,$(FINAL_TARGET)) \ + $(NULL) + +libs:: $(libs-preqs) install --preserve-timestamps $(foreach f,$(REDIST_FILES),"$(WIN32_REDIST_DIR)"/$(f)) $(FINAL_TARGET) endif diff --git a/client.mk b/client.mk index e4d3ef38dcb8..8b036c49d203 100644 --- a/client.mk +++ b/client.mk @@ -101,7 +101,6 @@ ifeq (,$(strip $(AUTOCONF))) AUTOCONF=$(error Could not find autoconf 2.13) endif -MKDIR := mkdir SH := /bin/sh PERL ?= perl PYTHON ?= python @@ -181,6 +180,9 @@ OBJDIR_TARGETS = install export libs clean realclean distclean alldep maybe_clob build:: $(MAKE) -f $(TOPSRCDIR)/client.mk $(if $(MOZ_PGO),profiledbuild,realbuild) +# Define mkdir +include $(TOPSRCDIR)/config/makefiles/makeutils.mk +include $(TOPSRCDIR)/config/makefiles/autotargets.mk # Print out any options loaded from mozconfig. all realbuild clean depend distclean export libs install realclean:: @@ -316,11 +318,13 @@ endif configure-files: $(CONFIGURES) -configure:: configure-files -ifdef MOZ_BUILD_PROJECTS - @if test ! -d $(MOZ_OBJDIR); then $(MKDIR) $(MOZ_OBJDIR); else true; fi -endif - @if test ! -d $(OBJDIR); then $(MKDIR) $(OBJDIR); else true; fi +configure-preqs = \ + configure-files \ + $(call mkdir_deps,$(OBJDIR)) \ + $(if $(MOZ_BUILD_PROJECTS),$(call mkdir_deps,$(MOZ_OBJDIR))) \ + $(NULL) + +configure:: $(configure-preqs) @echo cd $(OBJDIR); @echo $(CONFIGURE) $(CONFIGURE_ARGS) @cd $(OBJDIR) && $(BUILD_PROJECT_ARG) $(CONFIGURE_ENV_ARGS) $(CONFIGURE) $(CONFIGURE_ARGS) \ diff --git a/config/Makefile.in b/config/Makefile.in index 881288b7e19d..b51808d4ba34 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -1,8 +1,42 @@ # -*- Makefile -*- # -# 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/. +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Robert Ginda +# John Taylor +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** DEPTH = .. topsrcdir = @top_srcdir@ @@ -84,8 +118,11 @@ else endif ifdef WRAP_SYSTEM_INCLUDES -export:: - if test ! -d system_wrappers; then mkdir system_wrappers; fi +export-preqs = \ + $(call mkdir_deps,system_wrappers) \ + $(NULL) + +export:: $(export-preqs) $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) \ -DMOZ_TREE_CAIRO=$(MOZ_TREE_CAIRO) \ -DMOZ_TREE_PIXMAN=$(MOZ_TREE_PIXMAN) \ @@ -157,11 +194,14 @@ PYUNITS := \ unit-writemozinfo.py \ $(NULL) -check::\ - check-python-modules check-jar-mn\ - check-makefiles\ +check-preqs = \ + check-python-modules \ + check-jar-mn \ + check-makefiles \ $(NULL) +check:: $(check-preqs) + check-python-modules:: @$(EXIT_ON_ERROR) \ for test in $(PYUNITS); do \ diff --git a/config/config.mk b/config/config.mk index a830bfe969be..f9fd8b273d36 100644 --- a/config/config.mk +++ b/config/config.mk @@ -46,7 +46,7 @@ # Define an include-at-most-once flag ifdef INCLUDED_CONFIG_MK -$(error Don't include config.mk twice!) +$(error Do not include config.mk twice!) endif INCLUDED_CONFIG_MK = 1 diff --git a/config/makefiles/autotargets.mk b/config/makefiles/autotargets.mk index 0253c70b747b..b99f4cafd3e7 100644 --- a/config/makefiles/autotargets.mk +++ b/config/makefiles/autotargets.mk @@ -11,12 +11,14 @@ # *_DEPS - Make dependencies derived from a given macro. ########################################################################### +MKDIR ?= mkdir -p +TOUCH ?= touch ########################################################################### # Threadsafe directory creation # GENERATED_DIRS - Automated creation of these directories. ########################################################################### -mkdir_deps =$(foreach dir,$($(1)),$(dir)/.mkdir.done) +mkdir_deps =$(foreach dir,$(getargv),$(dir)/.mkdir.done) ifneq (,$(GENERATED_DIRS)) tmpauto :=$(call mkdir_deps,GENERATED_DIRS) @@ -33,5 +35,11 @@ endif # config/rules.mk::all target is available by default # Add $(AUTO_DEPS) as an explicit target dependency when needed. ################################################################# + AUTO_DEPS +=$(GENERATED_DIRS_DEPS) + +# Complain loudly if deps have not loaded so getargv != $(NULL) +ifndef getargv + $(error config/makefiles/makeutil.mk has not been included) +endif diff --git a/config/makefiles/makeutils.mk b/config/makefiles/makeutils.mk index 291ccc10e20d..596ce488fa0f 100644 --- a/config/makefiles/makeutils.mk +++ b/config/makefiles/makeutils.mk @@ -34,17 +34,3 @@ argv +=) ## $(call banner,ref) ; ref=foo bar tans ## getarglist() would be a more accurate name but is longer to type getargv = $(if $(call isvar,$(1)),$($(1)),$(argv)) - -## http://www.gnu.org/software/make/manual/make.html#Call-Function -## Usage: o = $(call map,origin,o map $(MAKE)) -map = $(foreach val,$(2),$(call $(1),$(val))) - - -# Usage: $(call checkIfEmpty,[error|warning] foo NULL bar) -checkIfEmpty =$(foreach var,$(wordlist 2,100,$(getargv)),$(if $(strip $($(var))),$(NOP),$(call $(1),Variable $(var) does not contain a value))) - -# Usage: $(call errorIfEmpty,foo NULL bar) -errorIfEmpty =$(call checkIfEmpty,error $(getargv)) -warnIfEmpty =$(call checkIfEmpty,warning $(getargv)) - - diff --git a/config/makefiles/test/Makefile.in b/config/makefiles/test/Makefile.in index 8fefdeace66a..863a235d9913 100644 --- a/config/makefiles/test/Makefile.in +++ b/config/makefiles/test/Makefile.in @@ -36,14 +36,6 @@ $(info ========================================================================= $(info Running test: $(MAKECMDGOALS): pwd=$(CURDIR)) $(info ===========================================================================) - -ifdef VERBOSE -$(info ) -$(info ===========================================================================) -$(info Running test: istype, getargv) -$(info ===========================================================================) -endif - ## Silent errors are oh so much fun ifndef istype $(error makeutils.mk was not included) @@ -98,32 +90,6 @@ ifneq (arg_list,$(call getargv,arg_ref)) $(error getargv(arg_ref)=list, found [$(call getargv,arg_ref)]) endif - -ifdef MANUAL_TEST - # For automated testing a callback is needed that can set an external status - # variable that can be tested. Syntax is tricky to get correct functionality. - ifdef VERBOSE - $(info ) - $(info ===========================================================================) - $(info Running test: checkIfEmpty) - $(info ===========================================================================) - endif - - #status = - #setTRUE =status=true - #setFALSE =status=$(NULL) - #$(call checkIfEmpty,setFALSE NULL) - #$(if $(status),$(error checkIfEmpty(xyz) failed)) - #$(call checkIfEmpty,setTRUE xyz) - #$(if $(status),$(error checkIfEmpty(xyz) failed)) - xyz=abc - $(info STATUS: warnIfEmpty - two vars) - $(call warnIfEmpty,foo xyz bar) - $(info STATUS: errorIfEmpty - on first var) - $(call errorIfEmpty,foo xyz bar) - $(error TEST FAILED: processing should not reach this point) -endif - endif # check in MAKECMDGOALS diff --git a/config/rules.mk b/config/rules.mk index 68e1ea6c44e8..5eae4ccc24c1 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -22,6 +22,9 @@ ifndef INCLUDED_VERSION_MK include $(topsrcdir)/config/version.mk endif +include $(topsrcdir)/config/makefiles/makeutils.mk +include $(topsrcdir)/config/makefiles/autotargets.mk + ifdef SDK_XPIDLSRCS XPIDLSRCS += $(SDK_XPIDLSRCS) endif @@ -477,8 +480,8 @@ endif # A Makefile that needs $(MDDEPDIR) created but doesn't set any of these # variables we know to check can just set NEED_MDDEPDIR explicitly. ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS)$(NEED_MDDEPDIR)) -MAKE_DIRS += $(CURDIR)/$(MDDEPDIR) -GARBAGE_DIRS += $(MDDEPDIR) +MAKE_DIRS += $(CURDIR)/$(MDDEPDIR) +GARBAGE_DIRS += $(CURDIR)/$(MDDEPDIR) endif # @@ -1426,12 +1429,6 @@ endif # generate .h files from into $(XPIDL_GEN_DIR), then export to $(DIST)/include; # warn against overriding existing .h file. -$(XPIDL_GEN_DIR)/.done: - $(MKDIR) -p $(XPIDL_GEN_DIR) - @$(TOUCH) $@ - -# don't depend on $(XPIDL_GEN_DIR), because the modification date changes -# with any addition to the directory, regenerating all .h files -> everything. XPIDL_DEPS = \ $(topsrcdir)/xpcom/idl-parser/header.py \ @@ -1439,7 +1436,12 @@ XPIDL_DEPS = \ $(topsrcdir)/xpcom/idl-parser/xpidl.py \ $(NULL) -$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done +xpidl-preqs = \ + $(call mkdir_deps,$(XPIDL_GEN_DIR)) \ + $(call mkdir_deps,$(MDDEPDIR)) \ + $(NULL) + +$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(xpidl-preqs) $(REPORT_BUILD) $(PYTHON_PATH) \ -I$(topsrcdir)/other-licenses/ply \ @@ -1451,7 +1453,7 @@ $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done ifndef NO_GEN_XPT # generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link # into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components. -$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done +$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_DEPS) $(xpidl-preqs) $(REPORT_BUILD) $(PYTHON_PATH) \ -I$(topsrcdir)/other-licenses/ply \ @@ -1993,7 +1995,7 @@ $(foreach var,$(FREEZE_VARIABLES),$(eval $(var)_FROZEN := '$($(var))')) CHECK_FROZEN_VARIABLES = $(foreach var,$(FREEZE_VARIABLES), \ $(if $(subst $($(var)_FROZEN),,'$($(var))'),$(error Makefile variable '$(var)' changed value after including rules.mk. Was $($(var)_FROZEN), now $($(var)).))) -libs export libs:: +libs export:: $(CHECK_FROZEN_VARIABLES) default all:: diff --git a/config/tests/makefiles/autodeps/Makefile.in b/config/tests/makefiles/autodeps/Makefile.in index bc7a52f70baa..662d46d57199 100644 --- a/config/tests/makefiles/autodeps/Makefile.in +++ b/config/tests/makefiles/autodeps/Makefile.in @@ -17,7 +17,6 @@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -# INCLUDED_CONFIG_MK = 1 include $(topsrcdir)/config/config.mk include $(topsrcdir)/config/rules.mk @@ -38,7 +37,5 @@ check:: $(tgts) # Only run unit test when autotargets.mk is modified $(autotgt_tests): $(topsrcdir)/config/makefiles/autotargets.mk - echo "MAKECMD=$(MAKE)" MAKECMD=$(MAKE) $(PYTEST) $(srcdir)/check_mkdir.tpy @$(TOUCH) $@ - diff --git a/config/tests/makefiles/autodeps/testor.tmpl b/config/tests/makefiles/autodeps/testor.tmpl index 4e75d53d6392..d216e6e27863 100644 --- a/config/tests/makefiles/autodeps/testor.tmpl +++ b/config/tests/makefiles/autodeps/testor.tmpl @@ -17,6 +17,7 @@ ifdef VERBOSE endif # Define macros +include $(topsrcdir)/config/makefiles/makeutils.mk include $(topsrcdir)/config/makefiles/autotargets.mk ########################## diff --git a/dom/workers/test/extensions/bootstrap/Makefile.in b/dom/workers/test/extensions/bootstrap/Makefile.in index 982be6324a7e..0f4a8e69fd06 100644 --- a/dom/workers/test/extensions/bootstrap/Makefile.in +++ b/dom/workers/test/extensions/bootstrap/Makefile.in @@ -52,8 +52,9 @@ DIST_FILES = \ TEST_EXTENSIONS_DIR = $(DEPTH)/_tests/testing/mochitest/extensions +GENERATED_DIRS = $(TEST_EXTENSIONS_DIR) + include $(topsrcdir)/config/rules.mk libs:: - $(MKDIR) -p $(TEST_EXTENSIONS_DIR) @(cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - $(XPI_NAME)) | (cd $(TEST_EXTENSIONS_DIR) && tar -xf -) diff --git a/dom/workers/test/extensions/traditional/Makefile.in b/dom/workers/test/extensions/traditional/Makefile.in index 2b12cb9ba9eb..f46b79bbdb45 100644 --- a/dom/workers/test/extensions/traditional/Makefile.in +++ b/dom/workers/test/extensions/traditional/Makefile.in @@ -61,8 +61,9 @@ DIST_FILES = \ TEST_EXTENSIONS_DIR = $(DEPTH)/_tests/testing/mochitest/extensions +GENERATED_DIRS = $(TEST_EXTENSIONS_DIR) + include $(topsrcdir)/config/rules.mk libs:: - $(MKDIR) -p $(TEST_EXTENSIONS_DIR) @(cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - $(XPI_NAME)) | (cd $(TEST_EXTENSIONS_DIR) && tar -xf -) diff --git a/js/src/config/Makefile.in b/js/src/config/Makefile.in index 1c36b803ff04..1e335ce13ad3 100644 --- a/js/src/config/Makefile.in +++ b/js/src/config/Makefile.in @@ -89,8 +89,9 @@ ifdef HOST_PROGRAM endif ifdef WRAP_SYSTEM_INCLUDES -export:: - if test ! -d system_wrappers_js; then mkdir system_wrappers_js; fi +export:: \ + $(call mkdir_deps,system_wrappers_js) \ + $(NULL) $(PYTHON) $(srcdir)/Preprocessor.py $(DEFINES) $(ACDEFINES) \ $(srcdir)/system-headers | $(PERL) $(srcdir)/make-system-wrappers.pl system_wrappers_js $(INSTALL) system_wrappers_js $(DIST) diff --git a/js/src/config/config.mk b/js/src/config/config.mk index a830bfe969be..f9fd8b273d36 100644 --- a/js/src/config/config.mk +++ b/js/src/config/config.mk @@ -46,7 +46,7 @@ # Define an include-at-most-once flag ifdef INCLUDED_CONFIG_MK -$(error Don't include config.mk twice!) +$(error Do not include config.mk twice!) endif INCLUDED_CONFIG_MK = 1 diff --git a/js/src/config/makefiles/autotargets.mk b/js/src/config/makefiles/autotargets.mk index 0253c70b747b..b99f4cafd3e7 100644 --- a/js/src/config/makefiles/autotargets.mk +++ b/js/src/config/makefiles/autotargets.mk @@ -11,12 +11,14 @@ # *_DEPS - Make dependencies derived from a given macro. ########################################################################### +MKDIR ?= mkdir -p +TOUCH ?= touch ########################################################################### # Threadsafe directory creation # GENERATED_DIRS - Automated creation of these directories. ########################################################################### -mkdir_deps =$(foreach dir,$($(1)),$(dir)/.mkdir.done) +mkdir_deps =$(foreach dir,$(getargv),$(dir)/.mkdir.done) ifneq (,$(GENERATED_DIRS)) tmpauto :=$(call mkdir_deps,GENERATED_DIRS) @@ -33,5 +35,11 @@ endif # config/rules.mk::all target is available by default # Add $(AUTO_DEPS) as an explicit target dependency when needed. ################################################################# + AUTO_DEPS +=$(GENERATED_DIRS_DEPS) + +# Complain loudly if deps have not loaded so getargv != $(NULL) +ifndef getargv + $(error config/makefiles/makeutil.mk has not been included) +endif diff --git a/js/src/config/makefiles/makeutils.mk b/js/src/config/makefiles/makeutils.mk index 291ccc10e20d..596ce488fa0f 100644 --- a/js/src/config/makefiles/makeutils.mk +++ b/js/src/config/makefiles/makeutils.mk @@ -34,17 +34,3 @@ argv +=) ## $(call banner,ref) ; ref=foo bar tans ## getarglist() would be a more accurate name but is longer to type getargv = $(if $(call isvar,$(1)),$($(1)),$(argv)) - -## http://www.gnu.org/software/make/manual/make.html#Call-Function -## Usage: o = $(call map,origin,o map $(MAKE)) -map = $(foreach val,$(2),$(call $(1),$(val))) - - -# Usage: $(call checkIfEmpty,[error|warning] foo NULL bar) -checkIfEmpty =$(foreach var,$(wordlist 2,100,$(getargv)),$(if $(strip $($(var))),$(NOP),$(call $(1),Variable $(var) does not contain a value))) - -# Usage: $(call errorIfEmpty,foo NULL bar) -errorIfEmpty =$(call checkIfEmpty,error $(getargv)) -warnIfEmpty =$(call checkIfEmpty,warning $(getargv)) - - diff --git a/js/src/config/rules.mk b/js/src/config/rules.mk index 68e1ea6c44e8..5eae4ccc24c1 100644 --- a/js/src/config/rules.mk +++ b/js/src/config/rules.mk @@ -22,6 +22,9 @@ ifndef INCLUDED_VERSION_MK include $(topsrcdir)/config/version.mk endif +include $(topsrcdir)/config/makefiles/makeutils.mk +include $(topsrcdir)/config/makefiles/autotargets.mk + ifdef SDK_XPIDLSRCS XPIDLSRCS += $(SDK_XPIDLSRCS) endif @@ -477,8 +480,8 @@ endif # A Makefile that needs $(MDDEPDIR) created but doesn't set any of these # variables we know to check can just set NEED_MDDEPDIR explicitly. ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS)$(NEED_MDDEPDIR)) -MAKE_DIRS += $(CURDIR)/$(MDDEPDIR) -GARBAGE_DIRS += $(MDDEPDIR) +MAKE_DIRS += $(CURDIR)/$(MDDEPDIR) +GARBAGE_DIRS += $(CURDIR)/$(MDDEPDIR) endif # @@ -1426,12 +1429,6 @@ endif # generate .h files from into $(XPIDL_GEN_DIR), then export to $(DIST)/include; # warn against overriding existing .h file. -$(XPIDL_GEN_DIR)/.done: - $(MKDIR) -p $(XPIDL_GEN_DIR) - @$(TOUCH) $@ - -# don't depend on $(XPIDL_GEN_DIR), because the modification date changes -# with any addition to the directory, regenerating all .h files -> everything. XPIDL_DEPS = \ $(topsrcdir)/xpcom/idl-parser/header.py \ @@ -1439,7 +1436,12 @@ XPIDL_DEPS = \ $(topsrcdir)/xpcom/idl-parser/xpidl.py \ $(NULL) -$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done +xpidl-preqs = \ + $(call mkdir_deps,$(XPIDL_GEN_DIR)) \ + $(call mkdir_deps,$(MDDEPDIR)) \ + $(NULL) + +$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(xpidl-preqs) $(REPORT_BUILD) $(PYTHON_PATH) \ -I$(topsrcdir)/other-licenses/ply \ @@ -1451,7 +1453,7 @@ $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done ifndef NO_GEN_XPT # generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link # into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components. -$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done +$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_DEPS) $(xpidl-preqs) $(REPORT_BUILD) $(PYTHON_PATH) \ -I$(topsrcdir)/other-licenses/ply \ @@ -1993,7 +1995,7 @@ $(foreach var,$(FREEZE_VARIABLES),$(eval $(var)_FROZEN := '$($(var))')) CHECK_FROZEN_VARIABLES = $(foreach var,$(FREEZE_VARIABLES), \ $(if $(subst $($(var)_FROZEN),,'$($(var))'),$(error Makefile variable '$(var)' changed value after including rules.mk. Was $($(var)_FROZEN), now $($(var)).))) -libs export libs:: +libs export:: $(CHECK_FROZEN_VARIABLES) default all::