Makefile 18.2 KB
Newer Older
D
duke 已提交
1
#
2
# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
D
duke 已提交
3 4 5 6
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation.  Oracle designates this
D
duke 已提交
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
D
duke 已提交
10 11 12 13 14 15 16 17 18 19 20
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
21 22 23
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
D
duke 已提交
24 25
#

26 27
BUILD_PARENT_DIRECTORY=.

D
duke 已提交
28
ifndef TOPDIR
29
  TOPDIR:=.
D
duke 已提交
30 31
endif

32 33 34
# Openjdk sources (only used if SKIP_OPENJDK_BUILD!=true)
OPENJDK_SOURCETREE=$(TOPDIR)/openjdk
OPENJDK_BUILDDIR:=$(shell \
35
  if [ -r $(OPENJDK_SOURCETREE)/Makefile ]; then \
36 37 38 39 40
    echo "$(OPENJDK_SOURCETREE)"; \
  else \
    echo "."; \
  fi)

D
duke 已提交
41 42 43 44 45 46 47
ifndef JDK_TOPDIR
  JDK_TOPDIR=$(TOPDIR)/jdk
endif
ifndef JDK_MAKE_SHARED_DIR
  JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared
endif

48 49
# For start and finish echo lines
TITLE_TEXT = Control $(PLATFORM) $(ARCH) $(RELEASE)
50
DATE_STAMP = `$(DATE) '+%y-%m-%d %H:%M'`
51 52
START_ECHO  = echo "$(TITLE_TEXT) $@ build started: $(DATE_STAMP)"
FINISH_ECHO = echo "$(TITLE_TEXT) $@ build finished: $(DATE_STAMP)"
D
duke 已提交
53

54
default: all
D
duke 已提交
55

56 57
include $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk
include ./make/Defs-internal.gmk
D
duke 已提交
58 59 60 61 62 63 64 65 66 67 68
include ./make/sanity-rules.gmk
include ./make/hotspot-rules.gmk
include ./make/langtools-rules.gmk
include ./make/corba-rules.gmk
include ./make/jaxp-rules.gmk
include ./make/jaxws-rules.gmk
include ./make/jdk-rules.gmk
include ./make/install-rules.gmk
include ./make/sponsors-rules.gmk
include ./make/deploy-rules.gmk

69 70 71
# What "all" means
all::
	@$(START_ECHO)
D
duke 已提交
72

O
ohair 已提交
73
all:: openjdk_check sanity
74 75 76 77 78 79 80 81

ifeq ($(SKIP_FASTDEBUG_BUILD), false)
  all:: fastdebug_build
endif

ifeq ($(SKIP_DEBUG_BUILD), false)
  all:: debug_build
endif
D
duke 已提交
82

83
ifneq ($(SKIP_OPENJDK_BUILD), true)
84
  all:: openjdk_build
85 86
endif

O
ohair 已提交
87 88
all:: all_product_build 

89 90 91 92 93 94
all:: 
	@$(FINISH_ECHO)

# Everything for a full product build
all_product_build::
	@$(START_ECHO)
D
duke 已提交
95

96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
ifeq ($(SKIP_PRODUCT_BUILD), false)
  
  all_product_build:: product_build

  ifeq ($(BUILD_INSTALL), true)
    all_product_build:: $(INSTALL)
    clobber:: install-clobber
  endif
  
  ifeq ($(BUILD_SPONSORS), true)
    all_product_build:: $(SPONSORS)
    clobber:: sponsors-clobber
  endif
  
  ifneq ($(SKIP_COMPARE_IMAGES), true)
    all_product_build:: compare-image
  endif

endif

all_product_build:: 
	@$(FINISH_ECHO)

119
# Generic build of basic repo series
120 121 122
generic_build_repo_series::
	$(MKDIR) -p $(OUTPUTDIR)
	$(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
D
duke 已提交
123 124

ifeq ($(BUILD_LANGTOOLS), true)
125
  generic_build_repo_series:: langtools
D
duke 已提交
126 127 128 129
  clobber:: langtools-clobber
endif

ifeq ($(BUILD_CORBA), true)
130
  generic_build_repo_series:: corba
D
duke 已提交
131 132 133 134
  clobber:: corba-clobber
endif

ifeq ($(BUILD_JAXP), true)
135
  generic_build_repo_series:: jaxp
D
duke 已提交
136 137 138 139
  clobber:: jaxp-clobber
endif

ifeq ($(BUILD_JAXWS), true)
140
  generic_build_repo_series:: jaxws
D
duke 已提交
141 142 143 144
  clobber:: jaxws-clobber
endif

ifeq ($(BUILD_HOTSPOT), true)
145
  generic_build_repo_series:: $(HOTSPOT) 
D
duke 已提交
146 147 148 149
  clobber:: hotspot-clobber
endif

ifeq ($(BUILD_JDK), true)
150
  generic_build_repo_series:: $(JDK_JAVA_EXE)
D
duke 已提交
151 152 153 154
  clobber:: jdk-clobber
endif

ifeq ($(BUILD_DEPLOY), true)
155
  generic_build_repo_series:: $(DEPLOY)
D
duke 已提交
156 157 158
  clobber:: deploy-clobber
endif

159 160 161 162 163 164 165
ifeq ($(BUILD_JDK), true)
  ifeq ($(BUNDLE_RULES_AVAILABLE), true)
    generic_build_repo_series:: openjdk-binary-plugs-bundles
  endif
endif

# The debug build, fastdebug or debug. Needs special handling.
D
duke 已提交
166 167 168 169 170 171 172 173 174 175 176 177
#  Note that debug builds do NOT do INSTALL steps, but must be done
#  after the product build and before the INSTALL step of the product build.
#
#   DEBUG_NAME is fastdebug or debug
#   ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix
#   The resulting j2sdk-image is used by the install makefiles to create a
#     debug install bundle jdk-*-debug-** bundle (tar or zip) 
#     which will install in the debug or fastdebug subdirectory of the
#     normal product install area.
#     The install process needs to know what the DEBUG_NAME is, so
#     look for INSTALL_DEBUG_NAME in the install rules.
#
178 179 180 181
#   NOTE: On windows, do not use $(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME).
#         Due to the use of short paths in $(ABS_OUTPUTDIR), this may 
#         not be the same location.
#
D
duke 已提交
182

183 184 185
# Location of fresh bootdir output
ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
FRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image
186
FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME)/j2sdk-image
187 188 189 190
  
create_fresh_product_bootdir: FRC
	@$(START_ECHO)
	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
191
		GENERATE_DOCS=false \
192 193 194 195 196 197 198
		BOOT_CYCLE_SETTINGS= \
		build_product_image
	@$(FINISH_ECHO)

create_fresh_debug_bootdir: FRC
	@$(START_ECHO)
	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
199
		GENERATE_DOCS=false \
200 201 202 203 204 205 206
		BOOT_CYCLE_DEBUG_SETTINGS= \
		build_debug_image
	@$(FINISH_ECHO)

create_fresh_fastdebug_bootdir: FRC
	@$(START_ECHO)
	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
207
		GENERATE_DOCS=false \
208 209 210 211 212 213 214 215 216 217
		BOOT_CYCLE_DEBUG_SETTINGS= \
		build_fastdebug_image
	@$(FINISH_ECHO)

# Create boot image?
ifeq ($(SKIP_BOOT_CYCLE),false)
  ifneq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
    DO_BOOT_CYCLE=true
  endif
endif
D
duke 已提交
218

219 220 221 222 223 224 225 226 227 228 229 230 231 232
ifeq ($(DO_BOOT_CYCLE),true)
  
  # Create the bootdir to use in the build
  product_build:: create_fresh_product_bootdir
  debug_build:: create_fresh_debug_bootdir
  fastdebug_build:: create_fresh_fastdebug_bootdir

  # Define variables to be used now for the boot jdk
  BOOT_CYCLE_SETTINGS= \
     ALT_BOOTDIR=$(FRESH_BOOTDIR) \
     ALT_JDK_IMPORT_PATH=$(FRESH_BOOTDIR)
  BOOT_CYCLE_DEBUG_SETTINGS= \
     ALT_BOOTDIR=$(FRESH_DEBUG_BOOTDIR) \
     ALT_JDK_IMPORT_PATH=$(FRESH_DEBUG_BOOTDIR)
D
duke 已提交
233

234
else
D
duke 已提交
235

236 237 238
  # Use the supplied ALT_BOOTDIR as the boot
  BOOT_CYCLE_SETTINGS=
  BOOT_CYCLE_DEBUG_SETTINGS=
D
duke 已提交
239 240 241

endif

242 243 244 245 246 247 248 249
build_product_image:
	@$(START_ECHO)
	$(MAKE) \
	        SKIP_FASTDEBUG_BUILD=true \
	        SKIP_DEBUG_BUILD=true \
	        $(BOOT_CYCLE_SETTINGS) \
	        generic_build_repo_series
	@$(FINISH_ECHO)
D
duke 已提交
250

251 252 253 254
#   NOTE: On windows, do not use $(ABS_OUTPUTDIR)-$(DEBUG_NAME).
#         Due to the use of short paths in $(ABS_OUTPUTDIR), this may 
#         not be the same location.

255 256 257
generic_debug_build:
	@$(START_ECHO)
	$(MAKE) \
258
		ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME) \
259
	        DEBUG_NAME=$(DEBUG_NAME) \
260
		GENERATE_DOCS=false \
261 262 263 264 265 266
	        $(BOOT_CYCLE_DEBUG_SETTINGS) \
		generic_build_repo_series
	@$(FINISH_ECHO)

build_debug_image:
	$(MAKE) DEBUG_NAME=debug generic_debug_build
D
duke 已提交
267

268 269
build_fastdebug_image:
	$(MAKE) DEBUG_NAME=fastdebug generic_debug_build
D
duke 已提交
270

271 272 273 274
# Build final image
product_build:: build_product_image
debug_build:: build_debug_image
fastdebug_build:: build_fastdebug_image
D
duke 已提交
275

276 277
# Check on whether we really can build the openjdk, need source etc.
openjdk_check: FRC
278
ifneq ($(SKIP_OPENJDK_BUILD), true)
279 280 281 282 283 284 285 286 287 288 289
	@$(ECHO) " "
	@$(ECHO) "================================================="
	@if [ ! -r $(OPENJDK_BUILDDIR)/Makefile ] ; then \
	    $(ECHO) "ERROR: No openjdk source tree available at: $(OPENJDK_BUILDDIR)"; \
	    exit 1; \
	else \
	    $(ECHO) "OpenJDK will be built after JDK is built"; \
	    $(ECHO) "  OPENJDK_BUILDDIR=$(OPENJDK_BUILDDIR)"; \
	fi
	@$(ECHO) "================================================="
	@$(ECHO) " "
290 291 292 293 294 295 296 297 298 299 300
endif

# If we have bundle rules, we have a chance here to do a complete cycle
#   build, of production and open build.
# FIXUP: We should create the openjdk source bundle and build that?
#   But how do we reliable create or get at a formal openjdk source tree?
#   The one we have needs to be trimmed of built bits and closed dirs.
#   The repositories might not be available.
#   The openjdk source bundle is probably not available.

ifneq ($(SKIP_OPENJDK_BUILD), true)
D
duke 已提交
301 302
  ifeq ($(BUILD_JDK), true)
    ifeq ($(BUNDLE_RULES_AVAILABLE), true)
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318

OPENJDK_PLUGS=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME)
OPENJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/open-output
OPENJDK_BUILD_NAME \
  = openjdk-$(JDK_MINOR_VERSION)-$(BUILD_NUMBER)-$(PLATFORM)-$(ARCH)-$(BUNDLE_DATE)
OPENJDK_BUILD_BINARY_ZIP=$(ABS_BIN_BUNDLEDIR)/$(OPENJDK_BUILD_NAME).zip
BUILT_IMAGE=$(ABS_OUTPUTDIR)/j2sdk-image
ifeq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
  OPENJDK_BOOTDIR=$(BOOTDIR)
  OPENJDK_IMPORTJDK=$(JDK_IMPORT_PATH)
else
  OPENJDK_BOOTDIR=$(BUILT_IMAGE)
  OPENJDK_IMPORTJDK=$(BUILT_IMAGE)
endif

openjdk_build:
319
	@$(START_ECHO)
D
duke 已提交
320 321 322
	@$(ECHO) " "
	@$(ECHO) "================================================="
	@$(ECHO) "Starting openjdk build"
323
	@$(ECHO) " Using: ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR)"
D
duke 已提交
324 325
	@$(ECHO) "================================================="
	@$(ECHO) " "
326 327 328 329
	$(RM) -r $(OPENJDK_OUTPUTDIR)
	$(MKDIR) -p $(OPENJDK_OUTPUTDIR)
	($(CD) $(OPENJDK_BUILDDIR) && $(MAKE) \
	  OPENJDK=true \
330
	  GENERATE_DOCS=false \
331 332 333 334 335 336
	  ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR) \
	  ALT_OUTPUTDIR=$(OPENJDK_OUTPUTDIR) \
	  ALT_BINARY_PLUGS_PATH=$(OPENJDK_PLUGS) \
	  ALT_BOOTDIR=$(OPENJDK_BOOTDIR) \
	  ALT_JDK_IMPORT_PATH=$(OPENJDK_IMPORTJDK) \
		product_build )
D
duke 已提交
337
	$(RM) $(OPENJDK_BUILD_BINARY_ZIP)
338
	( $(CD) $(OPENJDK_OUTPUTDIR)/j2sdk-image && \
D
duke 已提交
339
	  $(ZIPEXE) -q -r $(OPENJDK_BUILD_BINARY_ZIP) .)
340 341 342 343 344 345 346
	$(RM) -r $(OPENJDK_OUTPUTDIR)
	@$(ECHO) " "
	@$(ECHO) "================================================="
	@$(ECHO) "Finished openjdk build"
	@$(ECHO) " Binary Bundle: $(OPENJDK_BUILD_BINARY_ZIP)"
	@$(ECHO) "================================================="
	@$(ECHO) " "
347
	@$(FINISH_ECHO)
348
    
D
duke 已提交
349 350 351 352 353 354
    endif
  endif
endif

clobber::
	$(RM) -r $(OUTPUTDIR)/*
355 356
	$(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-debug/*
	$(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-fastdebug/*
D
duke 已提交
357 358 359 360
	-($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE))

clean: clobber

361 362 363 364 365 366 367 368 369 370 371 372
#
# Dev builds
#

dev : dev-build

dev-build:
	$(MAKE) DEV_ONLY=true all
dev-sanity:
	$(MAKE) DEV_ONLY=true sanity
dev-clobber:
	$(MAKE) DEV_ONLY=true clobber
D
duke 已提交
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556

#
# Quick jdk verification build
#
jdk_only:
	$(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all


#
# Quick jdk verification fastdebug build
#
jdk_fastdebug_only:
	$(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \
	    BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build

#
# Quick deploy verification fastdebug build
#
deploy_fastdebug_only:
	$(MAKE) \
	    DEBUG_NAME=fastdebug \
	    BUILD_HOTSPOT=false \
	    BUILD_JDK=false \
	    BUILD_LANGTOOLS=false \
	    BUILD_CORBA=false \
	    BUILD_JAXP=false \
	    BUILD_JAXWS=false \
	    BUILD_INSTALL=false \
	    BUILD_SPONSORS=false \
	    generic_debug_build

#
# Product build (skip debug builds)
#
product_only:
	$(MAKE) SKIP_FASTDEBUG_BUILD=true all

#
# Check target
#

check: variable_check

#
# Help target
#
help: intro_help target_help variable_help notes_help examples_help

# Intro help message
intro_help:
	@$(ECHO) "\
Makefile for the JDK builds (all the JDK). \n\
"

# Target help
target_help:
	@$(ECHO) "\
--- Common Targets ---  \n\
all               -- build the core JDK (default target) \n\
help              -- Print out help information \n\
check             -- Check make variable values for correctness \n\
sanity            -- Perform detailed sanity checks on system and settings \n\
fastdebug_build   -- build the core JDK in 'fastdebug' mode (-g -O) \n\
debug_build       -- build the core JDK in 'debug' mode (-g) \n\
clean             -- remove all built and imported files \n\
clobber           -- same as clean \n\
"

# Variable help (only common ones used by this Makefile)
variable_help: variable_help_intro variable_list variable_help_end
variable_help_intro:
	@$(ECHO) "--- Common Variables ---"
variable_help_end:
	@$(ECHO) " "

# One line descriptions for the variables
OUTPUTDIR.desc             = Output directory
PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count
SLASH_JAVA.desc            = Root of all build tools, e.g. /java or J:
BOOTDIR.desc               = JDK used to boot the build
JDK_IMPORT_PATH.desc       = JDK used to import components of the build
COMPILER_PATH.desc         = Compiler install directory
CACERTS_FILE.desc          = Location of certificates file
DEVTOOLS_PATH.desc         = Directory containing zip and gnumake
CUPS_HEADERS_PATH.desc     = Include directory location for CUPS header files
DXSDK_PATH.desc            = Root directory of DirectX SDK
MSDEVTOOLS_PATH.desc       = Root directory of VC++ tools (e.g. rc.exe)
MSVCRT_DLL_PATH.desc       = Directory containing mscvrt.dll

# Make variables to print out (description and value)
VARIABLE_PRINTVAL_LIST +=       \
    OUTPUTDIR                   \
    PARALLEL_COMPILE_JOBS       \
    SLASH_JAVA                  \
    BOOTDIR                     \
    JDK_IMPORT_PATH             \
    COMPILER_PATH               \
    CACERTS_FILE                \
    DEVTOOLS_PATH

# Make variables that should refer to directories that exist
VARIABLE_CHECKDIR_LIST +=       \
    SLASH_JAVA                  \
    BOOTDIR                     \
    JDK_IMPORT_PATH             \
    COMPILER_PATH               \
    DEVTOOLS_PATH 

# Make variables that should refer to files that exist
VARIABLE_CHECKFIL_LIST +=       \
    CACERTS_FILE

# Some are windows specific
ifeq ($(PLATFORM), windows)

VARIABLE_PRINTVAL_LIST +=       \
    DXSDK_PATH                  \
    MSDEVTOOLS_PATH             \
    MSVCRT_DLL_PATH

VARIABLE_CHECKDIR_LIST +=       \
    DXSDK_PATH                  \
    MSDEVTOOLS_PATH             \
    MSVCRT_DLL_PATH

endif

# For pattern rules below, so all are treated the same
DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)
DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)
DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)

# Complete variable check
variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)
variable_list: $(DO_PRINTVAL_LIST) variable_check

# Pattern rule for printing out a variable
%.printval:
	@$(ECHO) "  ALT_$* - $($*.desc)"
	@$(ECHO) "  \t $*=$($*)"

# Pattern rule for checking to see if a variable with a directory exists
%.checkdir:
	@if [ ! -d $($*) ] ; then \
	    $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
	fi

# Pattern rule for checking to see if a variable with a file exists
%.checkfil:
	@if [ ! -f $($*) ] ; then \
	    $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \
	fi

# Misc notes on help
notes_help:
	@$(ECHO) "\
--- Notes --- \n\
- All builds use same output directory unless overridden with \n\
 \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\
 \t to use the clean target first. \n\
- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\
 \t builds or previous release JDK builds will work. \n\
- The fastest builds have been when the sources and the BOOTDIR are on \n\
 \t local disk. \n\
"

examples_help:
	@$(ECHO) "\
--- Examples --- \n\
  $(MAKE) fastdebug_build \n\
  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\
  $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\
  $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\
  $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\
"

################################################################
# Source and binary plug bundling
################################################################
ifeq ($(BUNDLE_RULES_AVAILABLE), true)
  include $(BUNDLE_RULES)
endif

557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606
################################################################
# rule to test
################################################################

.NOTPARALLEL: test

test: test_clean test_start test_summary

test_start:
	@$(ECHO) "Tests started at `$(DATE)`"

test_clean:
	$(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt

test_summary: $(OUTPUTDIR)/test_failures.txt
	@$(ECHO) "#################################################"
	@$(ECHO) "Tests completed at `$(DATE)`"
	@( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \
          || $(ECHO) "No TEST STATS seen in log" )
	@$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt"
	@$(ECHO) "#################################################"
	@if [ -s $< ] ; then                                           \
          $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \
          $(CAT) $<;                                                   \
          exit 1;                                                      \
        else                                                           \
          $(ECHO) "Success! No failures detected";                     \
        fi

# Get failure list from log
$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt
	@$(RM) $@
	@( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) > $@

# Get log file of all tests run
JDK_TO_TEST := $(shell 							\
  if [ -d "$(ABS_OUTPUTDIR)/j2sdk-image" ] ; then 			\
    $(ECHO) "$(ABS_OUTPUTDIR)/j2sdk-image"; 				\
  elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then 				\
    $(ECHO) "$(ABS_OUTPUTDIR)"; 					\
  elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then 	\
    $(ECHO) "$(PRODUCT_HOME)"; 						\
  fi 									\
)
$(OUTPUTDIR)/test_log.txt:
	$(RM) $@
	( $(CD) test &&                                     \
          $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) \
        ) | tee $@

D
duke 已提交
607 608 609 610 611 612 613 614 615 616
################################################################
# JPRT rule to build
################################################################

include ./make/jprt.gmk

################################################################
#  PHONY
################################################################

617
.PHONY: all  test test_start test_summary test_clean \
618 619 620 621 622 623 624 625 626 627 628 629 630
	generic_build_repo_series \
	what clobber insane \
        dev dev-build dev-sanity dev-clobber \
        product_build \
        fastdebug_build \
        debug_build  \
        build_product_image  \
        build_debug_image  \
        build_fastdebug_image \
        create_fresh_product_bootdir \
        create_fresh_debug_bootdir \
        create_fresh_fastdebug_bootdir \
        generic_debug_build
D
duke 已提交
631

632 633 634
# Force target
FRC: