8146403: Windows build can be faster
authorerikj
Sat, 16 Jan 2016 13:01:43 +0100
changeset 35008 ef0cd710989f
parent 35005 2dc4c11fe488
child 35009 8b6dd0d6ffe0
child 35030 916c91ff2589
8146403: Windows build can be faster Reviewed-by: ihse
common/autoconf/generated-configure.sh
make/BuildStatic.gmk
make/GenerateModuleDeps.gmk
make/HotspotWrapper.gmk
make/Images.gmk
make/Init.gmk
make/InitSupport.gmk
make/MacBundles.gmk
make/Main.gmk
make/MainSupport.gmk
make/StripBinaries.gmk
make/common/IdlCompilation.gmk
make/common/MakeBase.gmk
make/common/Modules.gmk
make/common/NativeCompilation.gmk
make/common/RMICompilation.gmk
make/common/TextFileProcessing.gmk
--- a/common/autoconf/generated-configure.sh	Wed Jul 05 21:13:10 2017 +0200
+++ b/common/autoconf/generated-configure.sh	Sat Jan 16 13:01:43 2016 +0100
@@ -4839,7 +4839,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1452780299
+DATE_WHEN_GENERATED=1452935762
 
 ###############################################################################
 #
--- a/make/BuildStatic.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/BuildStatic.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -41,7 +41,7 @@
     $(SUPPORT_OUTPUTDIR)/modules_libs/$(module)/$(module).symbols)
 
 $(GLOBAL_SYMBOLS_FILE): $(MODULES_SYMBOLS_FILES)
-	$(ECHO) $(LOG_INFO) "Generating global exported.symbols file"
+	$(call LogInfo, Generating global exported.symbols file)
 	$(MKDIR) -p $(@D)
 	$(CAT) $^ > $@
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/GenerateModuleDeps.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -0,0 +1,64 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This file is included from Main.gmk only.
+
+include $(SRC_ROOT)/make/common/JavaCompilation.gmk
+include $(SRC_ROOT)/make/common/SetupJavaCompilers.gmk
+
+################################################################################
+
+$(eval $(call SetupJavaCompilation, BUILD_GENMODULESLIST, \
+    SETUP := BOOT_JAVAC, \
+    SRC := $(JDK_TOPDIR)/make/src/classes, \
+    INCLUDES := build/tools/module, \
+    EXCLUDE_FILES := ImageBuilder.java ModuleArchive.java, \
+    BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
+    DISABLE_SJAVAC := true, \
+))
+
+TOOL_GENMODULESLIST = $(JAVA_SMALL) \
+    -cp "$(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist" \
+    build.tools.module.GenModulesList
+
+MODULES_LIST_FILE := $(MAKESUPPORT_OUTPUTDIR)/modules.list
+# The module deps makefile is used from make/common/Modules.gmk
+MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
+
+$(MODULES_LIST_FILE): $(SRC_ROOT)/modules.xml $(BUILD_GENMODULESLIST)
+	$(TOOL_GENMODULESLIST) -o $@ $(filter %.xml, $^)
+
+$(MODULE_DEPS_MAKEFILE): $(MODULES_LIST_FILE)
+	$(CAT) $^ | $(SED) -e 's/^\([^:]*\):/DEPS_\1 :=/g' > $@
+
+TARGETS += $(MODULE_DEPS_MAKEFILE)
+
+################################################################################
+
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, , GenerateModuleDeps.gmk))
+
+# Trigger generation of this file and restart make if it changed.
+-include $(MODULE_DEPS_MAKEFILE)
--- a/make/HotspotWrapper.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/HotspotWrapper.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -35,14 +35,18 @@
 
 default: all
 
-# Get all files except .hg in the hotspot directory.
-HOTSPOT_FILES := $(shell $(FIND) -L $(HOTSPOT_TOPDIR) -name ".hg" -prune -o -print)
+# Get all files in src, make or agent subdirs in hotspot directory and
+# filter out .hg. This skips the test directory.
+HOTSPOT_FILES := $(shell $(FIND) -L \
+    $(HOTSPOT_TOPDIR)/src $(HOTSPOT_TOPDIR)/make $(HOTSPOT_TOPDIR)/agent \
+    -name ".hg" -prune -o -print)
 
 # The old build creates hotspot output dir before calling hotspot and
 # not doing it breaks builds on msys.
 $(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp: $(HOTSPOT_FILES)
 	@$(MKDIR) -p $(HOTSPOT_OUTPUTDIR)
-	@($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) LOG_LEVEL=$(LOG_LEVEL) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC))
+	@($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) \
+	    LOG_LEVEL=$(LOG_LEVEL) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC))
 	$(TOUCH) $@
 
 hotspot: $(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp
--- a/make/Images.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/Images.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -248,38 +248,38 @@
   endif
 
   $(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
 
   $(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
 
   $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
 
   $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
 
   ifeq ($(OPENJDK_TARGET_OS), solaris)
     $(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
 
     $(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
   endif
 
   ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
     $(JRE_IMAGE_DIR)/man/ja:
-	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
 
     $(JDK_IMAGE_DIR)/man/ja:
-	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
   endif
 
@@ -333,7 +333,7 @@
 # Processing license files from source area to image area
 # These are modified to have the platform specific EOL chars.
 define process-doc-file
-	$(ECHO) $(LOG_INFO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	LC_ALL=C $(SED) 's/$$//g' $< > $@
@@ -378,7 +378,7 @@
 
 # Param 1 - The file containing the MODULES list
 define prepare-info-file
-  $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+  $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
   $(MKDIR) -p $(@D)
   $(RM) $@
 endef
@@ -426,38 +426,30 @@
 # src.zip
 
 $(JDK_IMAGE_DIR)/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
 
 JDK_TARGETS += $(JDK_IMAGE_DIR)/src.zip
 
 ################################################################################
 # /demo dir
+ifneq ($(findstring images, $(MAKECMDGOALS)), )
+  $(eval $(call SetupCopyFiles, JDK_COPY_DEMOS, \
+      SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
+      DEST := $(JDK_IMAGE_DIR)/demo, \
+      FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
+          $(call DoubleDollar, $(call DoubleDollar, \
+          $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
+          -type f -a ! \( -name "_the*" -o -name "javac_state" \) )))), \
+  ))
 
-# The db demo contains an empty dir that needs to be copied. The other
-# directories will always trigger the rule for recompile since
-# _the.list_of_packages files are touched.
-ifneq ($(findstring images, $(MAKECMDGOALS)), )
-  $(JDK_IMAGE_DIR)/demo/%: $(SUPPORT_OUTPUTDIR)/demos/image/%
-	if [ ! -d "$@" ]; then \
-	  $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
-	  $(MKDIR) -p $(@D); \
-	  if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) '$<' '$@'; fi \
-	fi
-
-  # Find all files including directories
-  JDK_DEMO_TARGETS := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
-      $(patsubst $(SUPPORT_OUTPUTDIR)/demos/image/%, $(JDK_IMAGE_DIR)/demo/%, \
-      $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
-          ! \( -name "_the*" -o -name "javac_state" \) )))
-
-  JDK_TARGETS += $(JDK_DEMO_TARGETS)
+  JDK_TARGETS += $(JDK_COPY_DEMOS)
 endif
 
 ################################################################################
 # /sample dir
 
-$(eval $(call SetupCopyFiles,COPY_SAMPLES, \
+$(eval $(call SetupCopyFiles, COPY_SAMPLES, \
     SRC := $(SUPPORT_OUTPUTDIR)/sample/image, \
     DEST := $(JDK_IMAGE_DIR)/sample, \
     FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample/image), \
--- a/make/Init.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/Init.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -226,8 +226,8 @@
   $(eval $(call ParseCompareBuild))
 
   ifeq ($(LOG_NOFILE), true)
-    # Disable log wrapper if LOG=[level,]nofile was given
-    override BUILD_LOG_WRAPPER :=
+    # Disable build log if LOG=[level,]nofile was given
+    override BUILD_LOG_PIPE :=
   endif
 
   ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
@@ -277,10 +277,10 @@
         ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
 	  $(call RotateLogFiles)
 	  $(call PrepareFailureLogs)
-	  $(BUILD_LOG_WRAPPER) $(PRINTF) "Building $(TARGET_DESCRIPTION)\n"
+	  $(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
           ifneq ($(SEQUENTIAL_TARGETS), )
             # Don't touch build output dir since we might be cleaning. That
-            # means no log wrapper.
+            # means no log pipe.
 	    ( cd $(TOPDIR) && \
 	        $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 	        $(SEQUENTIAL_TARGETS) )
@@ -289,11 +289,12 @@
 	    $(call StartGlobalTimer)
 	    $(call PrepareSmartJavac)
 	    ( cd $(TOPDIR) && \
-	        $(BUILD_LOG_WRAPPER) $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
+	        $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
 	            -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
-	            $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) || \
-	        ( exitcode=$$? && $(BUILD_LOG_WRAPPER) \
-	        $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" && \
+	            $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
+	        ( exitcode=$$? && \
+	        $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \
+	            $(BUILD_LOG_PIPE) && \
 	        cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
 	            HAS_SPEC=true on-failure ; \
 	        exit $$exitcode ) )
@@ -301,7 +302,7 @@
 	    $(call StopGlobalTimer)
 	    $(call ReportBuildTimes)
           endif
-	  $(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n"
+	  $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
         endif
 
     on-failure:
--- a/make/InitSupport.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/InitSupport.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -155,7 +155,7 @@
     else ifeq ($$(LOG_LEVEL), debug)
       MAKE_LOG_FLAGS :=
     else ifeq ($$(LOG_LEVEL), trace)
-      MAKE_LOG_FLAGS := -d
+      MAKE_LOG_FLAGS :=
     else
       $$(info Error: LOG must be one of: warn, info, debug or trace.)
       $$(error Cannot continue)
@@ -235,11 +235,15 @@
           $$(foreach var, $$(all_confs), $$(info * $$(var)))
           $$(error Cannot continue)
         else
-          ifeq ($$(words $$(matching_confs)), 1)
-            $$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF)))
-          else
-            $$(info Building these configurations (matching CONF=$$(CONF)):)
-            $$(foreach var, $$(matching_confs), $$(info * $$(var)))
+          # Don't repeat this output on make restarts caused by including
+          # generated files.
+          ifeq ($$(MAKE_RESTARTS),)
+            ifeq ($$(words $$(matching_confs)), 1)
+              $$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF)))
+            else
+              $$(info Building these configurations (matching CONF=$$(CONF)):)
+              $$(foreach var, $$(matching_confs), $$(info * $$(var)))
+            endif
           endif
         endif
 
@@ -284,7 +288,7 @@
 
     $$(main_targets_file):
 	@( cd $$(topdir) && \
-	    $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/Main.gmk \
+	$$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/Main.gmk \
 	    -I $$(topdir)/make/common SPEC=$(strip $2) NO_RECIPES=true \
 	    LOG_LEVEL=$$(LOG_LEVEL) \
 	    create-main-targets-include )
@@ -313,7 +317,7 @@
   BUILD_LOG := $(OUTPUT_ROOT)/build.log
   BUILD_TRACE_LOG := $(OUTPUT_ROOT)/build-trace-time.log
 
-  BUILD_LOG_WRAPPER := $(BASH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)
+  BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2)
 
   # Sanity check the spec file, so it matches this source code
   define CheckSpecSanity
@@ -455,7 +459,7 @@
   endef
 
   define RotateLogFiles
-	$(RM) $(BUILD_LOG).old 2> /dev/null
+	$(RM) $(BUILD_LOG).old 2> /dev/null && \
 	$(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
 	$(if $(findstring trace, $(LOG_LEVEL)), \
 	  $(RM) $(BUILD_TRACE_LOG).old 2> /dev/null && \
@@ -464,7 +468,7 @@
   endef
 
   define PrepareFailureLogs
-	$(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null
+	$(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null && \
 	$(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs
   endef
 
@@ -483,8 +487,8 @@
   endef
 
   define StartGlobalTimer
-	$(RM) -r $(BUILDTIMESDIR) 2> /dev/null
-	$(MKDIR) -p $(BUILDTIMESDIR)
+	$(RM) -r $(BUILDTIMESDIR) 2> /dev/null && \
+	$(MKDIR) -p $(BUILDTIMESDIR) && \
 	$(call RecordStartTime,TOTAL)
   endef
 
@@ -495,13 +499,14 @@
   # Find all build_time_* files and print their contents in a list sorted
   # on the name of the sub repository.
   define ReportBuildTimes
-	$(BUILD_LOG_WRAPPER) $(PRINTF) $(LOG_INFO) -- \
+	$(PRINTF) $(LOG_INFO) -- \
 	    "----- Build times -------\nStart %s\nEnd   %s\n%s\n%s\n-------------------------\n" \
 	    "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
 	    "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
 	    "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \
 	    $(XARGS) $(CAT) | $(SORT) -k 2`" \
-	    "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`"
+	    "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \
+	    $(BUILD_LOG_PIPE)
   endef
 
 endif # HAS_SPEC
--- a/make/MacBundles.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/MacBundles.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -57,23 +57,23 @@
 
   # Copy empty directories (jre/lib/applet).
   $(JDK_MACOSX_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
 
   $(JRE_MACOSX_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
 
   $(JDK_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib:
-	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
+	$(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../Home/lib/jli/libjli.dylib $@
 
   $(JRE_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib:
-	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
+	$(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../Home/lib/jli/libjli.dylib $@
--- a/make/Main.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/Main.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -42,6 +42,8 @@
 
 # Load the vital tools for all the makefiles.
 include $(SRC_ROOT)/make/common/MakeBase.gmk
+# Explicitly generate module deps makefile data
+include $(SRC_ROOT)/make/GenerateModuleDeps.gmk
 include $(SRC_ROOT)/make/common/Modules.gmk
 
 # Declare ALL_TARGETS as an immediate variable. This variable is a list of all
@@ -78,7 +80,7 @@
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
 
 buildtools-jdk:
-	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
+	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk)
 
 ALL_TARGETS += buildtools-langtools interim-langtools \
     interim-rmic interim-cldrconverter buildtools-jdk
@@ -218,7 +220,7 @@
 # used to track the exact sources used to build that image.
 source-tips: $(SUPPORT_OUTPUTDIR)/source_tips
 $(SUPPORT_OUTPUTDIR)/source_tips: FRC
-	@$(MKDIR) -p $(@D)
+	$(call MakeDir, $(@D))
 	@$(RM) $@
 	@$(call GetSourceTips)
 
@@ -656,7 +658,7 @@
 	  @$(ECHO) $(sort $(ALL_MODULES))
 
 create-main-targets-include:
-	  @$(ECHO) $(LOG_INFO) Generating main target list
+	  $(call LogInfo, Generating main target list)
 	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
 	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
 
--- a/make/MainSupport.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/MainSupport.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -141,7 +141,6 @@
   else
     $2-$$($1_TARGET_SUFFIX):
   endif
-	$(ECHO) $(LOG_INFO) "Building $$@"
         ifeq ($$($1_USE_WRAPPER), true)
 	  +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
 	      -f ModuleWrapper.gmk \
--- a/make/StripBinaries.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/StripBinaries.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -40,8 +40,8 @@
 
 ifneq ($(STRIP), )
   define StripRecipe
-	$(ECHO) Stripping $(LOG_INFO) $(patsubst $(OUTPUT_ROOT)/%,%,$<)
-	$(MKDIR) -p $(@D)
+	$(call LogInfo, Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<))
+	$(call MakeDir, $(@D))
 	$(CP) $< $@.tmp
 	$(CHMOD) u+w $@.tmp
 	$(STRIP) $(STRIPFLAGS) $@.tmp
--- a/make/common/IdlCompilation.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/common/IdlCompilation.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -56,10 +56,9 @@
     $4_OLDIMPLBASE_MSG:=with -oldImplBase
   endif
   $5 : $4
-	$(MKDIR) -p $3/$$($4_TMPDIR)
+	$$(call LogInfo, Compiling IDL $(patsubst $2/%,%,$4))
+	$$(call MakeDir, $$(@D))
 	$(RM) -rf $3/$$($4_TMPDIR)
-	$(MKDIR) -p $(dir $5)
-	$(ECHO) $(LOG_INFO) Compiling IDL $(patsubst $2/%,%,$4)
 	$8 -td $3/$$($4_TMPDIR) \
 	    -i $2/org/omg/CORBA \
 	    -i $2/org/omg/PortableInterceptor \
--- a/make/common/MakeBase.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/common/MakeBase.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -86,8 +86,7 @@
 
 # Record starting time for build of a sub repository.
 define RecordStartTime
-	$(MKDIR) -p $(BUILDTIMESDIR)
-	$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)
+	$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1) && \
 	$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)_human_readable
 endef
 
@@ -233,6 +232,7 @@
   endef
 endif # HAS_FILE_FUNCTION
 
+################################################################################
 # The source tips can come from the Mercurial repository, or in the files
 # $(HGTIP_FILENAME) which contains the tip but is also positioned in the same
 # directory as the original $(HGDIR) directory.
@@ -264,12 +264,14 @@
 	$(PRINTF) "\n" >> $@
 endef
 
-# Create the HGTIP_FILENAME file. Called from jdk/make/closed/bundles.gmk
+# Create the HGTIP_FILENAME file. Called from closed/make/SourceBundles.gmk
 define CreateHgTip
 	$(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME); \
 	$(ECHO) $1/$(HGTIP_FILENAME)
 endef
 
+################################################################################
+
 define SetupLogging
   ifeq ($$(LOG_LEVEL), trace)
     # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
@@ -368,9 +370,9 @@
 
 ################################################################################
 # Make directory without forking mkdir if not needed
+# 1: List of directories to create
 MakeDir = \
-    $(strip $(if $(subst $(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),,$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9)),\
-      $(shell $(MKDIR) -p $1 $2 $3 $4 $5 $6 $7 $8 $9)))
+    $(strip $(if $(wildcard $1), , $(shell $(MKDIR) -p $1)))
 
 ################################################################################
 # Assign a variable only if it is empty
@@ -418,7 +420,8 @@
   # Running mkdir and cp in the same shell speeds up copy intensive tasks in Cygwin
   # significantly.
   define install-file
-	$(MKDIR) -p '$(@D)' && $(CP) -fP '$<' '$@'
+	$(call MakeDir, $(@D))
+	$(CP) -fP '$<' '$@'
   endef
 endif
 
@@ -518,9 +521,9 @@
   # Param 1 - Dirs to find in
   # Param 2 - (optional) specialization. Normally "-a \( ... \)" expression.
   define CacheFind
-    $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \
+      $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \
     $(shell $(FIND) $1 \( -type f -o -type l \) $2), \
-    $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE)))
+        $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE)))
   endef
 
 else
@@ -541,7 +544,7 @@
   # 3 : Variable to add targets to
   # 4 : Macro to call for copy operation
   $2: $1
-	$(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
+	$$(call LogInfo, Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@))
 	$$($$(strip $4))
 
   $3 += $2
@@ -686,8 +689,10 @@
 # Param 2 - A compact but representative name to describe this command
 # Param 3 - Command to run
 LogFailures = \
-  ( ($(BASH) $(SRC_ROOT)/common/bin/logger.sh $1 $3 && $(RM) $1) || \
-  (exitcode=$(DOLLAR)$(DOLLAR)? && $(MV) $1 $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(strip $2).log && exit $(DOLLAR)$(DOLLAR)exitcode) )
+  ( $3 > >($(TEE) $1) 2> >($(TEE) $1 >&2) || \
+      (exitcode=$(DOLLAR)$(DOLLAR)? && \
+      $(CP) $1 $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(strip $2).log && \
+      exit $(DOLLAR)$(DOLLAR)exitcode) )
 
 ################################################################################
 # Find lib dir for module
--- a/make/common/Modules.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/common/Modules.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -26,9 +26,6 @@
 ifndef _MODULES_GMK
 _MODULES_GMK := 1
 
-include JavaCompilation.gmk
-include SetupJavaCompilers.gmk
-
 ################################################################################
 # Some platforms don't have the serviceability agent
 ifeq ($(INCLUDE_SA), false)
@@ -71,29 +68,8 @@
 endef
 
 ################################################################################
-
-$(eval $(call SetupJavaCompilation,BUILD_GENMODULESLIST, \
-    SETUP := BOOT_JAVAC, \
-    SRC := $(JDK_TOPDIR)/make/src/classes, \
-    INCLUDES := build/tools/module, \
-    EXCLUDE_FILES := ImageBuilder.java ModuleArchive.java, \
-    BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
-    DISABLE_SJAVAC := true))
-
-TOOL_GENMODULESLIST = $(JAVA_SMALL) \
-    -cp "$(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist" \
-    build.tools.module.GenModulesList
-
-MODULES_LIST_FILE := $(MAKESUPPORT_OUTPUTDIR)/modules.list
+# The module deps makefile is generated in make/GenerateModuleDeps.gmk
 MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
-
-$(MODULES_LIST_FILE): $(SRC_ROOT)/modules.xml \
-    $(BUILD_GENMODULESLIST)
-	$(TOOL_GENMODULESLIST) -o $@ $(filter %.xml, $^)
-
-$(MODULE_DEPS_MAKEFILE): $(MODULES_LIST_FILE)
-	$(CAT) $^ | $(SED) -e 's/^\([^:]*\):/DEPS_\1 :=/g' > $@
-
 -include $(MODULE_DEPS_MAKEFILE)
 
 # Param 1: Module to find deps for
--- a/make/common/NativeCompilation.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/common/NativeCompilation.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -261,18 +261,17 @@
           # The Visual Studio compiler lacks a feature for generating make dependencies, but by
           # setting -showIncludes, all included files are printed. These are filtered out and
           # parsed into make dependences.
-          # Keep as much as possible on one execution line for best performance on Windows
-	  $(RM) $$($1_$2_DEP).exitvalue ; \
-	  ($(call LogFailures, $$($1_$2_OBJ).log, $$($1_SAFE_NAME)_$$(notdir $2), \
+          # Keep as much as possible on one execution line for best performance on Windows.
+          # No need to save exit code from compilation since pipefail is always active on
+          # Windows.
+	  $(call LogFailures, $$($1_$2_OBJ).log, $$($1_SAFE_NAME)_$$(notdir $2), \
 	      $$($1_$2_COMP) $$($1_$2_FLAGS) -showIncludes $$($1_$2_DEBUG_OUT_FLAGS) \
-	          $(CC_OUT_OPTION)$$($1_$2_OBJ) $2) || echo $$$$? > $$($1_$2_DEP).exitvalue ) \
-	      | $(TEE) $$($1_$2_DEP).raw | $(GREP) -v -e "^Note: including file:" \
+	          $(CC_OUT_OPTION)$$($1_$2_OBJ) $2) \
+	      | $(GREP) -v -e "^Note: including file:" \
 	          -e "^$(notdir $2)$$$$" || test "$$$$?" = "1" ; \
-	      ( test -s $$($1_$2_DEP).exitvalue \
-	          && exit `$(CAT) $$($1_$2_DEP).exitvalue` || true ) ; \
-	  ($(ECHO) $$@: \\ ; \
-	      $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_DEP).raw) \
-	      | $(SORT) -u > $$($1_$2_DEP) ; \
+	  $(ECHO) $$@: \\ > $$($1_$2_DEP) ; \
+	  $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_OBJ).log \
+	      | $(SORT) -u >> $$($1_$2_DEP) ; \
 	  $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_$2_DEP) > $$($1_$2_DEP_TARGETS)
         endif
   endif
@@ -658,14 +657,14 @@
           $$($1_RES).vardeps)
 
       $$($1_RES): $$($1_VERSIONINFO_RESOURCE) $$($1_RES_VARDEPS_FILE)
-		$(ECHO) $(LOG_INFO) "Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$(notdir $$($1_TARGET)))"
+		$$(call LogInfo, Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$(notdir $$($1_TARGET))))
 		$$($1_RC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) $(CC_OUT_OPTION)$$@ \
 		    $$($1_VERSIONINFO_RESOURCE)
                 # Windows RC compiler does not support -showIncludes, so we mis-use CL for this.
 		$$($1_CC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) -showIncludes -nologo -TC \
-		    $(CC_OUT_OPTION)$$($1_RES_DEP).obj $$($1_VERSIONINFO_RESOURCE) > $$($1_RES_DEP).raw 2>&1 || exit 0
-		($(ECHO) $$($1_RES): \\ \
-		&& $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).raw) > $$($1_RES_DEP)
+		    $(CC_OUT_OPTION)$$($1_RES_DEP).obj $$($1_VERSIONINFO_RESOURCE) > $$($1_RES_DEP).raw 2>&1 || true ; \
+		$(ECHO) $$($1_RES): \\ > $$($1_RES_DEP) ; \
+		$(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).raw >> $$($1_RES_DEP) ; \
 		$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_RES_DEP) > $$($1_RES_DEP_TARGETS)
     endif
   endif
@@ -801,7 +800,7 @@
                 endif
                 # Keep as much as possible on one execution line for best performance
                 # on Windows
-		$(ECHO) $(LOG_INFO) "Linking $$($1_BASENAME)" ; \
+		$$(call LogInfo, Linking $$($1_BASENAME))
 		$(call LogFailures, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link.log, $$($1_SAFE_NAME)_link, \
 		    $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
 		    $(LD_OUT_OPTION)$$@ \
@@ -820,7 +819,7 @@
 
     # Generating a static library, ie object file archive.
     $$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE)
-	$(ECHO) $(LOG_INFO) "Archiving $$($1_STATIC_LIBRARY)"
+	$$(call LogInfo, Archiving $$($1_STATIC_LIBRARY))
 	$(call LogFailures, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link.log, $$($1_SAFE_NAME)_link, \
 	    $$($1_AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_ALL_OBJS) \
 	        $$($1_RES))
@@ -842,7 +841,7 @@
 
     $$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \
         $$($1_VARDEPS_FILE)
-		$(ECHO) $(LOG_INFO) "Linking executable $$($1_BASENAME)" ; \
+		$$(call LogInfo, Linking executable $$($1_BASENAME))
 		$(call LogFailures, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link.log, $$($1_SAFE_NAME)_link, \
 		    $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
 		        $(EXE_OUT_OPTION)$$($1_TARGET) \
--- a/make/common/RMICompilation.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/common/RMICompilation.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -68,15 +68,15 @@
   $$($1_TARGETS): $$($1_DEP_FILE) $$($1_CLASS_FILES)
 
   $$($1_DEP_FILE): $$($1_CLASS_FILES)
-	$(MKDIR) -p $$($1_STUB_CLASSES_DIR)
-	$(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS) for $$($1_DOLLAR_SAFE_CLASSES) && \
+	$$(call LogInfo, Running rmic $$($1_ARGS) for $$($1_DOLLAR_SAFE_CLASSES))
+	$$(call MakeDir, $$($1_STUB_CLASSES_DIR))
 	$(RMIC) $$($1_ARGS) -classpath "$$($1_CLASSES_DIR)" \
 	    -d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \
 	if [ "x$$($1_ARGS2)" != "x" ]; then \
 	  $(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS2) for $$($1_DOLLAR_SAFE_CLASSES) && \
 	  $(RMIC) $$($1_ARGS2) -classpath "$$($1_CLASSES_DIR)" \
 	      -d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \
-	fi;
+	fi; \
 	$(TOUCH) $$@
 
 
--- a/make/common/TextFileProcessing.gmk	Wed Jul 05 21:13:10 2017 +0200
+++ b/make/common/TextFileProcessing.gmk	Sat Jan 16 13:01:43 2016 +0100
@@ -35,12 +35,12 @@
 # param 4 = the target file name (possibly with a partial path)
 define SetupSingleTextFileForProcessing
   $(strip $3)/$(strip $4): $2 $$($1_VARDEPS_FILE)
-	$(ECHO) $(LOG_INFO) "Processing $(strip $4)"
-	$(MKDIR) -p '$$(@D)'
-	$(RM) '$$@' '$$@.includes.tmp' '$$@.replacements.tmp'
-	$$($1_INCLUDES_COMMAND_LINE) < '$$<' > '$$@.includes.tmp'
-	$$($1_REPLACEMENTS_COMMAND_LINE) < '$$@.includes.tmp' > '$$@.replacements.tmp'
-	$(RM) '$$@.includes.tmp'
+	$$(call LogInfo, Processing $(strip $4))
+	$$(call MakeDir, $$(@D))
+	$(RM) '$$@' '$$@.includes.tmp' '$$@.replacements.tmp' ; \
+	$$($1_INCLUDES_COMMAND_LINE) < '$$<' > '$$@.includes.tmp' ; \
+	$$($1_REPLACEMENTS_COMMAND_LINE) < '$$@.includes.tmp' > '$$@.replacements.tmp' ; \
+	$(RM) '$$@.includes.tmp' ; \
 	$(MV) '$$@.replacements.tmp' '$$@'
 
   $1 += $(strip $3)/$(strip $4)