Makefile revision 3909
341N/A#
341N/A# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
341N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
341N/A#
688N/A# This code is free software; you can redistribute it and/or modify it
341N/A# under the terms of the GNU General Public License version 2 only, as
341N/A# published by the Free Software Foundation. Oracle designates this
341N/A# particular file as subject to the "Classpath" exception as provided
341N/A# by Oracle in the LICENSE file that accompanied this code.
341N/A#
341N/A# This code is distributed in the hope that it will be useful, but WITHOUT
341N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
341N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
341N/A# version 2 for more details (a copy is included in the LICENSE file that
341N/A# accompanied this code).
341N/A#
341N/A# You should have received a copy of the GNU General Public License version
341N/A# 2 along with this work; if not, write to the Free Software Foundation,
341N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
341N/A#
341N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
341N/A# or visit www.oracle.com if you need additional information or have any
341N/A# questions.
341N/A#
341N/A
341N/A#
341N/A# Makefile for building and packaging all of the JDK and the JRE. See
341N/A# also included files.
341N/A#
341N/A
341N/ABUILDDIR=.
341N/Ainclude $(BUILDDIR)/common/Defs.gmk
688N/A
341N/A#
341N/A# Make sure we are clear what the default target is
341N/A#
493N/Adefault_target: all
341N/A
341N/A#
688N/A# Check target
341N/A#
341N/A
341N/Acheck: variable_check
688N/A
688N/A#
341N/A# Help target
341N/A#
341N/Ahelp: intro_help target_help variable_help notes_help examples_help
341N/A
341N/A# Intro help message
341N/Aintro_help:
341N/A @$(ECHO) "\
341N/AMakefile for the main JDK workspace. \n\
341N/ADefault behavior is to use the BOOTDIR javac to bootstrap the build and \n\
392N/Aimport in pre-built components like the VM from the JDK_IMPORT_PATH. \n\
604N/A"
646N/A
688N/A# Target help
688N/Atarget_help:
688N/A @$(ECHO) "\
688N/A--- Common Targets --- \n\
688N/Aall -- build the core JDK (default target) \n\
688N/Ahelp -- Print out help information \n\
688N/Acheck -- Check make variable values for correctness \n\
688N/Asanity -- Perform detailed sanity checks on system and settings \n\
688N/Aopenjdk -- synonym for 'OPENJDK=true all' \n\
688N/Afastdebug -- build the core JDK in 'fastdebug' mode (-g -O) \n\
688N/Adebug -- build the core JDK in 'debug' mode (-g) \n\
688N/Aclean -- remove all built and imported files \n\
688N/Aclobber -- same as clean \n\
688N/Adocs -- run javadoc to generate the JDK documentation \n\
688N/Aimages -- build the jdk and jre image directories \n\
688N/Aimport -- copy in the pre-built components (e.g. VM) \n\
688N/Aimport_product -- copy in the product components \n\
688N/Aimport_fastdebug -- copy in the fastdebug components \n\
688N/Aimport_debug -- copy in the debug components \n\
688N/Acreate_links -- create softlinks in Solaris 32bit build to 64bit dirs \n\
688N/A"
688N/A
688N/A# Variable help (only common ones used by this workspace)
688N/Avariable_help: variable_help_intro variable_list variable_help_end
688N/Avariable_help_intro:
688N/A @$(ECHO) "--- Common Variables ---"
688N/Avariable_help_end:
688N/A @$(ECHO) " "
688N/A
688N/A# One line descriptions for the variables
688N/AOUTPUTDIR.desc = Output directory
688N/APARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count
688N/ASLASH_JAVA.desc = Root of all build tools, e.g. /java or J:
688N/ABOOTDIR.desc = JDK used to boot the build
688N/ALANGTOOLS_DIST.desc = langtools dist area used to build
688N/ACORBA_DIST.desc = corba dist area
688N/AJAXP_DIST.desc = jaxp dist area
688N/AJAXWS_DIST.desc = jaxws dist area
688N/AJDK_IMPORT_PATH.desc = JDK used to import components of the build
688N/ACOMPILER_PATH.desc = Compiler install directory
688N/ACACERTS_FILE.desc = Location of certificates file
688N/ADEVTOOLS_PATH.desc = Directory containing zip and unzip
688N/ACUPS_HEADERS_PATH.desc = Include directory location for CUPS header files
341N/ADXSDK_PATH.desc = Root directory of DirectX SDK
341N/A
341N/A# Make variables to print out (description and value)
341N/AVARIABLE_PRINTVAL_LIST += \
341N/A OUTPUTDIR \
341N/A PARALLEL_COMPILE_JOBS \
341N/A SLASH_JAVA \
493N/A BOOTDIR \
341N/A LANGTOOLS_DIST \
341N/A JAXWS_DIST \
341N/A CORBA_DIST \
493N/A JAXP_DIST \
341N/A JDK_IMPORT_PATH \
341N/A COMPILER_PATH \
341N/A CACERTS_FILE \
341N/A DEVTOOLS_PATH
341N/A
493N/A# Make variables that should refer to directories that exist
341N/AVARIABLE_CHECKDIR_LIST += \
341N/A SLASH_JAVA \
341N/A BOOTDIR \
341N/A JDK_IMPORT_PATH \
493N/A COMPILER_PATH \
341N/A DEVTOOLS_PATH
341N/A
493N/A# Make variables that should refer to files that exist
341N/AVARIABLE_CHECKFIL_LIST += \
341N/A CACERTS_FILE
341N/A
341N/A# Some are windows specific
341N/Aifeq ($(PLATFORM), windows)
341N/A
341N/AVARIABLE_PRINTVAL_LIST += \
493N/A DXSDK_PATH
341N/A
341N/AVARIABLE_CHECKDIR_LIST += \
341N/A DXSDK_PATH
341N/A
341N/Aendif
493N/A
493N/A# For pattern rules below, so all are treated the same
493N/ADO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
493N/ADO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
341N/ADO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)
341N/A
341N/A# Complete variable check
341N/Avariable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)
341N/Avariable_list: $(DO_PRINTVAL_LIST) variable_check
341N/A
341N/A# Pattern rule for printing out a variable
341N/A%.printval:
341N/A @$(ECHO) " ALT_$* - $($*.desc)"
341N/A @$(ECHO) " \t $*=$($*)"
341N/A
341N/A# Pattern rule for checking to see if a variable with a directory exists
341N/A%.checkdir:
341N/A @if [ ! -d $($*) ] ; then \
341N/A $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
341N/A fi
341N/A
341N/A# Pattern rule for checking to see if a variable with a file exists
341N/A%.checkfil:
@if [ ! -f $($*) ] ; then \
$(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
fi
# Misc notes on help
notes_help:
@$(ECHO) "\
--- Notes --- \n\
- All builds use same output directory unless overridden with \n\
\t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\
\t to use the clean target first. \n\
- LANGTOOLS_DIST must refer to a langtools dist area, used to build. \n\
- CORBA_DIST must refer to a corba dist area. \n\
- JAXP_DIST must refer to a jaxp dist area. \n\
- JAXWS_DIST must refer to a jaxws dist area. \n\
- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\
\t builds or previous release JDK builds will work. \n\
- The 'debug' target and 'import_debug' only works when a debug promoted \n\
\t build is available, and they currently are not. \n\
- The fastest builds have been when the workspace and the BOOTDIR are on \n\
\t local disk. \n\
"
examples_help:
@$(ECHO) "\
--- Examples --- \n\
$(MAKE) fastdebug \n\
$(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
$(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug images \n\
$(MAKE) ALT_OUTPUTDIR=/tmp/foobar all docs images \n\
$(MAKE) ALT_BOOTDIR=/opt/java/jdk1.6.0 \n\
$(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.7.0 \n\
"
#
# 'all' target intro
#
all::
@$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: $(shell $(DATE) '+%y-%m-%d %H:%M')
# Just in case anyone uses this old name, same as 'build'
optimized: build
openjdk:
$(MAKE) OPENJDK=true all
#
# Special debug rules (You may also want to set ALT_OUTPUTDIR)
#
debug:
$(MAKE) VARIANT=DBG all
fastdebug:
$(MAKE) VARIANT=DBG FASTDEBUG=true all
#
# Rules to re-import VM and other JDK files
#
import:
$(CD) java/redist; $(MAKE) clean all
import_fastdebug:
$(MAKE) VARIANT=DBG FASTDEBUG=true import
import_product:
$(MAKE) VARIANT=OPT FASTDEBUG=false import
#
# Core.
#
all build:: sanity-all post-sanity-all
SUBDIRS = tools java javax sun com
SUBDIRS_tools = launchers
SUBDIRS_misc = org sunw jpda mkdemo mksample
# Alternate classes implementation
ifndef OPENJDK
SUBDIRS_misc += altclasses
endif
include $(BUILDDIR)/common/Subdirs.gmk
all build::
$(SUBDIRS-loop)
clean clobber::
$(RM) -r $(OUTPUTDIR)
#
# Docs
#
OTHERSUBDIRS = docs
docs:: sanity-docs post-sanity-docs
$(OTHERSUBDIRS-loop)
#
# Release engineering targets.
#
include $(BUILDDIR)/common/Release.gmk
#
# Cscope targets.
#
include $(BUILDDIR)/common/Cscope.gmk
#
# Sanity checks.
#
include $(BUILDDIR)/common/Sanity.gmk
$(OUTPUTDIR) $(TEMPDIR):
$(MKDIR) -p $@
# this should be the last rule in this file:
all::
@if [ -r $(WARNING_FILE) ]; then \
$(CAT) $(WARNING_FILE) ; \
fi
@$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build finished: $(shell $(DATE) '+%y-%m-%d %H:%M')
#
# Developer rule that links 32 and 64 bit builds on Solaris by creating
# softlinks in the 32bit outputdir to the 64bit outputdir.
#
ifeq ($(PLATFORM), solaris)
ifeq ($(ARCH_FAMILY), sparc)
ARCH32 = sparc
ARCH64 = sparcv9
else
ARCH32 = i586
ARCH64 = amd64
endif
OUTPUTDIR32 = $(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH32)
OUTPUTDIR64 = $(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH64)
endif
create_links:
ifeq ($(PLATFORM), solaris)
@if [ -d $(OUTPUTDIR32) -a -d $(OUTPUTDIR64) ] ; then \
dirlist=`($(CD) $(OUTPUTDIR64); $(FIND) . -name $(ARCH64))`; \
for sd in $$dirlist ; do \
pdir=`$(DIRNAME) $$sd`; \
if [ -d $(OUTPUTDIR32)/$$pdir ] ; then \
echo "Creating link for $$sd"; \
(cd $(OUTPUTDIR32)/$$pdir; $(RM) $(ARCH64); \
$(LN) -s $(OUTPUTDIR64)/$$sd ); \
fi; \
done; \
else \
$(ECHO) "Build both 32 and 64 bit versions first"; \
fi
else
$(ECHO) "Rule $@ does not apply on $(PLATFORM)-$(ARCH)"
endif
#
# Test rule
#
.NOTPARALLEL: test_run
test:
$(MAKE) test_run
test_run: test_clean test_start test_summary
test_start:
@$(ECHO) "Tests started at `$(DATE)`"
test_clean:
$(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt
test_summary: $(OUTPUTDIR)/test_failures.txt
@$(ECHO) "#################################################"
@$(ECHO) "Tests completed at `$(DATE)`"
@( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \
|| $(ECHO) "No TEST STATS seen in log" )
@$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt"
@$(ECHO) "#################################################"
@if [ -s $< ] ; then \
$(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \
$(CAT) $<; \
exit 1; \
else \
$(ECHO) "Success! No failures detected"; \
fi
# Get failure list from log
$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt
@$(RM) $@
@( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@
# Get log file of all tests run
JDK_TO_TEST := $(shell \
if [ -d "$(ABS_OUTPUTDIR)/j2sdk-image" ] ; then \
$(ECHO) "$(ABS_OUTPUTDIR)/j2sdk-image"; \
elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then \
$(ECHO) "$(ABS_OUTPUTDIR)"; \
elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then \
$(ECHO) "$(PRODUCT_HOME)"; \
fi \
)
TEST_TARGETS=jdk_all
$(OUTPUTDIR)/test_log.txt:
$(RM) $@
( $(CD) ../test && \
$(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) $(TEST_TARGETS) \
) | tee $@
#
# JPRT rules
#
include jprt.gmk
#
# Phonies to avoid accidents.
#
.PHONY: all build clean clobber optimized debug fastdebug create_links \
import import_product import_fastdebug import_debug \
test test_run test_start test_clean test_summary