Makefile

Mon, 25 Feb 2013 15:08:11 -0800

author
jjg
date
Mon, 25 Feb 2013 15:08:11 -0800
changeset 645
5b0b6ef58dbf
parent 570
5cf7750c8c43
child 796
b1e9396fb8af
permissions
-rw-r--r--

8008914: Add nashorn to the tl build
Reviewed-by: mr, tbell, jjh
Contributed-by: erik.joelsson@oracle.com, james.laskey@oracle.com

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

mercurial