Makefile revision 315:c6f380693342
1214117Sjamie# 2223190Sjamie# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. 3214117Sjamie# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4214117Sjamie# 5214117Sjamie# This code is free software; you can redistribute it and/or modify it 6214117Sjamie# under the terms of the GNU General Public License version 2 only, as 7214117Sjamie# published by the Free Software Foundation. Oracle designates this 8214117Sjamie# particular file as subject to the "Classpath" exception as provided 9214117Sjamie# by Oracle in the LICENSE file that accompanied this code. 10214117Sjamie# 11214117Sjamie# This code is distributed in the hope that it will be useful, but WITHOUT 12214117Sjamie# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13214117Sjamie# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14214117Sjamie# version 2 for more details (a copy is included in the LICENSE file that 15214117Sjamie# accompanied this code). 16214117Sjamie# 17214117Sjamie# You should have received a copy of the GNU General Public License version 18214117Sjamie# 2 along with this work; if not, write to the Free Software Foundation, 19214117Sjamie# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20214117Sjamie# 21214117Sjamie# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22214117Sjamie# or visit www.oracle.com if you need additional information or have any 23214117Sjamie# questions. 24214117Sjamie# 25214117Sjamie 26214117SjamieBUILD_PARENT_DIRECTORY=. 27214117Sjamie 28214117Sjamieifndef TOPDIR 29214117Sjamie TOPDIR:=. 30214117Sjamieendif 31214117Sjamie 32214117Sjamieifndef JDK_TOPDIR 33214117Sjamie JDK_TOPDIR=$(TOPDIR)/jdk 34214117Sjamieendif 35214117Sjamieifndef JDK_MAKE_SHARED_DIR 36214117Sjamie JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared 37214117Sjamieendif 38214117Sjamie 39214117Sjamiedefault: all 40214117Sjamie 41214117Sjamieinclude $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk 42214117Sjamieinclude ./make/Defs-internal.gmk 43214117Sjamieinclude ./make/sanity-rules.gmk 44214117Sjamieinclude ./make/hotspot-rules.gmk 45214117Sjamieinclude ./make/langtools-rules.gmk 46214117Sjamieinclude ./make/corba-rules.gmk 47214117Sjamieinclude ./make/jaxp-rules.gmk 48214117Sjamieinclude ./make/jaxws-rules.gmk 49214117Sjamieinclude ./make/jdk-rules.gmk 50214117Sjamieinclude ./make/install-rules.gmk 51214117Sjamieinclude ./make/sponsors-rules.gmk 52214423Sjamieinclude ./make/deploy-rules.gmk 53214117Sjamie 54214117Sjamieall:: sanity 55214117Sjamie 56214117Sjamieifeq ($(SKIP_FASTDEBUG_BUILD), false) 57214117Sjamie all:: fastdebug_build 58214117Sjamieendif 59214117Sjamie 60214649Sjamieifeq ($(SKIP_DEBUG_BUILD), false) 61214649Sjamie all:: debug_build 62223189Sjamieendif 63223189Sjamie 64223189Sjamieall:: all_product_build 65214117Sjamie 66214117Sjamieall_product_build:: 67214117Sjamie 68214117Sjamie# Everything for a full product build 69214117Sjamieifeq ($(SKIP_PRODUCT_BUILD), false) 70214117Sjamie 71214117Sjamie all_product_build:: product_build 72214117Sjamie 73214117Sjamie ifeq ($(BUILD_INSTALL), true) 74235839Sjamie all_product_build:: $(INSTALL) 75235839Sjamie clobber:: install-clobber 76214117Sjamie endif 77214117Sjamie 78214117Sjamie ifeq ($(BUILD_SPONSORS), true) 79214117Sjamie all_product_build:: $(SPONSORS) 80214117Sjamie clobber:: sponsors-clobber 81214117Sjamie endif 82214117Sjamie 83214117Sjamie ifneq ($(SKIP_COMPARE_IMAGES), true) 84214117Sjamie all_product_build:: compare-image 85214117Sjamie endif 86214117Sjamie 87214117Sjamieendif 88214117Sjamie 89214117Sjamiedefine StartTimer 90214117Sjamie $(MKDIR) -p $(BUILDTIMESDIR) 91223351Sjamie $(RM) $(BUILDTIMESDIR)/build_time_* 92214117Sjamie $(call RecordStartTime,TOTAL) 93214117Sjamieendef 94223351Sjamie 95214117Sjamiedefine StopTimer 96214117Sjamie $(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),) 97214423Sjamieendef 98214117Sjamie 99214423Sjamie# Generic build of basic repo series 100223351Sjamiegeneric_build_repo_series:: 101214117Sjamie $(MKDIR) -p $(OUTPUTDIR) 102223351Sjamie $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image 103214117Sjamie @$(call StartTimer) 104214117Sjamie 105214117Sjamieifeq ($(BUILD_LANGTOOLS), true) 106214783Sjamie generic_build_repo_series:: langtools 107223189Sjamie clobber:: langtools-clobber 108214423Sjamieendif 109214423Sjamie 110214423Sjamieifeq ($(BUILD_CORBA), true) 111214423Sjamie generic_build_repo_series:: corba 112214423Sjamie clobber:: corba-clobber 113214423Sjamieendif 114232242Sjamie 115214423Sjamieifeq ($(BUILD_JAXP), true) 116214423Sjamie generic_build_repo_series:: jaxp 117223351Sjamie clobber:: jaxp-clobber 118214117Sjamieendif 119223351Sjamie 120214117Sjamieifeq ($(BUILD_JAXWS), true) 121214117Sjamie generic_build_repo_series:: jaxws 122214117Sjamie clobber:: jaxws-clobber 123214117Sjamieendif 124214117Sjamie 125214117Sjamieifeq ($(BUILD_HOTSPOT), true) 126214117Sjamie generic_build_repo_series:: $(HOTSPOT) 127214423Sjamie clobber:: hotspot-clobber 128214117Sjamieendif 129214117Sjamie 130214117Sjamieifeq ($(BUILD_JDK), true) 131214117Sjamie generic_build_repo_series:: $(JDK_JAVA_EXE) 132214117Sjamie clobber:: jdk-clobber 133214117Sjamieendif 134214117Sjamie 135214117Sjamieifeq ($(BUILD_DEPLOY), true) 136214117Sjamie generic_build_repo_series:: $(DEPLOY) 137214117Sjamie clobber:: deploy-clobber 138214117Sjamieendif 139214117Sjamie 140223188Sjamiegeneric_build_repo_series:: 141214117Sjamie @$(call StopTimer,$(if $(DEBUG_NAME),$(DEBUG_NAME)_build,all_product_build)) 142214117Sjamie 143223188Sjamie# The debug build, fastdebug or debug. Needs special handling. 144214117Sjamie# Note that debug builds do NOT do INSTALL steps, but must be done 145214117Sjamie# after the product build and before the INSTALL step of the product build. 146214117Sjamie# 147214117Sjamie# DEBUG_NAME is fastdebug or debug 148214117Sjamie# ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix 149214117Sjamie# The resulting j2sdk-image is used by the install makefiles to create a 150214117Sjamie# debug install bundle jdk-*-debug-** bundle (tar or zip) 151214117Sjamie# which will install in the debug or fastdebug subdirectory of the 152214117Sjamie# normal product install area. 153214117Sjamie# The install process needs to know what the DEBUG_NAME is, so 154214117Sjamie# look for INSTALL_DEBUG_NAME in the install rules. 155214117Sjamie# 156214117Sjamie# NOTE: On windows, do not use $(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME). 157214117Sjamie# Due to the use of short paths in $(ABS_OUTPUTDIR), this may 158214117Sjamie# not be the same location. 159214117Sjamie# 160214117Sjamie 161214117Sjamie# Location of fresh bootdir output 162214117SjamieABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk 163214117SjamieFRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image 164214117SjamieFRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME)/j2sdk-image 165214117Sjamie 166214117Sjamiecreate_fresh_product_bootdir: FRC 167214117Sjamie $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ 168214117Sjamie GENERATE_DOCS=false \ 169214117Sjamie BOOT_CYCLE_SETTINGS= \ 170214117Sjamie build_product_image 171214117Sjamie 172214117Sjamiecreate_fresh_debug_bootdir: FRC 173223189Sjamie $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ 174214117Sjamie GENERATE_DOCS=false \ 175214117Sjamie BOOT_CYCLE_DEBUG_SETTINGS= \ 176214117Sjamie build_debug_image 177214117Sjamie 178214117Sjamiecreate_fresh_fastdebug_bootdir: FRC 179214117Sjamie $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ 180214117Sjamie GENERATE_DOCS=false \ 181214117Sjamie BOOT_CYCLE_DEBUG_SETTINGS= \ 182214117Sjamie build_fastdebug_image 183214117Sjamie 184214117Sjamie# Create boot image? 185214117Sjamieifeq ($(SKIP_BOOT_CYCLE),false) 186214117Sjamie ifneq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64) 187214117Sjamie DO_BOOT_CYCLE=true 188214117Sjamie endif 189214117Sjamieendif 190214117Sjamie 191214117Sjamie 192223263Sjamie 193214117Sjamieifeq ($(DO_BOOT_CYCLE),true) 194214117Sjamie 195214117Sjamie # Create the bootdir to use in the build 196214117Sjamie product_build:: create_fresh_product_bootdir 197223189Sjamie debug_build:: create_fresh_debug_bootdir 198216367Sjamie fastdebug_build:: create_fresh_fastdebug_bootdir 199214117Sjamie 200214117Sjamie # Define variables to be used now for the boot jdk 201214117Sjamie BOOT_CYCLE_SETTINGS= \ 202214117Sjamie ALT_BOOTDIR=$(FRESH_BOOTDIR) \ 203214117Sjamie ALT_JDK_IMPORT_PATH=$(FRESH_BOOTDIR) 204214423Sjamie BOOT_CYCLE_DEBUG_SETTINGS= \ 205214117Sjamie ALT_BOOTDIR=$(FRESH_DEBUG_BOOTDIR) \ 206214117Sjamie ALT_JDK_IMPORT_PATH=$(FRESH_DEBUG_BOOTDIR) 207214117Sjamie 208214649Sjamieelse 209214117Sjamie 210214117Sjamie # Use the supplied ALT_BOOTDIR as the boot 211214117Sjamie BOOT_CYCLE_SETTINGS= 212214117Sjamie BOOT_CYCLE_DEBUG_SETTINGS= 213214117Sjamie 214214117Sjamieendif 215214117Sjamie 216214117Sjamiebuild_product_image: 217214117Sjamie $(MAKE) \ 218214117Sjamie SKIP_FASTDEBUG_BUILD=true \ 219231238Sjamie SKIP_DEBUG_BUILD=true \ 220231238Sjamie $(BOOT_CYCLE_SETTINGS) \ 221214117Sjamie generic_build_repo_series 222214117Sjamie 223214117Sjamie# NOTE: On windows, do not use $(ABS_OUTPUTDIR)-$(DEBUG_NAME). 224214117Sjamie# Due to the use of short paths in $(ABS_OUTPUTDIR), this may 225214117Sjamie# not be the same location. 226214117Sjamie 227214117Sjamiegeneric_debug_build: 228214117Sjamie $(MAKE) \ 229216367Sjamie ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME) \ 230214117Sjamie DEBUG_NAME=$(DEBUG_NAME) \ 231223263Sjamie GENERATE_DOCS=false \ 232216367Sjamie $(BOOT_CYCLE_DEBUG_SETTINGS) \ 233214117Sjamie generic_build_repo_series 234 235build_debug_image: 236 $(MAKE) DEBUG_NAME=debug generic_debug_build 237 238build_fastdebug_image: 239 $(MAKE) DEBUG_NAME=fastdebug generic_debug_build 240 241# Build final image 242product_build:: build_product_image 243debug_build:: build_debug_image 244fastdebug_build:: build_fastdebug_image 245 246clobber:: REPORT_BUILD_TIMES= 247clobber:: 248 $(RM) -r $(OUTPUTDIR)/* 249 $(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-debug/* 250 $(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-fastdebug/* 251 -($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE)) 252 253clean: clobber 254 255# 256# Dev builds 257# 258 259dev : dev-build 260 261dev-build: 262 $(MAKE) DEV_ONLY=true all 263dev-sanity: 264 $(MAKE) DEV_ONLY=true sanity 265dev-clobber: 266 $(MAKE) DEV_ONLY=true clobber 267 268# 269# Quick jdk verification build 270# 271jdk_only: 272 $(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all 273 274 275# 276# Quick jdk verification fastdebug build 277# 278jdk_fastdebug_only: 279 $(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \ 280 BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build 281 282# 283# Quick deploy verification fastdebug build 284# 285deploy_fastdebug_only: 286 $(MAKE) \ 287 DEBUG_NAME=fastdebug \ 288 BUILD_HOTSPOT=false \ 289 BUILD_JDK=false \ 290 BUILD_LANGTOOLS=false \ 291 BUILD_CORBA=false \ 292 BUILD_JAXP=false \ 293 BUILD_JAXWS=false \ 294 BUILD_INSTALL=false \ 295 BUILD_SPONSORS=false \ 296 generic_debug_build 297 298# 299# Product build (skip debug builds) 300# 301product_only: 302 $(MAKE) SKIP_FASTDEBUG_BUILD=true all 303 304# 305# Check target 306# 307 308check: variable_check 309 310# 311# Help target 312# 313help: intro_help target_help variable_help notes_help examples_help 314 315# Intro help message 316intro_help: 317 @$(ECHO) "\ 318Makefile for the JDK builds (all the JDK). \n\ 319" 320 321# Target help 322target_help: 323 @$(ECHO) "\ 324--- Common Targets --- \n\ 325all -- build the core JDK (default target) \n\ 326help -- Print out help information \n\ 327check -- Check make variable values for correctness \n\ 328sanity -- Perform detailed sanity checks on system and settings \n\ 329fastdebug_build -- build the core JDK in 'fastdebug' mode (-g -O) \n\ 330debug_build -- build the core JDK in 'debug' mode (-g) \n\ 331clean -- remove all built and imported files \n\ 332clobber -- same as clean \n\ 333" 334 335# Variable help (only common ones used by this Makefile) 336variable_help: variable_help_intro variable_list variable_help_end 337variable_help_intro: 338 @$(ECHO) "--- Common Variables ---" 339variable_help_end: 340 @$(ECHO) " " 341 342# One line descriptions for the variables 343OUTPUTDIR.desc = Output directory 344PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count 345SLASH_JAVA.desc = Root of all build tools, e.g. /java or J: 346BOOTDIR.desc = JDK used to boot the build 347JDK_IMPORT_PATH.desc = JDK used to import components of the build 348COMPILER_PATH.desc = Compiler install directory 349CACERTS_FILE.desc = Location of certificates file 350DEVTOOLS_PATH.desc = Directory containing zip and gnumake 351CUPS_HEADERS_PATH.desc = Include directory location for CUPS header files 352DXSDK_PATH.desc = Root directory of DirectX SDK 353 354# Make variables to print out (description and value) 355VARIABLE_PRINTVAL_LIST += \ 356 OUTPUTDIR \ 357 PARALLEL_COMPILE_JOBS \ 358 SLASH_JAVA \ 359 BOOTDIR \ 360 JDK_IMPORT_PATH \ 361 COMPILER_PATH \ 362 CACERTS_FILE \ 363 DEVTOOLS_PATH 364 365# Make variables that should refer to directories that exist 366VARIABLE_CHECKDIR_LIST += \ 367 SLASH_JAVA \ 368 BOOTDIR \ 369 JDK_IMPORT_PATH \ 370 COMPILER_PATH \ 371 DEVTOOLS_PATH 372 373# Make variables that should refer to files that exist 374VARIABLE_CHECKFIL_LIST += \ 375 CACERTS_FILE 376 377# Some are windows specific 378ifeq ($(PLATFORM), windows) 379 380VARIABLE_PRINTVAL_LIST += \ 381 DXSDK_PATH 382 383VARIABLE_CHECKDIR_LIST += \ 384 DXSDK_PATH 385 386endif 387 388# For pattern rules below, so all are treated the same 389DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval) 390DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir) 391DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil) 392 393# Complete variable check 394variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST) 395variable_list: $(DO_PRINTVAL_LIST) variable_check 396 397# Pattern rule for printing out a variable 398%.printval: 399 @$(ECHO) " ALT_$* - $($*.desc)" 400 @$(ECHO) " \t $*=$($*)" 401 402# Pattern rule for checking to see if a variable with a directory exists 403%.checkdir: 404 @if [ ! -d $($*) ] ; then \ 405 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ 406 fi 407 408# Pattern rule for checking to see if a variable with a file exists 409%.checkfil: 410 @if [ ! -f $($*) ] ; then \ 411 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ 412 fi 413 414# Misc notes on help 415notes_help: 416 @$(ECHO) "\ 417--- Notes --- \n\ 418- All builds use same output directory unless overridden with \n\ 419 \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\ 420 \t to use the clean target first. \n\ 421- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\ 422 \t builds or previous release JDK builds will work. \n\ 423- The fastest builds have been when the sources and the BOOTDIR are on \n\ 424 \t local disk. \n\ 425" 426 427examples_help: 428 @$(ECHO) "\ 429--- Examples --- \n\ 430 $(MAKE) fastdebug_build \n\ 431 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ 432 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\ 433 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ 434 $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\ 435 $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\ 436" 437 438################################################################ 439# Source bundling 440################################################################ 441ifeq ($(BUNDLE_RULES_AVAILABLE), true) 442 include $(BUNDLE_RULES) 443endif 444 445################################################################ 446# rule to test 447################################################################ 448 449.NOTPARALLEL: test_run 450 451test: 452 $(MAKE) test_run 453 454test_run: test_clean test_start test_summary 455 456test_start: 457 @$(ECHO) "Tests started at `$(DATE)`" 458 459test_clean: 460 $(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt 461 462test_summary: $(OUTPUTDIR)/test_failures.txt 463 @$(ECHO) "#################################################" 464 @$(ECHO) "Tests completed at `$(DATE)`" 465 @( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \ 466 || $(ECHO) "No TEST STATS seen in log" ) 467 @$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt" 468 @$(ECHO) "#################################################" 469 @if [ -s $< ] ; then \ 470 $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \ 471 $(CAT) $<; \ 472 exit 1; \ 473 else \ 474 $(ECHO) "Success! No failures detected"; \ 475 fi 476 477# Get failure list from log 478$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt 479 @$(RM) $@ 480 @( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@ 481 482# Get log file of all tests run 483JDK_TO_TEST := $(shell \ 484 if [ -d "$(ABS_OUTPUTDIR)/j2sdk-image" ] ; then \ 485 $(ECHO) "$(ABS_OUTPUTDIR)/j2sdk-image"; \ 486 elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then \ 487 $(ECHO) "$(ABS_OUTPUTDIR)"; \ 488 elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then \ 489 $(ECHO) "$(PRODUCT_HOME)"; \ 490 fi \ 491) 492TEST_TARGETS=all 493$(OUTPUTDIR)/test_log.txt: 494 $(RM) $@ 495 ( $(CD) test && \ 496 $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) $(TEST_TARGETS) \ 497 ) | tee $@ 498 499################################################################ 500# JPRT rule to build 501################################################################ 502 503include ./make/jprt.gmk 504 505################################################################ 506# PHONY 507################################################################ 508 509.PHONY: all test test_run test_start test_summary test_clean \ 510 generic_build_repo_series \ 511 what clobber insane \ 512 dev dev-build dev-sanity dev-clobber \ 513 product_build \ 514 fastdebug_build \ 515 debug_build \ 516 build_product_image \ 517 build_debug_image \ 518 build_fastdebug_image \ 519 create_fresh_product_bootdir \ 520 create_fresh_debug_bootdir \ 521 create_fresh_fastdebug_bootdir \ 522 generic_debug_build 523 524# Force target 525FRC: 526 527