--- a/config/rules.mk
+++ b/config/rules.mk
@@ -356,24 +356,38 @@ ifdef MOZ_UPDATE_XTERM
# platforms, but we can trick sed into doing it.
UPDATE_TITLE = sed -e "s!Y!$@ in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$(dir)!" $(MOZILLA_DIR)/config/xterm.str;
endif
LOOP_OVER_DIRS = \
@$(EXIT_ON_ERROR) \
$(foreach dir,$(DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
+# we only use this for the makefiles target and other stuff that doesn't matter
+LOOP_OVER_PARALLEL_DIRS = \
+ @$(EXIT_ON_ERROR) \
+ $(foreach dir,$(PARALLEL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
+
LOOP_OVER_STATIC_DIRS = \
@$(EXIT_ON_ERROR) \
$(foreach dir,$(STATIC_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
LOOP_OVER_TOOL_DIRS = \
@$(EXIT_ON_ERROR) \
$(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
+ifdef PARALLEL_DIRS
+# create a bunch of fake targets for order-only processing
+PARALLEL_DIRS_export = $(addsuffix _export,$(PARALLEL_DIRS))
+PARALLEL_DIRS_libs = $(addsuffix _libs,$(PARALLEL_DIRS))
+PARALLEL_DIRS_tools = $(addsuffix _tools,$(PARALLEL_DIRS))
+
+.PHONY: $(PARALLEL_DIRS_export) $(PARALLEL_DIRS_libs) $(PARALLEL_DIRS_tools)
+endif
+
#
# Now we can differentiate between objects used to build a library, and
# objects used to build an executable in the same directory.
#
ifndef PROGOBJS
PROGOBJS = $(OBJS)
endif
@@ -572,17 +586,17 @@ else
HOST_OUTOPTION = -o # eol
endif
endif
################################################################################
# SUBMAKEFILES: List of Makefiles for next level down.
# This is used to update or create the Makefiles before invoking them.
-SUBMAKEFILES += $(addsuffix /Makefile, $(DIRS) $(TOOL_DIRS))
+SUBMAKEFILES += $(addsuffix /Makefile, $(DIRS) $(TOOL_DIRS) $(PARALLEL_DIRS))
# The root makefile doesn't want to do a plain export/libs, because
# of the tiers and because of libxul. Suppress the default rules in favor
# of something else. Makefiles which use this var *must* provide a sensible
# default rule before including rules.mk
ifndef SUPPRESS_DEFAULT_RULES
ifdef TIERS
@@ -668,25 +682,40 @@ all_platforms:: $(NFSPWD)
done
$(NFSPWD):
cd $(@D); $(MAKE) $(@F)
endif
# Target to only regenerate makefiles
makefiles: $(SUBMAKEFILES)
-ifneq (,$(DIRS)$(TOOL_DIRS))
+ifneq (,$(DIRS)$(TOOL_DIRS)$(PARALLEL_DIRS))
+ +$(LOOP_OVER_PARALLEL_DIRS)
+$(LOOP_OVER_DIRS)
+$(LOOP_OVER_TOOL_DIRS)
endif
+ifdef PARALLEL_DIRS
+export:: $(PARALLEL_DIRS_export)
+
+$(PARALLEL_DIRS_export): %_export: %/Makefile
+ +$(MAKE) -C $* export
+endif
+
export:: $(SUBMAKEFILES) $(MAKE_DIRS) $(if $(EXPORTS)$(XPIDLSRCS)$(SDK_HEADERS)$(SDK_XPIDLSRCS),$(PUBLIC)) $(if $(SDK_HEADERS)$(SDK_XPIDLSRCS),$(SDK_PUBLIC)) $(if $(XPIDLSRCS),$(IDL_DIR)) $(if $(SDK_XPIDLSRCS),$(SDK_IDL_DIR))
+$(LOOP_OVER_DIRS)
+$(LOOP_OVER_TOOL_DIRS)
+ifdef PARALLEL_DIRS
+tools:: $(PARALLEL_DIRS_tools)
+
+$(PARALLEL_DIRS_tools): %_tools: %/Makefile
+ +$(MAKE) -C $* tools
+endif
+
tools:: $(SUBMAKEFILES) $(MAKE_DIRS)
+$(LOOP_OVER_DIRS)
ifdef TOOL_DIRS
@$(EXIT_ON_ERROR) \
$(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) libs; ) true
endif
#
@@ -709,16 +738,23 @@ endif # EXPORT_LIBRARY
endif # LIBRARY_NAME
# Create dependencies on static (and shared EXTRA_DSO_LIBS) libraries
LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(LIBS))
HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(HOST_LIBS))
DSO_LDOPTS_DEPS = $(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS))
##############################################
+ifdef PARALLEL_DIRS
+libs:: $(PARALLEL_DIRS_libs)
+
+$(PARALLEL_DIRS_libs): %_libs: %/Makefile
+ +$(MAKE) -C $* libs
+endif
+
libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS)
ifndef NO_DIST_INSTALL
ifdef LIBRARY
ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build
ifdef IS_COMPONENT
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(MOZDEPTH)/staticlib/components
else
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(MOZDEPTH)/staticlib
@@ -809,21 +845,23 @@ run_viewer: $(FINAL_TARGET)/viewer
cd $(FINAL_TARGET); \
MOZILLA_FIVE_HOME=`pwd` \
LD_LIBRARY_PATH=".:$(LIBS_PATH):$$LD_LIBRARY_PATH" \
viewer
clean clobber realclean clobber_all:: $(SUBMAKEFILES)
-rm -f $(ALL_TRASH)
-rm -rf $(ALL_TRASH_DIRS)
+ +-$(LOOP_OVER_PARALLEL_DIRS)
+-$(LOOP_OVER_DIRS)
+-$(LOOP_OVER_STATIC_DIRS)
+-$(LOOP_OVER_TOOL_DIRS)
distclean:: $(SUBMAKEFILES)
+ +-$(LOOP_OVER_PARALLEL_DIRS)
+-$(LOOP_OVER_DIRS)
+-$(LOOP_OVER_STATIC_DIRS)
+-$(LOOP_OVER_TOOL_DIRS)
-rm -rf $(ALL_TRASH_DIRS)
-rm -f $(ALL_TRASH) \
Makefile .HSancillary \
$(wildcard *.$(OBJ_SUFFIX)) $(wildcard *.ho) $(wildcard host_*.o*) \
$(wildcard *.$(LIB_SUFFIX)) $(wildcard *$(DLL_SUFFIX)) \
@@ -1360,22 +1398,24 @@ endif
# Bunch of things that extend the 'export' rule (in order):
###############################################################################
################################################################################
# Copy each element of EXPORTS to $(PUBLIC)
ifneq ($(EXPORTS)$(XPIDLSRCS)$(SDK_HEADERS)$(SDK_XPIDLSRCS),)
$(SDK_PUBLIC) $(PUBLIC)::
- @if test ! -d $@; then $(ECHO) Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi
+ $(NSINSTALL) -D $@
endif
ifneq ($(XPI_NAME),)
-export::
- @if test ! -d $(FINAL_TARGET); then echo Creating $(FINAL_TARGET); rm -fr $(FINAL_TARGET); $(NSINSTALL) -D $(FINAL_TARGET); else true; fi
+$(FINAL_TARGET):
+ $(NSINSTALL) -D $@
+
+export:: $(FINAL_TARGET)
endif
ifndef NO_DIST_INSTALL
ifneq ($(EXPORTS),)
export:: $(EXPORTS) $(PUBLIC)
$(INSTALL) $(IFLAGS1) $^
endif
@@ -1403,33 +1443,35 @@ endif
ifneq ($(PREF_JS_EXPORTS),)
# on win32, pref files need CRLF line endings... see bug 206029
ifeq (WINNT,$(OS_ARCH))
PREF_PPFLAGS = --line-endings=crlf
endif
ifndef NO_DIST_INSTALL
-libs:: $(PREF_JS_EXPORTS)
- if test ! -d $(FINAL_TARGET)/$(PREF_DIR); then $(NSINSTALL) -D $(FINAL_TARGET)/$(PREF_DIR); fi
+$(FINAL_TARGET)/$(PREF_DIR):
+ $(NSINSTALL) -D $@
+
+libs:: $(FINAL_TARGET)/$(PREF_DIR) $(PREF_JS_EXPORTS)
$(EXIT_ON_ERROR) \
for i in $(PREF_JS_EXPORTS); do \
dest=$(FINAL_TARGET)/$(PREF_DIR)/`basename $$i`; \
$(RM) -f $$dest; \
$(PYTHON) $(MOZILLA_SRCDIR)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
done
endif
endif
################################################################################
# Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
ifneq ($(AUTOCFG_JS_EXPORTS),)
$(FINAL_TARGET)/defaults/autoconfig::
- @if test ! -d $@; then echo Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi
+ $(NSINSTALL) -D $@
ifndef NO_DIST_INSTALL
export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig
$(INSTALL) $(IFLAGS1) $^
endif
endif
################################################################################
@@ -1449,17 +1491,17 @@ export:: FORCE
@echo
@echo "*** Error processing XPIDLSRCS:"
@echo "Please define MODULE or XPIDL_MODULE when defining XPIDLSRCS,"
@echo "so we have a module name to use when creating MODULE.xpt."
@echo; sleep 2; false
endif
$(SDK_IDL_DIR) $(IDL_DIR)::
- @if test ! -d $@; then echo Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi
+ $(NSINSTALL) -D $@
# generate .h files from into $(XPIDL_GEN_DIR), then export to $(PUBLIC);
# warn against overriding existing .h file.
$(XPIDL_GEN_DIR)/.done:
@if test ! -d $(XPIDL_GEN_DIR); then echo Creating $(XPIDL_GEN_DIR)/.done; rm -rf $(XPIDL_GEN_DIR); mkdir $(XPIDL_GEN_DIR); fi
@touch $@
# don't depend on $(XPIDL_GEN_DIR), because the modification date changes
@@ -1512,26 +1554,27 @@ endif # XPIDLSRCS
#
# General rules for exporting idl files.
#
# WORK-AROUND ONLY, for mozilla/tools/module-deps/bootstrap.pl build.
# Bug to fix idl dependency problems w/o this extra build pass is
# http://bugzilla.mozilla.org/show_bug.cgi?id=145777
#
$(IDL_DIR)::
- @if test ! -d $@; then echo Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi
+ $(NSINSTALL) -D $@
export-idl:: $(SUBMAKEFILES) $(MAKE_DIRS)
ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
ifndef NO_DIST_INSTALL
export-idl:: $(XPIDLSRCS) $(SDK_XPIDLSRCS) $(IDL_DIR)
$(INSTALL) $(IFLAGS1) $^
endif
endif
+ +$(LOOP_OVER_PARALLEL_DIRS)
+$(LOOP_OVER_DIRS)
+$(LOOP_OVER_TOOL_DIRS)
ifneq ($(SDK_XPIDLSRCS),)
# export .idl files to $(IDL_DIR) & $(SDK_IDL_DIR)
@@ -1600,51 +1643,54 @@ endif
endif
################################################################################
# SDK
ifneq (,$(SDK_LIBRARY))
$(SDK_LIB_DIR)::
- @if test ! -d $@; then echo Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi
+ $(NSINSTALL) -D $@
ifndef NO_DIST_INSTALL
libs:: $(SDK_LIBRARY) $(SDK_LIB_DIR)
$(INSTALL) $(IFLAGS2) $^
endif
endif # SDK_LIBRARY
ifneq (,$(SDK_BINARY))
$(SDK_BIN_DIR)::
- @if test ! -d $@; then echo Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi
+ $(NSINSTALL) -D $@
ifndef NO_DIST_INSTALL
libs:: $(SDK_BINARY) $(SDK_BIN_DIR)
$(INSTALL) $(IFLAGS2) $^
endif
endif # SDK_BINARY
################################################################################
# CHROME PACKAGING
JAR_MANIFEST := $(srcdir)/jar.mn
chrome::
$(MAKE) realchrome
+ +$(LOOP_OVER_PARALLEL_DIRS)
+$(LOOP_OVER_DIRS)
+$(LOOP_OVER_TOOL_DIRS)
-libs realchrome:: $(CHROME_DEPS)
+$(FINAL_TARGET)/chrome:
+ $(NSINSTALL) -D $@
+
+libs realchrome:: $(CHROME_DEPS) $(FINAL_TARGET)/chrome
ifndef NO_DIST_INSTALL
@$(EXIT_ON_ERROR) \
if test -f $(JAR_MANIFEST); then \
- if test ! -d $(FINAL_TARGET)/chrome; then $(NSINSTALL) -D $(FINAL_TARGET)/chrome; fi; \
$(PYTHON) $(MOZILLA_DIR)/config/JarMaker.py \
$(QUIET) -j $(FINAL_TARGET)/chrome \
$(MAKE_JARS_FLAGS) $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \
$(JAR_MANIFEST); \
fi
endif
ifneq ($(DIST_FILES),)
@@ -1853,21 +1899,23 @@ endef
$(REPORT_BUILD)
@$(MAKE_DEPS_NOAUTO)
ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
depend:: $(SUBMAKEFILES) $(MAKE_DIRS) $(MDDEPFILES)
else
depend:: $(SUBMAKEFILES)
endif
+ +$(LOOP_OVER_PARALLEL_DIRS)
+$(LOOP_OVER_DIRS)
+$(LOOP_OVER_TOOL_DIRS)
dependclean:: $(SUBMAKEFILES)
rm -f $(MDDEPFILES)
+ +$(LOOP_OVER_PARALLEL_DIRS)
+$(LOOP_OVER_DIRS)
+$(LOOP_OVER_TOOL_DIRS)
endif # MOZ_AUTO_DEPS
endif # COMPILER_DEPEND
@@ -1931,18 +1979,20 @@ endif
# Special gmake rules.
################################################################################
#
# Disallow parallel builds with MSVC < 8
#
ifneq (,$(filter 1200 1300 1310,$(_MSC_VER)))
+ifneq (,$(OBJS)$(HOST_OBJS))
.NOTPARALLEL:
endif
+endif
#
# 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.
#
.SUFFIXES:
#
@@ -1959,16 +2009,17 @@ FORCE:
# Properly set LIBPATTERNS for the platform
.LIBPATTERNS = $(if $(IMPORT_LIB_SUFFIX),$(LIB_PREFIX)%.$(IMPORT_LIB_SUFFIX)) $(LIB_PREFIX)%.$(LIB_SUFFIX) $(DLL_PREFIX)%$(DLL_SUFFIX)
tags: TAGS
TAGS: $(SUBMAKEFILES) $(CSRCS) $(CPPSRCS) $(wildcard *.h)
-etags $(CSRCS) $(CPPSRCS) $(wildcard *.h)
+ +$(LOOP_OVER_PARALLEL_DIRS)
+$(LOOP_OVER_DIRS)
echo-variable-%:
@echo $($*)
echo-tiers:
@echo $(TIERS)
@@ -1982,16 +2033,17 @@ echo-requires:
@echo $(REQUIRES)
echo-requires-recursive::
ifdef _REPORT_ALL_DIRS
@echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES)
else
@$(if $(REQUIRES),echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES))
endif
+ +$(LOOP_OVER_PARALLEL_DIRS)
+$(LOOP_OVER_DIRS)
echo-depth-path:
@$(MOZILLA_SRCDIR)/build/unix/print-depth-path.sh
echo-module-name:
@$(MOZILLA_SRCDIR)/build/package/rpm/print-module-name.sh
@@ -2011,16 +2063,17 @@ ifneq (,$(filter $(PROGRAM) $(HOST_PROGR
@echo "IMPORT_LIBRARY = $(IMPORT_LIBRARY)"
@echo "STATIC_LIBS = $(STATIC_LIBS)"
@echo "SHARED_LIBS = $(SHARED_LIBS)"
@echo "EXTRA_DSO_LIBS = $(EXTRA_DSO_LIBS)"
@echo "EXTRA_DSO_LDOPTS = $(EXTRA_DSO_LDOPTS)"
@echo "DEPENDENT_LIBS = $(DEPENDENT_LIBS)"
@echo --------------------------------------------------------------------------------
endif
+ +$(LOOP_OVER_PARALLEL_DIRS)
+$(LOOP_OVER_DIRS)
showbuild:
@echo "MOZ_BUILD_ROOT = $(MOZ_BUILD_ROOT)"
@echo "MOZ_WIDGET_TOOLKIT = $(MOZ_WIDGET_TOOLKIT)"
@echo "CC = $(CC)"
@echo "CXX = $(CXX)"
@echo "CCC = $(CCC)"
@@ -2072,17 +2125,19 @@ showhost:
showbuildmods::
@echo "Build Modules = $(BUILD_MODULES)"
@echo "Module dirs = $(BUILD_MODULE_DIRS)"
zipmakes:
ifneq (,$(filter $(PROGRAM) $(SIMPLE_PROGRAMS) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
zip $(DEPTH)/makefiles $(subst $(topsrcdir),$(MOZ_SRC)/mozilla,$(srcdir)/Makefile.in)
endif
+ +$(LOOP_OVER_PARALLEL_DIRS)
+$(LOOP_OVER_DIRS)
documentation:
@cd $(DEPTH)
$(DOXYGEN) $(DEPTH)/config/doxygen.cfg
check:: $(SUBMAKEFILES) $(MAKE_DIRS)
+ +$(LOOP_OVER_PARALLEL_DIRS)
+$(LOOP_OVER_DIRS)
+$(LOOP_OVER_TOOL_DIRS)