annotate make/Bundles.gmk @ 47284:59bdd7243c52

Backed out changeset ed420ea71310
author mcimadamore
date Mon, 25 Sep 2017 15:37:25 +0100
parents 92fd0e04e0e1
children b90a1b5b8142
rev   line source
erikj@37972 1 #
erikj@37972 2 # Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
erikj@37972 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@37972 4 #
erikj@37972 5 # This code is free software; you can redistribute it and/or modify it
erikj@37972 6 # under the terms of the GNU General Public License version 2 only, as
erikj@37972 7 # published by the Free Software Foundation. Oracle designates this
erikj@37972 8 # particular file as subject to the "Classpath" exception as provided
erikj@37972 9 # by Oracle in the LICENSE file that accompanied this code.
erikj@37972 10 #
erikj@37972 11 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@37972 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@37972 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@37972 14 # version 2 for more details (a copy is included in the LICENSE file that
erikj@37972 15 # accompanied this code).
erikj@37972 16 #
erikj@37972 17 # You should have received a copy of the GNU General Public License version
erikj@37972 18 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@37972 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@37972 20 #
erikj@37972 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@37972 22 # or visit www.oracle.com if you need additional information or have any
erikj@37972 23 # questions.
erikj@37972 24 #
erikj@37972 25
erikj@37972 26 default: all
erikj@37972 27
erikj@37972 28 include $(SPEC)
erikj@37972 29 include MakeBase.gmk
erikj@37972 30
erikj@37972 31 PRODUCT_TARGETS :=
erikj@37972 32 TEST_TARGETS :=
erikj@37972 33 DOCS_TARGETS :=
erikj@37972 34
erikj@37972 35 # On Windows tar frequently complains that "file changed as we read it" for
erikj@37972 36 # some random source files. This seems to be cause by anti virus scanners and
erikj@37972 37 # is most likely safe to ignore. When it happens, tar returns '1'.
erikj@37972 38 ifeq ($(OPENJDK_BUILD_OS), windows)
erikj@37972 39 TAR_IGNORE_EXIT_VALUE := || test "$$$$?" = "1"
erikj@37972 40 endif
erikj@37972 41
erikj@37972 42 # Hook to include the corresponding custom file, if present.
erikj@37972 43 $(eval $(call IncludeCustomExtension, , Bundles-pre.gmk))
erikj@37972 44 ################################################################################
erikj@37972 45 # BUNDLE : Name of bundle to create
erikj@42506 46 # FILES : Files in BASE_DIRS to add to bundle
erikj@42506 47 # SPECIAL_INCLUDES : List of directories inside BASE_DIRS to look for additional
erikj@37972 48 # files in. These files will not get proper dependency handling. Use when
erikj@37972 49 # files or directories may contain spaces.
erikj@42506 50 # BASE_DIRS : Base directories for the root dir in the bundle.
erikj@37972 51 # SUBDIR : Optional name of root dir in bundle.
erikj@37972 52 SetupBundleFile = $(NamedParamsMacroTemplate)
erikj@37972 53 define SetupBundleFileBody
erikj@37972 54
erikj@42506 55 $$(foreach d, $$($1_BASE_DIRS), \
erikj@42506 56 $$(eval $1_$$d_RELATIVE_FILES := $$$$(patsubst $$d/%, %, \
erikj@42506 57 $$$$(filter $$d/%, $$$$($1_FILES)))) \
erikj@42507 58 $$(eval $1_$$d_LIST_FILE := \
mcimadamore@47284 59 $(SUPPORT_OUTPUTDIR)/bundles/_$1_$$$$(subst /,_,$$$$(patsubst $(OUTPUT_ROOT)/%,%,$$d)_files)) \
erikj@42506 60 )
erikj@37972 61
erikj@37972 62 ifneq ($$(filter %.tar.gz, $$($1_BUNDLE_NAME)), )
erikj@37972 63 $1_TYPE := tar.gz
erikj@37972 64 else ifneq ($$(filter %.zip, $$($1_BUNDLE_NAME)), )
erikj@37972 65 $1_TYPE := zip
erikj@37972 66 else
erikj@37972 67 $$(error Unknown bundle type $$($1_BUNDLE_NAME))
erikj@37972 68 endif
erikj@37972 69
erikj@37972 70 $$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false)
erikj@37972 71
erikj@37972 72 $(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES)
erikj@42506 73 $$(foreach d, $$($1_BASE_DIRS), \
erikj@42506 74 $$(eval $$(call ListPathsSafely, \
erikj@42506 75 $1_$$d_RELATIVE_FILES, $$($1_$$d_LIST_FILE))) \
erikj@42506 76 )
erikj@37972 77 $$(call MakeDir, $$(@D))
erikj@37972 78 ifneq ($$($1_SPECIAL_INCLUDES), )
erikj@37972 79 $$(foreach i, $$($1_SPECIAL_INCLUDES), \
erikj@43051 80 $$(foreach d, $$($1_BASE_DIRS), \
erikj@43051 81 ($(CD) $$d && $(FIND) $$i >> $$($1_$$d_LIST_FILE)) ; ))
erikj@37972 82 endif
erikj@42506 83 ifeq ($$($1_SUBDIR)-$$($1_TYPE)-$$($1_UNZIP_DEBUGINFO), .-zip-false)
erikj@42506 84 # If no subdir is specified, zip can be done directly from BASE_DIRS.
erikj@42506 85 $$(foreach d, $$($1_BASE_DIRS), \
erikj@42506 86 ( $(CD) $$d \
erikj@42506 87 && $(ZIPEXE) -qru $$@ . -i@$$($1_$$d_LIST_FILE) \
erikj@42506 88 || test "$$$$?" = "12" )$$(NEWLINE))
erikj@42506 89 else ifeq ($$($1_SUBDIR)-$$($1_TYPE)-$$($1_UNZIP_DEBUGINFO)-$$(words $$($1_BASE_DIRS)), \
erikj@42506 90 .-tar.gz-false-1)
erikj@42506 91 # If no subdir is specified and only one BASE_DIR, tar.gz can be done
erikj@42506 92 # directly from BASE_DIR.
erikj@42506 93 $(CD) $$($1_BASE_DIRS) \
erikj@42506 94 && ( $(TAR) cf - $(TAR_CREATE_EXTRA_PARAM) \
erikj@42506 95 -$(TAR_INCLUDE_PARAM) $$($1_$$($1_BASE_DIRS)_LIST_FILE) \
erikj@42506 96 $(TAR_IGNORE_EXIT_VALUE) ) \
erikj@42506 97 | $(GZIP) > $$@
erikj@42506 98 else ifeq ($$($1_TYPE)-$(TAR_SUPPORTS_TRANSFORM)-$$($1_UNZIP_DEBUGINFO)-$$(words $$($1_BASE_DIRS)), \
erikj@42506 99 tar.gz-true-false-1)
erikj@42506 100 # If only one BASE_DIR, but with a SUBDIR set, tar.gz can use the
erikj@42506 101 # transform option to create bundle directly from the BASE_DIR.
erikj@42506 102 $(CD) $$($1_BASE_DIRS) \
erikj@42506 103 && ( $(TAR) cf - $(TAR_CREATE_EXTRA_PARAM) \
erikj@42506 104 -$(TAR_INCLUDE_PARAM) $$($1_$$($1_BASE_DIRS)_LIST_FILE) \
erikj@42849 105 $$(if $$($1_SUBDIR), --transform 's|^|$$($1_SUBDIR)/|S') \
erikj@42506 106 $(TAR_IGNORE_EXIT_VALUE) ) \
erikj@42506 107 | $(GZIP) > $$@
erikj@42506 108 else
erikj@42506 109 # In all other cases, need to copy all files into a temporary location
erikj@42506 110 # before creation bundle.
erikj@42506 111 $(RM) -r $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
erikj@42506 112 $(MKDIR) -p $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
erikj@42506 113 $$(foreach d, $$($1_BASE_DIRS), \
erikj@42506 114 ( $(CD) $$d \
erikj@42506 115 && $(TAR) cf - -$(TAR_INCLUDE_PARAM) $$($1_$$d_LIST_FILE) \
erikj@42506 116 $(TAR_IGNORE_EXIT_VALUE) ) \
erikj@42506 117 | ( $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) && $(TAR) xf - )$$(NEWLINE) )
erikj@42506 118 # Unzip any zipped debuginfo files
erikj@42506 119 ifeq ($$($1_UNZIP_DEBUGINFO), true)
erikj@42506 120 for f in `$(FIND) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) -name "*.diz"`; do \
erikj@42506 121 $(CD) $$$${f%/*} && $(UNZIP) -q $$$${f} && $(RM) $$$${f}; \
erikj@42506 122 done
erikj@37972 123 endif
erikj@37972 124 ifeq ($$($1_TYPE), tar.gz)
erikj@42506 125 $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && \
erikj@42506 126 ( $(TAR) cf - $(TAR_CREATE_EXTRA_PARAM) \
erikj@42506 127 $$(if $$($1_SUBDIR), $$($1_SUBDIR), .) $(TAR_IGNORE_EXIT_VALUE) ) \
erikj@42506 128 | $(GZIP) > $$@
erikj@37972 129 else ifeq ($$($1_TYPE), zip)
erikj@42506 130 $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && $(ZIPEXE) -qr $$@ .
erikj@37972 131 endif
erikj@37972 132 endif
erikj@37972 133
erikj@37972 134 $1 += $(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME)
erikj@37972 135
erikj@37972 136 endef
erikj@37972 137
erikj@37972 138 ################################################################################
erikj@37972 139
erikj@37972 140 # On Macosx, we bundle up the macosx specific images which already have the
erikj@37972 141 # correct base directories.
erikj@37982 142 ifeq ($(OPENJDK_TARGET_OS)-$(DEBUG_LEVEL), macosx-release)
erikj@37972 143 JDK_IMAGE_DIR := $(JDK_MACOSX_BUNDLE_DIR)
erikj@37972 144 JRE_IMAGE_DIR := $(JRE_MACOSX_BUNDLE_DIR)
erikj@37972 145 JDK_IMAGE_HOMEDIR := $(JDK_MACOSX_CONTENTS_DIR)/Home
erikj@37972 146 JRE_IMAGE_HOMEDIR := $(JRE_MACOSX_CONTENTS_DIR)/Home
erikj@37972 147 JDK_BUNDLE_SUBDIR :=
erikj@37972 148 JRE_BUNDLE_SUBDIR :=
erikj@37972 149 else
erikj@37972 150 JDK_IMAGE_HOMEDIR := $(JDK_IMAGE_DIR)
erikj@37972 151 JRE_IMAGE_HOMEDIR := $(JRE_IMAGE_DIR)
erikj@37972 152 JDK_BUNDLE_SUBDIR := jdk-$(VERSION_NUMBER)
erikj@37972 153 JRE_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER)
erikj@43043 154 JRE_COMPACT1_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER)-compact1
erikj@43043 155 JRE_COMPACT2_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER)-compact2
erikj@43043 156 JRE_COMPACT3_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER)-compact3
erikj@37972 157 ifneq ($(DEBUG_LEVEL), release)
erikj@37972 158 JDK_BUNDLE_SUBDIR := $(JDK_BUNDLE_SUBDIR)/$(DEBUG_LEVEL)
erikj@37972 159 JRE_BUNDLE_SUBDIR := $(JRE_BUNDLE_SUBDIR)/$(DEBUG_LEVEL)
erikj@37972 160 endif
erikj@37972 161 endif
erikj@37972 162
erikj@37972 163 ################################################################################
erikj@37972 164
erikj@37972 165 ifneq ($(filter product-bundles, $(MAKECMDGOALS)), )
erikj@37972 166 $(eval $(call FillCacheFind, $(IMAGES_OUTPUTDIR)))
erikj@37972 167
erikj@37972 168 SYMBOLS_EXCLUDE_PATTERN := %.debuginfo %.diz %.pdb %.map
erikj@37972 169
erikj@37972 170 ALL_JDK_FILES := $(call CacheFind, $(JDK_IMAGE_DIR))
erikj@37972 171
erikj@37972 172 # Create special filter rules when dealing with unzipped .dSYM directories on
erikj@37972 173 # macosx
erikj@37972 174 ifeq ($(OPENJDK_TARGET_OS), macosx)
erikj@37972 175 ifeq ($(ZIP_DEBUGINFO_FILES), false)
erikj@37972 176 JDK_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \
erikj@37972 177 $(call containing, .dSYM/, $(patsubst $(JDK_IMAGE_DIR)/%, %, $(ALL_JDK_FILES))))
erikj@37972 178 endif
erikj@37972 179 endif
erikj@37972 180
erikj@37972 181 JDK_BUNDLE_FILES := \
erikj@37972 182 $(filter-out \
erikj@37972 183 $(JDK_SYMBOLS_EXCLUDE_PATTERN) \
erikj@37972 184 $(JDK_EXTRA_EXCLUDES) \
erikj@37972 185 $(SYMBOLS_EXCLUDE_PATTERN) \
tbell@45097 186 $(JDK_IMAGE_HOMEDIR)/demo/% \
erikj@37972 187 , \
erikj@37972 188 $(ALL_JDK_FILES) \
erikj@37972 189 )
erikj@37972 190 JDK_SYMBOLS_BUNDLE_FILES := \
erikj@37972 191 $(filter \
erikj@37972 192 $(JDK_SYMBOLS_EXCLUDE_PATTERN) \
erikj@37972 193 $(SYMBOLS_EXCLUDE_PATTERN) \
erikj@37972 194 , \
erikj@39925 195 $(filter-out \
shurailine@44724 196 $(JDK_IMAGE_HOMEDIR)/demo/% \
erikj@39925 197 , \
erikj@39925 198 $(ALL_JDK_FILES) \
erikj@39925 199 ) \
erikj@37972 200 ) \
erikj@37972 201 $(call CacheFind, $(SYMBOLS_IMAGE_DIR))
erikj@37972 202
erikj@37972 203 ALL_JRE_FILES := $(call CacheFind, $(JRE_IMAGE_DIR))
erikj@37972 204
erikj@37972 205 # Create special filter rules when dealing with unzipped .dSYM directories on
erikj@37972 206 # macosx
erikj@37972 207 ifeq ($(OPENJDK_TARGET_OS), macosx)
erikj@37972 208 ifeq ($(ZIP_DEBUGINFO_FILES), false)
erikj@37972 209 JRE_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \
erikj@37972 210 $(call containing, .dSYM/, $(patsubst $(JRE_IMAGE_DIR)/%, %, $(ALL_JRE_FILES))))
erikj@37972 211 endif
erikj@37972 212 endif
erikj@37972 213
erikj@37972 214 JRE_BUNDLE_FILES := $(filter-out \
erikj@37972 215 $(JRE_SYMBOLS_EXCLUDE_PATTERN) \
erikj@37972 216 $(SYMBOLS_EXCLUDE_PATTERN), \
erikj@37972 217 $(ALL_JRE_FILES))
erikj@37972 218 JRE_SYMBOLS_BUNDLE_FILES := $(filter \
erikj@37972 219 $(JRE_SYMBOLS_EXCLUDE_PATTERN) \
erikj@37972 220 $(SYMBOLS_EXCLUDE_PATTERN), \
erikj@37972 221 $(ALL_JRE_FILES))
erikj@37972 222
erikj@37972 223 $(eval $(call SetupBundleFile, BUILD_JDK_BUNDLE, \
erikj@37972 224 BUNDLE_NAME := $(JDK_BUNDLE_NAME), \
erikj@37972 225 FILES := $(JDK_BUNDLE_FILES), \
erikj@37972 226 SPECIAL_INCLUDES := $(JDK_SPECIAL_INCLUDES), \
erikj@42506 227 BASE_DIRS := $(JDK_IMAGE_DIR), \
erikj@37972 228 SUBDIR := $(JDK_BUNDLE_SUBDIR), \
erikj@37972 229 ))
erikj@37972 230
erikj@37972 231 PRODUCT_TARGETS += $(BUILD_JDK_BUNDLE)
erikj@37972 232
erikj@37972 233 $(eval $(call SetupBundleFile, BUILD_JRE_BUNDLE, \
erikj@37972 234 BUNDLE_NAME := $(JRE_BUNDLE_NAME), \
erikj@37972 235 FILES := $(JRE_BUNDLE_FILES), \
erikj@42506 236 BASE_DIRS := $(JRE_IMAGE_DIR), \
erikj@37972 237 SUBDIR := $(JRE_BUNDLE_SUBDIR), \
erikj@37972 238 ))
erikj@37972 239
erikj@37972 240 PRODUCT_TARGETS += $(BUILD_JRE_BUNDLE)
erikj@37972 241
erikj@37972 242 $(eval $(call SetupBundleFile, BUILD_JDK_SYMBOLS_BUNDLE, \
erikj@37972 243 BUNDLE_NAME := $(JDK_SYMBOLS_BUNDLE_NAME), \
erikj@37972 244 FILES := $(JDK_SYMBOLS_BUNDLE_FILES), \
erikj@42506 245 BASE_DIRS := $(JDK_IMAGE_DIR) $(wildcard $(SYMBOLS_IMAGE_DIR)), \
erikj@37972 246 SUBDIR := $(JDK_BUNDLE_SUBDIR), \
erikj@37972 247 UNZIP_DEBUGINFO := true, \
erikj@37972 248 ))
erikj@37972 249
erikj@37972 250 PRODUCT_TARGETS += $(BUILD_JDK_SYMBOLS_BUNDLE)
erikj@37972 251
erikj@37972 252 $(eval $(call SetupBundleFile, BUILD_JRE_SYMBOLS_BUNDLE, \
erikj@37972 253 BUNDLE_NAME := $(JRE_SYMBOLS_BUNDLE_NAME), \
erikj@37972 254 FILES := $(JRE_SYMBOLS_BUNDLE_FILES), \
erikj@42506 255 BASE_DIRS := $(JRE_IMAGE_DIR), \
erikj@37972 256 SUBDIR := $(JRE_BUNDLE_SUBDIR), \
erikj@37972 257 UNZIP_DEBUGINFO := true, \
erikj@37972 258 ))
erikj@37972 259
erikj@37972 260 PRODUCT_TARGETS += $(BUILD_JRE_SYMBOLS_BUNDLE)
erikj@37972 261
erikj@37972 262 endif
erikj@37972 263
erikj@37972 264 ################################################################################
erikj@37972 265
erikj@43043 266 ifneq ($(filter profiles-bundles, $(MAKECMDGOALS)), )
erikj@43043 267 ifeq ($(OPENJDK_TARGET_OS), macosx)
erikj@43043 268 $(error Creating compact profiles bundles on macosx is unsupported)
erikj@43043 269 endif
erikj@43043 270
erikj@43043 271 define GenerateCompactProfilesBundles
erikj@43043 272 ALL_JRE_COMPACT$1_FILES := $$(call CacheFind, $$(JRE_COMPACT$1_IMAGE_DIR))
erikj@43043 273
erikj@43043 274 JRE_COMPACT$1_BUNDLE_FILES := $$(filter-out \
erikj@43043 275 $$(SYMBOLS_EXCLUDE_PATTERN), \
erikj@43043 276 $$(ALL_JRE_COMPACT$1_FILES))
erikj@43043 277
erikj@43043 278 $$(eval $$(call SetupBundleFile, BUILD_JRE_COMPACT$1_BUNDLE, \
erikj@43043 279 BUNDLE_NAME := $$(JRE_COMPACT$1_BUNDLE_NAME), \
erikj@43043 280 FILES := $$(JRE_COMPACT$1_BUNDLE_FILES), \
erikj@43043 281 BASE_DIRS := $$(JRE_COMPACT$1_IMAGE_DIR), \
erikj@43043 282 SUBDIR := $$(JRE_COMPACT$1_BUNDLE_SUBDIR), \
erikj@43043 283 ))
erikj@43043 284
erikj@43043 285 PROFILES_TARGETS += $$(BUILD_JRE_COMPACT$1_BUNDLE)
erikj@43043 286 endef
erikj@43043 287
erikj@43043 288 $(eval $(call GenerateCompactProfilesBundles,1))
erikj@43043 289 $(eval $(call GenerateCompactProfilesBundles,2))
erikj@43043 290 $(eval $(call GenerateCompactProfilesBundles,3))
erikj@43043 291 endif
erikj@43043 292
erikj@43043 293 ################################################################################
erikj@43043 294
erikj@37972 295 ifneq ($(filter test-bundles, $(MAKECMDGOALS)), )
erikj@37972 296 TEST_BUNDLE_FILES := $(call CacheFind, $(TEST_IMAGE_DIR))
erikj@37972 297
erikj@37972 298 $(eval $(call SetupBundleFile, BUILD_TEST_BUNDLE, \
erikj@37972 299 BUNDLE_NAME := $(TEST_BUNDLE_NAME), \
erikj@41875 300 FILES := $(TEST_BUNDLE_FILES), \
erikj@42506 301 BASE_DIRS := $(TEST_IMAGE_DIR), \
erikj@37972 302 ))
erikj@37972 303
erikj@37972 304 TEST_TARGETS += $(BUILD_TEST_BUNDLE)
erikj@37972 305 endif
erikj@37972 306
erikj@37972 307 ################################################################################
erikj@37972 308
erikj@37972 309 ifneq ($(filter docs-bundles, $(MAKECMDGOALS)), )
erikj@37972 310 DOCS_BUNDLE_FILES := $(call CacheFind, $(DOCS_IMAGE_DIR))
erikj@37972 311
erikj@37972 312 $(eval $(call SetupBundleFile, BUILD_DOCS_BUNDLE, \
erikj@37972 313 BUNDLE_NAME := $(DOCS_BUNDLE_NAME), \
erikj@37972 314 FILES := $(DOCS_BUNDLE_FILES), \
erikj@42506 315 BASE_DIRS := $(DOCS_IMAGE_DIR), \
erikj@37972 316 SUBDIR := docs, \
erikj@37972 317 ))
erikj@37972 318
erikj@37972 319 DOCS_TARGETS += $(BUILD_DOCS_BUNDLE)
erikj@37972 320 endif
erikj@37972 321
erikj@37972 322 ################################################################################
erikj@37972 323
erikj@37972 324 # Hook to include the corresponding custom file, if present.
erikj@37972 325 $(eval $(call IncludeCustomExtension, , Bundles.gmk))
erikj@37972 326
erikj@37972 327 ################################################################################
erikj@37972 328
erikj@37972 329 product-bundles: $(PRODUCT_TARGETS)
erikj@43043 330 profiles-bundles: $(PROFILES_TARGETS)
erikj@37972 331 test-bundles: $(TEST_TARGETS)
erikj@37972 332 docs-bundles: $(DOCS_TARGETS)
erikj@37972 333
erikj@43043 334 .PHONY: all default product-bundles profiles-bundles test-bundles docs-bundles