make/Main.gmk

Mon, 16 Oct 2017 15:57:35 +0800

author
aoqi
date
Mon, 16 Oct 2017 15:57:35 +0800
changeset 1482
8fb429038513
parent 1291
730f885548b4
parent 1288
7801df19942d
child 2316
64a3eeabf6e5
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/*)
aoqi@0 74 @$(ECHO) ERROR: $(SPEC) is not up to date
aoqi@0 75 @$(ECHO) Please rerun configure!
aoqi@0 76 @if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi
aoqi@0 77
aoqi@0 78 start-make: $(SPEC)
aoqi@0 79 @$(call AtMakeStart)
aoqi@0 80
aoqi@0 81 langtools: langtools-only
aoqi@0 82 langtools-only: start-make
aoqi@0 83 @$(call TargetEnter)
aoqi@0 84 @($(CD) $(LANGTOOLS_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildLangtools.gmk)
aoqi@0 85 @$(call TargetExit)
aoqi@0 86
aoqi@0 87 corba: langtools corba-only
aoqi@0 88 corba-only: start-make
aoqi@0 89 @$(call TargetEnter)
aoqi@0 90 @($(CD) $(CORBA_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildCorba.gmk)
aoqi@0 91 @$(call TargetExit)
aoqi@0 92
aoqi@0 93 jaxp: langtools jaxp-only
aoqi@0 94 jaxp-only: start-make
aoqi@0 95 @$(call TargetEnter)
aoqi@0 96 @($(CD) $(JAXP_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxp.gmk)
aoqi@0 97 @$(call TargetExit)
aoqi@0 98
aoqi@0 99 jaxws: langtools jaxp jaxws-only
aoqi@0 100 jaxws-only: start-make
aoqi@0 101 @$(call TargetEnter)
aoqi@0 102 @($(CD) $(JAXWS_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxws.gmk)
aoqi@0 103 @$(call TargetExit)
aoqi@0 104
aoqi@0 105 ifeq ($(BUILD_HOTSPOT),true)
aoqi@0 106 hotspot: hotspot-only
aoqi@0 107 hotspot-only: start-make
aoqi@0 108 @$(call TargetEnter)
aoqi@0 109 @($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
aoqi@0 110 @$(call TargetExit)
aoqi@0 111 endif
aoqi@0 112
aoqi@0 113 jdk: langtools hotspot corba jaxp jaxws jdk-only
aoqi@0 114 jdk-only: start-make
aoqi@0 115 @$(call TargetEnter)
aoqi@0 116 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk $(JDK_TARGET))
aoqi@0 117 @$(call TargetExit)
aoqi@0 118
aoqi@0 119 nashorn: jdk nashorn-only
aoqi@0 120 nashorn-only: start-make
aoqi@0 121 @$(call TargetEnter)
aoqi@0 122 @($(CD) $(NASHORN_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk)
aoqi@0 123 @$(call TargetExit)
aoqi@0 124
aoqi@0 125 demos: jdk demos-only
aoqi@0 126 demos-only: start-make
aoqi@0 127 @$(call TargetEnter)
aoqi@0 128 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk demos)
aoqi@0 129 @$(call TargetExit)
aoqi@0 130
aoqi@0 131 # Note: This double-colon rule is intentional, to support
aoqi@0 132 # custom make file integration.
aoqi@0 133 images:: source-tips demos nashorn images-only
aoqi@0 134 images-only: start-make
aoqi@0 135 @$(call TargetEnter)
aoqi@0 136 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images)
aoqi@0 137 @$(call TargetExit)
aoqi@0 138
aoqi@0 139 overlay-images: source-tips demos overlay-images-only
aoqi@0 140 overlay-images-only: start-make
aoqi@0 141 @$(call TargetEnter)
aoqi@0 142 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk overlay-images)
aoqi@0 143 @$(call TargetExit)
aoqi@0 144
dholmes@1291 145 profiles: source-tips jdk hotspot profiles-only
aoqi@0 146 profiles-only: start-make
aoqi@0 147 @$(call TargetEnter)
aoqi@0 148 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk profiles)
aoqi@0 149 @$(call TargetExit)
aoqi@0 150
aoqi@0 151 install: images install-only
aoqi@0 152 install-only: start-make
aoqi@0 153 @$(call TargetEnter)
aoqi@0 154 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk install)
aoqi@0 155 @$(call TargetExit)
aoqi@0 156
aoqi@0 157 docs: jdk docs-only
aoqi@0 158 docs-only: start-make
aoqi@0 159 @$(call TargetEnter)
aoqi@0 160 @($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
aoqi@0 161 @$(call TargetExit)
aoqi@0 162
aoqi@0 163 sign-jars: jdk sign-jars-only
aoqi@0 164 sign-jars-only: start-make
aoqi@0 165 @$(call TargetEnter)
aoqi@0 166 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk sign-jars)
aoqi@0 167 @$(call TargetExit)
aoqi@0 168
aoqi@0 169 bootcycle-images: images bootcycle-images-only
aoqi@0 170 bootcycle-images-only: start-make
aoqi@0 171 @$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
aoqi@0 172 @($(CD) $(SRC_ROOT) && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images)
aoqi@0 173
aoqi@0 174 test: images test-only
aoqi@0 175 test-only: start-make
aoqi@0 176 @$(call TargetEnter)
aoqi@0 177 @($(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 178 @$(call TargetExit)
aoqi@0 179
aoqi@0 180 # Stores the tips for each repository. This file is be used when constructing the jdk image and can be
aoqi@0 181 # used to track the exact sources used to build that image.
aoqi@0 182 source-tips: $(OUTPUT_ROOT)/source_tips
aoqi@0 183 $(OUTPUT_ROOT)/source_tips: FRC
aoqi@0 184 @$(MKDIR) -p $(@D)
aoqi@0 185 @$(RM) $@
aoqi@0 186 @$(call GetSourceTips)
aoqi@0 187
aoqi@0 188
aoqi@0 189 # Remove everything, except the output from configure.
aoqi@0 190 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 191 @($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
aoqi@0 192 @$(ECHO) Cleaned all build artifacts.
aoqi@0 193
aoqi@0 194 # Remove everything, including configure configuration.
aoqi@0 195 # If the output directory was created by configure and now becomes empty, remove it as well.
aoqi@0 196 # FIXME: tmp should not be here, fix ResetTimers instead. And remove spec.sh!
aoqi@0 197 dist-clean: clean
aoqi@0 198 @($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp javacservers)
aoqi@0 199 @$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
aoqi@0 200 if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
aoqi@0 201 $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
aoqi@0 202 else \
aoqi@0 203 ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" && $(RM) -r $(OUTPUT_ROOT)) \
aoqi@0 204 fi \
aoqi@0 205 )
aoqi@0 206 @$(ECHO) Cleaned everything, you will have to re-run configure.
aoqi@0 207
aoqi@0 208 clean-langtools:
aoqi@0 209 $(call CleanComponent,langtools)
aoqi@0 210 clean-corba:
aoqi@0 211 $(call CleanComponent,corba)
aoqi@0 212 clean-jaxp:
aoqi@0 213 $(call CleanComponent,jaxp)
aoqi@0 214 clean-jaxws:
aoqi@0 215 $(call CleanComponent,jaxws)
aoqi@0 216 clean-hotspot:
aoqi@0 217 $(call CleanComponent,hotspot)
aoqi@0 218 clean-jdk:
aoqi@0 219 $(call CleanComponent,jdk)
aoqi@0 220 clean-nashorn:
aoqi@0 221 $(call CleanComponent,nashorn)
aoqi@0 222 clean-images:
aoqi@0 223 $(call CleanComponent,images)
aoqi@0 224 clean-overlay-images:
aoqi@0 225 $(call CleanComponent,overlay-images)
aoqi@0 226 clean-bootcycle-build:
aoqi@0 227 $(call CleanComponent,bootcycle-build)
aoqi@0 228 clean-docs:
aoqi@0 229 $(call CleanComponent,docs)
aoqi@0 230 $(call CleanComponent,docstemp)
aoqi@0 231 clean-test:
aoqi@0 232 $(call CleanComponent,testoutput)
aoqi@0 233
aoqi@0 234 .PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install test docs
aoqi@0 235 .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 236 .PHONY: default all clean dist-clean bootcycle-images start-make
aoqi@0 237 .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 238 .PHONY: profiles profiles-only
aoqi@0 239
mikael@1140 240 include $(root_dir)/make/Jprt.gmk
mikael@1140 241
aoqi@0 242 FRC: # Force target

mercurial