make/Main.gmk

Thu, 12 Oct 2017 19:39:08 +0800

author
aoqi
date
Thu, 12 Oct 2017 19:39:08 +0800
changeset 1288
7801df19942d
parent 1140
6d0ebf545f49
parent 1133
50aaf272884f
child 1482
8fb429038513
permissions
-rw-r--r--

merge

aoqi@0 1 #
aoqi@0 2 # Copyright (c) 2011, 2013, 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
aoqi@0 145 profiles: profiles-oscheck 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 profiles-oscheck:
aoqi@0 152 ifneq ($(OPENJDK_TARGET_OS), linux)
aoqi@0 153 @echo "Error: The Java SE 8 Compact Profiles are only implemented for Linux at this time" && exit 1
aoqi@0 154 endif
aoqi@0 155
aoqi@0 156 install: images install-only
aoqi@0 157 install-only: start-make
aoqi@0 158 @$(call TargetEnter)
aoqi@0 159 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk install)
aoqi@0 160 @$(call TargetExit)
aoqi@0 161
aoqi@0 162 docs: jdk docs-only
aoqi@0 163 docs-only: start-make
aoqi@0 164 @$(call TargetEnter)
aoqi@0 165 @($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
aoqi@0 166 @$(call TargetExit)
aoqi@0 167
aoqi@0 168 sign-jars: jdk sign-jars-only
aoqi@0 169 sign-jars-only: start-make
aoqi@0 170 @$(call TargetEnter)
aoqi@0 171 @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk sign-jars)
aoqi@0 172 @$(call TargetExit)
aoqi@0 173
aoqi@0 174 bootcycle-images: images bootcycle-images-only
aoqi@0 175 bootcycle-images-only: start-make
aoqi@0 176 @$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
aoqi@0 177 @($(CD) $(SRC_ROOT) && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images)
aoqi@0 178
aoqi@0 179 test: images test-only
aoqi@0 180 test-only: start-make
aoqi@0 181 @$(call TargetEnter)
aoqi@0 182 @($(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 183 @$(call TargetExit)
aoqi@0 184
aoqi@0 185 # Stores the tips for each repository. This file is be used when constructing the jdk image and can be
aoqi@0 186 # used to track the exact sources used to build that image.
aoqi@0 187 source-tips: $(OUTPUT_ROOT)/source_tips
aoqi@0 188 $(OUTPUT_ROOT)/source_tips: FRC
aoqi@0 189 @$(MKDIR) -p $(@D)
aoqi@0 190 @$(RM) $@
aoqi@0 191 @$(call GetSourceTips)
aoqi@0 192
aoqi@0 193
aoqi@0 194 # Remove everything, except the output from configure.
aoqi@0 195 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 196 @($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
aoqi@0 197 @$(ECHO) Cleaned all build artifacts.
aoqi@0 198
aoqi@0 199 # Remove everything, including configure configuration.
aoqi@0 200 # If the output directory was created by configure and now becomes empty, remove it as well.
aoqi@0 201 # FIXME: tmp should not be here, fix ResetTimers instead. And remove spec.sh!
aoqi@0 202 dist-clean: clean
aoqi@0 203 @($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp javacservers)
aoqi@0 204 @$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
aoqi@0 205 if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
aoqi@0 206 $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
aoqi@0 207 else \
aoqi@0 208 ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" && $(RM) -r $(OUTPUT_ROOT)) \
aoqi@0 209 fi \
aoqi@0 210 )
aoqi@0 211 @$(ECHO) Cleaned everything, you will have to re-run configure.
aoqi@0 212
aoqi@0 213 clean-langtools:
aoqi@0 214 $(call CleanComponent,langtools)
aoqi@0 215 clean-corba:
aoqi@0 216 $(call CleanComponent,corba)
aoqi@0 217 clean-jaxp:
aoqi@0 218 $(call CleanComponent,jaxp)
aoqi@0 219 clean-jaxws:
aoqi@0 220 $(call CleanComponent,jaxws)
aoqi@0 221 clean-hotspot:
aoqi@0 222 $(call CleanComponent,hotspot)
aoqi@0 223 clean-jdk:
aoqi@0 224 $(call CleanComponent,jdk)
aoqi@0 225 clean-nashorn:
aoqi@0 226 $(call CleanComponent,nashorn)
aoqi@0 227 clean-images:
aoqi@0 228 $(call CleanComponent,images)
aoqi@0 229 clean-overlay-images:
aoqi@0 230 $(call CleanComponent,overlay-images)
aoqi@0 231 clean-bootcycle-build:
aoqi@0 232 $(call CleanComponent,bootcycle-build)
aoqi@0 233 clean-docs:
aoqi@0 234 $(call CleanComponent,docs)
aoqi@0 235 $(call CleanComponent,docstemp)
aoqi@0 236 clean-test:
aoqi@0 237 $(call CleanComponent,testoutput)
aoqi@0 238
aoqi@0 239 .PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install test docs
aoqi@0 240 .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 241 .PHONY: default all clean dist-clean bootcycle-images start-make
aoqi@0 242 .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
aoqi@0 243 .PHONY: profiles profiles-only profiles-oscheck
aoqi@0 244
mikael@1140 245 include $(root_dir)/make/Jprt.gmk
mikael@1140 246
aoqi@0 247 FRC: # Force target

mercurial