Makefile revision 311:a1c8b847b753
1331722Seadler# 21573Srgrimes# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. 31573Srgrimes# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41573Srgrimes# 51573Srgrimes# This code is free software; you can redistribute it and/or modify it 61573Srgrimes# under the terms of the GNU General Public License version 2 only, as 71573Srgrimes# published by the Free Software Foundation. Oracle designates this 81573Srgrimes# particular file as subject to the "Classpath" exception as provided 91573Srgrimes# by Oracle in the LICENSE file that accompanied this code. 101573Srgrimes# 111573Srgrimes# This code is distributed in the hope that it will be useful, but WITHOUT 121573Srgrimes# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 131573Srgrimes# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 141573Srgrimes# version 2 for more details (a copy is included in the LICENSE file that 151573Srgrimes# accompanied this code). 16251069Semaste# 171573Srgrimes# You should have received a copy of the GNU General Public License version 181573Srgrimes# 2 along with this work; if not, write to the Free Software Foundation, 191573Srgrimes# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 201573Srgrimes# 211573Srgrimes# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 221573Srgrimes# or visit www.oracle.com if you need additional information or have any 231573Srgrimes# questions. 241573Srgrimes# 251573Srgrimes 261573SrgrimesBUILD_PARENT_DIRECTORY=. 271573Srgrimes 281573Srgrimesifndef TOPDIR 291573Srgrimes TOPDIR:=. 301573Srgrimesendif 311573Srgrimes 321573Srgrimesifndef JDK_TOPDIR 331573Srgrimes JDK_TOPDIR=$(TOPDIR)/jdk 341573Srgrimesendif 351573Srgrimesifndef JDK_MAKE_SHARED_DIR 3686170Sobrien JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared 3786170Sobrienendif 381573Srgrimes 39138659Strhodesdefault: all 401573Srgrimes 411573Srgrimesinclude $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk 42138659Strhodesinclude ./make/Defs-internal.gmk 431573Srgrimesinclude ./make/sanity-rules.gmk 4492889Sobrieninclude ./make/hotspot-rules.gmk 4592889Sobrieninclude ./make/langtools-rules.gmk 4692889Sobrieninclude ./make/corba-rules.gmk 471573Srgrimesinclude ./make/jaxp-rules.gmk 48232503Seadlerinclude ./make/jaxws-rules.gmk 49232503Seadlerinclude ./make/jdk-rules.gmk 50102639Srobertinclude ./make/install-rules.gmk 511573Srgrimesinclude ./make/sponsors-rules.gmk 521573Srgrimesinclude ./make/deploy-rules.gmk 531573Srgrimes 541573Srgrimesall:: sanity 55102639Srobert 561573Srgrimesifeq ($(SKIP_FASTDEBUG_BUILD), false) 57102639Srobert all:: fastdebug_build 581573Srgrimesendif 591573Srgrimes 601573Srgrimesifeq ($(SKIP_DEBUG_BUILD), false) 611573Srgrimes all:: debug_build 62endif 63 64all:: all_product_build 65 66# Everything for a full product build 67ifeq ($(SKIP_PRODUCT_BUILD), false) 68 69 all_product_build:: product_build 70 71 ifeq ($(BUILD_INSTALL), true) 72 all_product_build:: $(INSTALL) 73 clobber:: install-clobber 74 endif 75 76 ifeq ($(BUILD_SPONSORS), true) 77 all_product_build:: $(SPONSORS) 78 clobber:: sponsors-clobber 79 endif 80 81 ifneq ($(SKIP_COMPARE_IMAGES), true) 82 all_product_build:: compare-image 83 endif 84 85endif 86 87define StartTimer 88 $(MKDIR) -p $(BUILDTIMESDIR) 89 $(RM) $(BUILDTIMESDIR)/build_time_* 90 $(call RecordStartTime,TOTAL) 91endef 92 93define StopTimer 94 $(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),) 95endef 96 97# Generic build of basic repo series 98generic_build_repo_series:: 99 $(MKDIR) -p $(OUTPUTDIR) 100 $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image 101 @$(call StartTimer) 102 103ifeq ($(BUILD_LANGTOOLS), true) 104 generic_build_repo_series:: langtools 105 clobber:: langtools-clobber 106endif 107 108ifeq ($(BUILD_CORBA), true) 109 generic_build_repo_series:: corba 110 clobber:: corba-clobber 111endif 112 113ifeq ($(BUILD_JAXP), true) 114 generic_build_repo_series:: jaxp 115 clobber:: jaxp-clobber 116endif 117 118ifeq ($(BUILD_JAXWS), true) 119 generic_build_repo_series:: jaxws 120 clobber:: jaxws-clobber 121endif 122 123ifeq ($(BUILD_HOTSPOT), true) 124 generic_build_repo_series:: $(HOTSPOT) 125 clobber:: hotspot-clobber 126endif 127 128ifeq ($(BUILD_JDK), true) 129 generic_build_repo_series:: $(JDK_JAVA_EXE) 130 clobber:: jdk-clobber 131endif 132 133ifeq ($(BUILD_DEPLOY), true) 134 generic_build_repo_series:: $(DEPLOY) 135 clobber:: deploy-clobber 136endif 137 138generic_build_repo_series:: 139 @$(call StopTimer,$(if $(DEBUG_NAME),$(DEBUG_NAME)_build,all_product_build)) 140 141# The debug build, fastdebug or debug. Needs special handling. 142# Note that debug builds do NOT do INSTALL steps, but must be done 143# after the product build and before the INSTALL step of the product build. 144# 145# DEBUG_NAME is fastdebug or debug 146# ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix 147# The resulting j2sdk-image is used by the install makefiles to create a 148# debug install bundle jdk-*-debug-** bundle (tar or zip) 149# which will install in the debug or fastdebug subdirectory of the 150# normal product install area. 151# The install process needs to know what the DEBUG_NAME is, so 152# look for INSTALL_DEBUG_NAME in the install rules. 153# 154# NOTE: On windows, do not use $(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME). 155# Due to the use of short paths in $(ABS_OUTPUTDIR), this may 156# not be the same location. 157# 158 159# Location of fresh bootdir output 160ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk 161FRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image 162FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME)/j2sdk-image 163 164create_fresh_product_bootdir: FRC 165 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ 166 GENERATE_DOCS=false \ 167 BOOT_CYCLE_SETTINGS= \ 168 build_product_image 169 170create_fresh_debug_bootdir: FRC 171 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ 172 GENERATE_DOCS=false \ 173 BOOT_CYCLE_DEBUG_SETTINGS= \ 174 build_debug_image 175 176create_fresh_fastdebug_bootdir: FRC 177 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ 178 GENERATE_DOCS=false \ 179 BOOT_CYCLE_DEBUG_SETTINGS= \ 180 build_fastdebug_image 181 182# Create boot image? 183ifeq ($(SKIP_BOOT_CYCLE),false) 184 ifneq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64) 185 DO_BOOT_CYCLE=true 186 endif 187endif 188 189 190 191ifeq ($(DO_BOOT_CYCLE),true) 192 193 # Create the bootdir to use in the build 194 product_build:: create_fresh_product_bootdir 195 debug_build:: create_fresh_debug_bootdir 196 fastdebug_build:: create_fresh_fastdebug_bootdir 197 198 # Define variables to be used now for the boot jdk 199 BOOT_CYCLE_SETTINGS= \ 200 ALT_BOOTDIR=$(FRESH_BOOTDIR) \ 201 ALT_JDK_IMPORT_PATH=$(FRESH_BOOTDIR) 202 BOOT_CYCLE_DEBUG_SETTINGS= \ 203 ALT_BOOTDIR=$(FRESH_DEBUG_BOOTDIR) \ 204 ALT_JDK_IMPORT_PATH=$(FRESH_DEBUG_BOOTDIR) 205 206else 207 208 # Use the supplied ALT_BOOTDIR as the boot 209 BOOT_CYCLE_SETTINGS= 210 BOOT_CYCLE_DEBUG_SETTINGS= 211 212endif 213 214build_product_image: 215 $(MAKE) \ 216 SKIP_FASTDEBUG_BUILD=true \ 217 SKIP_DEBUG_BUILD=true \ 218 $(BOOT_CYCLE_SETTINGS) \ 219 generic_build_repo_series 220 221# NOTE: On windows, do not use $(ABS_OUTPUTDIR)-$(DEBUG_NAME). 222# Due to the use of short paths in $(ABS_OUTPUTDIR), this may 223# not be the same location. 224 225generic_debug_build: 226 $(MAKE) \ 227 ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME) \ 228 DEBUG_NAME=$(DEBUG_NAME) \ 229 GENERATE_DOCS=false \ 230 $(BOOT_CYCLE_DEBUG_SETTINGS) \ 231 generic_build_repo_series 232 233build_debug_image: 234 $(MAKE) DEBUG_NAME=debug generic_debug_build 235 236build_fastdebug_image: 237 $(MAKE) DEBUG_NAME=fastdebug generic_debug_build 238 239# Build final image 240product_build:: build_product_image 241debug_build:: build_debug_image 242fastdebug_build:: build_fastdebug_image 243 244clobber:: REPORT_BUILD_TIMES= 245clobber:: 246 $(RM) -r $(OUTPUTDIR)/* 247 $(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-debug/* 248 $(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-fastdebug/* 249 -($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE)) 250 251clean: clobber 252 253# 254# Dev builds 255# 256 257dev : dev-build 258 259dev-build: 260 $(MAKE) DEV_ONLY=true all 261dev-sanity: 262 $(MAKE) DEV_ONLY=true sanity 263dev-clobber: 264 $(MAKE) DEV_ONLY=true clobber 265 266# 267# Quick jdk verification build 268# 269jdk_only: 270 $(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all 271 272 273# 274# Quick jdk verification fastdebug build 275# 276jdk_fastdebug_only: 277 $(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \ 278 BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build 279 280# 281# Quick deploy verification fastdebug build 282# 283deploy_fastdebug_only: 284 $(MAKE) \ 285 DEBUG_NAME=fastdebug \ 286 BUILD_HOTSPOT=false \ 287 BUILD_JDK=false \ 288 BUILD_LANGTOOLS=false \ 289 BUILD_CORBA=false \ 290 BUILD_JAXP=false \ 291 BUILD_JAXWS=false \ 292 BUILD_INSTALL=false \ 293 BUILD_SPONSORS=false \ 294 generic_debug_build 295 296# 297# Product build (skip debug builds) 298# 299product_only: 300 $(MAKE) SKIP_FASTDEBUG_BUILD=true all 301 302# 303# Check target 304# 305 306check: variable_check 307 308# 309# Help target 310# 311help: intro_help target_help variable_help notes_help examples_help 312 313# Intro help message 314intro_help: 315 @$(ECHO) "\ 316Makefile for the JDK builds (all the JDK). \n\ 317" 318 319# Target help 320target_help: 321 @$(ECHO) "\ 322--- Common Targets --- \n\ 323all -- build the core JDK (default target) \n\ 324help -- Print out help information \n\ 325check -- Check make variable values for correctness \n\ 326sanity -- Perform detailed sanity checks on system and settings \n\ 327fastdebug_build -- build the core JDK in 'fastdebug' mode (-g -O) \n\ 328debug_build -- build the core JDK in 'debug' mode (-g) \n\ 329clean -- remove all built and imported files \n\ 330clobber -- same as clean \n\ 331" 332 333# Variable help (only common ones used by this Makefile) 334variable_help: variable_help_intro variable_list variable_help_end 335variable_help_intro: 336 @$(ECHO) "--- Common Variables ---" 337variable_help_end: 338 @$(ECHO) " " 339 340# One line descriptions for the variables 341OUTPUTDIR.desc = Output directory 342PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count 343SLASH_JAVA.desc = Root of all build tools, e.g. /java or J: 344BOOTDIR.desc = JDK used to boot the build 345JDK_IMPORT_PATH.desc = JDK used to import components of the build 346COMPILER_PATH.desc = Compiler install directory 347CACERTS_FILE.desc = Location of certificates file 348DEVTOOLS_PATH.desc = Directory containing zip and gnumake 349CUPS_HEADERS_PATH.desc = Include directory location for CUPS header files 350DXSDK_PATH.desc = Root directory of DirectX SDK 351 352# Make variables to print out (description and value) 353VARIABLE_PRINTVAL_LIST += \ 354 OUTPUTDIR \ 355 PARALLEL_COMPILE_JOBS \ 356 SLASH_JAVA \ 357 BOOTDIR \ 358 JDK_IMPORT_PATH \ 359 COMPILER_PATH \ 360 CACERTS_FILE \ 361 DEVTOOLS_PATH 362 363# Make variables that should refer to directories that exist 364VARIABLE_CHECKDIR_LIST += \ 365 SLASH_JAVA \ 366 BOOTDIR \ 367 JDK_IMPORT_PATH \ 368 COMPILER_PATH \ 369 DEVTOOLS_PATH 370 371# Make variables that should refer to files that exist 372VARIABLE_CHECKFIL_LIST += \ 373 CACERTS_FILE 374 375# Some are windows specific 376ifeq ($(PLATFORM), windows) 377 378VARIABLE_PRINTVAL_LIST += \ 379 DXSDK_PATH 380 381VARIABLE_CHECKDIR_LIST += \ 382 DXSDK_PATH 383 384endif 385 386# For pattern rules below, so all are treated the same 387DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval) 388DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir) 389DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil) 390 391# Complete variable check 392variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST) 393variable_list: $(DO_PRINTVAL_LIST) variable_check 394 395# Pattern rule for printing out a variable 396%.printval: 397 @$(ECHO) " ALT_$* - $($*.desc)" 398 @$(ECHO) " \t $*=$($*)" 399 400# Pattern rule for checking to see if a variable with a directory exists 401%.checkdir: 402 @if [ ! -d $($*) ] ; then \ 403 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ 404 fi 405 406# Pattern rule for checking to see if a variable with a file exists 407%.checkfil: 408 @if [ ! -f $($*) ] ; then \ 409 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ 410 fi 411 412# Misc notes on help 413notes_help: 414 @$(ECHO) "\ 415--- Notes --- \n\ 416- All builds use same output directory unless overridden with \n\ 417 \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\ 418 \t to use the clean target first. \n\ 419- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\ 420 \t builds or previous release JDK builds will work. \n\ 421- The fastest builds have been when the sources and the BOOTDIR are on \n\ 422 \t local disk. \n\ 423" 424 425examples_help: 426 @$(ECHO) "\ 427--- Examples --- \n\ 428 $(MAKE) fastdebug_build \n\ 429 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ 430 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\ 431 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ 432 $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\ 433 $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\ 434" 435 436################################################################ 437# Source bundling 438################################################################ 439ifeq ($(BUNDLE_RULES_AVAILABLE), true) 440 include $(BUNDLE_RULES) 441endif 442 443################################################################ 444# rule to test 445################################################################ 446 447.NOTPARALLEL: test_run 448 449test: 450 $(MAKE) test_run 451 452test_run: test_clean test_start test_summary 453 454test_start: 455 @$(ECHO) "Tests started at `$(DATE)`" 456 457test_clean: 458 $(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt 459 460test_summary: $(OUTPUTDIR)/test_failures.txt 461 @$(ECHO) "#################################################" 462 @$(ECHO) "Tests completed at `$(DATE)`" 463 @( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \ 464 || $(ECHO) "No TEST STATS seen in log" ) 465 @$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt" 466 @$(ECHO) "#################################################" 467 @if [ -s $< ] ; then \ 468 $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \ 469 $(CAT) $<; \ 470 exit 1; \ 471 else \ 472 $(ECHO) "Success! No failures detected"; \ 473 fi 474 475# Get failure list from log 476$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt 477 @$(RM) $@ 478 @( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@ 479 480# Get log file of all tests run 481JDK_TO_TEST := $(shell \ 482 if [ -d "$(ABS_OUTPUTDIR)/j2sdk-image" ] ; then \ 483 $(ECHO) "$(ABS_OUTPUTDIR)/j2sdk-image"; \ 484 elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then \ 485 $(ECHO) "$(ABS_OUTPUTDIR)"; \ 486 elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then \ 487 $(ECHO) "$(PRODUCT_HOME)"; \ 488 fi \ 489) 490TEST_TARGETS=all 491$(OUTPUTDIR)/test_log.txt: 492 $(RM) $@ 493 ( $(CD) test && \ 494 $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) $(TEST_TARGETS) \ 495 ) | tee $@ 496 497################################################################ 498# JPRT rule to build 499################################################################ 500 501include ./make/jprt.gmk 502 503################################################################ 504# PHONY 505################################################################ 506 507.PHONY: all test test_run test_start test_summary test_clean \ 508 generic_build_repo_series \ 509 what clobber insane \ 510 dev dev-build dev-sanity dev-clobber \ 511 product_build \ 512 fastdebug_build \ 513 debug_build \ 514 build_product_image \ 515 build_debug_image \ 516 build_fastdebug_image \ 517 create_fresh_product_bootdir \ 518 create_fresh_debug_bootdir \ 519 create_fresh_fastdebug_bootdir \ 520 generic_debug_build 521 522# Force target 523FRC: 524 525