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