author | stuefe |
Tue, 02 Jul 2019 10:28:20 +0200 | |
changeset 55545 | 8a153a932d0f |
parent 54380 | e297c7bb6469 |
child 55670 | a87f5fdcd177 |
child 58678 | 9cf78a70fa4f |
permissions | -rw-r--r-- |
27560 | 1 |
# |
53995 | 2 |
# Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. |
27560 | 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 |
|
53995 | 30 |
include Execute.gmk |
34116
b746e382da18
8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
33437
diff
changeset
|
31 |
include Modules.gmk |
27560 | 32 |
|
28356 | 33 |
JDK_TARGETS := |
27560 | 34 |
JRE_TARGETS := |
35 |
||
36 |
# Hook to include the corresponding custom file, if present. |
|
47314 | 37 |
$(eval $(call IncludeCustomExtension, Images-pre.gmk)) |
27560 | 38 |
|
52983
7b4f2f7376fe
8215239: Make deletes images/jdk/bin/java if something goes wrong
erikj
parents:
52714
diff
changeset
|
39 |
################################################################################ |
27560 | 40 |
|
36543
a8ce27ddc757
8152197: Single place to specify module-specific information for images build
mchung
parents:
36506
diff
changeset
|
41 |
# All modules for the current target platform. |
a8ce27ddc757
8152197: Single place to specify module-specific information for images build
mchung
parents:
36506
diff
changeset
|
42 |
ALL_MODULES := $(call FindAllModules) |
27560 | 43 |
|
36725 | 44 |
$(eval $(call ReadImportMetaData)) |
27560 | 45 |
|
37978
2614022b9fa5
8157348: Build fails with certain source configurations
erikj
parents:
37865
diff
changeset
|
46 |
JRE_MODULES += $(filter $(ALL_MODULES), $(BOOT_MODULES) \ |
2614022b9fa5
8157348: Build fails with certain source configurations
erikj
parents:
37865
diff
changeset
|
47 |
$(PLATFORM_MODULES) $(JRE_TOOL_MODULES)) |
2614022b9fa5
8157348: Build fails with certain source configurations
erikj
parents:
37865
diff
changeset
|
48 |
JDK_MODULES += $(ALL_MODULES) |
36506 | 49 |
|
37770 | 50 |
JRE_MODULES_LIST := $(call CommaList, $(JRE_MODULES)) |
51 |
JDK_MODULES_LIST := $(call CommaList, $(JDK_MODULES)) |
|
36506 | 52 |
|
53 |
################################################################################ |
|
54 |
||
55 |
BASE_RELEASE_FILE := $(JDK_OUTPUTDIR)/release |
|
56 |
||
57 |
JMODS := $(wildcard $(IMAGES_OUTPUTDIR)/jmods/*.jmod) |
|
27560 | 58 |
|
38845
6d03072cdab8
8158402: jlink: should use regex for all pattern operations (--order-resources or --exclude-resources)
jlaskey
parents:
38546
diff
changeset
|
59 |
JLINK_ORDER_RESOURCES := **module-info.class |
40612
cec3daf6324a
8164858: Enable build-time use of java.lang.invoke resolve tracing
redestad
parents:
40241
diff
changeset
|
60 |
JLINK_JLI_CLASSES := |
38546
91a5c3430d4f
8157336: Generation of classlists at build time should be configurable
erikj
parents:
37978
diff
changeset
|
61 |
ifeq ($(ENABLE_GENERATE_CLASSLIST), true) |
41874
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
41532
diff
changeset
|
62 |
JLINK_ORDER_RESOURCES += @$(SUPPORT_OUTPUTDIR)/link_opt/classlist |
43783
35fe9d6f5075
8175026: Capture build-time parameters to --generate-jli-classes
redestad
parents:
43384
diff
changeset
|
63 |
JLINK_JLI_CLASSES := --generate-jli-classes=@$(SUPPORT_OUTPUTDIR)/link_opt/default_jli_trace.txt |
38546
91a5c3430d4f
8157336: Generation of classlists at build time should be configurable
erikj
parents:
37978
diff
changeset
|
64 |
endif |
91a5c3430d4f
8157336: Generation of classlists at build time should be configurable
erikj
parents:
37978
diff
changeset
|
65 |
JLINK_ORDER_RESOURCES += \ |
38845
6d03072cdab8
8158402: jlink: should use regex for all pattern operations (--order-resources or --exclude-resources)
jlaskey
parents:
38546
diff
changeset
|
66 |
/java.base/java/** \ |
6d03072cdab8
8158402: jlink: should use regex for all pattern operations (--order-resources or --exclude-resources)
jlaskey
parents:
38546
diff
changeset
|
67 |
/java.base/jdk/** \ |
6d03072cdab8
8158402: jlink: should use regex for all pattern operations (--order-resources or --exclude-resources)
jlaskey
parents:
38546
diff
changeset
|
68 |
/java.base/sun/** \ |
6d03072cdab8
8158402: jlink: should use regex for all pattern operations (--order-resources or --exclude-resources)
jlaskey
parents:
38546
diff
changeset
|
69 |
/java.base/com/** \ |
6d03072cdab8
8158402: jlink: should use regex for all pattern operations (--order-resources or --exclude-resources)
jlaskey
parents:
38546
diff
changeset
|
70 |
/jdk.localedata/** \ |
37865
94ea10488f02
8156756: Enable build-time use of resource ordering plugin
redestad
parents:
37770
diff
changeset
|
71 |
# |
94ea10488f02
8156756: Enable build-time use of resource ordering plugin
redestad
parents:
37770
diff
changeset
|
72 |
|
42287
925cf8cf736c
8160359: Improve jlink logging for cases when a plugin throws exception
sundar
parents:
42286
diff
changeset
|
73 |
JLINK_TOOL := $(JLINK) -J-Djlink.debug=true \ |
925cf8cf736c
8160359: Improve jlink logging for cases when a plugin throws exception
sundar
parents:
42286
diff
changeset
|
74 |
--module-path $(IMAGES_OUTPUTDIR)/jmods \ |
49886
22d36f1c0994
8202210: jlink uses little-endian for big-endian cross-compilation targets
shade
parents:
48912
diff
changeset
|
75 |
--endian $(OPENJDK_TARGET_CPU_ENDIAN) \ |
38546
91a5c3430d4f
8157336: Generation of classlists at build time should be configurable
erikj
parents:
37978
diff
changeset
|
76 |
--release-info $(BASE_RELEASE_FILE) \ |
91a5c3430d4f
8157336: Generation of classlists at build time should be configurable
erikj
parents:
37978
diff
changeset
|
77 |
--order-resources=$(call CommaList, $(JLINK_ORDER_RESOURCES)) \ |
42505
11439b0c0792
8169925: Organize licenses by module in source, JMOD file, and run-time image
mchung
parents:
42293
diff
changeset
|
78 |
--dedup-legal-notices=error-if-not-same-content \ |
40612
cec3daf6324a
8164858: Enable build-time use of java.lang.invoke resolve tracing
redestad
parents:
40241
diff
changeset
|
79 |
$(JLINK_JLI_CLASSES) \ |
38546
91a5c3430d4f
8157336: Generation of classlists at build time should be configurable
erikj
parents:
37978
diff
changeset
|
80 |
# |
36506 | 81 |
|
42140
a2ea75dd99dc
8170280: Enable -g for all java compilation in the build
erikj
parents:
41875
diff
changeset
|
82 |
JLINK_JRE_EXTRA_OPTS := --no-man-pages --no-header-files --strip-debug |
41532
76dffc133464
8167558: Add new JMOD section for header files and man pages
mchung
parents:
41458
diff
changeset
|
83 |
|
36506 | 84 |
ifeq ($(JLINK_KEEP_PACKAGED_MODULES), true) |
41532
76dffc133464
8167558: Add new JMOD section for header files and man pages
mchung
parents:
41458
diff
changeset
|
85 |
JLINK_JDK_EXTRA_OPTS := --keep-packaged-modules $(JDK_IMAGE_DIR)/jmods |
36506 | 86 |
endif |
87 |
||
53995 | 88 |
$(eval $(call SetupExecute, jlink_jdk, \ |
89 |
WARN := Creating jdk image, \ |
|
90 |
DEPS := $(JMODS) $(BASE_RELEASE_FILE) \ |
|
91 |
$(call DependOnVariable, JDK_MODULES_LIST), \ |
|
92 |
OUTPUT_DIR := $(JDK_IMAGE_DIR), \ |
|
93 |
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jdk, \ |
|
94 |
PRE_COMMAND := $(RM) -r $(JDK_IMAGE_DIR), \ |
|
95 |
COMMAND := $(JLINK_TOOL) --add-modules $(JDK_MODULES_LIST) \ |
|
96 |
$(JLINK_JDK_EXTRA_OPTS) --output $(JDK_IMAGE_DIR), \ |
|
97 |
)) |
|
98 |
||
99 |
JLINK_JDK_TARGETS := $(jlink_jdk) |
|
100 |
||
101 |
$(eval $(call SetupExecute, jlink_jre, \ |
|
102 |
WARN := Creating legacy jre image, \ |
|
103 |
DEPS := $(JMODS) $(BASE_RELEASE_FILE) \ |
|
104 |
$(call DependOnVariable, JDK_MODULES_LIST), \ |
|
105 |
OUTPUT_DIR := $(JDK_IMAGE_DIR), \ |
|
106 |
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jre, \ |
|
107 |
PRE_COMMAND := $(RM) -r $(JRE_IMAGE_DIR), \ |
|
108 |
COMMAND := $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \ |
|
109 |
$(JLINK_JRE_EXTRA_OPTS) --output $(JRE_IMAGE_DIR), \ |
|
110 |
)) |
|
111 |
||
112 |
JLINK_JRE_TARGETS := $(jlink_jre) |
|
27560 | 113 |
|
53995 | 114 |
ifeq ($(BUILD_CDS_ARCHIVE), true) |
54076
4b4745d185eb
8220383: Incremental build is broken and inefficient
erikj
parents:
53995
diff
changeset
|
115 |
ifeq ($(OPENJDK_TARGET_OS), windows) |
4b4745d185eb
8220383: Incremental build is broken and inefficient
erikj
parents:
53995
diff
changeset
|
116 |
CDS_ARCHIVE := bin/server/classes.jsa |
4b4745d185eb
8220383: Incremental build is broken and inefficient
erikj
parents:
53995
diff
changeset
|
117 |
else |
4b4745d185eb
8220383: Incremental build is broken and inefficient
erikj
parents:
53995
diff
changeset
|
118 |
CDS_ARCHIVE := lib/server/classes.jsa |
4b4745d185eb
8220383: Incremental build is broken and inefficient
erikj
parents:
53995
diff
changeset
|
119 |
endif |
53995 | 120 |
|
121 |
$(eval $(call SetupExecute, gen_cds_archive_jdk, \ |
|
122 |
WARN := Creating CDS archive for jdk image, \ |
|
123 |
DEPS := $(jlink_jdk), \ |
|
124 |
OUTPUT_FILE := $(JDK_IMAGE_DIR)/$(CDS_ARCHIVE), \ |
|
125 |
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jdk, \ |
|
126 |
COMMAND := $(FIXPATH) $(JDK_IMAGE_DIR)/bin/java -Xshare:dump \ |
|
127 |
-Xmx128M -Xms128M $(LOG_INFO), \ |
|
128 |
)) |
|
27560 | 129 |
|
53995 | 130 |
JDK_TARGETS += $(gen_cds_archive_jdk) |
131 |
||
132 |
$(eval $(call SetupExecute, gen_cds_archive_jre, \ |
|
133 |
WARN := Creating CDS archive for jre image, \ |
|
134 |
DEPS := $(jlink_jre), \ |
|
135 |
OUTPUT_FILE := $(JRE_IMAGE_DIR)/$(CDS_ARCHIVE), \ |
|
136 |
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jre, \ |
|
137 |
COMMAND := $(FIXPATH) $(JRE_IMAGE_DIR)/bin/java -Xshare:dump \ |
|
138 |
-Xmx128M -Xms128M $(LOG_INFO), \ |
|
139 |
)) |
|
140 |
||
141 |
JDK_TARGETS += $(gen_cds_archive_jdk) |
|
142 |
endif |
|
27560 | 143 |
|
144 |
################################################################################ |
|
145 |
# src.zip |
|
146 |
||
42523 | 147 |
$(JDK_IMAGE_DIR)/lib/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip |
47253
92fd0e04e0e1
8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents:
47224
diff
changeset
|
148 |
$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@)) |
27560 | 149 |
$(install-file) |
150 |
||
42523 | 151 |
JDK_TARGETS += $(JDK_IMAGE_DIR)/lib/src.zip |
27560 | 152 |
|
153 |
################################################################################ |
|
154 |
# /demo dir |
|
41260 | 155 |
# Avoid doing the expensive find unless called with "jdk" as target. |
156 |
ifneq ($(filter jdk, $(MAKECMDGOALS)), ) |
|
157 |
||
158 |
DEMO_FILES := \ |
|
159 |
$(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \ |
|
160 |
$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \ |
|
47354
e8bda13da40b
8189434: SetupCopyFiles does not handle files with $ in them
erikj
parents:
47314
diff
changeset
|
161 |
-type f -a ! \( -name "_the*" -o -name "javac_state" \) ) \ |
41260 | 162 |
) |
163 |
||
164 |
ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true) |
|
53683 | 165 |
ifeq ($(call isTargetOs, macosx), true) |
41260 | 166 |
DEMO_FILES := $(call not-containing, .dSYM, $(DEMO_FILES)) |
167 |
else |
|
168 |
DEMO_FILES := $(filter-out %.debuginfo %.pdb %.map, $(DEMO_FILES)) |
|
169 |
endif |
|
170 |
endif |
|
171 |
||
35008 | 172 |
$(eval $(call SetupCopyFiles, JDK_COPY_DEMOS, \ |
173 |
SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \ |
|
174 |
DEST := $(JDK_IMAGE_DIR)/demo, \ |
|
41260 | 175 |
FILES := $(DEMO_FILES), \ |
35008 | 176 |
)) |
27560 | 177 |
|
35008 | 178 |
JDK_TARGETS += $(JDK_COPY_DEMOS) |
27560 | 179 |
endif |
180 |
||
181 |
################################################################################ |
|
29305
4ddc6faf7842
8073021: add native code coverage target into makefiles
erikj
parents:
29303
diff
changeset
|
182 |
# Code coverage data files |
4ddc6faf7842
8073021: add native code coverage target into makefiles
erikj
parents:
29303
diff
changeset
|
183 |
|
4ddc6faf7842
8073021: add native code coverage target into makefiles
erikj
parents:
29303
diff
changeset
|
184 |
ifeq ($(GCOV_ENABLED), true) |
4ddc6faf7842
8073021: add native code coverage target into makefiles
erikj
parents:
29303
diff
changeset
|
185 |
|
54380 | 186 |
$(eval $(call SetupCopyFiles,COPY_GCOV_GCNO, \ |
47253
92fd0e04e0e1
8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents:
47224
diff
changeset
|
187 |
SRC := $(OUTPUTDIR), \ |
29444
b6186ae3a799
8075236: Change layout of gcov .gcno files in symbols image
erikj
parents:
29305
diff
changeset
|
188 |
DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \ |
54380 | 189 |
FILES := $(call FindFiles, $(HOTSPOT_OUTPUTDIR) \ |
190 |
$(SUPPORT_OUTPUTDIR)/native, *.gcno) \ |
|
191 |
)) |
|
29305
4ddc6faf7842
8073021: add native code coverage target into makefiles
erikj
parents:
29303
diff
changeset
|
192 |
|
54380 | 193 |
SYMBOLS_TARGETS += $(COPY_GCOV_GCNO) |
29305
4ddc6faf7842
8073021: add native code coverage target into makefiles
erikj
parents:
29303
diff
changeset
|
194 |
|
4ddc6faf7842
8073021: add native code coverage target into makefiles
erikj
parents:
29303
diff
changeset
|
195 |
endif |
4ddc6faf7842
8073021: add native code coverage target into makefiles
erikj
parents:
29303
diff
changeset
|
196 |
|
4ddc6faf7842
8073021: add native code coverage target into makefiles
erikj
parents:
29303
diff
changeset
|
197 |
################################################################################ |
37653 | 198 |
# Debug symbols |
199 |
# Since debug symbols are not included in the jmod files, they need to be copied |
|
200 |
# in manually after generating the images. |
|
201 |
||
202 |
ALL_JDK_MODULES := $(JDK_MODULES) |
|
203 |
ALL_JRE_MODULES := $(sort $(JRE_MODULES), $(foreach m, $(JRE_MODULES), \ |
|
204 |
$(call FindTransitiveDepsForModule, $m))) |
|
205 |
||
53683 | 206 |
ifeq ($(call isTargetOs, windows), true) |
37653 | 207 |
LIBS_TARGET_SUBDIR := bin |
208 |
else |
|
209 |
LIBS_TARGET_SUBDIR := lib |
|
210 |
endif |
|
211 |
||
212 |
# Param 1 - dir to find debuginfo files in |
|
213 |
FindDebuginfoFiles = \ |
|
214 |
$(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \ |
|
215 |
$(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \ |
|
216 |
$(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES))) |
|
217 |
||
41260 | 218 |
# Pick the correct debug info files to copy, either zipped or not. |
219 |
ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true) |
|
220 |
DEBUGINFO_SUFFIXES += .diz |
|
221 |
else |
|
222 |
DEBUGINFO_SUFFIXES := .debuginfo .pdb .map |
|
223 |
# On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM |
|
224 |
# dirs. |
|
53683 | 225 |
ifeq ($(call isTargetOs, macosx), true) |
54380 | 226 |
$(call FillFindCache, \ |
227 |
$(SUPPORT_OUTPUTDIR)/modules_cmds $(SUPPORT_OUTPUTDIR)/modules_libs) |
|
41260 | 228 |
FindDebuginfoFiles = \ |
54380 | 229 |
$(if $(wildcard $1), $(call containing, .dSYM/, $(call FindFiles, $1))) |
41260 | 230 |
endif |
37653 | 231 |
endif |
232 |
||
233 |
# Param 1 - either JDK or JRE |
|
234 |
SetupCopyDebuginfo = \ |
|
235 |
$(foreach m, $(ALL_$1_MODULES), \ |
|
236 |
$(eval $(call SetupCopyFiles, COPY_$1_LIBS_DEBUGINFO_$m, \ |
|
237 |
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$m, \ |
|
238 |
DEST := $($1_IMAGE_DIR)/$(LIBS_TARGET_SUBDIR), \ |
|
239 |
FILES := $(call FindDebuginfoFiles, \ |
|
240 |
$(SUPPORT_OUTPUTDIR)/modules_libs/$m), \ |
|
241 |
)) \ |
|
242 |
$(eval $1_TARGETS += $$(COPY_$1_LIBS_DEBUGINFO_$m)) \ |
|
243 |
) |
|
244 |
||
245 |
# No space before argument to avoid having to put $(strip ) everywhere in |
|
246 |
# implementation above. |
|
247 |
$(call SetupCopyDebuginfo,JDK) |
|
248 |
$(call SetupCopyDebuginfo,JRE) |
|
249 |
||
250 |
################################################################################ |
|
27560 | 251 |
|
252 |
# Include custom post hook here to make it possible to augment the target lists |
|
253 |
# before actual target prerequisites are declared. |
|
47314 | 254 |
$(eval $(call IncludeCustomExtension, Images-post.gmk)) |
27560 | 255 |
|
256 |
################################################################################ |
|
257 |
||
53995 | 258 |
$(JRE_TARGETS): $(JLINK_JRE_TARGETS) |
259 |
$(JDK_TARGETS): $(JLINK_JDK_TARGETS) |
|
27560 | 260 |
|
53995 | 261 |
jdk: $(JLINK_JDK_TARGETS) $(JDK_TARGETS) |
262 |
jre: $(JLINK_JRE_TARGETS) $(JRE_TARGETS) |
|
41260 | 263 |
symbols: $(SYMBOLS_TARGETS) |
264 |
||
265 |
all: jdk jre symbols |
|
27560 | 266 |
|
49979 | 267 |
.PHONY: default all jdk jre symbols |