Makefile revision 742
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# This code is free software; you can redistribute it and/or modify it
564c5c8d77e1fe074bfa96133bfdbbd0707c1ed3Matt Sweeney# under the terms of the GNU General Public License version 2 only, as
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# published by the Free Software Foundation. Oracle designates this
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney# particular file as subject to the "Classpath" exception as provided
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# by Oracle in the LICENSE file that accompanied this code.
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# This code is distributed in the hope that it will be useful, but WITHOUT
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# version 2 for more details (a copy is included in the LICENSE file that
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# accompanied this code).
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# You should have received a copy of the GNU General Public License version
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# 2 along with this work; if not, write to the Free Software Foundation,
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# or visit www.oracle.com if you need additional information or have any
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# Basename of any originally supplied ALT_OUTPUTDIR directory
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney ORIG_OUTPUTDIR_BASENAME := $(shell basename $(ALT_OUTPUTDIR))
056ec5e3a7c6ad7819398c8c3e6e225386c4bbd0Matt Sweeney# The three possible directories created for output (3 build flavors)
056ec5e3a7c6ad7819398c8c3e6e225386c4bbd0Matt SweeneyOUTPUTDIR_BASENAME- = $(ORIG_OUTPUTDIR_BASENAME)
056ec5e3a7c6ad7819398c8c3e6e225386c4bbd0Matt SweeneyOUTPUTDIR_BASENAME-debug = $(ORIG_OUTPUTDIR_BASENAME)-debug
056ec5e3a7c6ad7819398c8c3e6e225386c4bbd0Matt SweeneyOUTPUTDIR_BASENAME-fastdebug = $(ORIG_OUTPUTDIR_BASENAME)-fastdebug
056ec5e3a7c6ad7819398c8c3e6e225386c4bbd0Matt Sweeney# Relative path to a debug output area
056ec5e3a7c6ad7819398c8c3e6e225386c4bbd0Matt SweeneyREL_JDK_OUTPUTDIR = ../$(OUTPUTDIR_BASENAME-$(DEBUG_NAME))
056ec5e3a7c6ad7819398c8c3e6e225386c4bbd0Matt Sweeney# The created jdk image directory
056ec5e3a7c6ad7819398c8c3e6e225386c4bbd0Matt SweeneyJDK_IMAGE_DIR = $(OUTPUTDIR)/$(JDK_IMAGE_DIRNAME)
056ec5e3a7c6ad7819398c8c3e6e225386c4bbd0Matt SweeneyABS_JDK_IMAGE_DIR = $(ABS_OUTPUTDIR)/$(JDK_IMAGE_DIRNAME)
056ec5e3a7c6ad7819398c8c3e6e225386c4bbd0Matt Sweeney# Relative path from an output directory to the image directory
056ec5e3a7c6ad7819398c8c3e6e225386c4bbd0Matt SweeneyREL_JDK_IMAGE_DIR = ../$(OUTPUTDIR_BASENAME-$(DEBUG_NAME))/$(JDK_IMAGE_DIRNAME)
056ec5e3a7c6ad7819398c8c3e6e225386c4bbd0Matt SweeneyREL_JDK_DEBUG_IMAGE_DIR = ../$(OUTPUTDIR_BASENAME-debug)/$(JDK_IMAGE_DIRNAME)
056ec5e3a7c6ad7819398c8c3e6e225386c4bbd0Matt SweeneyREL_JDK_FASTDEBUG_IMAGE_DIR = ../$(OUTPUTDIR_BASENAME-fastdebug)/$(JDK_IMAGE_DIRNAME)
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared
484ded111840f4104ab556e0628b0e84632eba34Matt Sweeney# Everything for a full product build
484ded111840f4104ab556e0628b0e84632eba34Matt Sweeney $(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),)
484ded111840f4104ab556e0628b0e84632eba34Matt Sweeney# Generic build of basic repo series
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney generic_build_repo_series:: install-binaries-jdk-debug
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney @$(call StopTimer,$(if $(DEBUG_NAME),$(DEBUG_NAME)_build,all_product_build))
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# The debug build, fastdebug or debug. Needs special handling.
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# Note that debug builds do NOT do INSTALL steps aside from the
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# install-binaries-jdk-debug or install-binaries-jdk-debug-clobber targets.
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# DEBUG_NAME is fastdebug or debug
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney# The resulting image directory (j2sdk-image) is used by the install makefiles
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# (only if debug files are present when install checks for them)
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# to create a debug install bundle jdk-*-debug-** bundle (tar or zip)
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# which will install in the debug or fastdebug subdirectory of the
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# normal product install area.
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# The install process needs to know what the DEBUG_NAME is, so
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# look for INSTALL_DEBUG_NAME in the install rules.
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# NOTE: On windows, do not use $(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME).
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney# Due to the use of short paths in $(ABS_OUTPUTDIR), this may
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney# not be the same location.
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney# Location of fresh bootdir output
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt SweeneyFRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/$(JDK_IMAGE_DIRNAME)
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt SweeneyFRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/$(REL_JDK_IMAGE_DIR)
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney# Create boot image?
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney ifneq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney # Create the bootdir to use in the build
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney fastdebug_build:: create_fresh_fastdebug_bootdir
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney # Define variables to be used now for the boot jdk
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney # Use the supplied ALT_BOOTDIR as the boot
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# NOTE: On windows, do not use $(ABS_OUTPUTDIR)-$(DEBUG_NAME).
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# Due to the use of short paths in $(ABS_OUTPUTDIR), this may
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# not be the same location.
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)/$(REL_JDK_OUTPUTDIR) \
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney $(MAKE) DEBUG_NAME=fastdebug generic_debug_build
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# Build final image
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# The source tips are stored with the relative path to the repo.
73857faca3d4266c7840cd6ce428a71cf9a94d0cMatt Sweeney# This file will be used when constructing the jdk image.
c56d37350cde9ba6fcde1a42433b3d759fe2b2ecMatt Sweeney -($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE))
c56d37350cde9ba6fcde1a42433b3d759fe2b2ecMatt Sweeney# Quick jdk verification build
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney $(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney# Quick jdk verification fastdebug build
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney $(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney# Quick deploy verification fastdebug build
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney# Product build (skip debug builds)
c56d37350cde9ba6fcde1a42433b3d759fe2b2ecMatt Sweeney# Check target
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney# Help target
c56d37350cde9ba6fcde1a42433b3d759fe2b2ecMatt Sweeneyhelp: intro_help target_help variable_help notes_help examples_help
c56d37350cde9ba6fcde1a42433b3d759fe2b2ecMatt Sweeney# Intro help message
c56d37350cde9ba6fcde1a42433b3d759fe2b2ecMatt SweeneyMakefile for the JDK builds (all the JDK). \n\
c56d37350cde9ba6fcde1a42433b3d759fe2b2ecMatt Sweeney# Target help
c56d37350cde9ba6fcde1a42433b3d759fe2b2ecMatt Sweeney--- Common Targets --- \n\
c56d37350cde9ba6fcde1a42433b3d759fe2b2ecMatt Sweeneyall -- build the core JDK (default target) \n\
c56d37350cde9ba6fcde1a42433b3d759fe2b2ecMatt Sweeneyhelp -- Print out help information \n\
c56d37350cde9ba6fcde1a42433b3d759fe2b2ecMatt Sweeneycheck -- Check make variable values for correctness \n\
c56d37350cde9ba6fcde1a42433b3d759fe2b2ecMatt Sweeneysanity -- Perform detailed sanity checks on system and settings \n\
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeneyfastdebug_build -- build the core JDK in 'fastdebug' mode (-g -O) \n\
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeneydebug_build -- build the core JDK in 'debug' mode (-g) \n\
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeneyclean -- remove all built and imported files \n\
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeneyclobber -- same as clean \n\
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# Variable help (only common ones used by this Makefile)
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeneyvariable_help: variable_help_intro variable_list variable_help_end
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# One line descriptions for the variables
4a589644c0b4ea2684514116fbbad30d79536f8aMatt SweeneyPARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count
4a589644c0b4ea2684514116fbbad30d79536f8aMatt SweeneySLASH_JAVA.desc = Root of all build tools, e.g. /java or J:
4a589644c0b4ea2684514116fbbad30d79536f8aMatt SweeneyJDK_IMPORT_PATH.desc = JDK used to import components of the build
4a589644c0b4ea2684514116fbbad30d79536f8aMatt SweeneyCACERTS_FILE.desc = Location of certificates file
4a589644c0b4ea2684514116fbbad30d79536f8aMatt SweeneyDEVTOOLS_PATH.desc = Directory containing zip and gnumake
4a589644c0b4ea2684514116fbbad30d79536f8aMatt SweeneyCUPS_HEADERS_PATH.desc = Include directory location for CUPS header files
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# Make variables to print out (description and value)
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney# Make variables that should refer to directories that exist
85a258143f630b36522d3d1835a8e5a916dbad2cMatt Sweeney# Make variables that should refer to files that exist
85a258143f630b36522d3d1835a8e5a916dbad2cMatt Sweeney# Some are windows specific
85a258143f630b36522d3d1835a8e5a916dbad2cMatt Sweeney# For pattern rules below, so all are treated the same
85a258143f630b36522d3d1835a8e5a916dbad2cMatt SweeneyDO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
85a258143f630b36522d3d1835a8e5a916dbad2cMatt SweeneyDO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt SweeneyDO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)
85a258143f630b36522d3d1835a8e5a916dbad2cMatt Sweeney# Complete variable check
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeneyvariable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)
85a258143f630b36522d3d1835a8e5a916dbad2cMatt Sweeneyvariable_list: $(DO_PRINTVAL_LIST) variable_check
85a258143f630b36522d3d1835a8e5a916dbad2cMatt Sweeney# Pattern rule for printing out a variable
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney# Pattern rule for checking to see if a variable with a directory exists
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney @if [ ! -d $($*) ] ; then \
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney# Pattern rule for checking to see if a variable with a file exists
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney @if [ ! -f $($*) ] ; then \
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
0dfbad86367ee46837c580e51d7d76e8bd6d88b7Matt Sweeney# Misc notes on help
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney--- Notes --- \n\
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney- All builds use same output directory unless overridden with \n\
0dfbad86367ee46837c580e51d7d76e8bd6d88b7Matt Sweeney \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\
0dfbad86367ee46837c580e51d7d76e8bd6d88b7Matt Sweeney \t to use the clean target first. \n\
0dfbad86367ee46837c580e51d7d76e8bd6d88b7Matt Sweeney- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\
0dfbad86367ee46837c580e51d7d76e8bd6d88b7Matt Sweeney \t builds or previous release JDK builds will work. \n\
0dfbad86367ee46837c580e51d7d76e8bd6d88b7Matt Sweeney- The fastest builds have been when the sources and the BOOTDIR are on \n\
0dfbad86367ee46837c580e51d7d76e8bd6d88b7Matt Sweeney \t local disk. \n\
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney--- Examples --- \n\
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney################################################################
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney# Source bundling
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney################################################################
0dfbad86367ee46837c580e51d7d76e8bd6d88b7Matt Sweeney################################################################
0dfbad86367ee46837c580e51d7d76e8bd6d88b7Matt Sweeney# rule to test
0dfbad86367ee46837c580e51d7d76e8bd6d88b7Matt Sweeney################################################################
0dfbad86367ee46837c580e51d7d76e8bd6d88b7Matt Sweeney $(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney @$(ECHO) "#################################################"
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney @( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney @$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt"
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney @$(ECHO) "#################################################"
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney @if [ -s $< ] ; then \
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# Get failure list from log
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney @( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# Get log file of all tests run
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then \
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) $(TEST_TARGETS) \
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney################################################################
5985d0db35cae8ef4c1a022bb03ac15792ff51adMatt Sweeney# JPRT rule to build
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney################################################################
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney################################################################
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney################################################################
100cd7da99ccec416d3021e9a567addc2d9ed3dfMatt Sweeney.PHONY: all test test_run test_start test_summary test_clean \
4a589644c0b4ea2684514116fbbad30d79536f8aMatt Sweeney# Force target