changeset 26398:ca1f84f97e20

8057537: Serialize reconfigure and fix make clean-foo foo Reviewed-by: dholmes, ihse, tbell
author erikj
date Fri, 05 Sep 2014 12:42:41 +0200
parents 705a9199d2e4
children cecab64dc33a 2346a9f0d29d
files Makefile make/Main.gmk
diffstat 2 files changed, 23 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Sep 03 14:10:53 2014 +0200
+++ b/Makefile	Fri Sep 05 12:42:41 2014 +0200
@@ -108,12 +108,23 @@
       $(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*)
     endif
 
+    # Split out the targets requiring sequential execution. Run these targets separately
+    # from the rest so that the rest may still enjoy full parallel execution.
+    SEQUENTIAL_TARGETS := $(filter dist-clean clean% reconfigure, $(MAIN_TARGETS))
+    PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS))
+
     main-wrapper:
-	@$(if $(findstring clean, $(MAIN_TARGETS)), , $(call AtMakeStart))
-	(cd $(root_dir)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -f Main.gmk SPEC=$(SPEC) -j $(JOBS) \
-	    $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(MAIN_TARGETS) \
-	    $(if $(filter true, $(OUTPUT_SYNC_SUPPORTED)), -O$(OUTPUT_SYNC)))
-	@$(if $(findstring clean, $(MAIN_TARGETS)), , $(call AtMakeEnd))
+        ifneq ($(SEQUENTIAL_TARGETS), )
+	  (cd $(root_dir)/make && $(MAKE) -f Main.gmk SPEC=$(SPEC) -j 1 \
+	      $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(SEQUENTIAL_TARGETS))
+        endif
+        ifneq ($(PARALLEL_TARGETS), )
+	  @$(call AtMakeStart)
+	  (cd $(root_dir)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -f Main.gmk SPEC=$(SPEC) -j $(JOBS) \
+	      $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(PARALLEL_TARGETS) \
+	      $(if $(filter true, $(OUTPUT_SYNC_SUPPORTED)), -O$(OUTPUT_SYNC)))
+	  @$(call AtMakeEnd)
+        endif
 
      .PHONY: main-wrapper
 
@@ -138,10 +149,9 @@
 	$(info .  make profiles          # Create complete j2re compact profile images)
 	$(info .  make bootcycle-images  # Build images twice, second time with newly built JDK)
 	$(info .  make install           # Install the generated images locally)
+	$(info .  make reconfigure       # Rerun configure with the same arguments as last time)
 	$(info .  make clean             # Remove all files generated by make, but not those)
-	$(info .                         # generated by configure. Do not run clean and other)
-	$(info .                         # targets together as that might behave in an)
-	$(info .                         # unexpected way.)
+	$(info .                         # generated by configure)
 	$(info .  make dist-clean        # Remove all files, including configuration)
 	$(info .  make help              # Give some help on using make)
 	$(info .  make test              # Run tests, default is all tests (see TEST below))
--- a/make/Main.gmk	Wed Sep 03 14:10:53 2014 +0200
+++ b/make/Main.gmk	Fri Sep 05 12:42:41 2014 +0200
@@ -487,17 +487,8 @@
 # Clean targets
 #
 ################################################################################
-
-# If running a clean target, disable parallel execution
-ifneq ($(findstring clean, $(MAKECMDGOALS)), )
-  .NOTPARALLEL:
-  # It's not recommended to run additional targets to clean on the same make
-  # command line. Try to detect this and issue a warning.
-  ifneq ($(filter-out clean%, $(MAKECMDGOALS)), )
-    $(warning Mixing clean targets with normal build targets will not work well \
-        and is not recommended.)
-  endif
-endif
+# Clean targets are automatically run serially by the Makefile calling this 
+# file.
 
 CLEAN_COMPONENTS += langtools corba hotspot jdk nashorn images \
     bootcycle-build docs docstemp test
@@ -543,6 +534,9 @@
 	@if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi
 endif
 
+# The reconfigure target is automatically run serially from everything else
+# by the Makefile calling this file.
+
 reconfigure:
         ifneq ($(CONFIGURE_COMMAND_LINE), )
 	  @$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"