Makefile revision 27:55b2666e52e1
1# 2# Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved. 3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4# 5# This code is free software; you can redistribute it and/or modify it 6# under the terms of the GNU General Public License version 2 only, as 7# published by the Free Software Foundation. Sun designates this 8# particular file as subject to the "Classpath" exception as provided 9# by Sun in the LICENSE file that accompanied this code. 10# 11# This code is distributed in the hope that it will be useful, but WITHOUT 12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14# version 2 for more details (a copy is included in the LICENSE file that 15# accompanied this code). 16# 17# You should have received a copy of the GNU General Public License version 18# 2 along with this work; if not, write to the Free Software Foundation, 19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20# 21# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 22# CA 95054 USA or visit www.sun.com if you need additional information or 23# have any questions. 24# 25 26BUILD_PARENT_DIRECTORY=. 27 28ifndef TOPDIR 29 TOPDIR:=. 30endif 31 32ifndef CONTROL_TOPDIR 33 CONTROL_TOPDIR=$(TOPDIR) 34endif 35 36# Openjdk sources (only used if SKIP_OPENJDK_BUILD!=true) 37OPENJDK_SOURCETREE=$(TOPDIR)/openjdk 38OPENJDK_BUILDDIR:=$(shell \ 39 if [ -r $(OPENJDK_SOURCETREE)/Makefile ]; then \ 40 echo "$(OPENJDK_SOURCETREE)"; \ 41 else \ 42 echo "."; \ 43 fi) 44 45ifndef JDK_TOPDIR 46 JDK_TOPDIR=$(TOPDIR)/jdk 47endif 48ifndef JDK_MAKE_SHARED_DIR 49 JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared 50endif 51 52# For start and finish echo lines 53TITLE_TEXT = Control $(PLATFORM) $(ARCH) $(RELEASE) 54DAYE_STAMP = `$(DATE) '+%y-%m-%d %H:%M'` 55START_ECHO = echo "$(TITLE_TEXT) $@ build started: $(DATE_STAMP)" 56FINISH_ECHO = echo "$(TITLE_TEXT) $@ build finished: $(DATE_STAMP)" 57 58default: all 59 60include $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk 61include ./make/Defs-internal.gmk 62include ./make/sanity-rules.gmk 63include ./make/hotspot-rules.gmk 64include ./make/langtools-rules.gmk 65include ./make/corba-rules.gmk 66include ./make/jaxp-rules.gmk 67include ./make/jaxws-rules.gmk 68include ./make/jdk-rules.gmk 69include ./make/install-rules.gmk 70include ./make/sponsors-rules.gmk 71include ./make/deploy-rules.gmk 72 73# What "all" means 74all:: 75 @$(START_ECHO) 76 77all:: openjdk_check sanity all_product_build 78 79ifeq ($(SKIP_FASTDEBUG_BUILD), false) 80 all:: fastdebug_build 81endif 82 83ifeq ($(SKIP_DEBUG_BUILD), false) 84 all:: debug_build 85endif 86 87ifneq ($(SKIP_OPENJDK_BUILD), true) 88 all:: openjdk_build 89endif 90 91all:: 92 @$(FINISH_ECHO) 93 94# Everything for a full product build 95all_product_build:: 96 @$(START_ECHO) 97 98ifeq ($(SKIP_PRODUCT_BUILD), false) 99 100 all_product_build:: product_build 101 102 ifeq ($(BUILD_INSTALL), true) 103 all_product_build:: $(INSTALL) 104 clobber:: install-clobber 105 endif 106 107 ifeq ($(BUILD_SPONSORS), true) 108 all_product_build:: $(SPONSORS) 109 clobber:: sponsors-clobber 110 endif 111 112 ifneq ($(SKIP_COMPARE_IMAGES), true) 113 all_product_build:: compare-image 114 endif 115 116endif 117 118all_product_build:: 119 @$(FINISH_ECHO) 120 121# Generis build of basic repo series 122generic_build_repo_series:: 123 $(MKDIR) -p $(OUTPUTDIR) 124 $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image 125 126ifeq ($(BUILD_LANGTOOLS), true) 127 generic_build_repo_series:: langtools 128 clobber:: langtools-clobber 129endif 130 131ifeq ($(BUILD_CORBA), true) 132 generic_build_repo_series:: corba 133 clobber:: corba-clobber 134endif 135 136ifeq ($(BUILD_JAXP), true) 137 generic_build_repo_series:: jaxp 138 clobber:: jaxp-clobber 139endif 140 141ifeq ($(BUILD_JAXWS), true) 142 generic_build_repo_series:: jaxws 143 clobber:: jaxws-clobber 144endif 145 146ifeq ($(BUILD_HOTSPOT), true) 147 generic_build_repo_series:: $(HOTSPOT) 148 clobber:: hotspot-clobber 149endif 150 151ifeq ($(BUILD_JDK), true) 152 generic_build_repo_series:: $(JDK_JAVA_EXE) 153 clobber:: jdk-clobber 154endif 155 156ifeq ($(BUILD_DEPLOY), true) 157 generic_build_repo_series:: $(DEPLOY) 158 clobber:: deploy-clobber 159endif 160 161ifeq ($(BUILD_JDK), true) 162 ifeq ($(BUNDLE_RULES_AVAILABLE), true) 163 generic_build_repo_series:: openjdk-binary-plugs-bundles 164 endif 165endif 166 167# The debug build, fastdebug or debug. Needs special handling. 168# Note that debug builds do NOT do INSTALL steps, but must be done 169# after the product build and before the INSTALL step of the product build. 170# 171# DEBUG_NAME is fastdebug or debug 172# ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix 173# The resulting j2sdk-image is used by the install makefiles to create a 174# debug install bundle jdk-*-debug-** bundle (tar or zip) 175# which will install in the debug or fastdebug subdirectory of the 176# normal product install area. 177# The install process needs to know what the DEBUG_NAME is, so 178# look for INSTALL_DEBUG_NAME in the install rules. 179# 180 181# Location of fresh bootdir output 182ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk 183FRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image 184FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME)/j2sdk-image 185 186create_fresh_product_bootdir: FRC 187 @$(START_ECHO) 188 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ 189 NO_DOCS=true \ 190 BOOT_CYCLE_SETTINGS= \ 191 build_product_image 192 @$(FINISH_ECHO) 193 194create_fresh_debug_bootdir: FRC 195 @$(START_ECHO) 196 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ 197 NO_DOCS=true \ 198 BOOT_CYCLE_DEBUG_SETTINGS= \ 199 build_debug_image 200 @$(FINISH_ECHO) 201 202create_fresh_fastdebug_bootdir: FRC 203 @$(START_ECHO) 204 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ 205 NO_DOCS=true \ 206 BOOT_CYCLE_DEBUG_SETTINGS= \ 207 build_fastdebug_image 208 @$(FINISH_ECHO) 209 210# Create boot image? 211ifeq ($(SKIP_BOOT_CYCLE),false) 212 ifneq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64) 213 DO_BOOT_CYCLE=true 214 endif 215endif 216 217ifeq ($(DO_BOOT_CYCLE),true) 218 219 # Create the bootdir to use in the build 220 product_build:: create_fresh_product_bootdir 221 debug_build:: create_fresh_debug_bootdir 222 fastdebug_build:: create_fresh_fastdebug_bootdir 223 224 # Define variables to be used now for the boot jdk 225 BOOT_CYCLE_SETTINGS= \ 226 ALT_BOOTDIR=$(FRESH_BOOTDIR) \ 227 ALT_JDK_IMPORT_PATH=$(FRESH_BOOTDIR) 228 BOOT_CYCLE_DEBUG_SETTINGS= \ 229 ALT_BOOTDIR=$(FRESH_DEBUG_BOOTDIR) \ 230 ALT_JDK_IMPORT_PATH=$(FRESH_DEBUG_BOOTDIR) 231 232else 233 234 # Use the supplied ALT_BOOTDIR as the boot 235 BOOT_CYCLE_SETTINGS= 236 BOOT_CYCLE_DEBUG_SETTINGS= 237 238endif 239 240build_product_image: 241 @$(START_ECHO) 242 $(MAKE) \ 243 SKIP_FASTDEBUG_BUILD=true \ 244 SKIP_DEBUG_BUILD=true \ 245 $(BOOT_CYCLE_SETTINGS) \ 246 generic_build_repo_series 247 @$(FINISH_ECHO) 248 249generic_debug_build: 250 @$(START_ECHO) 251 $(MAKE) \ 252 ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)-$(DEBUG_NAME) \ 253 DEBUG_NAME=$(DEBUG_NAME) \ 254 NO_DOCS=true \ 255 $(BOOT_CYCLE_DEBUG_SETTINGS) \ 256 generic_build_repo_series 257 @$(FINISH_ECHO) 258 259build_debug_image: 260 $(MAKE) DEBUG_NAME=debug generic_debug_build 261 262build_fastdebug_image: 263 $(MAKE) DEBUG_NAME=fastdebug generic_debug_build 264 265# Build final image 266product_build:: build_product_image 267debug_build:: build_debug_image 268fastdebug_build:: build_fastdebug_image 269 270# Check on whether we really can build the openjdk, need source etc. 271openjdk_check: FRC 272ifneq ($(SKIP_OPENJDK_BUILD), true) 273 @$(ECHO) " " 274 @$(ECHO) "=================================================" 275 @if [ ! -r $(OPENJDK_BUILDDIR)/Makefile ] ; then \ 276 $(ECHO) "ERROR: No openjdk source tree available at: $(OPENJDK_BUILDDIR)"; \ 277 exit 1; \ 278 else \ 279 $(ECHO) "OpenJDK will be built after JDK is built"; \ 280 $(ECHO) " OPENJDK_BUILDDIR=$(OPENJDK_BUILDDIR)"; \ 281 fi 282 @$(ECHO) "=================================================" 283 @$(ECHO) " " 284endif 285 286# If we have bundle rules, we have a chance here to do a complete cycle 287# build, of production and open build. 288# FIXUP: We should create the openjdk source bundle and build that? 289# But how do we reliable create or get at a formal openjdk source tree? 290# The one we have needs to be trimmed of built bits and closed dirs. 291# The repositories might not be available. 292# The openjdk source bundle is probably not available. 293 294ifneq ($(SKIP_OPENJDK_BUILD), true) 295 ifeq ($(BUILD_JDK), true) 296 ifeq ($(BUNDLE_RULES_AVAILABLE), true) 297 298OPENJDK_PLUGS=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME) 299OPENJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/open-output 300OPENJDK_BUILD_NAME \ 301 = openjdk-$(JDK_MINOR_VERSION)-$(BUILD_NUMBER)-$(PLATFORM)-$(ARCH)-$(BUNDLE_DATE) 302OPENJDK_BUILD_BINARY_ZIP=$(ABS_BIN_BUNDLEDIR)/$(OPENJDK_BUILD_NAME).zip 303BUILT_IMAGE=$(ABS_OUTPUTDIR)/j2sdk-image 304ifeq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64) 305 OPENJDK_BOOTDIR=$(BOOTDIR) 306 OPENJDK_IMPORTJDK=$(JDK_IMPORT_PATH) 307else 308 OPENJDK_BOOTDIR=$(BUILT_IMAGE) 309 OPENJDK_IMPORTJDK=$(BUILT_IMAGE) 310endif 311 312openjdk_build: 313 @$(START_ECHO) 314 @$(ECHO) " " 315 @$(ECHO) "=================================================" 316 @$(ECHO) "Starting openjdk build" 317 @$(ECHO) " Using: ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR)" 318 @$(ECHO) "=================================================" 319 @$(ECHO) " " 320 $(RM) -r $(OPENJDK_OUTPUTDIR) 321 $(MKDIR) -p $(OPENJDK_OUTPUTDIR) 322 ($(CD) $(OPENJDK_BUILDDIR) && $(MAKE) \ 323 OPENJDK=true \ 324 NO_DOCS=true \ 325 ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR) \ 326 ALT_OUTPUTDIR=$(OPENJDK_OUTPUTDIR) \ 327 ALT_BINARY_PLUGS_PATH=$(OPENJDK_PLUGS) \ 328 ALT_BOOTDIR=$(OPENJDK_BOOTDIR) \ 329 ALT_JDK_IMPORT_PATH=$(OPENJDK_IMPORTJDK) \ 330 product_build ) 331 $(RM) $(OPENJDK_BUILD_BINARY_ZIP) 332 ( $(CD) $(OPENJDK_OUTPUTDIR)/j2sdk-image && \ 333 $(ZIPEXE) -q -r $(OPENJDK_BUILD_BINARY_ZIP) .) 334 $(RM) -r $(OPENJDK_OUTPUTDIR) 335 @$(ECHO) " " 336 @$(ECHO) "=================================================" 337 @$(ECHO) "Finished openjdk build" 338 @$(ECHO) " Binary Bundle: $(OPENJDK_BUILD_BINARY_ZIP)" 339 @$(ECHO) "=================================================" 340 @$(ECHO) " " 341 @$(FINISH_ECHO) 342 343 endif 344 endif 345endif 346 347clobber:: 348 $(RM) -r $(OUTPUTDIR)/* 349 $(RM) -r $(OUTPUTDIR)-debug/* 350 $(RM) -r $(OUTPUTDIR)-fastdebug/* 351 -($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE)) 352 353clean: clobber 354 355# 356# Dev builds 357# 358 359dev : dev-build 360 361dev-build: 362 $(MAKE) DEV_ONLY=true all 363dev-sanity: 364 $(MAKE) DEV_ONLY=true sanity 365dev-clobber: 366 $(MAKE) DEV_ONLY=true clobber 367 368# 369# Quick jdk verification build 370# 371jdk_only: 372 $(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all 373 374 375# 376# Quick jdk verification fastdebug build 377# 378jdk_fastdebug_only: 379 $(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \ 380 BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build 381 382# 383# Quick deploy verification fastdebug build 384# 385deploy_fastdebug_only: 386 $(MAKE) \ 387 DEBUG_NAME=fastdebug \ 388 BUILD_HOTSPOT=false \ 389 BUILD_JDK=false \ 390 BUILD_LANGTOOLS=false \ 391 BUILD_CORBA=false \ 392 BUILD_JAXP=false \ 393 BUILD_JAXWS=false \ 394 BUILD_INSTALL=false \ 395 BUILD_SPONSORS=false \ 396 generic_debug_build 397 398# 399# Product build (skip debug builds) 400# 401product_only: 402 $(MAKE) SKIP_FASTDEBUG_BUILD=true all 403 404# 405# Check target 406# 407 408check: variable_check 409 410# 411# Help target 412# 413help: intro_help target_help variable_help notes_help examples_help 414 415# Intro help message 416intro_help: 417 @$(ECHO) "\ 418Makefile for the JDK builds (all the JDK). \n\ 419" 420 421# Target help 422target_help: 423 @$(ECHO) "\ 424--- Common Targets --- \n\ 425all -- build the core JDK (default target) \n\ 426help -- Print out help information \n\ 427check -- Check make variable values for correctness \n\ 428sanity -- Perform detailed sanity checks on system and settings \n\ 429fastdebug_build -- build the core JDK in 'fastdebug' mode (-g -O) \n\ 430debug_build -- build the core JDK in 'debug' mode (-g) \n\ 431clean -- remove all built and imported files \n\ 432clobber -- same as clean \n\ 433" 434 435# Variable help (only common ones used by this Makefile) 436variable_help: variable_help_intro variable_list variable_help_end 437variable_help_intro: 438 @$(ECHO) "--- Common Variables ---" 439variable_help_end: 440 @$(ECHO) " " 441 442# One line descriptions for the variables 443OUTPUTDIR.desc = Output directory 444PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count 445SLASH_JAVA.desc = Root of all build tools, e.g. /java or J: 446BOOTDIR.desc = JDK used to boot the build 447JDK_IMPORT_PATH.desc = JDK used to import components of the build 448COMPILER_PATH.desc = Compiler install directory 449CACERTS_FILE.desc = Location of certificates file 450DEVTOOLS_PATH.desc = Directory containing zip and gnumake 451CUPS_HEADERS_PATH.desc = Include directory location for CUPS header files 452DXSDK_PATH.desc = Root directory of DirectX SDK 453MSDEVTOOLS_PATH.desc = Root directory of VC++ tools (e.g. rc.exe) 454MSVCRT_DLL_PATH.desc = Directory containing mscvrt.dll 455 456# Make variables to print out (description and value) 457VARIABLE_PRINTVAL_LIST += \ 458 OUTPUTDIR \ 459 PARALLEL_COMPILE_JOBS \ 460 SLASH_JAVA \ 461 BOOTDIR \ 462 JDK_IMPORT_PATH \ 463 COMPILER_PATH \ 464 CACERTS_FILE \ 465 DEVTOOLS_PATH 466 467# Make variables that should refer to directories that exist 468VARIABLE_CHECKDIR_LIST += \ 469 SLASH_JAVA \ 470 BOOTDIR \ 471 JDK_IMPORT_PATH \ 472 COMPILER_PATH \ 473 DEVTOOLS_PATH 474 475# Make variables that should refer to files that exist 476VARIABLE_CHECKFIL_LIST += \ 477 CACERTS_FILE 478 479# Some are windows specific 480ifeq ($(PLATFORM), windows) 481 482VARIABLE_PRINTVAL_LIST += \ 483 DXSDK_PATH \ 484 MSDEVTOOLS_PATH \ 485 MSVCRT_DLL_PATH 486 487VARIABLE_CHECKDIR_LIST += \ 488 DXSDK_PATH \ 489 MSDEVTOOLS_PATH \ 490 MSVCRT_DLL_PATH 491 492endif 493 494# For pattern rules below, so all are treated the same 495DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval) 496DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir) 497DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil) 498 499# Complete variable check 500variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST) 501variable_list: $(DO_PRINTVAL_LIST) variable_check 502 503# Pattern rule for printing out a variable 504%.printval: 505 @$(ECHO) " ALT_$* - $($*.desc)" 506 @$(ECHO) " \t $*=$($*)" 507 508# Pattern rule for checking to see if a variable with a directory exists 509%.checkdir: 510 @if [ ! -d $($*) ] ; then \ 511 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ 512 fi 513 514# Pattern rule for checking to see if a variable with a file exists 515%.checkfil: 516 @if [ ! -f $($*) ] ; then \ 517 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ 518 fi 519 520# Misc notes on help 521notes_help: 522 @$(ECHO) "\ 523--- Notes --- \n\ 524- All builds use same output directory unless overridden with \n\ 525 \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\ 526 \t to use the clean target first. \n\ 527- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\ 528 \t builds or previous release JDK builds will work. \n\ 529- The fastest builds have been when the sources and the BOOTDIR are on \n\ 530 \t local disk. \n\ 531" 532 533examples_help: 534 @$(ECHO) "\ 535--- Examples --- \n\ 536 $(MAKE) fastdebug_build \n\ 537 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ 538 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\ 539 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ 540 $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\ 541 $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\ 542" 543 544################################################################ 545# Source and binary plug bundling 546################################################################ 547ifeq ($(BUNDLE_RULES_AVAILABLE), true) 548 include $(BUNDLE_RULES) 549endif 550 551################################################################ 552# JPRT rule to build 553################################################################ 554 555include ./make/jprt.gmk 556 557################################################################ 558# PHONY 559################################################################ 560 561.PHONY: all \ 562 generic_build_repo_series \ 563 what clobber insane \ 564 dev dev-build dev-sanity dev-clobber \ 565 product_build \ 566 fastdebug_build \ 567 debug_build \ 568 build_product_image \ 569 build_debug_image \ 570 build_fastdebug_image \ 571 create_fresh_product_bootdir \ 572 create_fresh_debug_bootdir \ 573 create_fresh_fastdebug_bootdir \ 574 generic_debug_build 575 576# Force target 577FRC: 578 579