1 #
   2 # Copyright (c) 2016, 2020, 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 default: all
  27 
  28 include $(SPEC)
  29 include MakeBase.gmk
  30 
  31 PRODUCT_TARGETS :=
  32 LEGACY_TARGETS :=
  33 TEST_TARGETS :=
  34 DOCS_TARGETS :=
  35 
  36 # On Windows tar frequently complains that "file changed as we read it" for
  37 # some random source files. This seems to be cause by anti virus scanners and
  38 # is most likely safe to ignore. When it happens, tar returns '1'.
  39 ifeq ($(call isBuildOs, windows), true)
  40   TAR_IGNORE_EXIT_VALUE := || test "$$$$?" = "1"
  41 endif
  42 
  43 # Hook to include the corresponding custom file, if present.
  44 $(eval $(call IncludeCustomExtension, Bundles-pre.gmk))
  45 ################################################################################
  46 # BUNDLE : Name of bundle to create
  47 # FILES : Files in BASE_DIRS to add to bundle
  48 # SPECIAL_INCLUDES : List of directories inside BASE_DIRS to look for additional
  49 #     files in. These files will not get proper dependency handling. Use when
  50 #     files or directories may contain spaces.
  51 # BASE_DIRS : Base directories for the root dir in the bundle.
  52 # SUBDIR : Optional name of root dir in bundle.
  53 # OUTPUTDIR : Optionally override output dir
  54 SetupBundleFile = $(NamedParamsMacroTemplate)
  55 define SetupBundleFileBody
  56 
  57   $$(foreach d, $$($1_BASE_DIRS), \
  58     $$(eval $1_$$d_RELATIVE_FILES := $$$$(patsubst $$d/%, %, \
  59         $$$$(filter $$d/%, $$$$($1_FILES)))) \
  60     $$(eval $1_$$d_LIST_FILE := \
  61         $(SUPPORT_OUTPUTDIR)/bundles/_$1_$$$$(subst /,_,$$$$(patsubst $(OUTPUTDIR)/%,%,$$d)_files)) \
  62   )
  63 
  64   ifneq ($$(filter %.tar.gz, $$($1_BUNDLE_NAME)), )
  65     $1_TYPE := tar.gz
  66   else ifneq ($$(filter %.zip, $$($1_BUNDLE_NAME)), )
  67     $1_TYPE := zip
  68   else
  69     $$(error Unknown bundle type $$($1_BUNDLE_NAME))
  70   endif
  71 
  72   $$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false)
  73 
  74   $$(call SetIfEmpty, $1_OUTPUTDIR, $$(BUNDLES_OUTPUTDIR))
  75 
  76   $$($1_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES)
  77         $$(call MakeTargetDir)
  78         $$(call LogWarn, Creating $$($1_BUNDLE_NAME))
  79         # If any of the files contain a space in the file name, FindFiles
  80         # will have replaced it with ?. Tar does not accept that so need to
  81         # switch it back.
  82         $$(foreach d, $$($1_BASE_DIRS), \
  83           $$(eval $$(call ListPathsSafely, \
  84               $1_$$d_RELATIVE_FILES, $$($1_$$d_LIST_FILE))) \
  85           $$(CAT) $$($1_$$d_LIST_FILE) | $$(TR) '?' ' ' > $$($1_$$d_LIST_FILE).tmp \
  86               && $(MV) $$($1_$$d_LIST_FILE).tmp $$($1_$$d_LIST_FILE) $$(NEWLINE) \
  87         )
  88         ifneq ($$($1_SPECIAL_INCLUDES), )
  89           $$(foreach i, $$($1_SPECIAL_INCLUDES), \
  90             $$(foreach d, $$($1_BASE_DIRS), \
  91               ($(CD) $$d && $(FIND) $$i >> $$($1_$$d_LIST_FILE)) ; ))
  92         endif
  93         ifeq ($$($1_SUBDIR)-$$($1_TYPE)-$$($1_UNZIP_DEBUGINFO), .-zip-false)
  94           # If no subdir is specified, zip can be done directly from BASE_DIRS.
  95           $$(foreach d, $$($1_BASE_DIRS), \
  96             ( $(CD) $$d \
  97             && $(ZIPEXE) -qru $$@ . -i@$$($1_$$d_LIST_FILE) \
  98             || test "$$$$?" = "12" )$$(NEWLINE))
  99         else ifeq ($$($1_SUBDIR)-$$($1_TYPE)-$$($1_UNZIP_DEBUGINFO)-$$(words $$($1_BASE_DIRS)), \
 100             .-tar.gz-false-1)
 101           # If no subdir is specified and only one BASE_DIR, tar.gz can be done
 102           # directly from BASE_DIR.
 103           $(CD) $$($1_BASE_DIRS) \
 104               && ( $(TAR) cf - \
 105                   -$(TAR_INCLUDE_PARAM) $$($1_$$($1_BASE_DIRS)_LIST_FILE) \
 106                   $(TAR_IGNORE_EXIT_VALUE) ) \
 107               | $(GZIP) > $$@
 108         else ifeq ($$($1_TYPE)-$(TAR_SUPPORTS_TRANSFORM)-$$($1_UNZIP_DEBUGINFO)-$$(words $$($1_BASE_DIRS)), \
 109             tar.gz-true-false-1)
 110           # If only one BASE_DIR, but with a SUBDIR set, tar.gz can use the
 111           # transform option to create bundle directly from the BASE_DIR.
 112           $(CD) $$($1_BASE_DIRS) \
 113               && ( $(TAR) cf - \
 114                   -$(TAR_INCLUDE_PARAM) $$($1_$$($1_BASE_DIRS)_LIST_FILE) \
 115                   $$(if $$($1_SUBDIR), --transform 's|^|$$($1_SUBDIR)/|S') \
 116                   $(TAR_IGNORE_EXIT_VALUE) ) \
 117               | $(GZIP) > $$@
 118         else
 119           # In all other cases, need to copy all files into a temporary location
 120           # before creation bundle.
 121           $(RM) -r $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
 122           $(MKDIR) -p $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
 123           $$(foreach d, $$($1_BASE_DIRS), \
 124             ( $(CD) $$d \
 125             && $(TAR) cf - -$(TAR_INCLUDE_PARAM) $$($1_$$d_LIST_FILE) \
 126                 $(TAR_IGNORE_EXIT_VALUE) ) \
 127             | ( $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) && $(TAR) xf - )$$(NEWLINE) )
 128           # Rename stripped pdb files
 129           ifeq ($(call isTargetOs, windows)+$(SHIP_DEBUG_SYMBOLS), true+public)
 130             for f in `$(FIND) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) -name "*.stripped.pdb"`; do \
 131               $(ECHO) Renaming $$$${f} to $$$${f%stripped.pdb}pdb $(LOG_INFO); \
 132               $(MV) $$$${f} $$$${f%stripped.pdb}pdb; \
 133             done
 134           endif
 135           # Unzip any zipped debuginfo files
 136           ifeq ($$($1_UNZIP_DEBUGINFO), true)
 137             for f in `$(FIND) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) -name "*.diz"`; do \
 138               $(CD) $$$${f%/*} && $(UNZIP) -q $$$${f} && $(RM) $$$${f}; \
 139             done
 140           endif
 141           ifeq ($$($1_TYPE), tar.gz)
 142             $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && \
 143             ( $(TAR) cf - \
 144                 $$(if $$($1_SUBDIR), $$($1_SUBDIR), .) $(TAR_IGNORE_EXIT_VALUE) ) \
 145             | $(GZIP) > $$@
 146           else ifeq ($$($1_TYPE), zip)
 147             $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && $(ZIPEXE) -qr $$@ .
 148           endif
 149         endif
 150 
 151   $1 += $$($1_OUTPUTDIR)/$$($1_BUNDLE_NAME)
 152 
 153 endef
 154 
 155 ################################################################################
 156 
 157 # On Macosx, we bundle up the macosx specific images which already have the
 158 # correct base directories.
 159 ifeq ($(call isTargetOs, macosx)+$(DEBUG_LEVEL), true+release)
 160   JDK_IMAGE_DIR := $(JDK_MACOSX_BUNDLE_DIR)
 161   JRE_IMAGE_DIR := $(JRE_MACOSX_BUNDLE_DIR)
 162   JDK_IMAGE_HOMEDIR := $(JDK_MACOSX_CONTENTS_DIR)/Home
 163   JRE_IMAGE_HOMEDIR := $(JRE_MACOSX_CONTENTS_DIR)/Home
 164   JDK_BUNDLE_SUBDIR :=
 165   JRE_BUNDLE_SUBDIR :=
 166   # In certain situations, the JDK_IMAGE_DIR points to an image without the
 167   # the symbols and demos. If so, the symobls and demos can be found in a
 168   # separate image. These variables allow for overriding from a custom makefile.
 169   JDK_SYMBOLS_IMAGE_DIR ?= $(JDK_IMAGE_DIR)
 170   JDK_DEMOS_IMAGE_DIR ?= $(JDK_IMAGE_DIR)
 171   JDK_DEMOS_IMAGE_HOMEDIR ?= $(JDK_DEMOS_IMAGE_DIR)/$(JDK_MACOSX_CONTENTS_SUBDIR)/Home
 172 else
 173   JDK_IMAGE_HOMEDIR := $(JDK_IMAGE_DIR)
 174   JRE_IMAGE_HOMEDIR := $(JRE_IMAGE_DIR)
 175   JDK_BUNDLE_SUBDIR := jdk-$(VERSION_NUMBER)
 176   JRE_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER)
 177   ifneq ($(DEBUG_LEVEL), release)
 178     JDK_BUNDLE_SUBDIR := $(JDK_BUNDLE_SUBDIR)/$(DEBUG_LEVEL)
 179     JRE_BUNDLE_SUBDIR := $(JRE_BUNDLE_SUBDIR)/$(DEBUG_LEVEL)
 180   endif
 181   # In certain situations, the JDK_IMAGE_DIR points to an image without the
 182   # the symbols and demos. If so, the symobls and demos can be found in a
 183   # separate image. These variables allow for overriding from a custom makefile.
 184   JDK_SYMBOLS_IMAGE_DIR ?= $(JDK_IMAGE_DIR)
 185   JDK_DEMOS_IMAGE_DIR ?= $(JDK_IMAGE_DIR)
 186   JDK_DEMOS_IMAGE_HOMEDIR ?= $(JDK_DEMOS_IMAGE_DIR)
 187 endif
 188 
 189 ################################################################################
 190 
 191 ifneq ($(filter product-bundles% legacy-bundles, $(MAKECMDGOALS)), )
 192 
 193   SYMBOLS_EXCLUDE_PATTERN := %.debuginfo %.diz %.map
 194 
 195   # There may be files with spaces in the names, so use ShellFindFiles
 196   # explicitly.
 197   ALL_JDK_FILES := $(call ShellFindFiles, $(JDK_IMAGE_DIR))
 198   ifneq ($(JDK_IMAGE_DIR), $(JDK_SYMBOLS_IMAGE_DIR))
 199     ALL_JDK_SYMBOLS_FILES := $(call ShellFindFiles, $(JDK_SYMBOLS_IMAGE_DIR))
 200   else
 201     ALL_JDK_SYMBOLS_FILES := $(ALL_JDK_FILES)
 202   endif
 203   ifneq ($(JDK_IMAGE_DIR), $(JDK_DEMOS_IMAGE_DIR))
 204     ALL_JDK_DEMOS_FILES := $(call ShellFindFiles, $(JDK_DEMOS_IMAGE_DIR))
 205   else
 206     ALL_JDK_DEMOS_FILES := $(ALL_JDK_FILES)
 207   endif
 208 
 209   # Create special filter rules when dealing with unzipped .dSYM directories on
 210   # macosx
 211   ifeq ($(call isTargetOs, macosx), true)
 212     ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), false)
 213       JDK_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \
 214           $(call containing, .dSYM/, $(patsubst $(JDK_IMAGE_DIR)/%, %, \
 215           $(ALL_JDK_SYMBOLS_FILES))))
 216     endif
 217   endif
 218 
 219   # Create special filter rules when dealing with debug symbols on windows
 220   ifeq ($(call isTargetOs, windows), true)
 221     ifeq ($(SHIP_DEBUG_SYMBOLS), )
 222       JDK_SYMBOLS_EXCLUDE_PATTERN := %.pdb
 223     else
 224       ifeq ($(SHIP_DEBUG_SYMBOLS), public)
 225         JDK_SYMBOLS_EXCLUDE_PATTERN := \
 226             $(filter-out \
 227                 %.stripped.pdb, \
 228                 $(filter %.pdb, $(ALL_JDK_FILES)) \
 229             )
 230       endif
 231     endif
 232   endif
 233 
 234   JDK_BUNDLE_FILES := \
 235       $(filter-out \
 236           $(JDK_SYMBOLS_EXCLUDE_PATTERN) \
 237           $(JDK_EXTRA_EXCLUDES) \
 238           $(SYMBOLS_EXCLUDE_PATTERN) \
 239           $(JDK_IMAGE_HOMEDIR)/demo/% \
 240           , \
 241           $(ALL_JDK_FILES) \
 242       )
 243 
 244   JDK_SYMBOLS_BUNDLE_FILES := \
 245       $(filter \
 246           $(JDK_SYMBOLS_EXCLUDE_PATTERN) \
 247           $(SYMBOLS_EXCLUDE_PATTERN) \
 248           , \
 249           $(filter-out \
 250               $(JDK_IMAGE_HOMEDIR)/demo/% %.stripped.pdb \
 251               , \
 252               $(ALL_JDK_SYMBOLS_FILES) \
 253           ) \
 254       ) \
 255       $(call FindFiles, $(SYMBOLS_IMAGE_DIR))
 256 
 257   TEST_DEMOS_BUNDLE_FILES := $(filter $(JDK_DEMOS_IMAGE_HOMEDIR)/demo/%, \
 258       $(ALL_JDK_DEMOS_FILES))
 259 
 260   ALL_JRE_FILES := $(call ShellFindFiles, $(JRE_IMAGE_DIR))
 261 
 262   # Create special filter rules when dealing with unzipped .dSYM directories on
 263   # macosx
 264   ifeq ($(OPENJDK_TARGET_OS), macosx)
 265     ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), false)
 266       JRE_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \
 267           $(call containing, .dSYM/, $(patsubst $(JRE_IMAGE_DIR)/%, %, $(ALL_JRE_FILES))))
 268     endif
 269   endif
 270 
 271   # Create special filter rules when dealing with debug symbols on windows
 272   ifeq ($(call isTargetOs, windows), true)
 273     ifeq ($(SHIP_DEBUG_SYMBOLS), )
 274       JRE_SYMBOLS_EXCLUDE_PATTERN := %.pdb
 275     else
 276       ifeq ($(SHIP_DEBUG_SYMBOLS), public)
 277         JRE_SYMBOLS_EXCLUDE_PATTERN := \
 278             $(filter-out \
 279                 %.stripped.pdb, \
 280                 $(filter %.pdb, $(ALL_JRE_FILES)) \
 281             )
 282       endif
 283     endif
 284   endif
 285 
 286   JRE_BUNDLE_FILES := $(filter-out \
 287       $(JRE_SYMBOLS_EXCLUDE_PATTERN) \
 288       $(SYMBOLS_EXCLUDE_PATTERN), \
 289       $(ALL_JRE_FILES))
 290 
 291   # On Macosx release builds, when there is a code signing certificate available,
 292   # the final bundle layout can be signed.
 293   SIGN_BUNDLE := false
 294   ifeq ($(call isTargetOs, macosx)+$(DEBUG_LEVEL), true+release)
 295     ifneq ($(CODESIGN), )
 296       SIGN_BUNDLE := true
 297     endif
 298   endif
 299 
 300   ifeq ($(SIGN_BUNDLE), true)
 301     # Macosx release build and code signing available.
 302 
 303     ################################################################################
 304     # JDK bundle
 305     $(eval $(call SetupCopyFiles, CREATE_JDK_BUNDLE_DIR_SIGNED, \
 306         SRC := $(JDK_IMAGE_DIR), \
 307         FILES := $(JDK_BUNDLE_FILES), \
 308         DEST := $(JDK_MACOSX_BUNDLE_DIR_SIGNED), \
 309     ))
 310 
 311     JDK_SIGNED_CODE_RESOURCES := \
 312         $(JDK_MACOSX_BUNDLE_DIR_SIGNED)/$(JDK_MACOSX_CONTENTS_SUBDIR)/_CodeSignature/CodeResources
 313 
 314     $(JDK_SIGNED_CODE_RESOURCES): $(CREATE_JDK_BUNDLE_DIR_SIGNED)
 315         $(call LogWarn, Signing $(JDK_BUNDLE_NAME))
 316         $(CODESIGN) -s "$(MACOSX_CODESIGN_IDENTITY)" \
 317             --timestamp --options runtime --deep --force \
 318             $(JDK_MACOSX_BUNDLE_DIR_SIGNED)/$(JDK_MACOSX_BUNDLE_TOP_DIR) $(LOG_DEBUG)
 319         $(TOUCH) $@
 320 
 321     $(eval $(call SetupBundleFile, BUILD_JDK_BUNDLE, \
 322         BUNDLE_NAME := $(JDK_BUNDLE_NAME), \
 323         FILES := \
 324             $(CREATE_JDK_BUNDLE_DIR_SIGNED) \
 325             $(JDK_SIGNED_CODE_RESOURCES), \
 326         BASE_DIRS := $(JDK_MACOSX_BUNDLE_DIR_SIGNED), \
 327         SUBDIR := $(JDK_BUNDLE_SUBDIR), \
 328     ))
 329 
 330     PRODUCT_TARGETS += $(BUILD_JDK_BUNDLE)
 331 
 332     ################################################################################
 333     # JRE bundle
 334     $(eval $(call SetupCopyFiles, CREATE_JRE_BUNDLE_DIR_SIGNED, \
 335         SRC := $(JRE_IMAGE_DIR), \
 336         FILES := $(JRE_BUNDLE_FILES), \
 337         DEST := $(JRE_MACOSX_BUNDLE_DIR_SIGNED), \
 338     ))
 339 
 340     JRE_SIGNED_CODE_RESOURCES := \
 341         $(JRE_MACOSX_BUNDLE_DIR_SIGNED)/$(JRE_MACOSX_CONTENTS_SUBDIR)/_CodeSignature/CodeResources
 342 
 343     $(JRE_SIGNED_CODE_RESOURCES): $(CREATE_JRE_BUNDLE_DIR_SIGNED)
 344         $(call LogWarn, Signing $(JRE_BUNDLE_NAME))
 345         $(CODESIGN) -s "$(MACOSX_CODESIGN_IDENTITY)" \
 346             --timestamp --options runtime --deep --force \
 347             $(JRE_MACOSX_BUNDLE_DIR_SIGNED)/$(JRE_MACOSX_BUNDLE_TOP_DIR) $(LOG_DEBUG)
 348         $(TOUCH) $@
 349 
 350     $(eval $(call SetupBundleFile, BUILD_JRE_BUNDLE, \
 351         BUNDLE_NAME := $(JRE_BUNDLE_NAME), \
 352         FILES := \
 353             $(CREATE_JRE_BUNDLE_DIR_SIGNED) \
 354             $(JRE_SIGNED_CODE_RESOURCES), \
 355         BASE_DIRS := $(JRE_MACOSX_BUNDLE_DIR_SIGNED), \
 356         SUBDIR := $(JRE_BUNDLE_SUBDIR), \
 357     ))
 358 
 359     LEGACY_TARGETS += $(BUILD_JRE_BUNDLE)
 360   else
 361     # Not a Macosx release build or code signing not available.
 362     $(eval $(call SetupBundleFile, BUILD_JDK_BUNDLE, \
 363         BUNDLE_NAME := $(JDK_BUNDLE_NAME), \
 364         FILES := $(JDK_BUNDLE_FILES), \
 365         SPECIAL_INCLUDES := $(JDK_SPECIAL_INCLUDES), \
 366         BASE_DIRS := $(JDK_IMAGE_DIR), \
 367         SUBDIR := $(JDK_BUNDLE_SUBDIR), \
 368     ))
 369 
 370     PRODUCT_TARGETS += $(BUILD_JDK_BUNDLE)
 371 
 372     $(eval $(call SetupBundleFile, BUILD_JRE_BUNDLE, \
 373         BUNDLE_NAME := $(JRE_BUNDLE_NAME), \
 374         FILES := $(JRE_BUNDLE_FILES), \
 375         BASE_DIRS := $(JRE_IMAGE_DIR), \
 376         SUBDIR := $(JRE_BUNDLE_SUBDIR), \
 377     ))
 378 
 379     LEGACY_TARGETS += $(BUILD_JRE_BUNDLE)
 380   endif
 381 
 382   ifeq ($(COPY_DEBUG_SYMBOLS), true)
 383     $(eval $(call SetupBundleFile, BUILD_JDK_SYMBOLS_BUNDLE, \
 384         BUNDLE_NAME := $(JDK_SYMBOLS_BUNDLE_NAME), \
 385         FILES := $(JDK_SYMBOLS_BUNDLE_FILES), \
 386         BASE_DIRS := $(JDK_SYMBOLS_IMAGE_DIR) $(wildcard $(SYMBOLS_IMAGE_DIR)), \
 387         SUBDIR := $(JDK_BUNDLE_SUBDIR), \
 388         UNZIP_DEBUGINFO := true, \
 389     ))
 390 
 391     PRODUCT_TARGETS += $(BUILD_JDK_SYMBOLS_BUNDLE)
 392   endif
 393 
 394   # The demo bundle is only created to support client tests. Ideally it should
 395   # be built with the main test bundle, but since the prerequisites match
 396   # better with the product build, it makes more sense to keep it there for now.
 397   $(eval $(call SetupBundleFile, BUILD_TEST_DEMOS_BUNDLE, \
 398       BUNDLE_NAME := $(TEST_DEMOS_BUNDLE_NAME), \
 399       FILES := $(TEST_DEMOS_BUNDLE_FILES), \
 400       BASE_DIRS := $(JDK_DEMOS_IMAGE_DIR), \
 401       SUBDIR := $(JDK_BUNDLE_SUBDIR), \
 402   ))
 403 
 404   PRODUCT_TARGETS += $(BUILD_TEST_DEMOS_BUNDLE)
 405 endif
 406 
 407 ################################################################################
 408 
 409 ifneq ($(filter test-bundles, $(MAKECMDGOALS)), )
 410   TEST_BUNDLE_FILES := $(call FindFiles, $(TEST_IMAGE_DIR))
 411 
 412   $(eval $(call SetupBundleFile, BUILD_TEST_BUNDLE, \
 413       BUNDLE_NAME := $(TEST_BUNDLE_NAME), \
 414       FILES := $(TEST_BUNDLE_FILES), \
 415       BASE_DIRS := $(TEST_IMAGE_DIR), \
 416   ))
 417 
 418   TEST_TARGETS += $(BUILD_TEST_BUNDLE)
 419 endif
 420 
 421 ################################################################################
 422 
 423 ifneq ($(filter docs-bundles, $(MAKECMDGOALS)), )
 424   DOCS_BUNDLE_FILES := $(call FindFiles, $(DOCS_IMAGE_DIR))
 425 
 426   $(eval $(call SetupBundleFile, BUILD_DOCS_BUNDLE, \
 427       BUNDLE_NAME := $(DOCS_BUNDLE_NAME), \
 428       FILES := $(DOCS_BUNDLE_FILES), \
 429       BASE_DIRS := $(DOCS_IMAGE_DIR), \
 430       SUBDIR := docs, \
 431   ))
 432 
 433   DOCS_TARGETS += $(BUILD_DOCS_BUNDLE)
 434 endif
 435 
 436 ################################################################################
 437 
 438 ifneq ($(filter jcov-bundles, $(MAKECMDGOALS)), )
 439   JCOV_BUNDLE_FILES := $(call FindFiles, $(JCOV_IMAGE_DIR))
 440 
 441   $(eval $(call SetupBundleFile, BUILD_JCOV_BUNDLE, \
 442       BUNDLE_NAME := $(JCOV_BUNDLE_NAME), \
 443       FILES := $(JCOV_BUNDLE_FILES), \
 444       BASE_DIRS := $(JCOV_IMAGE_DIR), \
 445       SUBDIR := $(JDK_BUNDLE_SUBDIR), \
 446   ))
 447 
 448   JCOV_TARGETS += $(BUILD_JCOV_BUNDLE)
 449 endif
 450 
 451 ################################################################################
 452 
 453 ifneq ($(filter static-libs-bundles, $(MAKECMDGOALS)), )
 454   STATIC_LIBS_BUNDLE_FILES := $(call FindFiles, $(STATIC_LIBS_IMAGE_DIR))
 455 
 456   ifeq ($(OPENJDK_TARGET_OS)-$(DEBUG_LEVEL), macosx-release)
 457     STATIC_LIBS_BUNDLE_SUBDIR := $(JDK_MACOSX_CONTENTS_SUBDIR)/Home
 458   else
 459     STATIC_LIBS_BUNDLE_SUBDIR := $(JDK_BUNDLE_SUBDIR)
 460   endif
 461 
 462   $(eval $(call SetupBundleFile, BUILD_STATIC_LIBS_BUNDLE, \
 463       BUNDLE_NAME := $(STATIC_LIBS_BUNDLE_NAME), \
 464       FILES := $(STATIC_LIBS_BUNDLE_FILES), \
 465       BASE_DIRS := $(STATIC_LIBS_IMAGE_DIR), \
 466       SUBDIR := $(STATIC_LIBS_BUNDLE_SUBDIR), \
 467   ))
 468 
 469   STATIC_LIBS_TARGETS += $(BUILD_STATIC_LIBS_BUNDLE)
 470 endif
 471 
 472 ################################################################################
 473 
 474 # Hook to include the corresponding custom file, if present.
 475 $(eval $(call IncludeCustomExtension, Bundles.gmk))
 476 
 477 ################################################################################
 478 
 479 product-bundles: $(PRODUCT_TARGETS)
 480 legacy-bundles: $(LEGACY_TARGETS)
 481 test-bundles: $(TEST_TARGETS)
 482 docs-bundles: $(DOCS_TARGETS)
 483 static-libs-bundles: $(STATIC_LIBS_TARGETS)
 484 jcov-bundles: $(JCOV_TARGETS)
 485 
 486 .PHONY: all default product-bundles test-bundles docs-bundles \
 487     static-libs-bundles jcov-bundles