Makefile revision 4632
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This code is free software; you can redistribute it and/or modify it
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# under the terms of the GNU General Public License version 2 only, as
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# published by the Free Software Foundation. Oracle designates this
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# particular file as subject to the "Classpath" exception as provided
28a8f5b0de57d269cf2845c69cb6abe18cbd3b3aMark Andrews# by Oracle in the LICENSE file that accompanied this code.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein# This code is distributed in the hope that it will be useful, but WITHOUT
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# version 2 for more details (a copy is included in the LICENSE file that
f4b4e7c16211137332e50bcad3fef0d15639a4f1Brian Wellington# accompanied this code).
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# You should have received a copy of the GNU General Public License version
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# 2 along with this work; if not, write to the Free Software Foundation,
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# or visit www.oracle.com if you need additional information or have any
229ce407c359b0b641759ba1fc4a5fa2054a44daBrian Wellington# Makefile for building and packaging all of the JDK and the JRE. See
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# also included files.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# Make sure we are clear what the default target is
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# Check target
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellingtonhelp: intro_help target_help variable_help notes_help examples_help
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington# Intro help message
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian WellingtonMakefile for the main JDK workspace. \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian WellingtonDefault behavior is to use the BOOTDIR javac to bootstrap the build and \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonimport in pre-built components like the VM from the JDK_IMPORT_PATH. \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington--- Common Targets --- \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonall -- build the core JDK (default target) \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonhelp -- Print out help information \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtoncheck -- Check make variable values for correctness \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonsanity -- Perform detailed sanity checks on system and settings \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonopenjdk -- synonym for 'OPENJDK=true all' \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonfastdebug -- build the core JDK in 'fastdebug' mode (-g -O) \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtondebug -- build the core JDK in 'debug' mode (-g) \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonclean -- remove all built and imported files \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonclobber -- same as clean \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtondocs -- run javadoc to generate the JDK documentation \n\
229ce407c359b0b641759ba1fc4a5fa2054a44daBrian Wellingtonimages -- build the jdk and jre image directories \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonimport -- copy in the pre-built components (e.g. VM) \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonimport_product -- copy in the product components \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonimport_fastdebug -- copy in the fastdebug components \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonimport_debug -- copy in the debug components \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtoncreate_links -- create softlinks in Solaris 32bit build to 64bit dirs \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington# Variable help (only common ones used by this workspace)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonvariable_help: variable_help_intro variable_list variable_help_end
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington# One line descriptions for the variables
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian WellingtonPARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian WellingtonSLASH_JAVA.desc = Root of all build tools, e.g. /java or J:
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian WellingtonLANGTOOLS_DIST.desc = langtools dist area used to build
571688b02f955f6304649866e768b1f81739cbedBrian WellingtonJDK_IMPORT_PATH.desc = JDK used to import components of the build
571688b02f955f6304649866e768b1f81739cbedBrian WellingtonCOMPILER_PATH.desc = Compiler install directory
571688b02f955f6304649866e768b1f81739cbedBrian WellingtonCACERTS_FILE.desc = Location of certificates file
571688b02f955f6304649866e768b1f81739cbedBrian WellingtonDEVTOOLS_PATH.desc = Directory containing zip and unzip
571688b02f955f6304649866e768b1f81739cbedBrian WellingtonCUPS_HEADERS_PATH.desc = Include directory location for CUPS header files
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian WellingtonDXSDK_PATH.desc = Root directory of DirectX SDK
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# Make variables to print out (description and value)
557bcc2092642b2d4668c9b08872c9f2bb88bddbMark Andrews# Make variables that should refer to directories that exist
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington# Make variables that should refer to files that exist
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington# Some are windows specific
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# For pattern rules below, so all are treated the same
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian WellingtonDO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian WellingtonDO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian WellingtonDO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# Complete variable check
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonvariable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonvariable_list: $(DO_PRINTVAL_LIST) variable_check
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington# Pattern rule for printing out a variable
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# Pattern rule for checking to see if a variable with a directory exists
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington @if [ ! -d $($*) ] ; then \
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington# Pattern rule for checking to see if a variable with a file exists
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington @if [ ! -f $($*) ] ; then \
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington# Misc notes on help
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington--- Notes --- \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington- All builds use same output directory unless overridden with \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington \t to use the clean target first. \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington- LANGTOOLS_DIST must refer to a langtools dist area, used to build. \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington- CORBA_DIST must refer to a corba dist area. \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington- JAXP_DIST must refer to a jaxp dist area. \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington- JAXWS_DIST must refer to a jaxws dist area. \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington \t builds or previous release JDK builds will work. \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington- The 'debug' target and 'import_debug' only works when a debug promoted \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington \t build is available, and they currently are not. \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington- The fastest builds have been when the workspace and the BOOTDIR are on \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington \t local disk. \n\
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington--- Examples --- \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug images \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all docs images \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.7.0 \n\
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# 'all' target intro
75e1e12f48012505699f504cfa364260cb2bc1afBrian Wellington @$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: $(shell $(DATE) '+%y-%m-%d %H:%M')
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington# Just in case anyone uses this old name, same as 'build'
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews# Special debug rules (You may also want to set ALT_OUTPUTDIR)
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington# Rules to re-import VM and other JDK files
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian WellingtonSUBDIRS_misc = org sunw jpda mkdemo mksample
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington# Alternate classes implementation
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# Release engineering targets.
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews# Cscope targets.
d2aebe24c477c70e79dc33ea0507e8886eb7d626Brian Wellington# Sanity checks.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# this should be the last rule in this file:
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington @if [ -r $(WARNING_FILE) ]; then \
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington @$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build finished: $(shell $(DATE) '+%y-%m-%d %H:%M')
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# Developer rule that links 32 and 64 bit builds on Solaris by creating
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington# softlinks in the 32bit outputdir to the 64bit outputdir.
29d52c001ff976561669375cf0c866b815a90c49Mark Andrews OUTPUTDIR32 = $(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH32)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington OUTPUTDIR64 = $(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH64)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington @if [ -d $(OUTPUTDIR32) -a -d $(OUTPUTDIR64) ] ; then \
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dirlist=`($(CD) $(OUTPUTDIR64); $(FIND) . -name $(ARCH64))`; \
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington echo "Creating link for $$sd"; \
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson (cd $(OUTPUTDIR32)/$$pdir; $(RM) $(ARCH64); \
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson $(ECHO) "Build both 32 and 64 bit versions first"; \
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington $(ECHO) "Rule $@ does not apply on $(PLATFORM)-$(ARCH)"
2f012d936b5ccdf6520c96a4de23721dc58a2221Automatic Updatertest_run: test_clean test_start test_summary
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson $(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssontest_summary: $(OUTPUTDIR)/test_failures.txt
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson @$(ECHO) "#################################################"
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson @( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson @$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt"
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson @$(ECHO) "#################################################"
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson @if [ -s $< ] ; then \
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson $(ECHO) "Success! No failures detected"; \
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson# Get failure list from log
daa73eae708d568d453e6082e0890d35886a9e0fMark Andrews$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt
daa73eae708d568d453e6082e0890d35886a9e0fMark Andrews @( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson# Get log file of all tests run
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington if [ -d "$(ABS_OUTPUTDIR)/j2sdk-image" ] ; then \
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then \
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then \
6f7abb89ec22aef5eda40ed60fcf605a42b78d4dMark Andrews $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) $(TEST_TARGETS) \
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson# Phonies to avoid accidents.
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson.PHONY: all build clean clobber optimized debug fastdebug create_links \
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson import import_product import_fastdebug import_debug \