Main.gmk revision 921:c3c75eda6606
1214501Srpaulo# 2252726Srpaulo# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 3252726Srpaulo# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4214501Srpaulo# 5252726Srpaulo# This code is free software; you can redistribute it and/or modify it 6252726Srpaulo# under the terms of the GNU General Public License version 2 only, as 7214501Srpaulo# published by the Free Software Foundation. Oracle designates this 8214501Srpaulo# particular file as subject to the "Classpath" exception as provided 9214501Srpaulo# by Oracle in the LICENSE file that accompanied this code. 10214501Srpaulo# 11214501Srpaulo# This code is distributed in the hope that it will be useful, but WITHOUT 12214501Srpaulo# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13214501Srpaulo# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14252726Srpaulo# version 2 for more details (a copy is included in the LICENSE file that 15214501Srpaulo# accompanied this code). 16214501Srpaulo# 17214501Srpaulo# You should have received a copy of the GNU General Public License version 18214501Srpaulo# 2 along with this work; if not, write to the Free Software Foundation, 19214501Srpaulo# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20214501Srpaulo# 21214501Srpaulo# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22214501Srpaulo# or visit www.oracle.com if you need additional information or have any 23214501Srpaulo# questions. 24214501Srpaulo# 25214501Srpaulo 26214501Srpaulo### This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file. 27214501Srpaulo 28214501Srpaulo# Now load the spec 29214501Srpauloinclude $(SPEC) 30214501Srpaulo 31214501Srpaulo# Load the vital tools for all the makefiles. 32214501Srpauloinclude $(SRC_ROOT)/make/common/MakeBase.gmk 33214501Srpaulo 34214501Srpaulo# Include the corresponding custom file, if present. 35214501Srpaulo-include $(CUSTOM_MAKE_DIR)/Main.gmk 36214501Srpaulo 37214501Srpaulo### Clean up from previous run 38214501Srpaulo 39214501Srpaulo# Remove any build.log from a previous run, if they exist 40214501Srpauloifneq (,$(BUILD_LOG)) 41214501Srpaulo ifneq (,$(BUILD_LOG_PREVIOUS)) 42214501Srpaulo # Rotate old log 43214501Srpaulo $(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null) 44214501Srpaulo $(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null) 45214501Srpaulo else 46214501Srpaulo $(shell $(RM) $(BUILD_LOG) 2> /dev/null) 47214501Srpaulo endif 48214501Srpaulo $(shell $(RM) $(OUTPUT_ROOT)/build-trace-time.log 2> /dev/null) 49214501Srpauloendif 50214501Srpaulo# Remove any javac server logs and port files. This 51214501Srpaulo# prevents a new make run to reuse the previous servers. 52252726Srpauloifneq (,$(SJAVAC_SERVER_DIR)) 53252726Srpaulo $(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*) 54214501Srpauloendif 55214501Srpaulo 56214501Srpaulo# Reset the build timers. 57252726Srpaulo$(eval $(call ResetAllTimers)) 58214501Srpaulo 59214501Srpaulo# Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line, 60214501Srpaulo# hence this workaround. 61214501SrpauloMAKE_ARGS:=$(MAKE_ARGS) -j$(JOBS) 62214501Srpaulo 63214501Srpaulo### Main targets 64214501Srpaulo 65214501Srpaulodefault: jdk 66214501Srpaulo @$(call CheckIfMakeAtEnd) 67214501Srpaulo 68214501Srpauloall: images docs 69214501Srpaulo @$(call CheckIfMakeAtEnd) 70214501Srpaulo 71214501Srpaulo# Setup a rule for SPEC file that fails if executed. This check makes sure the configuration 72214501Srpaulo# is up to date after changes to configure 73214501Srpaulo$(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*) 74214501Srpaulo @$(ECHO) ERROR: $(SPEC) is not up to date 75214501Srpaulo @$(ECHO) Please rerun configure! 76214501Srpaulo @if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi 77214501Srpaulo 78214501Srpaulostart-make: $(SPEC) 79214501Srpaulo @$(call AtMakeStart) 80214501Srpaulo 81214501Srpaulolangtools: langtools-only 82214501Srpaulolangtools-only: start-make 83214501Srpaulo @$(call TargetEnter) 84214501Srpaulo @($(CD) $(LANGTOOLS_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildLangtools.gmk) 85214501Srpaulo @$(call TargetExit) 86214501Srpaulo 87214501Srpaulocorba: langtools corba-only 88214501Srpaulocorba-only: start-make 89214501Srpaulo @$(call TargetEnter) 90252726Srpaulo @($(CD) $(CORBA_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildCorba.gmk) 91252726Srpaulo @$(call TargetExit) 92252726Srpaulo 93252726Srpaulojaxp: langtools jaxp-only 94252726Srpaulojaxp-only: start-make 95252726Srpaulo @$(call TargetEnter) 96252726Srpaulo @($(CD) $(JAXP_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxp.gmk) 97252726Srpaulo @$(call TargetExit) 98252726Srpaulo 99252726Srpaulojaxws: langtools jaxp jaxws-only 100252726Srpaulojaxws-only: start-make 101252726Srpaulo @$(call TargetEnter) 102252726Srpaulo @($(CD) $(JAXWS_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxws.gmk) 103252726Srpaulo @$(call TargetExit) 104252726Srpaulo 105252726Srpauloifeq ($(BUILD_HOTSPOT),true) 106252726Srpaulo hotspot: hotspot-only 107252726Srpaulo hotspot-only: start-make 108252726Srpaulo @$(call TargetEnter) 109252726Srpaulo @($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk) 110252726Srpaulo @$(call TargetExit) 111252726Srpauloendif 112252726Srpaulo 113252726Srpaulojdk: langtools hotspot corba jaxp jaxws jdk-only 114252726Srpaulojdk-only: start-make 115252726Srpaulo @$(call TargetEnter) 116252726Srpaulo @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk $(JDK_TARGET)) 117252726Srpaulo @$(call TargetExit) 118252726Srpaulo 119252726Srpaulonashorn: jdk nashorn-only 120252726Srpaulonashorn-only: start-make 121252726Srpaulo @$(call TargetEnter) 122252726Srpaulo @($(CD) $(NASHORN_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk) 123252726Srpaulo @$(call TargetExit) 124252726Srpaulo 125252726Srpaulodemos: jdk demos-only 126252726Srpaulodemos-only: start-make 127252726Srpaulo @$(call TargetEnter) 128252726Srpaulo @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk demos) 129252726Srpaulo @$(call TargetExit) 130252726Srpaulo 131252726Srpaulo# Note: This double-colon rule is intentional, to support 132252726Srpaulo# custom make file integration. 133252726Srpauloimages:: source-tips demos nashorn images-only 134252726Srpauloimages-only: start-make 135252726Srpaulo @$(call TargetEnter) 136252726Srpaulo @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images) 137252726Srpaulo @$(call TargetExit) 138252726Srpaulo 139252726Srpaulooverlay-images: source-tips demos overlay-images-only 140252726Srpaulooverlay-images-only: start-make 141252726Srpaulo @$(call TargetEnter) 142252726Srpaulo @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk overlay-images) 143252726Srpaulo @$(call TargetExit) 144252726Srpaulo 145252726Srpauloprofiles: profiles-oscheck source-tips jdk hotspot profiles-only 146252726Srpauloprofiles-only: start-make 147252726Srpaulo @$(call TargetEnter) 148252726Srpaulo @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk profiles) 149252726Srpaulo @$(call TargetExit) 150252726Srpaulo 151252726Srpauloprofiles-oscheck: 152252726Srpaulo ifneq ($(OPENJDK_TARGET_OS), linux) 153252726Srpaulo @echo "Error: The Java SE 8 Compact Profiles are only implemented for Linux at this time" && exit 1 154252726Srpaulo endif 155252726Srpaulo 156252726Srpauloinstall: images install-only 157252726Srpauloinstall-only: start-make 158252726Srpaulo @$(call TargetEnter) 159252726Srpaulo @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk install) 160252726Srpaulo @$(call TargetExit) 161252726Srpaulo 162252726Srpaulodocs: jdk docs-only 163252726Srpaulodocs-only: start-make 164252726Srpaulo @$(call TargetEnter) 165252726Srpaulo @($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs) 166252726Srpaulo @$(call TargetExit) 167252726Srpaulo 168252726Srpaulosign-jars: jdk sign-jars-only 169252726Srpaulosign-jars-only: start-make 170252726Srpaulo @$(call TargetEnter) 171252726Srpaulo @($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk sign-jars) 172252726Srpaulo @$(call TargetExit) 173252726Srpaulo 174252726Srpaulobootcycle-images: images bootcycle-images-only 175252726Srpaulobootcycle-images-only: start-make 176252726Srpaulo @$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image 177252726Srpaulo @($(CD) $(SRC_ROOT) && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images) 178252726Srpaulo 179252726Srpaulotest: images test-only 180214501Srpaulotest-only: start-make 181214501Srpaulo @$(call TargetEnter) 182214501Srpaulo @($(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 183214501Srpaulo @$(call TargetExit) 184214501Srpaulo 185214501Srpaulo# Stores the tips for each repository. This file is be used when constructing the jdk image and can be 186214501Srpaulo# used to track the exact sources used to build that image. 187214501Srpaulosource-tips: $(OUTPUT_ROOT)/source_tips 188214501Srpaulo$(OUTPUT_ROOT)/source_tips: FRC 189214501Srpaulo @$(MKDIR) -p $(@D) 190214501Srpaulo @$(RM) $@ 191214501Srpaulo @$(call GetSourceTips) 192214501Srpaulo 193214501Srpaulo 194214501Srpaulo# Remove everything, except the output from configure. 195214501Srpauloclean: 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 196214501Srpaulo @($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*) 197252726Srpaulo @$(ECHO) Cleaned all build artifacts. 198214501Srpaulo 199214501Srpaulo# Remove everything, including configure configuration. 200214501Srpaulo# If the output directory was created by configure and now becomes empty, remove it as well. 201214501Srpaulo# FIXME: tmp should not be here, fix ResetTimers instead. And remove spec.sh! 202214501Srpaulodist-clean: clean 203214501Srpaulo @($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp javacservers) 204214501Srpaulo @$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \ 205214501Srpaulo if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \ 206214501Srpaulo $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \ 207214501Srpaulo else \ 208214501Srpaulo ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" && $(RM) -r $(OUTPUT_ROOT)) \ 209214501Srpaulo fi \ 210214501Srpaulo ) 211214501Srpaulo @$(ECHO) Cleaned everything, you will have to re-run configure. 212214501Srpaulo 213214501Srpauloclean-langtools: 214214501Srpaulo $(call CleanComponent,langtools) 215214501Srpauloclean-corba: 216214501Srpaulo $(call CleanComponent,corba) 217214501Srpauloclean-jaxp: 218214501Srpaulo $(call CleanComponent,jaxp) 219214501Srpauloclean-jaxws: 220252726Srpaulo $(call CleanComponent,jaxws) 221214501Srpauloclean-hotspot: 222214501Srpaulo $(call CleanComponent,hotspot) 223214501Srpauloclean-jdk: 224214501Srpaulo $(call CleanComponent,jdk) 225214501Srpauloclean-nashorn: 226214501Srpaulo $(call CleanComponent,nashorn) 227214501Srpauloclean-images: 228214501Srpaulo $(call CleanComponent,images) 229214501Srpauloclean-overlay-images: 230252726Srpaulo $(call CleanComponent,overlay-images) 231214501Srpauloclean-bootcycle-build: 232214501Srpaulo $(call CleanComponent,bootcycle-build) 233214501Srpauloclean-docs: 234214501Srpaulo $(call CleanComponent,docs) 235214501Srpaulo $(call CleanComponent,docstemp) 236214501Srpauloclean-test: 237214501Srpaulo $(call CleanComponent,testoutput) 238214501Srpaulo 239214501Srpaulo.PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install test docs 240214501Srpaulo.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 241214501Srpaulo.PHONY: default all clean dist-clean bootcycle-images start-make 242214501Srpaulo.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 243214501Srpaulo.PHONY: profiles profiles-only profiles-oscheck 244214501Srpaulo 245214501Srpauloinclude $(root_dir)/make/Jprt.gmk 246214501Srpaulo 247214501SrpauloFRC: # Force target 248214501Srpaulo