2
# Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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.
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
28
include TextFileProcessing.gmk
30
# Hook to include the corresponding custom file, if present.
31
$(eval $(call IncludeCustomExtension, modules/java.base/Copy.gmk))
33
################################################################################
35
ifeq ($(call isTargetOs, aix), true)
37
TZMAPPINGS_SRC := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf
39
$(LIB_DST_DIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings
42
TARGETS += $(LIB_DST_DIR)/tzmappings
46
################################################################################
47
# Copy the microsoft runtime libraries on windows, but only if we are not
48
# creating a buildjdk. If we are, the provided runtime librareis are made for
49
# the target platform, not the build platform (and we should not need to bundle
50
# anything with the minimalistic, locally-only buildjdk.)
51
ifeq ($(call isTargetOs, windows)+$(CREATING_BUILDJDK), true+false)
53
# Chmod to avoid permission issues if bundles are unpacked on unix platforms.
59
# Use separate macro calls in case the source files are not in the same
61
$(eval $(call SetupCopyFiles,COPY_MSVCR, \
62
DEST := $(LIB_DST_DIR), \
63
FILES := $(MSVCR_DLL), \
64
MACRO := copy-and-chmod))
66
$(eval $(call SetupCopyFiles,COPY_VCRUNTIME_1, \
67
DEST := $(LIB_DST_DIR), \
68
FILES := $(VCRUNTIME_1_DLL), \
69
MACRO := copy-and-chmod))
71
$(eval $(call SetupCopyFiles,COPY_MSVCP, \
72
DEST := $(LIB_DST_DIR), \
73
FILES := $(MSVCP_DLL), \
74
MACRO := copy-and-chmod))
76
TARGETS += $(COPY_MSVCR) $(COPY_VCRUNTIME_1) $(COPY_MSVCP)
78
ifneq ($(UCRT_DLL_DIR), )
79
$(eval $(call SetupCopyFiles, COPY_UCRT_DLLS, \
80
DEST := $(LIB_DST_DIR), \
81
SRC := $(UCRT_DLL_DIR), \
82
FILES := $(wildcard $(UCRT_DLL_DIR)/*.dll), \
83
MACRO := copy-and-chmod, \
86
TARGETS += $(COPY_UCRT_DLLS)
90
################################################################################
91
# In jvm.cfg, the first listed KNOWN variant is the default. On most build
92
# configurations, that is the server variant.
93
ifeq ($(call And, $(call isTargetOs, windows) $(call isTargetCpu, x86)), true)
94
DEFAULT_CFG_VARIANT ?= client
96
DEFAULT_CFG_VARIANT ?= server
98
# Change the order to put the default variant first if present.
99
ORDERED_CFG_VARIANTS := \
100
$(if $(filter $(DEFAULT_CFG_VARIANT), $(JVM_VARIANTS)), $(DEFAULT_CFG_VARIANT)) \
101
$(filter-out $(DEFAULT_CFG_VARIANT), $(JVM_VARIANTS))
103
JVMCFG := $(LIB_DST_DIR)/jvm.cfg
106
$(call LogInfo, Adding -$1 $2 to jvm.cfg)
107
$(PRINTF) -- "-$1 $2\n" >> $@ $(NEWLINE)
110
$(JVMCFG): $(call DependOnVariable, ORDERED_CFG_VARIANTS)
111
$(call MakeTargetDir)
113
$(foreach v, $(ORDERED_CFG_VARIANTS), \
114
$(call print-cfg-line,$v,KNOWN) \
116
# If either of server or client aren't present, add IGNORE lines for
118
$(foreach v, server client, \
119
$(if $(filter $v, $(ORDERED_CFG_VARIANTS)), , \
120
$(call print-cfg-line,$v,IGNORE) \
126
################################################################################
128
POLICY_SRC := $(TOPDIR)/src/java.base/share/conf/security/java.policy
129
POLICY_DST := $(CONF_DST_DIR)/security/java.policy
131
POLICY_SRC_LIST := $(POLICY_SRC)
133
$(POLICY_DST): $(POLICY_SRC_LIST)
134
$(call MakeTargetDir)
136
$(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
139
TARGETS += $(POLICY_DST)
141
################################################################################
143
DEF_POLICY_SRC := $(TOPDIR)/src/java.base/share/lib/security/default.policy
144
DEF_POLICY_DST := $(LIB_DST_DIR)/security/default.policy
146
DEF_POLICY_SRC_LIST := $(DEF_POLICY_SRC)
147
DEF_POLICY_SRC_LIST += $(CUSTOM_POLICY_SRC_LIST)
149
ifeq ($(call isTargetOs, windows), true)
150
DEF_POLICY_SRC_LIST += $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/lib/security/default.policy
153
# Allow imported modules to modify the java.policy
154
ifneq ($(IMPORT_MODULES_CONF), )
155
DEF_POLICY_SRC_LIST += $(wildcard $(IMPORT_MODULES_CONF)/java.base/security/java.policy.extra)
158
$(DEF_POLICY_DST): $(DEF_POLICY_SRC_LIST)
159
$(call MakeTargetDir)
161
$(foreach f,$(DEF_POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
164
TARGETS += $(DEF_POLICY_DST)
166
################################################################################
168
# CACERTS_FILE is optionally set in configure to override the default cacerts
169
# which is otherwise generated in Gendata-java.base.gmk
170
CACERTS_DST := $(LIB_DST_DIR)/security/cacerts
172
$(CACERTS_DST): $(CACERTS_FILE)
173
$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%, %, $@))
176
ifneq ($(CACERTS_FILE), )
177
TARGETS += $(CACERTS_DST)
180
################################################################################
182
NET_PROPERTIES_SRCS := $(TOPDIR)/src/java.base/share/conf/net.properties \
183
$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/net.properties
185
NET_PROPERTIES_DST := $(CONF_DST_DIR)/net.properties
187
$(NET_PROPERTIES_DST): $(NET_PROPERTIES_SRCS)
188
$(call MakeTargetDir)
189
$(CAT) $(NET_PROPERTIES_SRCS) > $@
191
TARGETS += $(NET_PROPERTIES_DST)
193
ifeq ($(call isTargetOs, linux), true)
194
$(eval $(call SetupCopyFiles, COPY_SDP_CONF, \
195
FILES := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template, \
196
DEST := $(CONF_DST_DIR)/sdp, \
199
TARGETS += $(COPY_SDP_CONF)
202
################################################################################
204
# JDK license and assembly exception files to be packaged in JMOD
206
# The license files may not be present if the source has been obtained using a
208
JDK_LICENSE ?= $(wildcard $(TOPDIR)/LICENSE)
209
JDK_NOTICE ?= $(wildcard $(TOPDIR)/ASSEMBLY_EXCEPTION)
210
JDK_ADDITIONAL_LICENSE_INFO ?= $(wildcard $(TOPDIR)/ADDITIONAL_LICENSE_INFO)
212
$(eval $(call SetupCopyFiles, COPY_JDK_NOTICES, \
213
FILES := $(JDK_LICENSE) $(JDK_NOTICE) $(JDK_ADDITIONAL_LICENSE_INFO), \
214
DEST := $(COMMON_LEGAL_DST_DIR), \
218
TARGETS += $(COPY_JDK_NOTICES)
220
################################################################################
222
# Copy and filter the legal files depending on what 3rd party components are
223
# bundled or linked from the OS.
225
ifeq ($(USE_EXTERNAL_LIBZ), true)
226
LEGAL_EXCLUDES += zlib.md
229
$(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \
230
EXCLUDES := $(LEGAL_EXCLUDES), \
233
TARGETS += $(COPY_LEGAL)
235
################################################################################
236
# Optionally copy libffi.so.? into the image
238
ifeq ($(ENABLE_LIBFFI_BUNDLING), true)
239
$(eval $(call SetupCopyFiles, COPY_LIBFFI, \
240
FILES := $(LIBFFI_LIB_FILE), \
241
DEST := $(call FindLibDirForModule, $(MODULE)), \
243
MACRO := install-file-nolink, \
246
TARGETS += $(COPY_LIBFFI)
249
################################################################################
250
# Copy tzmappings file for Windows
252
ifeq ($(call isTargetOs, windows), true)
253
$(eval $(call SetupCopyFiles, COPY_TZMAPPINGS, \
254
FILES := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/windows/conf/tzmappings, \
255
DEST := $(call FindLibDirForModule, $(MODULE)), \
258
TARGETS += $(COPY_TZMAPPINGS)
261
################################################################################
262
# Optionally copy hsdis into the image
264
ifeq ($(ENABLE_HSDIS_BUNDLING), true)
265
HSDIS_NAME := hsdis-$(OPENJDK_TARGET_CPU_LEGACY_LIB)$(SHARED_LIBRARY_SUFFIX)
266
HSDIS_PATH := $(SUPPORT_OUTPUTDIR)/hsdis/$(HSDIS_NAME)
268
$(eval $(call SetupCopyFiles, COPY_HSDIS, \
269
FILES := $(HSDIS_PATH), \
270
DEST := $(call FindLibDirForModule, $(MODULE)), \
272
MACRO := install-file-nolink, \
275
TARGETS += $(COPY_HSDIS)
278
################################################################################
279
# Generate classfile_constants.h
281
$(eval $(call SetupTextFileProcessing, CREATE_CLASSFILE_CONSTANTS_H, \
282
SOURCE_FILES := $(TOPDIR)/src/java.base/share/native/include/classfile_constants.h.template, \
283
OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/modules_include/java.base/classfile_constants.h, \
285
@@VERSION_CLASSFILE_MAJOR@@ => $(VERSION_CLASSFILE_MAJOR) ; \
286
@@VERSION_CLASSFILE_MINOR@@ => $(VERSION_CLASSFILE_MINOR) ; , \
289
TARGETS += $(CREATE_CLASSFILE_CONSTANTS_H)
291
################################################################################