1 # 2 # Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 5 # This code is free software; you can redistribute it and/or modify it 6 # under the terms of the GNU General Public License version 2 only, as 7 # published by the Free Software Foundation. Oracle designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Oracle in the LICENSE file that accompanied this code. 10 # 11 # This code is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 # version 2 for more details (a copy is included in the LICENSE file that 15 # accompanied this code). 16 # 17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 ### This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file. 27 28 # Now load the spec 29 include $(SPEC) 30 31 # Load the vital tools for all the makefiles. 32 include $(SRC_ROOT)/make/common/MakeBase.gmk 33 34 # Include the corresponding custom file, if present. 35 -include $(CUSTOM_MAKE_DIR)/Main.gmk 36 37 ### Clean up from previous run 38 39 # Remove any build.log from a previous run, if they exist 40 ifneq (,$(BUILD_LOG)) 41 ifneq (,$(BUILD_LOG_PREVIOUS)) 42 # Rotate old log 43 $(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null) 44 $(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null) 45 else 46 $(shell $(RM) $(BUILD_LOG) 2> /dev/null) 47 endif 48 $(shell $(RM) $(OUTPUT_ROOT)/build-trace-time.log 2> /dev/null) 49 endif 50 # Remove any javac server logs and port files. This 51 # prevents a new make run to reuse the previous servers. 52 ifneq (,$(SJAVAC_SERVER_DIR)) 53 $(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*) 54 endif 55 56 # Reset the build timers. 57 $(eval $(call ResetAllTimers)) 58 59 # Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line, 60 # hence this workaround. 61 MAKE_ARGS:=$(MAKE_ARGS) -j$(JOBS) 62 63 ### Main targets 64 65 default: jdk 66 @$(call CheckIfMakeAtEnd) 67 68 all: images docs 69 @$(call CheckIfMakeAtEnd) 70 71 # Setup a rule for SPEC file that fails if executed. This check makes sure the configuration 72 # is up to date after changes to configure 73 $(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*) 74 @$(ECHO) "ERROR: $(SPEC) is not up to date." 75 @$(ECHO) "Please rerun configure! Easiest way to do this is by running" 76 @$(ECHO) "'make reconfigure'." 77 @if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi 78 79 start-make: $(SPEC) 80 @$(call AtMakeStart) 81 82 langtools: langtools-only 83 langtools-only: start-make 84 @$(call TargetEnter) 85 @($(CD) $(LANGTOOLS_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildLangtools.gmk) 86 @$(call TargetExit) 87 88 corba: langtools corba-only 89 corba-only: start-make 90 @$(call TargetEnter) 91 @($(CD) $(CORBA_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildCorba.gmk) 92 @$(call TargetExit) 93 94 jaxp: langtools jaxp-only 95 jaxp-only: start-make 96 @$(call TargetEnter) 97 @($(CD) $(JAXP_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxp.gmk) 98 @$(call TargetExit) 99 100 jaxws: langtools jaxp jaxws-only 101 jaxws-only: start-make 102 @$(call TargetEnter) 103 @($(CD) $(JAXWS_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxws.gmk) 104 @$(call TargetExit) 105 106 ifeq ($(BUILD_HOTSPOT),true) 107 hotspot: hotspot-only 108 hotspot-only: start-make 109 @$(call TargetEnter) 110 @($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk) 111 @$(call TargetExit) 112 endif 113 114 jdk: langtools hotspot corba jaxp jaxws jdk-only 115 jdk-only: start-make 116 @$(call TargetEnter) 117 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk $(JDK_TARGET)) 118 @$(call TargetExit) 119 120 nashorn: jdk nashorn-only 121 nashorn-only: start-make 122 @$(call TargetEnter) 123 @($(CD) $(NASHORN_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk) 124 @$(call TargetExit) 125 126 demos: jdk demos-only 127 demos-only: start-make 128 @$(call TargetEnter) 129 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk demos) 130 @$(call TargetExit) 131 132 # Note: This double-colon rule is intentional, to support 133 # custom make file integration. 134 images:: source-tips demos nashorn images-only 135 images-only: start-make 136 @$(call TargetEnter) 137 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images) 138 @$(call TargetExit) 139 140 overlay-images: source-tips demos overlay-images-only 141 overlay-images-only: start-make 142 @$(call TargetEnter) 143 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk overlay-images) 144 @$(call TargetExit) 145 146 profiles: source-tips jdk hotspot profiles-only 147 profiles-only: start-make 148 @$(call TargetEnter) 149 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk profiles) 150 @$(call TargetExit) 151 152 install: images install-only 153 install-only: start-make 154 @$(call TargetEnter) 155 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk install) 156 @$(call TargetExit) 157 158 docs: jdk docs-only 159 docs-only: start-make 160 @$(call TargetEnter) 161 @($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs) 162 @$(call TargetExit) 163 164 docs-zip: docs docs-zip-only 165 docs-zip-only: start-make 166 @$(call TargetEnter) 167 @($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-zip) 168 @$(call TargetExit) 169 170 sign-jars: jdk sign-jars-only 171 sign-jars-only: start-make 172 @$(call TargetEnter) 173 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk sign-jars) 174 @$(call TargetExit) 175 176 bootcycle-images: images bootcycle-images-only 177 bootcycle-images-only: start-make 178 @$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image 179 @($(CD) $(SRC_ROOT) && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images) 180 181 # If the tests produced a $(TEST)_exitcode.txt file, use the number in that 182 # file for the exit code of the "make test" invocation. 183 test: images test-only 184 test-only: start-make 185 @$(call TargetEnter) 186 @($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 -k MAKEFLAGS= JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $(TEST)) || true 187 @$(call TargetExit) 188 @(if [ -r $(OUTPUT_ROOT)/testoutput/$(TEST)_exitcode.txt ]; then \ 189 EXIT=$$($(CAT) $(OUTPUT_ROOT)/testoutput/$(TEST)_exitcode.txt); \ 190 exit $${EXIT}; \ 191 fi) 192 193 # Stores the tips for each repository. This file is be used when constructing the jdk image and can be 194 # used to track the exact sources used to build that image. 195 source-tips: $(OUTPUT_ROOT)/source_tips 196 $(OUTPUT_ROOT)/source_tips: FRC 197 @$(MKDIR) -p $(@D) 198 @$(RM) $@ 199 @$(call GetSourceTips) 200 201 202 # Remove everything, except the output from configure. 203 clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build clean-docs clean-test 204 @($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*) 205 @$(ECHO) Cleaned all build artifacts. 206 207 # Remove everything, including configure configuration. 208 # If the output directory was created by configure and now becomes empty, remove it as well. 209 # FIXME: tmp should not be here, fix ResetTimers instead. And remove spec.sh! 210 dist-clean: clean 211 @($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp javacservers) 212 @$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \ 213 if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \ 214 $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \ 215 else \ 216 ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" && $(RM) -r $(OUTPUT_ROOT)) \ 217 fi \ 218 ) 219 @$(ECHO) Cleaned everything, you will have to re-run configure. 220 221 clean-langtools: 222 $(call CleanComponent,langtools) 223 clean-corba: 224 $(call CleanComponent,corba) 225 clean-jaxp: 226 $(call CleanComponent,jaxp) 227 clean-jaxws: 228 $(call CleanComponent,jaxws) 229 clean-hotspot: 230 $(call CleanComponent,hotspot) 231 clean-jdk: 232 $(call CleanComponent,jdk) 233 clean-nashorn: 234 $(call CleanComponent,nashorn) 235 clean-images: 236 $(call CleanComponent,images) 237 clean-overlay-images: 238 $(call CleanComponent,overlay-images) 239 clean-bootcycle-build: 240 $(call CleanComponent,bootcycle-build) 241 clean-docs: 242 $(call CleanComponent,docs) 243 $(call CleanComponent,docstemp) 244 clean-docs-zip: 245 $(call CleanComponent,bundles/jdk-*-docs.zip) 246 clean-test: 247 $(call CleanComponent,testoutput) 248 249 reconfigure: 250 ifneq ($(CONFIGURE_COMMAND_LINE), ) 251 @$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'" 252 else 253 @$(ECHO) "Re-running configure using default settings" 254 endif 255 @( cd $(OUTPUT_ROOT) && $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) ) 256 257 .PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install test docs docs-zip 258 .PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only nashorn-only images-only overlay-images-only install-only test-only docs-only docs-zip-only 259 .PHONY: default all clean dist-clean bootcycle-images start-make 260 .PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-docs clean-docs-zip clean-test clean-overlay-images clean-bootcycle-build 261 .PHONY: profiles profiles-only 262 263 include $(root_dir)/make/Jprt.gmk 264 265 FRC: # Force target