37972
|
1 |
#
|
|
2 |
# Copyright (c) 2016, 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 |
TEST_TARGETS :=
|
|
33 |
DOCS_TARGETS :=
|
|
34 |
|
|
35 |
# On Windows tar frequently complains that "file changed as we read it" for
|
|
36 |
# some random source files. This seems to be cause by anti virus scanners and
|
|
37 |
# is most likely safe to ignore. When it happens, tar returns '1'.
|
|
38 |
ifeq ($(OPENJDK_BUILD_OS), windows)
|
|
39 |
TAR_IGNORE_EXIT_VALUE := || test "$$$$?" = "1"
|
|
40 |
endif
|
|
41 |
|
|
42 |
# Hook to include the corresponding custom file, if present.
|
|
43 |
$(eval $(call IncludeCustomExtension, , Bundles-pre.gmk))
|
|
44 |
################################################################################
|
|
45 |
# BUNDLE : Name of bundle to create
|
|
46 |
# FILES : Files in BASE_DIR to add to bundle
|
|
47 |
# SPECIAL_INCLUDES : List of directories inside BASE_DIR to look for additional
|
|
48 |
# files in. These files will not get proper dependency handling. Use when
|
|
49 |
# files or directories may contain spaces.
|
|
50 |
# BASE_DIR : Base directory for the root dir in the bundle.
|
|
51 |
# SUBDIR : Optional name of root dir in bundle.
|
|
52 |
SetupBundleFile = $(NamedParamsMacroTemplate)
|
|
53 |
define SetupBundleFileBody
|
|
54 |
|
|
55 |
$1_RELATIVE_FILES := $$(patsubst $$($1_BASE_DIR)/%, ./%, $$($1_FILES))
|
|
56 |
|
|
57 |
ifneq ($$(filter %.tar.gz, $$($1_BUNDLE_NAME)), )
|
|
58 |
$1_TYPE := tar.gz
|
|
59 |
else ifneq ($$(filter %.zip, $$($1_BUNDLE_NAME)), )
|
|
60 |
$1_TYPE := zip
|
|
61 |
else
|
|
62 |
$$(error Unknown bundle type $$($1_BUNDLE_NAME))
|
|
63 |
endif
|
|
64 |
|
|
65 |
$$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false)
|
|
66 |
|
|
67 |
$(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES)
|
|
68 |
$$(eval $$(call ListPathsSafely, \
|
|
69 |
$1_RELATIVE_FILES, \
|
|
70 |
$(SUPPORT_OUTPUTDIR)/bundles/_$1_files))
|
|
71 |
$$(call MakeDir, $$(@D))
|
|
72 |
ifneq ($$($1_SPECIAL_INCLUDES), )
|
|
73 |
$$(foreach i, $$($1_SPECIAL_INCLUDES), \
|
|
74 |
($(CD) $$($1_BASE_DIR) && $(FIND) ./$$i \
|
|
75 |
>> $(SUPPORT_OUTPUTDIR)/bundles/_$1_files ) ; )
|
|
76 |
endif
|
|
77 |
ifneq ($$($1_SUBDIR), )
|
|
78 |
ifeq ($$($1_TYPE)-$(TAR_SUPPORTS_TRANSFORM)-$$($1_UNZIP_DEBUGINFO), tar.gz-true-false)
|
|
79 |
$(CD) $$($1_BASE_DIR) \
|
|
80 |
&& ( $(TAR) cf - -$(TAR_INCLUDE_PARAM) $(SUPPORT_OUTPUTDIR)/bundles/_$1_files \
|
|
81 |
--transform 's|^|$$($1_SUBDIR)/|' $(TAR_IGNORE_EXIT_VALUE) ) \
|
|
82 |
| $(GZIP) > $$@
|
|
83 |
else
|
|
84 |
# If a subdir has been specified, copy all files into a temporary
|
|
85 |
# location with this subdir before creating the tar file
|
|
86 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
|
|
87 |
$(MKDIR) -p $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
|
|
88 |
( $(CD) $$($1_BASE_DIR) \
|
|
89 |
&& $(TAR) cf - -$(TAR_INCLUDE_PARAM) $(SUPPORT_OUTPUTDIR)/bundles/_$1_files \
|
|
90 |
$(TAR_IGNORE_EXIT_VALUE) ) \
|
|
91 |
| ( $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) && $(TAR) xf - )
|
|
92 |
# Unzip any zipped debuginfo files
|
|
93 |
ifeq ($$($1_UNZIP_DEBUGINFO), true)
|
|
94 |
for f in `$(FIND) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) -name "*.diz"`; do \
|
|
95 |
$(CD) $$$${f%/*} && $(UNZIP) -q $$$${f} && $(RM) $$$${f}; \
|
|
96 |
done
|
|
97 |
endif
|
|
98 |
ifeq ($$($1_TYPE), tar.gz)
|
|
99 |
$(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && \
|
|
100 |
( $(TAR) cf - $$($1_SUBDIR) $(TAR_IGNORE_EXIT_VALUE) ) | $(GZIP) > $$@
|
|
101 |
else ifeq ($$($1_TYPE), zip)
|
|
102 |
$(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && $(ZIP) -qr $$@ .
|
|
103 |
endif
|
|
104 |
endif
|
|
105 |
else
|
|
106 |
ifeq ($$($1_TYPE), tar.gz)
|
|
107 |
$(CD) $$($1_BASE_DIR) \
|
|
108 |
&& ( $(TAR) cf - -$(TAR_INCLUDE_PARAM) $(SUPPORT_OUTPUTDIR)/bundles/_$1_files \
|
|
109 |
$(TAR_IGNORE_EXIT_VALUE) ) \
|
|
110 |
| $(GZIP) > $$@
|
|
111 |
else ifeq ($$($1_TYPE), zip)
|
|
112 |
$(CD) $$($1_BASE_DIR) \
|
|
113 |
&& $(ZIP) -qr $$@ . -i@$(SUPPORT_OUTPUTDIR)/bundles/_$1_files
|
|
114 |
endif
|
|
115 |
endif
|
|
116 |
|
|
117 |
$1 += $(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME)
|
|
118 |
|
|
119 |
endef
|
|
120 |
|
|
121 |
################################################################################
|
|
122 |
|
|
123 |
# On Macosx, we bundle up the macosx specific images which already have the
|
|
124 |
# correct base directories.
|
|
125 |
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
|
126 |
JDK_IMAGE_DIR := $(JDK_MACOSX_BUNDLE_DIR)
|
|
127 |
JRE_IMAGE_DIR := $(JRE_MACOSX_BUNDLE_DIR)
|
|
128 |
JDK_IMAGE_HOMEDIR := $(JDK_MACOSX_CONTENTS_DIR)/Home
|
|
129 |
JRE_IMAGE_HOMEDIR := $(JRE_MACOSX_CONTENTS_DIR)/Home
|
|
130 |
JDK_BUNDLE_SUBDIR :=
|
|
131 |
JRE_BUNDLE_SUBDIR :=
|
|
132 |
else
|
|
133 |
JDK_IMAGE_HOMEDIR := $(JDK_IMAGE_DIR)
|
|
134 |
JRE_IMAGE_HOMEDIR := $(JRE_IMAGE_DIR)
|
|
135 |
JDK_BUNDLE_SUBDIR := jdk-$(VERSION_NUMBER)
|
|
136 |
JRE_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER)
|
|
137 |
ifneq ($(DEBUG_LEVEL), release)
|
|
138 |
JDK_BUNDLE_SUBDIR := $(JDK_BUNDLE_SUBDIR)/$(DEBUG_LEVEL)
|
|
139 |
JRE_BUNDLE_SUBDIR := $(JRE_BUNDLE_SUBDIR)/$(DEBUG_LEVEL)
|
|
140 |
endif
|
|
141 |
endif
|
|
142 |
|
|
143 |
################################################################################
|
|
144 |
|
|
145 |
ifneq ($(filter product-bundles, $(MAKECMDGOALS)), )
|
|
146 |
$(eval $(call FillCacheFind, $(IMAGES_OUTPUTDIR)))
|
|
147 |
|
|
148 |
SYMBOLS_EXCLUDE_PATTERN := %.debuginfo %.diz %.pdb %.map
|
|
149 |
|
|
150 |
ALL_JDK_FILES := $(call CacheFind, $(JDK_IMAGE_DIR))
|
|
151 |
|
|
152 |
# Create special filter rules when dealing with unzipped .dSYM directories on
|
|
153 |
# macosx
|
|
154 |
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
|
155 |
ifeq ($(ZIP_DEBUGINFO_FILES), false)
|
|
156 |
JDK_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \
|
|
157 |
$(call containing, .dSYM/, $(patsubst $(JDK_IMAGE_DIR)/%, %, $(ALL_JDK_FILES))))
|
|
158 |
endif
|
|
159 |
endif
|
|
160 |
|
|
161 |
JDK_BUNDLE_FILES := \
|
|
162 |
$(filter-out \
|
|
163 |
$(JDK_SYMBOLS_EXCLUDE_PATTERN) \
|
|
164 |
$(JDK_EXTRA_EXCLUDES) \
|
|
165 |
$(SYMBOLS_EXCLUDE_PATTERN) \
|
|
166 |
$(JDK_IMAGE_HOMEDIR)/demo/% $(JDK_IMAGE_HOMEDIR)/sample/% \
|
|
167 |
, \
|
|
168 |
$(ALL_JDK_FILES) \
|
|
169 |
)
|
|
170 |
DEMOS_BUNDLE_FILES := \
|
|
171 |
$(filter-out \
|
|
172 |
$(JDK_SYMBOLS_EXCLUDE_PATTERN) \
|
|
173 |
$(SYMBOLS_EXCLUDE_PATTERN) \
|
|
174 |
, \
|
|
175 |
$(filter \
|
|
176 |
$(JDK_IMAGE_HOMEDIR)/demo/% $(JDK_IMAGE_HOMEDIR)/sample/% \
|
|
177 |
$(JDK_IMAGE_HOMEDIR)/release \
|
|
178 |
, \
|
|
179 |
$(ALL_JDK_FILES) \
|
|
180 |
) \
|
|
181 |
)
|
|
182 |
JDK_SYMBOLS_BUNDLE_FILES := \
|
|
183 |
$(filter \
|
|
184 |
$(JDK_SYMBOLS_EXCLUDE_PATTERN) \
|
|
185 |
$(SYMBOLS_EXCLUDE_PATTERN) \
|
|
186 |
, \
|
|
187 |
$(ALL_JDK_FILES) \
|
|
188 |
) \
|
|
189 |
$(call CacheFind, $(SYMBOLS_IMAGE_DIR))
|
|
190 |
|
|
191 |
ALL_JRE_FILES := $(call CacheFind, $(JRE_IMAGE_DIR))
|
|
192 |
|
|
193 |
# Create special filter rules when dealing with unzipped .dSYM directories on
|
|
194 |
# macosx
|
|
195 |
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
|
196 |
ifeq ($(ZIP_DEBUGINFO_FILES), false)
|
|
197 |
JRE_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \
|
|
198 |
$(call containing, .dSYM/, $(patsubst $(JRE_IMAGE_DIR)/%, %, $(ALL_JRE_FILES))))
|
|
199 |
endif
|
|
200 |
endif
|
|
201 |
|
|
202 |
JRE_BUNDLE_FILES := $(filter-out \
|
|
203 |
$(JRE_SYMBOLS_EXCLUDE_PATTERN) \
|
|
204 |
$(SYMBOLS_EXCLUDE_PATTERN), \
|
|
205 |
$(ALL_JRE_FILES))
|
|
206 |
JRE_SYMBOLS_BUNDLE_FILES := $(filter \
|
|
207 |
$(JRE_SYMBOLS_EXCLUDE_PATTERN) \
|
|
208 |
$(SYMBOLS_EXCLUDE_PATTERN), \
|
|
209 |
$(ALL_JRE_FILES))
|
|
210 |
|
|
211 |
$(eval $(call SetupBundleFile, BUILD_JDK_BUNDLE, \
|
|
212 |
BUNDLE_NAME := $(JDK_BUNDLE_NAME), \
|
|
213 |
FILES := $(JDK_BUNDLE_FILES), \
|
|
214 |
SPECIAL_INCLUDES := $(JDK_SPECIAL_INCLUDES), \
|
|
215 |
BASE_DIR := $(JDK_IMAGE_DIR), \
|
|
216 |
SUBDIR := $(JDK_BUNDLE_SUBDIR), \
|
|
217 |
))
|
|
218 |
|
|
219 |
PRODUCT_TARGETS += $(BUILD_JDK_BUNDLE)
|
|
220 |
|
|
221 |
$(eval $(call SetupBundleFile, BUILD_JRE_BUNDLE, \
|
|
222 |
BUNDLE_NAME := $(JRE_BUNDLE_NAME), \
|
|
223 |
FILES := $(JRE_BUNDLE_FILES), \
|
|
224 |
BASE_DIR := $(JRE_IMAGE_DIR), \
|
|
225 |
SUBDIR := $(JRE_BUNDLE_SUBDIR), \
|
|
226 |
))
|
|
227 |
|
|
228 |
PRODUCT_TARGETS += $(BUILD_JRE_BUNDLE)
|
|
229 |
|
|
230 |
$(eval $(call SetupBundleFile, BUILD_JDK_SYMBOLS_BUNDLE, \
|
|
231 |
BUNDLE_NAME := $(JDK_SYMBOLS_BUNDLE_NAME), \
|
|
232 |
FILES := $(JDK_SYMBOLS_BUNDLE_FILES), \
|
|
233 |
BASE_DIR := $(JDK_IMAGE_DIR), \
|
|
234 |
SUBDIR := $(JDK_BUNDLE_SUBDIR), \
|
|
235 |
UNZIP_DEBUGINFO := true, \
|
|
236 |
))
|
|
237 |
|
|
238 |
PRODUCT_TARGETS += $(BUILD_JDK_SYMBOLS_BUNDLE)
|
|
239 |
|
|
240 |
$(eval $(call SetupBundleFile, BUILD_JRE_SYMBOLS_BUNDLE, \
|
|
241 |
BUNDLE_NAME := $(JRE_SYMBOLS_BUNDLE_NAME), \
|
|
242 |
FILES := $(JRE_SYMBOLS_BUNDLE_FILES), \
|
|
243 |
BASE_DIR := $(JRE_IMAGE_DIR), \
|
|
244 |
SUBDIR := $(JRE_BUNDLE_SUBDIR), \
|
|
245 |
UNZIP_DEBUGINFO := true, \
|
|
246 |
))
|
|
247 |
|
|
248 |
PRODUCT_TARGETS += $(BUILD_JRE_SYMBOLS_BUNDLE)
|
|
249 |
|
|
250 |
$(eval $(call SetupBundleFile, BUILD_DEMOS_BUNDLE, \
|
|
251 |
BUNDLE_NAME := $(DEMOS_BUNDLE_NAME), \
|
|
252 |
FILES := $(call DoubleDollar, $(DEMOS_BUNDLE_FILES)), \
|
|
253 |
BASE_DIR := $(JDK_IMAGE_DIR), \
|
|
254 |
SUBDIR := $(JDK_BUNDLE_SUBDIR), \
|
|
255 |
))
|
|
256 |
|
|
257 |
PRODUCT_TARGETS += $(BUILD_DEMOS_BUNDLE)
|
|
258 |
endif
|
|
259 |
|
|
260 |
################################################################################
|
|
261 |
|
|
262 |
ifneq ($(filter test-bundles, $(MAKECMDGOALS)), )
|
|
263 |
TEST_BUNDLE_FILES := $(call CacheFind, $(TEST_IMAGE_DIR))
|
|
264 |
|
|
265 |
$(eval $(call SetupBundleFile, BUILD_TEST_BUNDLE, \
|
|
266 |
BUNDLE_NAME := $(TEST_BUNDLE_NAME), \
|
|
267 |
FILES := $(call DoubleDollar, $(TEST_BUNDLE_FILES)), \
|
|
268 |
BASE_DIR := $(TEST_IMAGE_DIR), \
|
|
269 |
))
|
|
270 |
|
|
271 |
TEST_TARGETS += $(BUILD_TEST_BUNDLE)
|
|
272 |
endif
|
|
273 |
|
|
274 |
################################################################################
|
|
275 |
|
|
276 |
ifneq ($(filter docs-bundles, $(MAKECMDGOALS)), )
|
|
277 |
DOCS_BUNDLE_FILES := $(call CacheFind, $(DOCS_IMAGE_DIR))
|
|
278 |
|
|
279 |
$(eval $(call SetupBundleFile, BUILD_DOCS_BUNDLE, \
|
|
280 |
BUNDLE_NAME := $(DOCS_BUNDLE_NAME), \
|
|
281 |
FILES := $(DOCS_BUNDLE_FILES), \
|
|
282 |
BASE_DIR := $(DOCS_IMAGE_DIR), \
|
|
283 |
SUBDIR := docs, \
|
|
284 |
))
|
|
285 |
|
|
286 |
DOCS_TARGETS += $(BUILD_DOCS_BUNDLE)
|
|
287 |
endif
|
|
288 |
|
|
289 |
################################################################################
|
|
290 |
|
|
291 |
# Hook to include the corresponding custom file, if present.
|
|
292 |
$(eval $(call IncludeCustomExtension, , Bundles.gmk))
|
|
293 |
|
|
294 |
################################################################################
|
|
295 |
|
|
296 |
product-bundles: $(PRODUCT_TARGETS)
|
|
297 |
test-bundles: $(TEST_TARGETS)
|
|
298 |
docs-bundles: $(DOCS_TARGETS)
|
|
299 |
|
|
300 |
.PHONY: all default product-bundles test-bundles docs-bundles
|