Makefile revision 289:24900a58ab9f
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 363 364# Make variables to print out (description and value) 365VARIABLE_PRINTVAL_LIST += \ 366 OUTPUTDIR \ 367 PARALLEL_COMPILE_JOBS \ 368 SLASH_JAVA \ 369 BOOTDIR \ 370 JDK_IMPORT_PATH \ 371 COMPILER_PATH \ 372 CACERTS_FILE \ 373 DEVTOOLS_PATH 374 375# Make variables that should refer to directories that exist 376VARIABLE_CHECKDIR_LIST += \ 377 SLASH_JAVA \ 378 BOOTDIR \ 379 JDK_IMPORT_PATH \ 380 COMPILER_PATH \ 381 DEVTOOLS_PATH 382 383# Make variables that should refer to files that exist 384VARIABLE_CHECKFIL_LIST += \ 385 CACERTS_FILE 386 387# Some are windows specific 388ifeq ($(PLATFORM), windows) 389 390VARIABLE_PRINTVAL_LIST += \ 391 DXSDK_PATH 392 393VARIABLE_CHECKDIR_LIST += \ 394 DXSDK_PATH 395 396endif 397 398# For pattern rules below, so all are treated the same 399DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval) 400DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir) 401DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil) 402 403# Complete variable check 404variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST) 405variable_list: $(DO_PRINTVAL_LIST) variable_check 406 407# Pattern rule for printing out a variable 408%.printval: 409 @$(ECHO) " ALT_$* - $($*.desc)" 410 @$(ECHO) " \t $*=$($*)" 411 412# Pattern rule for checking to see if a variable with a directory exists 413%.checkdir: 414 @if [ ! -d $($*) ] ; then \ 415 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ 416 fi 417 418# Pattern rule for checking to see if a variable with a file exists 419%.checkfil: 420 @if [ ! -f $($*) ] ; then \ 421 $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ 422 fi 423 424# Misc notes on help 425notes_help: 426 @$(ECHO) "\ 427--- Notes --- \n\ 428- All builds use same output directory unless overridden with \n\ 429 \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\ 430 \t to use the clean target first. \n\ 431- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\ 432 \t builds or previous release JDK builds will work. \n\ 433- The fastest builds have been when the sources and the BOOTDIR are on \n\ 434 \t local disk. \n\ 435" 436 437examples_help: 438 @$(ECHO) "\ 439--- Examples --- \n\ 440 $(MAKE) fastdebug_build \n\ 441 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ 442 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\ 443 $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ 444 $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\ 445 $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\ 446" 447 448################################################################ 449# Source bundling 450################################################################ 451ifeq ($(BUNDLE_RULES_AVAILABLE), true) 452 include $(BUNDLE_RULES) 453endif 454 455################################################################ 456# rule to test 457################################################################ 458 459.NOTPARALLEL: test_run 460 461test: 462 $(MAKE) test_run 463 464test_run: test_clean test_start test_summary 465 466test_start: 467 @$(ECHO) "Tests started at `$(DATE)`" 468 469test_clean: 470 $(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt 471 472test_summary: $(OUTPUTDIR)/test_failures.txt 473 @$(ECHO) "#################################################" 474 @$(ECHO) "Tests completed at `$(DATE)`" 475 @( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \ 476 || $(ECHO) "No TEST STATS seen in log" ) 477 @$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt" 478 @$(ECHO) "#################################################" 479 @if [ -s $< ] ; then \ 480 $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \ 481 $(CAT) $<; \ 482 exit 1; \ 483 else \ 484 $(ECHO) "Success! No failures detected"; \ 485 fi 486 487# Get failure list from log 488$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt 489 @$(RM) $@ 490 @( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@ 491 492# Get log file of all tests run 493JDK_TO_TEST := $(shell \ 494 if [ -d "$(ABS_OUTPUTDIR)/j2sdk-image" ] ; then \ 495 $(ECHO) "$(ABS_OUTPUTDIR)/j2sdk-image"; \ 496 elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then \ 497 $(ECHO) "$(ABS_OUTPUTDIR)"; \ 498 elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then \ 499 $(ECHO) "$(PRODUCT_HOME)"; \ 500 fi \ 501) 502TEST_TARGETS=all 503$(OUTPUTDIR)/test_log.txt: 504 $(RM) $@ 505 ( $(CD) test && \ 506 $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) $(TEST_TARGETS) \ 507 ) | tee $@ 508 509################################################################ 510# JPRT rule to build 511################################################################ 512 513include ./make/jprt.gmk 514 515################################################################ 516# PHONY 517################################################################ 518 519.PHONY: all test test_run test_start test_summary test_clean \ 520 generic_build_repo_series \ 521 what clobber insane \ 522 dev dev-build dev-sanity dev-clobber \ 523 product_build \ 524 fastdebug_build \ 525 debug_build \ 526 build_product_image \ 527 build_debug_image \ 528 build_fastdebug_image \ 529 create_fresh_product_bootdir \ 530 create_fresh_debug_bootdir \ 531 create_fresh_fastdebug_bootdir \ 532 generic_debug_build 533 534# Force target 535FRC: 536 537