make/Main.gmk

Thu, 27 Dec 2018 11:47:57 +0800

author
aoqi
date
Thu, 27 Dec 2018 11:47:57 +0800
changeset 2316
64a3eeabf6e5
parent 2211
2209644bcac4
parent 1482
8fb429038513
child 2438
f4b08401e50d
permissions
-rw-r--r--

Merge

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

mercurial