Makefile revision 286:6db0e6f221bd
1# 2# Copyright (c) 1995, 2010, Oracle and/or its affiliates. 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. Oracle designates this 8# particular file as subject to the "Classpath" exception as provided 9# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22# or visit www.oracle.com if you need additional information or have any 23# questions. 24# 25 26BUILD_PARENT_DIRECTORY=. 27 28ifndef TOPDIR 29 TOPDIR:=. 30endif 31 32ifndef JDK_TOPDIR 33 JDK_TOPDIR=$(TOPDIR)/jdk 34endif 35ifndef JDK_MAKE_SHARED_DIR 36 JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared 37endif 38 39# For start and finish echo lines 40TITLE_TEXT = Control $(PLATFORM) $(ARCH) $(RELEASE) 41DATE_STAMP = `$(DATE) '+%y-%m-%d %H:%M'` 42START_ECHO = echo "$(TITLE_TEXT) $@ build started: $(DATE_STAMP)" 43FINISH_ECHO = echo "$(TITLE_TEXT) $@ build finished: $(DATE_STAMP)" 44 45default: all 46 47include $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk 48include ./make/Defs-internal.gmk 49include ./make/sanity-rules.gmk 50include ./make/hotspot-rules.gmk 51include ./make/langtools-rules.gmk 52include ./make/corba-rules.gmk 53include ./make/jaxp-rules.gmk 54include ./make/jaxws-rules.gmk 55include ./make/jdk-rules.gmk 56include ./make/install-rules.gmk 57include ./make/sponsors-rules.gmk 58include ./make/deploy-rules.gmk 59 60# What "all" means 61all:: 62 @$(START_ECHO) 63 64all:: sanity 65 66ifeq ($(SKIP_FASTDEBUG_BUILD), false) 67 all:: fastdebug_build 68endif 69 70ifeq ($(SKIP_DEBUG_BUILD), false) 71 all:: debug_build 72endif 73 74all:: all_product_build 75 76all:: 77 @$(FINISH_ECHO) 78 79# Everything for a full product build 80all_product_build:: 81 @$(START_ECHO) 82 83ifeq ($(SKIP_PRODUCT_BUILD), false) 84 85 all_product_build:: product_build 86 87 ifeq ($(BUILD_INSTALL), true) 88 all_product_build:: $(INSTALL) 89 clobber:: install-clobber 90 endif 91 92 ifeq ($(BUILD_SPONSORS), true) 93 all_product_build:: $(SPONSORS) 94 clobber:: sponsors-clobber 95 endif 96 97 ifneq ($(SKIP_COMPARE_IMAGES), true) 98 all_product_build:: compare-image 99 endif 100 101endif 102 103all_product_build:: 104 @$(FINISH_ECHO) 105 106# Generic build of basic repo series 107generic_build_repo_series:: 108 $(MKDIR) -p $(OUTPUTDIR) 109 $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image 110 111ifeq ($(BUILD_LANGTOOLS), true) 112 generic_build_repo_series:: langtools 113 clobber:: langtools-clobber 114endif 115 116ifeq ($(BUILD_CORBA), true) 117 generic_build_repo_series:: corba 118 clobber:: corba-clobber 119endif 120 121ifeq ($(BUILD_JAXP), true) 122 generic_build_repo_series:: jaxp 123 clobber:: jaxp-clobber 124endif 125 126ifeq ($(BUILD_JAXWS), true) 127 generic_build_repo_series:: jaxws 128 clobber:: jaxws-clobber 129endif 130 131ifeq ($(BUILD_HOTSPOT), true) 132 generic_build_repo_series:: $(HOTSPOT) 133 clobber:: hotspot-clobber 134endif 135 136ifeq ($(BUILD_JDK), true) 137 generic_build_repo_series:: $(JDK_JAVA_EXE) 138 clobber:: jdk-clobber 139endif 140 141ifeq ($(BUILD_DEPLOY), true) 142 generic_build_repo_series:: $(DEPLOY) 143 clobber:: deploy-clobber 144endif 145 146# The debug build, fastdebug or debug. Needs special handling. 147# Note that debug builds do NOT do INSTALL steps, but must be done 148# after the product build and before the INSTALL step of the product build. 149# 150# DEBUG_NAME is fastdebug or debug 151# ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix 152# The resulting j2sdk-image is used by the install makefiles to create a 153# debug install bundle jdk-*-debug-** bundle (tar or zip) 154# which will install in the debug or fastdebug subdirectory of the 155# normal product install area. 156# The install process needs to know what the DEBUG_NAME is, so 157# look for INSTALL_DEBUG_NAME in the install rules. 158# 159# NOTE: On windows, do not use $(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME). 160# Due to the use of short paths in $(ABS_OUTPUTDIR), this may 161# not be the same location. 162# 163 164# Location of fresh bootdir output 165ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk 166FRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image 167FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME)/j2sdk-image 168 169create_fresh_product_bootdir: FRC 170 @$(START_ECHO) 171 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ 172 GENERATE_DOCS=false \ 173 BOOT_CYCLE_SETTINGS= \ 174 build_product_image 175 @$(FINISH_ECHO) 176 177create_fresh_debug_bootdir: FRC 178 @$(START_ECHO) 179 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ 180 GENERATE_DOCS=false \ 181 BOOT_CYCLE_DEBUG_SETTINGS= \ 182 build_debug_image 183 @$(FINISH_ECHO) 184 185create_fresh_fastdebug_bootdir: FRC 186 @$(START_ECHO) 187 $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ 188 GENERATE_DOCS=false \ 189 BOOT_CYCLE_DEBUG_SETTINGS= \ 190 build_fastdebug_image 191 @$(FINISH_ECHO) 192 193# Create boot image? 194ifeq ($(SKIP_BOOT_CYCLE),false) 195 ifneq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64) 196 DO_BOOT_CYCLE=true 197 endif 198endif 199 200ifeq ($(DO_BOOT_CYCLE),true) 201 202 # Create the bootdir to use in the build 203 product_build:: create_fresh_product_bootdir 204 debug_build:: create_fresh_debug_bootdir 205 fastdebug_build:: create_fresh_fastdebug_bootdir 206 207 # Define variables to be used now for the boot jdk 208 BOOT_CYCLE_SETTINGS= \ 209 ALT_BOOTDIR=$(FRESH_BOOTDIR) \ 210 ALT_JDK_IMPORT_PATH=$(FRESH_BOOTDIR) 211 BOOT_CYCLE_DEBUG_SETTINGS= \ 212 ALT_BOOTDIR=$(FRESH_DEBUG_BOOTDIR) \ 213 ALT_JDK_IMPORT_PATH=$(FRESH_DEBUG_BOOTDIR) 214 215else 216 217 # Use the supplied ALT_BOOTDIR as the boot 218 BOOT_CYCLE_SETTINGS= 219 BOOT_CYCLE_DEBUG_SETTINGS= 220 221endif 222 223build_product_image: 224 @$(START_ECHO) 225 $(MAKE) \ 226 SKIP_FASTDEBUG_BUILD=true \ 227 SKIP_DEBUG_BUILD=true \ 228 $(BOOT_CYCLE_SETTINGS) \ 229 generic_build_repo_series 230 @$(FINISH_ECHO) 231 232# NOTE: On windows, do not use $(ABS_OUTPUTDIR)-$(DEBUG_NAME). 233# Due to the use of short paths in $(ABS_OUTPUTDIR), this may 234# not be the same location. 235 236generic_debug_build: 237 @$(START_ECHO) 238 $(MAKE) \ 239 ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME) \ 240 DEBUG_NAME=$(DEBUG_NAME) \ 241 GENERATE_DOCS=false \ 242 $(BOOT_CYCLE_DEBUG_SETTINGS) \ 243 generic_build_repo_series 244 @$(FINISH_ECHO) 245 246build_debug_image: 247 $(MAKE) DEBUG_NAME=debug generic_debug_build 248 249build_fastdebug_image: 250 $(MAKE) DEBUG_NAME=fastdebug generic_debug_build 251 252# Build final image 253product_build:: build_product_image 254debug_build:: build_debug_image 255fastdebug_build:: build_fastdebug_image 256 257clobber:: 258 $(RM) -r $(OUTPUTDIR)/* 259 $(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-debug/* 260 $(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-fastdebug/* 261 -($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE)) 262 263clean: clobber 264 265# 266# Dev builds 267# 268 269dev : dev-build 270 271dev-build: 272 $(MAKE) DEV_ONLY=true all 273dev-sanity: 274 $(MAKE) DEV_ONLY=true sanity 275dev-clobber: 276 $(MAKE) DEV_ONLY=true clobber 277 278# 279# Quick jdk verification build 280# 281jdk_only: 282 $(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all 283 284 285# 286# Quick jdk verification fastdebug build 287# 288jdk_fastdebug_only: 289 $(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \ 290 BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build 291 292# 293# Quick deploy verification fastdebug build 294# 295deploy_fastdebug_only: 296 $(MAKE) \ 297 DEBUG_NAME=fastdebug \ 298 BUILD_HOTSPOT=false \ 299 BUILD_JDK=false \ 300 BUILD_LANGTOOLS=false \ 301 BUILD_CORBA=false \ 302 BUILD_JAXP=false \ 303 BUILD_JAXWS=false \ 304 BUILD_INSTALL=false \ 305 BUILD_SPONSORS=false \ 306 generic_debug_build 307 308# 309# Product build (skip debug builds) 310# 311product_only: 312 $(MAKE) SKIP_FASTDEBUG_BUILD=true all 313 314# 315# Check target 316# 317 318check: variable_check 319 320# 321# Help target 322# 323help: intro_help target_help variable_help notes_help examples_help 324 325# Intro help message 326intro_help: 327 @$(ECHO) "\ 328Makefile for the JDK builds (all the JDK). \n\ 329" 330 331# Target help 332target_help: 333 @$(ECHO) "\ 334--- Common Targets --- \n\ 335all -- build the core JDK (default target) \n\ 336help -- Print out help information \n\ 337check -- Check make variable values for correctness \n\ 338sanity -- Perform detailed sanity checks on system and settings \n\ 339fastdebug_build -- build the core JDK in 'fastdebug' mode (-g -O) \n\ 340debug_build -- build the core JDK in 'debug' mode (-g) \n\ 341clean -- remove all built and imported files \n\ 342clobber -- same as clean \n\ 343" 344 345# Variable help (only common ones used by this Makefile) 346variable_help: variable_help_intro variable_list variable_help_end 347variable_help_intro: 348 @$(ECHO) "--- Common Variables ---" 349variable_help_end: 350 @$(ECHO) " " 351 352# One line descriptions for the variables 353OUTPUTDIR.desc = Output directory 354PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count 355SLASH_JAVA.desc = Root of all build tools, e.g. /java or J: 356BOOTDIR.desc = JDK used to boot the build 357JDK_IMPORT_PATH.desc = JDK used to import components of the build 358COMPILER_PATH.desc = Compiler install directory 359CACERTS_FILE.desc = Location of certificates file 360DEVTOOLS_PATH.desc = Directory containing zip and gnumake 361CUPS_HEADERS_PATH.desc = Include directory location for CUPS header files 362DXSDK_PATH.desc = Root directory of DirectX SDK 363MSVCRT_DLL_PATH.desc = Directory containing mscvrt.dll 364 365# Make variables to print out (description and value) 366VARIABLE_PRINTVAL_LIST += \ 367 OUTPUTDIR \ 368 PARALLEL_COMPILE_JOBS \ 369 SLASH_JAVA \ 370 BOOTDIR \ 371 JDK_IMPORT_PATH \ 372 COMPILER_PATH \ 373 CACERTS_FILE \ 374 DEVTOOLS_PATH 375 376# Make variables that should refer to directories that exist 377VARIABLE_CHECKDIR_LIST += \ 378 SLASH_JAVA \ 379 BOOTDIR \ 380 JDK_IMPORT_PATH \ 381 COMPILER_PATH \ 382 DEVTOOLS_PATH 383 384# Make variables that should refer to files that exist 385VARIABLE_CHECKFIL_LIST += \ 386 CACERTS_FILE 387 388# Some are windows specific 389ifeq ($(PLATFORM), windows) 390 391VARIABLE_PRINTVAL_LIST += \ 392 DXSDK_PATH \ 393 MSVCRT_DLL_PATH 394 395VARIABLE_CHECKDIR_LIST += \ 396 DXSDK_PATH \ 397 MSVCRT_DLL_PATH 398 399endif 400 401# For pattern rules below, so all are treated the same 402DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval) 403DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir) 404DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil) 405 406# Complete variable check 407variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST) 408variable_list: $(DO_PRINTVAL_LIST) variable_check 409 410# Pattern rule for printing out a variable 411%.printval: 412 @$(ECHO) " ALT_$* - $($*.desc)" 413 @$(ECHO) " \t $*=$($*)" 414 415# Pattern rule for checking to see if a variable with a directory exists 416%.checkdir: 417 @if [ ! -d $($*) ] ; then \ 418 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ 419 fi 420 421# Pattern rule for checking to see if a variable with a file exists 422%.checkfil: 423 @if [ ! -f $($*) ] ; then \ 424 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ 425 fi 426 427# Misc notes on help 428notes_help: 429 @$(ECHO) "\ 430--- Notes --- \n\ 431- All builds use same output directory unless overridden with \n\ 432 \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\ 433 \t to use the clean target first. \n\ 434- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\ 435 \t builds or previous release JDK builds will work. \n\ 436- The fastest builds have been when the sources and the BOOTDIR are on \n\ 437 \t local disk. \n\ 438" 439 440examples_help: 441 @$(ECHO) "\ 442--- Examples --- \n\ 443 $(MAKE) fastdebug_build \n\ 444 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ 445 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\ 446 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ 447 $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\ 448 $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\ 449" 450 451################################################################ 452# Source bundling 453################################################################ 454ifeq ($(BUNDLE_RULES_AVAILABLE), true) 455 include $(BUNDLE_RULES) 456endif 457 458################################################################ 459# rule to test 460################################################################ 461 462.NOTPARALLEL: test_run 463 464test: 465 $(MAKE) test_run 466 467test_run: test_clean test_start test_summary 468 469test_start: 470 @$(ECHO) "Tests started at `$(DATE)`" 471 472test_clean: 473 $(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt 474 475test_summary: $(OUTPUTDIR)/test_failures.txt 476 @$(ECHO) "#################################################" 477 @$(ECHO) "Tests completed at `$(DATE)`" 478 @( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \ 479 || $(ECHO) "No TEST STATS seen in log" ) 480 @$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt" 481 @$(ECHO) "#################################################" 482 @if [ -s $< ] ; then \ 483 $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \ 484 $(CAT) $<; \ 485 exit 1; \ 486 else \ 487 $(ECHO) "Success! No failures detected"; \ 488 fi 489 490# Get failure list from log 491$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt 492 @$(RM) $@ 493 @( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@ 494 495# Get log file of all tests run 496JDK_TO_TEST := $(shell \ 497 if [ -d "$(ABS_OUTPUTDIR)/j2sdk-image" ] ; then \ 498 $(ECHO) "$(ABS_OUTPUTDIR)/j2sdk-image"; \ 499 elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then \ 500 $(ECHO) "$(ABS_OUTPUTDIR)"; \ 501 elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then \ 502 $(ECHO) "$(PRODUCT_HOME)"; \ 503 fi \ 504) 505TEST_TARGETS=all 506$(OUTPUTDIR)/test_log.txt: 507 $(RM) $@ 508 ( $(CD) test && \ 509 $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) $(TEST_TARGETS) \ 510 ) | tee $@ 511 512################################################################ 513# JPRT rule to build 514################################################################ 515 516include ./make/jprt.gmk 517 518################################################################ 519# PHONY 520################################################################ 521 522.PHONY: all test test_run test_start test_summary test_clean \ 523 generic_build_repo_series \ 524 what clobber insane \ 525 dev dev-build dev-sanity dev-clobber \ 526 product_build \ 527 fastdebug_build \ 528 debug_build \ 529 build_product_image \ 530 build_debug_image \ 531 build_fastdebug_image \ 532 create_fresh_product_bootdir \ 533 create_fresh_debug_bootdir \ 534 create_fresh_fastdebug_bootdir \ 535 generic_debug_build 536 537# Force target 538FRC: 539 540