duke@2: # dcubed@423: # Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. duke@2: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@2: # duke@2: # This code is free software; you can redistribute it and/or modify it duke@2: # under the terms of the GNU General Public License version 2 only, as ohair@182: # published by the Free Software Foundation. Oracle designates this duke@2: # particular file as subject to the "Classpath" exception as provided ohair@182: # by Oracle in the LICENSE file that accompanied this code. duke@2: # duke@2: # This code is distributed in the hope that it will be useful, but WITHOUT duke@2: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@2: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@2: # version 2 for more details (a copy is included in the LICENSE file that duke@2: # accompanied this code). duke@2: # duke@2: # You should have received a copy of the GNU General Public License version duke@2: # 2 along with this work; if not, write to the Free Software Foundation, duke@2: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@2: # ohair@182: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@182: # or visit www.oracle.com if you need additional information or have any ohair@182: # questions. duke@2: # duke@2: duke@2: # duke@2: # Common variables used by all the Java makefiles. This file should duke@2: # not contain rules. duke@2: # duke@2: ohrstrom@313: # The build times report is turned off by setting REPORT_BUILD_TIMES to nothing. ohrstrom@313: # This is necessary for the target clobber/clean which will erase the ohrstrom@313: # directories where the buildtimes are stored. ohrstrom@313: REPORT_BUILD_TIMES=1 ohrstrom@313: # Store the build times in this directory. ohrstrom@313: BUILDTIMESDIR=$(ABS_OUTPUTDIR)/tmp/buildtimes ohrstrom@313: ohrstrom@313: # Record starting time for build of a sub repository. ohrstrom@313: define RecordStartTime ohrstrom@313: $(MKDIR) -p $(BUILDTIMESDIR) ohrstrom@313: $(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$1 ohrstrom@313: $(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$1_human_readable ohrstrom@313: endef ohrstrom@313: ohrstrom@313: # Indicate that we started to build a sub repository and record starting time. ohair@128: define MakeStart ohrstrom@313: $(call RecordStartTime,$1) ohrstrom@313: $(PRINTF) "\n\n%s\n%s\n##### %-60.60s #####\n%s\n\n" \ ohair@128: "########################################################################" \ ohair@128: "########################################################################" \ ohrstrom@313: "Entering $1 for target(s) $2" \ ohair@128: "########################################################################" ohair@128: endef ohair@128: ohrstrom@313: # Record ending time and calculate the difference and store it in a ohrstrom@313: # easy to read format. Handles builds that cross midnight. Expects ohrstrom@313: # that a build will never take 24 hours or more. ohrstrom@313: define RecordEndTime ohrstrom@313: $(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$1 ohrstrom@313: $(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$1_human_readable ohrstrom@313: $(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$1` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$1` $1 | \ ohrstrom@313: $(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \ ohrstrom@313: M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \ ohrstrom@313: > $(BUILDTIMESDIR)/build_time_diff_$1 ohrstrom@313: endef ohrstrom@313: ohrstrom@313: # Indicate that we are done. ohrstrom@313: # Record ending time and print out the total time it took to build. ohrstrom@313: define MakeFinish ohrstrom@313: $(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,$1),) ohrstrom@313: $(PRINTF) "%s\n##### %-60.60s #####\n%s\n##### %-60.60s #####\n%s\n\n" \ ohair@128: "########################################################################" \ ohrstrom@313: "Leaving $1 for target(s) $2" \ ohair@128: "########################################################################" \ ohrstrom@313: $(if $(REPORT_BUILD_TIMES),"Build time `$(CAT) $(BUILDTIMESDIR)/build_time_diff_$1` for target(s) $2","") \ ohrstrom@313: "########################################################################" ohrstrom@313: endef ohrstrom@313: ohrstrom@313: # Find all build_time_* files and print their contents in a list sorted ohrstrom@313: # on the name of the sub repository. ohrstrom@313: define ReportBuildTimes michaelm@414: $(PRINTF) -- "-- Build times ----------\nTarget %s\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \ ohrstrom@313: $1 \ ohrstrom@313: "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \ ohrstrom@313: "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \ ohrstrom@313: "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | $(XARGS) $(CAT) | $(SORT) -k 2`" \ ohrstrom@313: "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" ohair@128: endef ohair@128: ohair@9: ifdef OPENJDK ohair@9: ifneq ($(OPENJDK),true) ohair@9: x:=$(error "OPENJDK (if defined) can only be set to true") ohair@9: endif ohair@9: endif ohair@9: duke@2: # Define absolute paths to TOPDIRs duke@2: ABS_LANGTOOLS_TOPDIR:=$(call OptFullPath,"$(LANGTOOLS_TOPDIR)") duke@2: ABS_CORBA_TOPDIR:=$(call OptFullPath,"$(CORBA_TOPDIR)") duke@2: ABS_JAXP_TOPDIR:=$(call OptFullPath,"$(JAXP_TOPDIR)") duke@2: ABS_JAXWS_TOPDIR:=$(call OptFullPath,"$(JAXWS_TOPDIR)") duke@2: ABS_JDK_TOPDIR:=$(call OptFullPath,"$(JDK_TOPDIR)") duke@2: ABS_HOTSPOT_TOPDIR:=$(call OptFullPath,"$(HOTSPOT_TOPDIR)") jjg@645: ABS_NASHORN_TOPDIR:=$(call OptFullPath,"$(NASHORN_TOPDIR)") duke@2: ABS_INSTALL_TOPDIR:=$(call OptFullPath,"$(INSTALL_TOPDIR)") duke@2: ABS_SPONSORS_TOPDIR:=$(call OptFullPath,"$(SPONSORS_TOPDIR)") duke@2: ABS_DEPLOY_TOPDIR:=$(call OptFullPath,"$(DEPLOY_TOPDIR)") duke@2: duke@2: # Macro to return true or false if a file exists and is readable duke@2: define MkExists duke@2: $(shell if [ -r $1 ]; then $(ECHO) true; else $(ECHO) false; fi) duke@2: endef duke@2: duke@2: HOTSPOT_SRC_AVAILABLE := $(call MkExists,$(HOTSPOT_TOPDIR)/make/Makefile) duke@2: ifndef BUILD_HOTSPOT duke@2: ifdef ALT_HOTSPOT_IMPORT_PATH duke@2: BUILD_HOTSPOT := false duke@2: else duke@2: BUILD_HOTSPOT := $(HOTSPOT_SRC_AVAILABLE) duke@2: endif duke@2: endif duke@2: duke@2: LANGTOOLS_SRC_AVAILABLE := $(call MkExists,$(LANGTOOLS_TOPDIR)/make/Makefile) duke@2: ifndef BUILD_LANGTOOLS duke@2: ifdef ALT_LANGTOOLS_DIST duke@2: BUILD_LANGTOOLS := false duke@2: else duke@2: BUILD_LANGTOOLS := $(LANGTOOLS_SRC_AVAILABLE) duke@2: endif duke@2: endif duke@2: duke@2: CORBA_SRC_AVAILABLE := $(call MkExists,$(CORBA_TOPDIR)/make/Makefile) duke@2: ifndef BUILD_CORBA duke@2: ifdef ALT_CORBA_DIST duke@2: BUILD_CORBA := false duke@2: else duke@2: BUILD_CORBA := $(CORBA_SRC_AVAILABLE) duke@2: endif duke@2: endif duke@2: duke@2: JAXP_SRC_AVAILABLE := $(call MkExists,$(JAXP_TOPDIR)/make/Makefile) duke@2: ifndef BUILD_JAXP duke@2: ifdef ALT_JAXP_DIST duke@2: BUILD_JAXP := false duke@2: else duke@2: BUILD_JAXP := $(JAXP_SRC_AVAILABLE) duke@2: endif duke@2: endif duke@2: duke@2: JAXWS_SRC_AVAILABLE := $(call MkExists,$(JAXWS_TOPDIR)/make/Makefile) duke@2: ifndef BUILD_JAXWS duke@2: ifdef ALT_JAXWS_DIST duke@2: BUILD_JAXWS := false duke@2: else duke@2: BUILD_JAXWS := $(JAXWS_SRC_AVAILABLE) duke@2: endif duke@2: endif duke@2: duke@2: JDK_SRC_AVAILABLE := $(call MkExists,$(JDK_TOPDIR)/make/Makefile) duke@2: ifndef BUILD_JDK duke@2: BUILD_JDK := $(JDK_SRC_AVAILABLE) duke@2: endif duke@2: ifeq ($(JDK_SRC_AVAILABLE),true) duke@2: JDK_CLOSED_SRC_AVAILABLE := $(call MkExists,$(JDK_TOPDIR)/src/closed) ohair@9: ifeq ($(JDK_CLOSED_SRC_AVAILABLE),false) ohair@9: OPENJDK = true duke@2: endif duke@2: endif duke@2: jjg@645: NASHORN_SRC_AVAILABLE := $(call MkExists,$(NASHORN_TOPDIR)/make/Makefile) jjg@645: ifndef BUILD_NASHORN jjg@645: ifdef ALT_NASHORN_DIST jjg@645: BUILD_NASHORN := false jjg@645: else jjg@645: BUILD_NASHORN := $(NASHORN_SRC_AVAILABLE) jjg@645: endif jjg@645: endif jjg@645: duke@2: DEPLOY_SRC_AVAILABLE := $(call MkExists,$(DEPLOY_TOPDIR)/make/Makefile) duke@2: ifndef BUILD_DEPLOY duke@2: BUILD_DEPLOY := $(DEPLOY_SRC_AVAILABLE) duke@2: endif duke@2: duke@2: INSTALL_SRC_AVAILABLE := $(call MkExists,$(INSTALL_TOPDIR)/make/Makefile) duke@2: ifndef BUILD_INSTALL duke@2: ifdef DEV_ONLY duke@2: BUILD_INSTALL := false duke@2: else duke@2: BUILD_INSTALL := $(INSTALL_SRC_AVAILABLE) duke@2: endif duke@2: endif duke@2: duke@2: SPONSORS_SRC_AVAILABLE := $(call MkExists,$(SPONSORS_TOPDIR)/make/Makefile) duke@2: ifndef BUILD_SPONSORS duke@2: ifdef DEV_ONLY duke@2: BUILD_SPONSORS := false duke@2: else duke@2: BUILD_SPONSORS := $(SPONSORS_SRC_AVAILABLE) duke@2: endif duke@2: endif duke@2: duke@2: ohair@288: # Do we build the source bundles? duke@2: BUNDLE_RULES = $(JDK_TOPDIR)/make/closed/bundles.gmk wetmore@122: ifeq ($(SKIP_BUNDLES_BUILD), true) wetmore@122: BUNDLE_RULES_AVAILABLE := false wetmore@122: else wetmore@122: BUNDLE_RULES_AVAILABLE := $(call MkExists,$(BUNDLE_RULES)) wetmore@122: endif duke@2: duke@2: # Current things we do NOT build for OPENJDK duke@2: ifdef OPENJDK duke@2: BUILD_DEPLOY = false duke@2: BUILD_INSTALL = false duke@2: BUILD_SPONSORS = false duke@2: BUNDLE_RULES_AVAILABLE := false duke@2: # These could be over-ridden on the command line or in environment duke@2: ifndef SKIP_FASTDEBUG_BUILD duke@2: SKIP_FASTDEBUG_BUILD = true duke@2: endif duke@2: ifndef SKIP_DEBUG_BUILD duke@2: SKIP_DEBUG_BUILD = true duke@2: endif duke@2: ifndef SKIP_COMPARE_IMAGES duke@2: SKIP_COMPARE_IMAGES = true duke@2: endif duke@2: else ohair@102: ohair@102: # Various non-OPENJDK reasons to NOT build the deploy repository ohair@102: ifeq ($(ARCH), ia64) ohair@102: BUILD_DEPLOY=false ohair@102: endif ohair@102: ifeq ($(ARCH), sparcv9) ohair@102: BUILD_DEPLOY=false ohair@102: endif ohair@102: ifeq ($(ARCH), amd64) ohair@102: ifeq ($(PLATFORM), solaris) ohair@102: BUILD_DEPLOY=false ohair@102: endif ohair@102: endif ohair@102: duke@2: endif ohair@29: ifndef SKIP_PRODUCT_BUILD ohair@29: SKIP_PRODUCT_BUILD = false ohair@29: endif duke@2: duke@2: # Many reasons why we would want to skip the comparison to previous jdk duke@2: ifndef SKIP_COMPARE_IMAGES duke@2: ifeq ($(BUILD_JDK), false) duke@2: SKIP_COMPARE_IMAGES = true duke@2: endif duke@2: ifeq ($(BUILD_DEPLOY), false) duke@2: SKIP_COMPARE_IMAGES = true duke@2: endif duke@2: ifeq ($(BUILD_INSTALL), false) duke@2: SKIP_COMPARE_IMAGES = true duke@2: endif duke@2: ifdef DEV_ONLY duke@2: SKIP_COMPARE_IMAGES = true duke@2: endif duke@2: endif duke@2: duke@2: # Select defaults if these are not set to true or false duke@2: ifndef SKIP_DEBUG_BUILD duke@2: SKIP_DEBUG_BUILD=true duke@2: endif duke@2: ifndef SKIP_FASTDEBUG_BUILD ohair@296: SKIP_FASTDEBUG_BUILD=true duke@2: endif duke@2: ohair@144: # Select javadoc setting GENERATE_DOCS ohair@144: ifndef NO_DOCS ohair@144: # Default value (we want javadoc run) ohair@144: GENERATE_DOCS=true andrew@151: # No DOCS build when JDK_UPDATE_VERSION set on non-OPENJDK builds andrew@151: ifndef OPENJDK andrew@151: ifdef JDK_UPDATE_VERSION andrew@151: GENERATE_DOCS=false andrew@151: endif ohair@144: endif ohair@144: # If langtools, corba, jaxp, and jaxws are not being built, ohair@144: # a full jdk javadoc is not possible ohair@144: ifneq ($(BUILD_LANGTOOLS), true) ohair@144: GENERATE_DOCS=false ohair@144: endif ohair@144: ifneq ($(BUILD_CORBA), true) ohair@144: GENERATE_DOCS=false ohair@144: endif ohair@144: ifneq ($(BUILD_JAXP), true) ohair@144: GENERATE_DOCS=false ohair@144: endif ohair@144: ifneq ($(BUILD_JAXWS), true) ohair@144: GENERATE_DOCS=false ohair@144: endif ohair@144: ifeq ($(GENERATE_DOCS),false) ohair@144: NO_DOCS=true ohair@144: endif ohair@144: else ohair@144: GENERATE_DOCS=false ohair@144: endif ohair@144: duke@2: # Output directory for hotspot build duke@2: HOTSPOT_DIR = $(ABS_OUTPUTDIR)/hotspot duke@2: duke@2: # If we are building components duke@2: ifndef ALT_LANGTOOLS_DIST duke@2: LANGTOOLS_OUTPUTDIR = $(ABS_OUTPUTDIR)/langtools duke@2: ABS_LANGTOOLS_DIST = $(LANGTOOLS_OUTPUTDIR)/dist duke@2: endif duke@2: ifndef ALT_CORBA_DIST duke@2: CORBA_OUTPUTDIR = $(ABS_OUTPUTDIR)/corba duke@2: ABS_CORBA_DIST = $(CORBA_OUTPUTDIR)/dist duke@2: endif duke@2: ifndef ALT_JAXP_DIST duke@2: JAXP_OUTPUTDIR = $(ABS_OUTPUTDIR)/jaxp duke@2: ABS_JAXP_DIST = $(JAXP_OUTPUTDIR)/dist duke@2: endif duke@2: ifndef ALT_JAXWS_DIST duke@2: JAXWS_OUTPUTDIR = $(ABS_OUTPUTDIR)/jaxws duke@2: ABS_JAXWS_DIST = $(JAXWS_OUTPUTDIR)/dist duke@2: endif jjg@645: ifndef ALT_NASHORN_DIST jjg@645: NASHORN_OUTPUTDIR = $(ABS_OUTPUTDIR)/nashorn jjg@645: ABS_NASHORN_DIST = $(NASHORN_OUTPUTDIR)/dist jjg@645: endif duke@2: duke@2: # Common make arguments (supplied to all component builds) duke@2: COMMON_BUILD_ARGUMENTS = \ duke@2: JDK_TOPDIR=$(ABS_JDK_TOPDIR) \ duke@2: JDK_MAKE_SHARED_DIR=$(ABS_JDK_TOPDIR)/make/common/shared \ duke@2: EXTERNALSANITYCONTROL=true \ jjg@87: SOURCE_LANGUAGE_VERSION=$(SOURCE_LANGUAGE_VERSION) \ duke@2: TARGET_CLASS_VERSION=$(TARGET_CLASS_VERSION) \ duke@2: MILESTONE=$(MILESTONE) \ duke@2: BUILD_NUMBER=$(BUILD_NUMBER) \ duke@2: JDK_BUILD_NUMBER=$(JDK_BUILD_NUMBER) \ duke@2: FULL_VERSION=$(FULL_VERSION) \ duke@2: PREVIOUS_JDK_VERSION=$(PREVIOUS_JDK_VERSION) \ duke@2: JDK_VERSION=$(JDK_VERSION) \ duke@2: JDK_MKTG_VERSION=$(JDK_MKTG_VERSION) \ duke@2: JDK_MAJOR_VERSION=$(JDK_MAJOR_VERSION) \ duke@2: JDK_MINOR_VERSION=$(JDK_MINOR_VERSION) \ martin@17: JDK_MICRO_VERSION=$(JDK_MICRO_VERSION) \ martin@17: PREVIOUS_MAJOR_VERSION=$(PREVIOUS_MAJOR_VERSION) \ martin@17: PREVIOUS_MINOR_VERSION=$(PREVIOUS_MINOR_VERSION) \ martin@17: PREVIOUS_MICRO_VERSION=$(PREVIOUS_MICRO_VERSION) duke@2: dholmes@483: ifdef OPENJDK dholmes@483: COMMON_BUILD_ARGUMENTS += OPENJDK=$(OPENJDK) dholmes@483: endif dholmes@483: duke@2: ifdef ARCH_DATA_MODEL duke@2: COMMON_BUILD_ARGUMENTS += ARCH_DATA_MODEL=$(ARCH_DATA_MODEL) duke@2: endif duke@2: duke@2: ifeq ($(DEBUG_NAME), debug) duke@2: COMMON_BUILD_ARGUMENTS += VARIANT=DBG DEBUG_CLASSFILES=true duke@2: endif duke@2: duke@2: ifeq ($(DEBUG_NAME), fastdebug) duke@2: COMMON_BUILD_ARGUMENTS += VARIANT=DBG FASTDEBUG=true DEBUG_CLASSFILES=true duke@2: endif duke@2: duke@2: ifdef COOKED_JDK_UPDATE_VERSION duke@2: COMMON_BUILD_ARGUMENTS += COOKED_JDK_UPDATE_VERSION=$(COOKED_JDK_UPDATE_VERSION) duke@2: endif duke@2: duke@2: ifdef COOKED_BUILD_NUMBER duke@2: COMMON_BUILD_ARGUMENTS += COOKED_BUILD_NUMBER=$(COOKED_BUILD_NUMBER) duke@2: endif duke@2: duke@2: ifdef ANT_HOME duke@2: COMMON_BUILD_ARGUMENTS += ANT_HOME="$(ANT_HOME)" duke@2: endif duke@2: dcubed@423: # When all repos support FULL_DEBUG_SYMBOLS and ZIP_DEBUGINFO_FILES, dcubed@423: # then these can be set here: dcubed@423: #ifdef FULL_DEBUG_SYMBOLS dcubed@423: # COMMON_BUILD_ARGUMENTS += FULL_DEBUG_SYMBOLS=$(FULL_DEBUG_SYMBOLS) dcubed@423: #endif dcubed@423: # dcubed@423: #ifdef ZIP_DEBUGINFO_FILES dcubed@423: # COMMON_BUILD_ARGUMENTS += ZIP_DEBUGINFO_FILES="$(ZIP_DEBUGINFO_FILES)" dcubed@423: #endif