Makefile
changeset 26398 ca1f84f97e20
parent 26128 91be51647a45
child 26548 3b002da2aee1
--- 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))