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