Makefile revision 3909
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# This code is free software; you can redistribute it and/or modify it
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# under the terms of the GNU General Public License version 2 only, as
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# published by the Free Software Foundation. Oracle designates this
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# particular file as subject to the "Classpath" exception as provided
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# by Oracle in the LICENSE file that accompanied this code.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# This code is distributed in the hope that it will be useful, but WITHOUT
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# version 2 for more details (a copy is included in the LICENSE file that
5dbfd19ad5fcc2b779f40f80fa05c1bd28fd0b4eTheo Schlossnagle# accompanied this code).
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# You should have received a copy of the GNU General Public License version
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# 2 along with this work; if not, write to the Free Software Foundation,
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# or visit www.oracle.com if you need additional information or have any
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Makefile for building and packaging all of the JDK and the JRE. See
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# also included files.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Make sure we are clear what the default target is
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Check target
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Help target
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowehelp: intro_help target_help variable_help notes_help examples_help
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Intro help message
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweMakefile for the main JDK workspace. \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweDefault behavior is to use the BOOTDIR javac to bootstrap the build and \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweimport in pre-built components like the VM from the JDK_IMPORT_PATH. \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Target help
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe--- Common Targets --- \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweall -- build the core JDK (default target) \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowehelp -- Print out help information \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowecheck -- Check make variable values for correctness \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowesanity -- Perform detailed sanity checks on system and settings \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweopenjdk -- synonym for 'OPENJDK=true all' \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowefastdebug -- build the core JDK in 'fastdebug' mode (-g -O) \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowedebug -- build the core JDK in 'debug' mode (-g) \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweclean -- remove all built and imported files \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweclobber -- same as clean \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowedocs -- run javadoc to generate the JDK documentation \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweimages -- build the jdk and jre image directories \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweimport -- copy in the pre-built components (e.g. VM) \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweimport_product -- copy in the product components \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweimport_fastdebug -- copy in the fastdebug components \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweimport_debug -- copy in the debug components \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowecreate_links -- create softlinks in Solaris 32bit build to 64bit dirs \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Variable help (only common ones used by this workspace)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowevariable_help: variable_help_intro variable_list variable_help_end
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# One line descriptions for the variables
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LowePARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweSLASH_JAVA.desc = Root of all build tools, e.g. /java or J:
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweLANGTOOLS_DIST.desc = langtools dist area used to build
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweJDK_IMPORT_PATH.desc = JDK used to import components of the build
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweCACERTS_FILE.desc = Location of certificates file
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweDEVTOOLS_PATH.desc = Directory containing zip and unzip
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweCUPS_HEADERS_PATH.desc = Include directory location for CUPS header files
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Make variables to print out (description and value)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Make variables that should refer to directories that exist
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Make variables that should refer to files that exist
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Some are windows specific
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# For pattern rules below, so all are treated the same
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweDO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweDO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweDO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Complete variable check
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowevariable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowevariable_list: $(DO_PRINTVAL_LIST) variable_check
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Pattern rule for printing out a variable
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Pattern rule for checking to see if a variable with a directory exists
296749875bd503e7a14e25b4c57d3142cb496df1Joshua M. Clulow @if [ ! -d $($*) ] ; then \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Pattern rule for checking to see if a variable with a file exists
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @if [ ! -f $($*) ] ; then \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Misc notes on help
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe--- Notes --- \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe- All builds use same output directory unless overridden with \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe \t to use the clean target first. \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe- LANGTOOLS_DIST must refer to a langtools dist area, used to build. \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe- CORBA_DIST must refer to a corba dist area. \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe- JAXP_DIST must refer to a jaxp dist area. \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe- JAXWS_DIST must refer to a jaxws dist area. \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe \t builds or previous release JDK builds will work. \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe- The 'debug' target and 'import_debug' only works when a debug promoted \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe \t build is available, and they currently are not. \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe- The fastest builds have been when the workspace and the BOOTDIR are on \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe \t local disk. \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe--- Examples --- \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug images \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all docs images \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.7.0 \n\
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# 'all' target intro
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: $(shell $(DATE) '+%y-%m-%d %H:%M')
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Just in case anyone uses this old name, same as 'build'
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Special debug rules (You may also want to set ALT_OUTPUTDIR)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Rules to re-import VM and other JDK files
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Alternate classes implementation
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Release engineering targets.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Cscope targets.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Sanity checks.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# this should be the last rule in this file:
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @if [ -r $(WARNING_FILE) ]; then \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build finished: $(shell $(DATE) '+%y-%m-%d %H:%M')
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Developer rule that links 32 and 64 bit builds on Solaris by creating
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# softlinks in the 32bit outputdir to the 64bit outputdir.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe OUTPUTDIR32 = $(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH32)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe OUTPUTDIR64 = $(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH64)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @if [ -d $(OUTPUTDIR32) -a -d $(OUTPUTDIR64) ] ; then \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe dirlist=`($(CD) $(OUTPUTDIR64); $(FIND) . -name $(ARCH64))`; \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe echo "Creating link for $$sd"; \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(ECHO) "Build both 32 and 64 bit versions first"; \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(ECHO) "Rule $@ does not apply on $(PLATFORM)-$(ARCH)"
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @$(ECHO) "#################################################"
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt"
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @$(ECHO) "#################################################"
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @if [ -s $< ] ; then \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Get failure list from log
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Get log file of all tests run
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe if [ -d "$(ABS_OUTPUTDIR)/j2sdk-image" ] ; then \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) $(TEST_TARGETS) \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Phonies to avoid accidents.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe.PHONY: all build clean clobber optimized debug fastdebug create_links \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe import import_product import_fastdebug import_debug \