diff -r 63fbc565bba5 -r 98ce0879ab4c Makefile --- a/Makefile Sun Aug 10 19:38:50 2014 -0700 +++ b/Makefile Sun Aug 17 15:51:37 2014 +0100 @@ -58,29 +58,70 @@ ifeq ($(SPEC),) # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing. else - ifeq ($(words $(SPEC)),1) - # We are building a single configuration. This is the normal case. Execute the Main.gmk file. - include $(root_dir)/make/Main.gmk - else - # We are building multiple configurations. - # First, find out the valid targets - # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find - # available PHONY targets. Use this list as valid targets to pass on to the repeated calls. - all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \ - cd $(root_dir) && $(MAKE) -p -q FRC SPEC=$(firstword $(SPEC)) | \ - grep ^.PHONY: | head -n 1 | cut -d " " -f 2-))) + # In Cygwin, the MAKE variable gets messed up if the make executable is called with + # a Windows mixed path (c:/cygwin/bin/make.exe). If that's the case, fix it by removing + # the prepended root_dir. + ifneq ($(findstring :, $(MAKE)), ) + MAKE := $(patsubst $(root_dir)%, %, $(MAKE)) + endif + + # We are potentially building multiple configurations. + # First, find out the valid targets + # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find + # available PHONY targets. Use this list as valid targets to pass on to the repeated calls. + all_phony_targets := $(sort $(filter-out $(global_targets), $(strip $(shell \ + cd $(root_dir)/make && $(MAKE) -f Main.gmk -p -q FRC SPEC=$(firstword $(SPEC)) | \ + grep "^.PHONY:" | head -n 1 | cut -d " " -f 2-)))) + + # Loop through the configurations and call the main-wrapper for each one. The wrapper + # target will execute with a single configuration loaded. + $(all_phony_targets): + @$(if $(TARGET_RUN),,\ + $(foreach spec,$(SPEC),\ + (cd $(root_dir) && $(MAKE) SPEC=$(spec) MAIN_TARGETS="$(call GetRealTarget)" \ + $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) main-wrapper) &&) true) + @echo > /dev/null + $(eval TARGET_RUN=true) + + .PHONY: $(all_phony_targets) - $(all_phony_targets): - @$(foreach spec,$(SPEC),(cd $(root_dir) && $(MAKE) SPEC=$(spec) \ - $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true + ifneq ($(MAIN_TARGETS), ) + # The wrapper target was called so we now have a single configuration. Load the spec file + # and call the real Main.gmk. + include $(SPEC) - .PHONY: $(all_phony_targets) + ### Clean up from previous run + # Remove any build.log from a previous run, if they exist + ifneq (,$(BUILD_LOG)) + ifneq (,$(BUILD_LOG_PREVIOUS)) + # Rotate old log + $(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null) + $(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null) + else + $(shell $(RM) $(BUILD_LOG) 2> /dev/null) + endif + $(shell $(RM) $(OUTPUT_ROOT)/build-trace-time.log 2> /dev/null) + endif + # Remove any javac server logs and port files. This + # prevents a new make run to reuse the previous servers. + ifneq (,$(SJAVAC_SERVER_DIR)) + $(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*) + endif - endif + 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)) + + .PHONY: main-wrapper + + endif endif # Here are "global" targets, i.e. targets that can be executed without specifying a single configuration. -# If you addd more global targets, please update the variable global_targets in MakeHelpers. +# If you add more global targets, please update the variable global_targets in MakeHelpers. help: $(info ) @@ -88,12 +129,12 @@ $(info =====================) $(info ) $(info Common make targets) - $(info . make [default] # Compile all product in langtools, hotspot, jaxp, jaxws,) - $(info . # corba and jdk) - $(info . make all # Compile everything, all repos and images) + $(info . make [default] # Compile all modules in langtools, hotspot, jaxp, jaxws,) + $(info . # corba and jdk and create a runnable "exploded" image) + $(info . make all # Compile everything, all repos, docs and images) $(info . make images # Create complete j2sdk and j2re images) - $(info . make docs # Create javadocs) - $(info . make overlay-images # Create limited images for sparc 64 bit platforms) + $(info . make docs # Create all docs) + $(info . make docs-javadoc # Create just javadocs, depends on less than full docs) $(info . make profiles # Create complete j2re compact profile images) $(info . make bootcycle-images # Build images twice, second time with newly build JDK) $(info . make install # Install the generated images locally) @@ -103,12 +144,18 @@ $(info . make help # Give some help on using make) $(info . make test # Run tests, default is all tests (see TEST below)) $(info ) - $(info Targets for specific components) - $(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, nashorn, images, overlay-images, docs or test)) - $(info . make # Build and everything it depends on. ) - $(info . make -only # Build only, without dependencies. This) + $(info Targets for specific modules) + $(info . make # Build and everything it depends on. ) + $(info . make -only # Build only, without dependencies. This) $(info . # is faster but can result in incorrect build results!) - $(info . make clean- # Remove files generated by make for ) + $(info . make -java # Compile java classes for and everything it) + $(info . # depends on) + $(info . make -libs # Build native libraries for and everything it) + $(info . # depends on) + $(info . make -launchers# Build native executables for and everything it) + $(info . # depends on) + $(info . make -gensrc # Execute the gensrc step for and everything it) + $(info . # depends on) $(info ) $(info Useful make variables) $(info . make CONF= # Build all configurations (note, assignment is empty))