Makefile

Tue, 18 Sep 2012 11:29:16 -0700

author
ohair
date
Tue, 18 Sep 2012 11:29:16 -0700
changeset 478
2ba6f4da4bf3
parent 340
14b8e7eee105
child 570
5cf7750c8c43
permissions
-rw-r--r--

7197849: Update new build-infra makefiles
Reviewed-by: ihse, erikj, ohrstrom, tbell

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

mercurial