Makefile revision 18:2dab2f712e18
155714Skris# 255714Skris# Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved. 355714Skris# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 455714Skris# 555714Skris# This code is free software; you can redistribute it and/or modify it 655714Skris# under the terms of the GNU General Public License version 2 only, as 755714Skris# published by the Free Software Foundation. Sun designates this 855714Skris# particular file as subject to the "Classpath" exception as provided 955714Skris# by Sun in the LICENSE file that accompanied this code. 1055714Skris# 1155714Skris# This code is distributed in the hope that it will be useful, but WITHOUT 1255714Skris# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1355714Skris# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1455714Skris# version 2 for more details (a copy is included in the LICENSE file that 1555714Skris# accompanied this code). 1655714Skris# 1755714Skris# You should have received a copy of the GNU General Public License version 1855714Skris# 2 along with this work; if not, write to the Free Software Foundation, 1955714Skris# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2055714Skris# 2155714Skris# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 2255714Skris# CA 95054 USA or visit www.sun.com if you need additional information or 2355714Skris# have any questions. 2455714Skris# 2555714Skris 2655714SkrisBUILD_PARENT_DIRECTORY=. 2755714Skris 2855714Skrisifndef TOPDIR 2955714Skris TOPDIR:=. 3055714Skrisendif 3155714Skris 3255714Skrisifndef CONTROL_TOPDIR 3355714Skris CONTROL_TOPDIR=$(TOPDIR) 3455714Skrisendif 3555714Skris 3655714Skris# Openjdk sources (only used if SKIP_OPENJDK_BUILD!=true) 3755714SkrisOPENJDK_SOURCETREE=$(TOPDIR)/openjdk 3855714SkrisOPENJDK_BUILDDIR:=$(shell \ 3955714Skris if [ -r $(OPENJDK_SOURCETREE)/Makefile ]; then \ 4055714Skris echo "$(OPENJDK_SOURCETREE)"; \ 4155714Skris else \ 4255714Skris echo "."; \ 4355714Skris fi) 4455714Skris 4555714Skrisifndef JDK_TOPDIR 4655714Skris JDK_TOPDIR=$(TOPDIR)/jdk 4755714Skrisendif 4855714Skrisifndef JDK_MAKE_SHARED_DIR 4955714Skris JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared 5055714Skrisendif 5155714Skris 5255714Skrisinclude $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk 5355714Skris 5455714Skrisinclude ./make/Defs-internal.gmk 5555714Skris 5655714Skrisall:: 5755714Skris @$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: `$(DATE) '+%y-%m-%d %H:%M'` 5855714Skris $(MKDIR) -p $(OUTPUTDIR) 5955714Skris 6055714Skris# Rules for sanity checks 6155714Skrisinclude ./make/sanity-rules.gmk 6255714Skris 6355714Skrisdev : dev-build 64238405Sjkim 6555714Skrisdev-build: 6655714Skris $(MAKE) DEV_ONLY=true all 6755714Skrisdev-sanity: 6855714Skris $(MAKE) DEV_ONLY=true sanity 6955714Skrisdev-clobber: 7059191Skris $(MAKE) DEV_ONLY=true clobber 7155714Skris 7255714Skris# Rules for various components 7355714Skrisinclude ./make/hotspot-rules.gmk 7455714Skrisinclude ./make/langtools-rules.gmk 7555714Skrisinclude ./make/corba-rules.gmk 7655714Skrisinclude ./make/jaxp-rules.gmk 7755714Skrisinclude ./make/jaxws-rules.gmk 7855714Skrisinclude ./make/jdk-rules.gmk 7955714Skrisinclude ./make/install-rules.gmk 8055714Skrisinclude ./make/sponsors-rules.gmk 8155714Skrisinclude ./make/deploy-rules.gmk 8255714Skris 8355714Skrisall:: setup build 8455714Skris 8555714Skrissetup: openjdk_check 8655714Skris $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image 8768651Skris 8855714Skris# Check on whether we really can build the openjdk, need source etc. 8955714Skrisopenjdk_check: FRC 9055714Skrisifneq ($(SKIP_OPENJDK_BUILD), true) 9155714Skris @$(ECHO) " " 9255714Skris @$(ECHO) "=================================================" 9355714Skris @if [ ! -r $(OPENJDK_BUILDDIR)/Makefile ] ; then \ 9455714Skris $(ECHO) "ERROR: No openjdk source tree available at: $(OPENJDK_BUILDDIR)"; \ 9555714Skris exit 1; \ 9655714Skris else \ 9755714Skris $(ECHO) "OpenJDK will be built after JDK is built"; \ 9855714Skris $(ECHO) " OPENJDK_BUILDDIR=$(OPENJDK_BUILDDIR)"; \ 9955714Skris fi 10055714Skris @$(ECHO) "=================================================" 10155714Skris @$(ECHO) " " 10255714Skrisendif 10355714Skris 10455714Skrisbuild:: sanity 10555714Skris 10655714Skrisclobber:: 10755714Skris 10855714Skrisifeq ($(BUILD_LANGTOOLS), true) 10955714Skris build:: langtools 11055714Skris clobber:: langtools-clobber 11155714Skrisendif 11255714Skris 11355714Skrisifeq ($(BUILD_CORBA), true) 11455714Skris build:: corba 11555714Skris clobber:: corba-clobber 11655714Skrisendif 117160814Ssimon 118160814Ssimonifeq ($(BUILD_JAXP), true) 119160814Ssimon build:: jaxp 120160814Ssimon clobber:: jaxp-clobber 121160814Ssimonendif 122160814Ssimon 123160814Ssimonifeq ($(BUILD_JAXWS), true) 124160814Ssimon build:: jaxws 125160814Ssimon clobber:: jaxws-clobber 126160814Ssimonendif 127160814Ssimon 128160814Ssimonifeq ($(BUILD_HOTSPOT), true) 129160814Ssimon build:: $(HOTSPOT) 130160814Ssimon clobber:: hotspot-clobber 131160814Ssimonendif 132160814Ssimon 133160814Ssimonifeq ($(BUILD_JDK), true) 134160814Ssimon build:: $(JDK_JAVA_EXE) 135160814Ssimon clobber:: jdk-clobber 136160814Ssimonendif 137160814Ssimon 138160814Ssimonifeq ($(BUILD_DEPLOY), true) 139160814Ssimon build:: $(DEPLOY) 140160814Ssimon clobber:: deploy-clobber 141160814Ssimonendif 142160814Ssimon 143160814Ssimon# 144160814Ssimon# Generic debug build, fastdebug or debug. Needs special handling. 145160814Ssimon# Note that debug builds do NOT do INSTALL steps, but must be done 146160814Ssimon# after the product build and before the INSTALL step of the product build. 147160814Ssimon# 148160814Ssimon# DEBUG_NAME is fastdebug or debug 149160814Ssimon# ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix 150160814Ssimon# The resulting j2sdk-image is used by the install makefiles to create a 151160814Ssimon# debug install bundle jdk-*-debug-** bundle (tar or zip) 152160814Ssimon# which will install in the debug or fastdebug subdirectory of the 153160814Ssimon# normal product install area. 154160814Ssimon# The install process needs to know what the DEBUG_NAME is, so 155160814Ssimon# look for INSTALL_DEBUG_NAME in the install rules. 156160814Ssimon# 15759191Skris 15859191SkrisCOMMON_DEBUG_FLAGS= \ 15959191Skris DEBUG_NAME=$(DEBUG_NAME) \ 16059191Skris ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)-$(DEBUG_NAME) \ 16159191Skris NO_DOCS=true 162142425Snectar 16359191Skrisproduct_build: setup 16459191Skris @$(ECHO) $@ build started: `$(DATE) '+%y-%m-%d %H:%M'` 16559191Skris $(MAKE) SKIP_FASTDEBUG_BUILD=true SKIP_DEBUG_BUILD=true all 16659191Skris @$(ECHO) $@ build finished: `$(DATE) '+%y-%m-%d %H:%M'` 16759191Skris 16859191Skrisgeneric_debug_build: 16959191Skris @$(ECHO) $@ build started: `$(DATE) '+%y-%m-%d %H:%M'` 17059191Skris $(MAKE) $(COMMON_DEBUG_FLAGS) setup build 17159191Skris @$(ECHO) $@ build finished: `$(DATE) '+%y-%m-%d %H:%M'` 17259191Skris 17359191Skrisdebug_build: setup 17459191Skris $(MAKE) DEBUG_NAME=debug generic_debug_build 17559191Skris 17659191Skrisfastdebug_build: setup 17759191Skris $(MAKE) DEBUG_NAME=fastdebug generic_debug_build 17859191Skris 17959191Skrisifeq ($(SKIP_FASTDEBUG_BUILD), false) 18059191Skris all:: fastdebug_build 18159191Skrisendif 18259191Skris 18359191Skrisifeq ($(SKIP_DEBUG_BUILD), false) 18459191Skris all:: debug_build 18559191Skrisendif 18659191Skris 187142425Snectarifeq ($(BUILD_JDK), true) 18859191Skris ifeq ($(BUNDLE_RULES_AVAILABLE), true) 18959191Skris all:: openjdk-binary-plugs-bundles 190142425Snectar endif 191160814Ssimonendif 192142425Snectar 193142425Snectarifeq ($(BUILD_INSTALL), true) 19459191Skris all :: $(INSTALL) 195142425Snectar clobber:: install-clobber 196142425Snectarendif 197142425Snectar 198142425Snectarifeq ($(BUILD_SPONSORS), true) 199142425Snectar all :: $(SPONSORS) 200142425Snectar clobber:: sponsors-clobber 201142425Snectarendif 202142425Snectar 203142425Snectarifneq ($(SKIP_COMPARE_IMAGES), true) 204142425Snectar all :: compare-image 20559191Skrisendif 206142425Snectar 207142425Snectarifneq ($(SKIP_OPENJDK_BUILD), true) 20859191Skris all :: openjdk_build 209238405Sjkimendif 210238405Sjkim 211238405Sjkim# If we have bundle rules, we have a chance here to do a complete cycle 212160814Ssimon# build, of production and open build. 21359191Skris# FIXUP: We should create the openjdk source bundle and build that? 21459191Skris# But how do we reliable create or get at a formal openjdk source tree? 21559191Skris# The one we have needs to be trimmed of built bits and closed dirs. 21659191Skris# The repositories might not be available. 21759191Skris# The openjdk source bundle is probably not available. 21859191Skris 21959191Skrisifneq ($(SKIP_OPENJDK_BUILD), true) 22059191Skris ifeq ($(BUILD_JDK), true) 22159191Skris ifeq ($(BUNDLE_RULES_AVAILABLE), true) 22259191Skris 22359191SkrisOPENJDK_PLUGS=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME) 22459191SkrisOPENJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/open-output 22559191SkrisOPENJDK_BUILD_NAME \ 22659191Skris = openjdk-$(JDK_MINOR_VERSION)-$(BUILD_NUMBER)-$(PLATFORM)-$(ARCH)-$(BUNDLE_DATE) 22759191SkrisOPENJDK_BUILD_BINARY_ZIP=$(ABS_BIN_BUNDLEDIR)/$(OPENJDK_BUILD_NAME).zip 228238405SjkimBUILT_IMAGE=$(ABS_OUTPUTDIR)/j2sdk-image 229238405Sjkimifeq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64) 230238405Sjkim OPENJDK_BOOTDIR=$(BOOTDIR) 231238405Sjkim OPENJDK_IMPORTJDK=$(JDK_IMPORT_PATH) 23259191Skriselse 23359191Skris OPENJDK_BOOTDIR=$(BUILT_IMAGE) 23459191Skris OPENJDK_IMPORTJDK=$(BUILT_IMAGE) 23559191Skrisendif 236109998Smarkm 23759191Skrisopenjdk_build: 238167612Ssimon @$(ECHO) " " 239167612Ssimon @$(ECHO) "=================================================" 240167612Ssimon @$(ECHO) "Starting openjdk build" 241167612Ssimon @$(ECHO) " Using: ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR)" 242167612Ssimon @$(ECHO) "=================================================" 24359191Skris @$(ECHO) " " 24459191Skris $(RM) -r $(OPENJDK_OUTPUTDIR) 24559191Skris $(MKDIR) -p $(OPENJDK_OUTPUTDIR) 24659191Skris ($(CD) $(OPENJDK_BUILDDIR) && $(MAKE) \ 24759191Skris OPENJDK=true \ 24859191Skris ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR) \ 24959191Skris ALT_OUTPUTDIR=$(OPENJDK_OUTPUTDIR) \ 25059191Skris ALT_BINARY_PLUGS_PATH=$(OPENJDK_PLUGS) \ 25159191Skris ALT_BOOTDIR=$(OPENJDK_BOOTDIR) \ 25259191Skris ALT_JDK_IMPORT_PATH=$(OPENJDK_IMPORTJDK) \ 25359191Skris product_build ) 25459191Skris $(RM) $(OPENJDK_BUILD_BINARY_ZIP) 25559191Skris ( $(CD) $(OPENJDK_OUTPUTDIR)/j2sdk-image && \ 25659191Skris $(ZIPEXE) -q -r $(OPENJDK_BUILD_BINARY_ZIP) .) 25759191Skris $(RM) -r $(OPENJDK_OUTPUTDIR) 25859191Skris @$(ECHO) " " 25959191Skris @$(ECHO) "=================================================" 26059191Skris @$(ECHO) "Finished openjdk build" 26159191Skris @$(ECHO) " Binary Bundle: $(OPENJDK_BUILD_BINARY_ZIP)" 26259191Skris @$(ECHO) "=================================================" 26359191Skris @$(ECHO) " " 26459191Skris 26559191Skris endif 26659191Skris endif 26759191Skrisendif 26859191Skris 26959191Skrisclobber:: 27059191Skris $(RM) -r $(OUTPUTDIR)/* 27159191Skris $(RM) -r $(OUTPUTDIR)-debug/* 27259191Skris $(RM) -r $(OUTPUTDIR)-fastdebug/* 27359191Skris -($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE)) 27459191Skris 27559191Skrisclean: clobber 27659191Skris 27759191Skrisall:: 27859191Skris @$(ECHO) Control build finished: `$(DATE) '+%y-%m-%d %H:%M'` 27959191Skris 28059191Skris# 28159191Skris# Quick jdk verification build 28259191Skris# 28359191Skrisjdk_only: 28459191Skris $(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all 28559191Skris 28659191Skris 28759191Skris# 28859191Skris# Quick jdk verification fastdebug build 28959191Skris# 29059191Skrisjdk_fastdebug_only: 29159191Skris $(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \ 292109998Smarkm BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build 293109998Smarkm 29459191Skris# 29559191Skris# Quick deploy verification fastdebug build 29659191Skris# 29759191Skrisdeploy_fastdebug_only: 29859191Skris $(MAKE) \ 29959191Skris DEBUG_NAME=fastdebug \ 30059191Skris BUILD_HOTSPOT=false \ 30159191Skris BUILD_JDK=false \ 302109998Smarkm BUILD_LANGTOOLS=false \ 30359191Skris BUILD_CORBA=false \ 30459191Skris BUILD_JAXP=false \ 30559191Skris BUILD_JAXWS=false \ 30659191Skris BUILD_INSTALL=false \ 30759191Skris BUILD_SPONSORS=false \ 30859191Skris generic_debug_build 30959191Skris 310109998Smarkm# 311109998Smarkm# Product build (skip debug builds) 31259191Skris# 31359191Skrisproduct_only: 31459191Skris $(MAKE) SKIP_FASTDEBUG_BUILD=true all 31559191Skris 31659191Skris# 317# Check target 318# 319 320check: variable_check 321 322# 323# Help target 324# 325help: intro_help target_help variable_help notes_help examples_help 326 327# Intro help message 328intro_help: 329 @$(ECHO) "\ 330Makefile for the JDK builds (all the JDK). \n\ 331" 332 333# Target help 334target_help: 335 @$(ECHO) "\ 336--- Common Targets --- \n\ 337all -- build the core JDK (default target) \n\ 338help -- Print out help information \n\ 339check -- Check make variable values for correctness \n\ 340sanity -- Perform detailed sanity checks on system and settings \n\ 341fastdebug_build -- build the core JDK in 'fastdebug' mode (-g -O) \n\ 342debug_build -- build the core JDK in 'debug' mode (-g) \n\ 343clean -- remove all built and imported files \n\ 344clobber -- same as clean \n\ 345" 346 347# Variable help (only common ones used by this Makefile) 348variable_help: variable_help_intro variable_list variable_help_end 349variable_help_intro: 350 @$(ECHO) "--- Common Variables ---" 351variable_help_end: 352 @$(ECHO) " " 353 354# One line descriptions for the variables 355OUTPUTDIR.desc = Output directory 356PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count 357SLASH_JAVA.desc = Root of all build tools, e.g. /java or J: 358BOOTDIR.desc = JDK used to boot the build 359JDK_IMPORT_PATH.desc = JDK used to import components of the build 360COMPILER_PATH.desc = Compiler install directory 361CACERTS_FILE.desc = Location of certificates file 362DEVTOOLS_PATH.desc = Directory containing zip and gnumake 363CUPS_HEADERS_PATH.desc = Include directory location for CUPS header files 364DXSDK_PATH.desc = Root directory of DirectX SDK 365MSDEVTOOLS_PATH.desc = Root directory of VC++ tools (e.g. rc.exe) 366MSVCRT_DLL_PATH.desc = Directory containing mscvrt.dll 367 368# Make variables to print out (description and value) 369VARIABLE_PRINTVAL_LIST += \ 370 OUTPUTDIR \ 371 PARALLEL_COMPILE_JOBS \ 372 SLASH_JAVA \ 373 BOOTDIR \ 374 JDK_IMPORT_PATH \ 375 COMPILER_PATH \ 376 CACERTS_FILE \ 377 DEVTOOLS_PATH 378 379# Make variables that should refer to directories that exist 380VARIABLE_CHECKDIR_LIST += \ 381 SLASH_JAVA \ 382 BOOTDIR \ 383 JDK_IMPORT_PATH \ 384 COMPILER_PATH \ 385 DEVTOOLS_PATH 386 387# Make variables that should refer to files that exist 388VARIABLE_CHECKFIL_LIST += \ 389 CACERTS_FILE 390 391# Some are windows specific 392ifeq ($(PLATFORM), windows) 393 394VARIABLE_PRINTVAL_LIST += \ 395 DXSDK_PATH \ 396 MSDEVTOOLS_PATH \ 397 MSVCRT_DLL_PATH 398 399VARIABLE_CHECKDIR_LIST += \ 400 DXSDK_PATH \ 401 MSDEVTOOLS_PATH \ 402 MSVCRT_DLL_PATH 403 404endif 405 406# For pattern rules below, so all are treated the same 407DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval) 408DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir) 409DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil) 410 411# Complete variable check 412variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST) 413variable_list: $(DO_PRINTVAL_LIST) variable_check 414 415# Pattern rule for printing out a variable 416%.printval: 417 @$(ECHO) " ALT_$* - $($*.desc)" 418 @$(ECHO) " \t $*=$($*)" 419 420# Pattern rule for checking to see if a variable with a directory exists 421%.checkdir: 422 @if [ ! -d $($*) ] ; then \ 423 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ 424 fi 425 426# Pattern rule for checking to see if a variable with a file exists 427%.checkfil: 428 @if [ ! -f $($*) ] ; then \ 429 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ 430 fi 431 432# Misc notes on help 433notes_help: 434 @$(ECHO) "\ 435--- Notes --- \n\ 436- All builds use same output directory unless overridden with \n\ 437 \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\ 438 \t to use the clean target first. \n\ 439- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\ 440 \t builds or previous release JDK builds will work. \n\ 441- The fastest builds have been when the sources and the BOOTDIR are on \n\ 442 \t local disk. \n\ 443" 444 445examples_help: 446 @$(ECHO) "\ 447--- Examples --- \n\ 448 $(MAKE) fastdebug_build \n\ 449 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ 450 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\ 451 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ 452 $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\ 453 $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\ 454" 455 456################################################################ 457# Source and binary plug bundling 458################################################################ 459ifeq ($(BUNDLE_RULES_AVAILABLE), true) 460 include $(BUNDLE_RULES) 461endif 462 463################################################################ 464# Cycle build. Build the jdk, use it to build the jdk again. 465################################################################ 466 467ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk 468 469boot_cycle: 470 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) product_build 471 $(MAKE) ALT_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image product_build 472 473################################################################ 474# JPRT rule to build 475################################################################ 476 477include ./make/jprt.gmk 478 479################################################################ 480# PHONY 481################################################################ 482 483.PHONY: all build what clobber insane \ 484 fastdebug_build debug_build product_build setup \ 485 dev dev-build dev-sanity dev-clobber 486 487# Force target 488FRC: 489 490