1.1 --- a/common/makefiles/Makefile Thu Sep 06 17:27:20 2012 -0700 1.2 +++ b/common/makefiles/Makefile Tue Sep 18 11:29:16 2012 -0700 1.3 @@ -26,6 +26,11 @@ 1.4 # This must be the first rule 1.5 default: all 1.6 1.7 +# Inclusion of this pseudo-target will cause make to execute this file 1.8 +# serially, regardless of -j. Recursively called makefiles will not be 1.9 +# affected, however. This is required for correct dependency management. 1.10 +.NOTPARALLEL: 1.11 + 1.12 # Locate this Makefile 1.13 ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),) 1.14 makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST)) 1.15 @@ -41,18 +46,18 @@ 1.16 $(eval $(call SetupLogging)) 1.17 $(eval $(call ParseConfAndSpec)) 1.18 1.19 -# Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line, 1.20 -# hence this workaround. 1.21 -ifeq ($(JOBS),) 1.22 - JOBS=$(NUM_CORES) 1.23 -endif 1.24 - 1.25 ifneq ($(words $(SPEC)),1) 1.26 ### We have multiple configurations to build, call make repeatedly 1.27 -all jdk hotspot jaxws jaxp corba langtools install images clean dist-clean: 1.28 - @$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@ $(MAKE_ARGS)) &&) true 1.29 +all clean dist-clean: 1.30 +langtools corba jaxp jaxws hotspot jdk images overlay-images install: 1.31 +langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only: 1.32 +clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images: 1.33 + @$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true 1.34 1.35 -.PHONY: all jdk hotspot jaxws jaxp corba langtools install images clean dist-clean 1.36 +.PHONY: all clean dist-clean 1.37 +.PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install 1.38 +.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only 1.39 +.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images 1.40 1.41 else 1.42 ### This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file. 1.43 @@ -77,77 +82,110 @@ 1.44 endif 1.45 # Remove any javac server logs and port files. This 1.46 # prevents a new make run to reuse the previous servers. 1.47 -ifneq (,$(JAVAC_SERVERS)) 1.48 - $(shell mkdir -p $(JAVAC_SERVERS) && rm -rf $(JAVAC_SERVERS)/*) 1.49 +ifneq (,$(SJAVAC_SERVER_DIR)) 1.50 + $(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*) 1.51 endif 1.52 # Clean out any notifications from the previous build. 1.53 -$(shell find $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE)) 1.54 +$(shell $(FIND) $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE)) 1.55 1.56 # Reset the build timers. 1.57 $(eval $(call ResetTimers)) 1.58 1.59 +# Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line, 1.60 +# hence this workaround. 1.61 +ifeq ($(JOBS),) 1.62 + JOBS=$(NUM_CORES) 1.63 +endif 1.64 +MAKE_ARGS:=$(MAKE_ARGS) -j$(JOBS) 1.65 + 1.66 ### Main targets 1.67 1.68 all: jdk 1.69 - @$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port) 1.70 + @$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port) 1.71 @$(call AtRootMakeEnd) 1.72 +.PHONY: all 1.73 1.74 langtools: start-make langtools-only 1.75 langtools-only: 1.76 @$(call MakeStart,langtools,all) 1.77 - @($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS)) 1.78 + @($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS)) 1.79 @$(call MakeFinish,langtools,all) 1.80 1.81 corba: langtools corba-only 1.82 corba-only: 1.83 @$(call MakeStart,corba,all) 1.84 - @($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS)) 1.85 + @($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS)) 1.86 @$(call MakeFinish,corba,all) 1.87 1.88 jaxp: langtools jaxp-only 1.89 jaxp-only: 1.90 @$(call MakeStart,jaxp,all) 1.91 - @($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS)) 1.92 + @($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS)) 1.93 @$(call MakeFinish,jaxp,all) 1.94 1.95 jaxws: langtools jaxp jaxws-only 1.96 jaxws-only: 1.97 @$(call MakeStart,jaxws,all) 1.98 - @($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS)) 1.99 + @($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS)) 1.100 @$(call MakeFinish,jaxws,all) 1.101 1.102 hotspot: langtools hotspot-only 1.103 hotspot-only: 1.104 @$(call MakeStart,hotspot,all) 1.105 - @($(CD) $(HOTSPOT_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS) $(MAKE_ARGS)) 1.106 + @($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk) 1.107 @$(call MakeFinish,hotspot,all) 1.108 1.109 jdk: langtools corba jaxp jaxws hotspot jdk-only 1.110 jdk-only: 1.111 @$(call MakeStart,jdk,all) 1.112 - @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS)) 1.113 + @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(JDK_TARGET)) 1.114 @$(call MakeFinish,jdk,all) 1.115 1.116 images: source-tips start-make jdk langtools corba jaxp jaxws hotspot images-only 1.117 images-only: 1.118 @$(call MakeStart,jdk-images,$@) 1.119 - @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(JDK_MAKE_ARGS) $(MAKE_ARGS) images) 1.120 + @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) images) 1.121 @$(call MakeFinish,jdk-images,$@) 1.122 - @$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port) 1.123 + @$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port) 1.124 + @$(call AtRootMakeEnd) 1.125 + 1.126 +overlay-images: source-tips start-make jdk langtools corba jaxp jaxws hotspot overlay-images-only 1.127 +overlay-images-only: 1.128 + @$(call MakeStart,jdk-overlay-images,$@) 1.129 + @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) overlay-images) 1.130 + @$(call MakeFinish,jdk-overlay-images,$@) 1.131 + @$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port) 1.132 @$(call AtRootMakeEnd) 1.133 1.134 install: source-tips start-make jdk langtools corba jaxp jaxws hotspot install-only 1.135 install-only: 1.136 @$(call MakeStart,jdk-images,$@) 1.137 - @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(JDK_MAKE_ARGS) $(MAKE_ARGS) install) 1.138 + @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) install) 1.139 @$(call MakeFinish,jdk-images,$@) 1.140 - @$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port) 1.141 + @$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port) 1.142 @$(call AtRootMakeEnd) 1.143 1.144 +docs: start-make jdk docs-only 1.145 +docs-only: 1.146 + @$(call MakeStart,docs,$@) 1.147 + @($(CD) $(SRC_ROOT)/common/makefiles/javadoc && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs) 1.148 + @$(call MakeFinish,docs,$@) 1.149 + @$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port) 1.150 + @$(call AtRootMakeEnd) 1.151 + 1.152 + 1.153 +.PHONY: langtools corba jaxp jaxws hotspot jdk images install 1.154 +.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only install-only 1.155 + 1.156 start-make: 1.157 @$(call AtRootMakeStart) 1.158 +.PHONY: start-make 1.159 1.160 -.PHONY: jdk hotspot jaxws jaxp corba langtools install images start-make 1.161 +bootcycle-images: 1.162 + @$(ECHO) Boot cycle build step 1: Building the JDK image normally 1.163 + @($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(SPEC) images) 1.164 + @$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image 1.165 + @($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images) 1.166 1.167 test: start-make 1.168 @$(call MakeStart,test,$(if $(TEST),$(TEST),all)) 1.169 @@ -167,8 +205,8 @@ 1.170 1.171 1.172 # Remove everything, except the output from configure. 1.173 -clean: 1.174 - @(cd $(OUTPUT_ROOT) && $(RM) -r `$(LS) $(OUTPUT_ROOT) | grep -v spec.gmk | grep -v spec.sh | grep -v Makefile | grep -v config.status | grep -v config.log | grep -v config.h | grep -v configure-arguments | grep -v "localdevenv.*" | grep -v uncygdrive.exe`) 1.175 +clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-bootcycle-build 1.176 + @($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log*) 1.177 @$(ECHO) Cleaned everything except the build configuration. 1.178 .PHONY: clean 1.179 1.180 @@ -178,11 +216,24 @@ 1.181 @$(ECHO) Cleaned everything, you will have to re-run configure. 1.182 .PHONY: dist-clean 1.183 1.184 +clean-langtools: 1.185 + $(call CleanComponent,langtools) 1.186 +clean-corba: 1.187 + $(call CleanComponent,corba) 1.188 +clean-jaxp: 1.189 + $(call CleanComponent,jaxp) 1.190 +clean-jaxws: 1.191 + $(call CleanComponent,jaxws) 1.192 +clean-hotspot: 1.193 + $(call CleanComponent,hotspot) 1.194 clean-jdk: 1.195 - @(cd $(OUTPUT_ROOT) && $(RM) -r `$(LS) $(OUTPUT_ROOT) | grep -v spec.gmk | grep -v spec.sh | grep -v Makefile | grep -v config.status | grep -v config.log | grep -v config.h | grep -v configure-arguments | \ 1.196 - grep -v langtools | grep -v corba | grep -v jaxp | grep -v jaxws | grep -v hotspot`) 1.197 - @$(ECHO) "Cleaned jdk build artifacts (but not langtools,corba,jaxp,jaxws,hotspot nor the build configuration)" 1.198 -.PHONY: clean 1.199 + $(call CleanComponent,jdk) 1.200 +clean-images: 1.201 + $(call CleanComponent,images) 1.202 +clean-bootcycle-build: 1.203 + $(call CleanComponent,bootcycle-build) 1.204 + 1.205 +.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images 1.206 1.207 endif 1.208 1.209 @@ -195,24 +246,39 @@ 1.210 $(info =====================) 1.211 $(info ) 1.212 $(info Common make targets) 1.213 - $(info . make [all] # Compile all code but do not create images) 1.214 - $(info . make images # Create complete j2sdk and j2re images) 1.215 - $(info . make install # Install the generated images locally) 1.216 - $(info . make clean # Remove all files generated by make, but not those generated by configure) 1.217 - $(info . make dist-clean # Remove all files generated by both make and configure) 1.218 - $(info . make help # Give some help on using make) 1.219 - $(info . make test # Run tests, default is all tests (see TEST below)) 1.220 + $(info . make [all] # Compile all code but do not create images) 1.221 + $(info . make images # Create complete j2sdk and j2re images) 1.222 + $(info . make overlay-images # Create limited images for sparc 64 bit platforms) 1.223 + $(info . make bootcycle-images # Build images twice, second time with newly build JDK) 1.224 + $(info . make install # Install the generated images locally) 1.225 + $(info . make clean # Remove all files generated by make, but not those) 1.226 + $(info . # generated by configure) 1.227 + $(info . make dist-clean # Remove all files, including configuration) 1.228 + $(info . make help # Give some help on using make) 1.229 + $(info . make test # Run tests, default is all tests (see TEST below)) 1.230 + $(info ) 1.231 + $(info Targets for specific components) 1.232 + $(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk or images)) 1.233 + $(info . make <component> # Build <component> and everything it depends on. ) 1.234 + $(info . make <component>-only # Build <component> only, without dependencies. This) 1.235 + $(info . # is faster but can result in incorrect build results!) 1.236 + $(info . make clean-<component> # Remove files generated by make for <component>) 1.237 $(info ) 1.238 $(info Useful make variables) 1.239 - $(info . make CONF= # Build all configurations (note, assignment is empty)) 1.240 - $(info . make CONF=<substring> # Build the configuration(s) with a name matching the given substring) 1.241 + $(info . make CONF= # Build all configurations (note, assignment is empty)) 1.242 + $(info . make CONF=<substring> # Build the configuration(s) with a name matching) 1.243 + $(info . # <substring>) 1.244 $(info ) 1.245 - $(info . make LOG=<loglevel> # Change loglevel from warn (default) to the given loglevel) 1.246 - $(info . # Available loglevels are: warn, info, debug and trace) 1.247 - $(info . # To see executed command lines, use LOG=info) 1.248 + $(info . make LOG=<loglevel> # Change the log level from warn to <loglevel>) 1.249 + $(info . # Available log levels are:) 1.250 + $(info . # 'warn' (default), 'info', 'debug' and 'trace') 1.251 + $(info . # To see executed command lines, use LOG=info) 1.252 $(info ) 1.253 - $(info . make test TEST=<test> # Only run the given test or tests, e.g.) 1.254 - $(info . # make test TEST="jdk_lang jdk_net") 1.255 + $(info . make JOBS=<n> # Run <n> parallel make jobs) 1.256 + $(info . # Note that -jN does not work as expected!) 1.257 + $(info ) 1.258 + $(info . make test TEST=<test> # Only run the given test or tests, e.g.) 1.259 + $(info . # make test TEST="jdk_lang jdk_net") 1.260 $(info ) 1.261 .PHONY: help 1.262 FRC: # Force target