blob: d5b3b8ea54bb2b415ee37ded47e188085d81310f [file] [log] [blame]
ihse554e46f2013-11-14 11:19:32 +01001#
2# Copyright (c) 2013, 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
26default: all
27
28include $(SPEC)
29include MakeBase.gmk
30include JavaCompilation.gmk
31include Setup.gmk
32
33# The jars created in this file are required for the exploded jdk image to function and
34# cannot wait to be built in the images target.
35
36##########################################################################################
37# Create manifest for security jars
38#
39# Include these extra attributes for now, should probably take out.
40#
41MAINMANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf
42JCE_MANIFEST := $(JDK_OUTPUTDIR)/lib/_the.security.manifest.mf
43
44$(JCE_MANIFEST): $(MAINMANIFEST)
45 $(MKDIR) -p $(@D)
46 $(RM) $@ $@.tmp
47 $(SED) -e "s#@@RELEASE@@#$(JDK_VERSION)#" \
48 -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
49 $(MAINMANIFEST) >> $@.tmp
50 $(ECHO) "Extension-Name: javax.crypto" >> $@.tmp
51 $(ECHO) "Implementation-Vendor-Id: com.sun" >> $@.tmp
52 $(MV) $@.tmp $@
53
54##########################################################################################
55# For security and crypto jars, always build the jar, but for closed, install the prebuilt
56# signed version instead of the newly built jar. Unsigned jars are treated as intermediate
erikj295c3d62013-12-05 09:25:31 +010057# targets and explicitly added to the TARGETS list. For open, signing is not needed. See
ihse554e46f2013-11-14 11:19:32 +010058# SignJars.gmk for more information.
59#
60# The source for the crypto jars is not available for all licensees. The BUILD_CRYPTO
61# variable is set to no if these jars can't be built to skip that step of the build.
62# Note that for OPENJDK, the build will fail if BUILD_CRYPTO=no since then there is no
63# other way to get the jars than to build them.
64
65SUNPKCS11_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunpkcs11.jar
erikj295c3d62013-12-05 09:25:31 +010066SUNPKCS11_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunpkcs11.jar
ihse554e46f2013-11-14 11:19:32 +010067
68$(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR, , \
69 SRCS := $(JDK_OUTPUTDIR)/classes_security, \
70 SUFFIXES := .class, \
71 INCLUDES := sun/security/pkcs11, \
72 JAR := $(SUNPKCS11_JAR_UNSIGNED), \
73 MANIFEST := $(JCE_MANIFEST), \
74 SKIP_METAINF := true))
75
76$(SUNPKCS11_JAR_UNSIGNED): $(JCE_MANIFEST)
77
78ifndef OPENJDK
79 SUNPKCS11_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/pkcs11/sunpkcs11.jar
80 $(SUNPKCS11_JAR_DST): $(SUNPKCS11_JAR_SRC)
erikj295c3d62013-12-05 09:25:31 +010081 @$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
ihse554e46f2013-11-14 11:19:32 +010082 $(install-file)
83else
84 $(SUNPKCS11_JAR_DST): $(SUNPKCS11_JAR_UNSIGNED)
85 $(install-file)
86endif
87
erikj295c3d62013-12-05 09:25:31 +010088TARGETS += $(SUNPKCS11_JAR_UNSIGNED) $(SUNPKCS11_JAR_DST)
ihse554e46f2013-11-14 11:19:32 +010089
90##########################################################################################
91
92SUNEC_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunec.jar
erikj295c3d62013-12-05 09:25:31 +010093SUNEC_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunec.jar
ihse554e46f2013-11-14 11:19:32 +010094
95$(eval $(call SetupArchive,BUILD_SUNEC_JAR, , \
96 SRCS := $(JDK_OUTPUTDIR)/classes_security, \
97 SUFFIXES := .class, \
98 INCLUDES := sun/security/ec, \
99 JAR := $(SUNEC_JAR_UNSIGNED), \
100 MANIFEST := $(JCE_MANIFEST), \
101 SKIP_METAINF := true))
102
103$(SUNEC_JAR_UNSIGNED): $(JCE_MANIFEST)
104
105ifndef OPENJDK
106 SUNEC_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ec/sunec.jar
107 $(SUNEC_JAR_DST): $(SUNEC_JAR_SRC)
erikj295c3d62013-12-05 09:25:31 +0100108 @$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
ihse554e46f2013-11-14 11:19:32 +0100109 $(install-file)
110else
111 $(SUNEC_JAR_DST): $(SUNEC_JAR_UNSIGNED)
112 $(install-file)
113endif
114
erikj295c3d62013-12-05 09:25:31 +0100115TARGETS += $(SUNEC_JAR_UNSIGNED) $(SUNEC_JAR_DST)
ihse554e46f2013-11-14 11:19:32 +0100116
117##########################################################################################
118
119SUNJCE_PROVIDER_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunjce_provider.jar
erikj295c3d62013-12-05 09:25:31 +0100120SUNJCE_PROVIDER_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunjce_provider.jar
ihse554e46f2013-11-14 11:19:32 +0100121
122ifneq ($(BUILD_CRYPTO), no)
123 $(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR, , \
124 SRCS := $(JDK_OUTPUTDIR)/classes_security, \
125 SUFFIXES := .class, \
126 INCLUDES := com/sun/crypto/provider, \
127 JAR := $(SUNJCE_PROVIDER_JAR_UNSIGNED), \
128 MANIFEST := $(JCE_MANIFEST), \
129 SKIP_METAINF := true))
130
131 $(SUNJCE_PROVIDER_JAR_UNSIGNED): $(JCE_MANIFEST)
132
erikj295c3d62013-12-05 09:25:31 +0100133 TARGETS += $(SUNJCE_PROVIDER_JAR_UNSIGNED)
ihse554e46f2013-11-14 11:19:32 +0100134endif
135
136ifndef OPENJDK
137 SUNJCE_PROVIDER_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/sunjce_provider.jar
138 $(SUNJCE_PROVIDER_JAR_DST): $(SUNJCE_PROVIDER_JAR_SRC)
erikj295c3d62013-12-05 09:25:31 +0100139 @$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
ihse554e46f2013-11-14 11:19:32 +0100140 $(install-file)
141else
142 $(SUNJCE_PROVIDER_JAR_DST): $(SUNJCE_PROVIDER_JAR_UNSIGNED)
143 $(install-file)
144endif
145
erikj295c3d62013-12-05 09:25:31 +0100146TARGETS += $(SUNJCE_PROVIDER_JAR_DST)
ihse554e46f2013-11-14 11:19:32 +0100147
148##########################################################################################
149
150JCE_JAR_DST := $(JDK_OUTPUTDIR)/lib/jce.jar
erikj295c3d62013-12-05 09:25:31 +0100151JCE_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/jce.jar
ihse554e46f2013-11-14 11:19:32 +0100152
153ifneq ($(BUILD_CRYPTO), no)
154 $(eval $(call SetupArchive,BUILD_JCE_JAR, , \
155 SRCS := $(JDK_OUTPUTDIR)/classes_security, \
156 SUFFIXES := .class, \
157 INCLUDES := javax/crypto sun/security/internal, \
158 JAR := $(JCE_JAR_UNSIGNED), \
159 MANIFEST := $(JCE_MANIFEST), \
160 SKIP_METAINF := true))
161
162 $(JCE_JAR_UNSIGNED): $(JCE_MANIFEST)
163
erikj295c3d62013-12-05 09:25:31 +0100164 TARGETS += $(JCE_JAR_UNSIGNED)
ihse554e46f2013-11-14 11:19:32 +0100165endif
166
167ifndef OPENJDK
168 JCE_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar
169 $(JCE_JAR_DST): $(JCE_JAR_SRC)
erikj295c3d62013-12-05 09:25:31 +0100170 @$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
ihse554e46f2013-11-14 11:19:32 +0100171 $(install-file)
172else
173 $(JCE_JAR_DST): $(JCE_JAR_UNSIGNED)
174 $(install-file)
175endif
176
erikj295c3d62013-12-05 09:25:31 +0100177TARGETS += $(JCE_JAR_DST)
ihse554e46f2013-11-14 11:19:32 +0100178
179##########################################################################################
180
181US_EXPORT_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar
ihse554e46f2013-11-14 11:19:32 +0100182
183ifneq ($(BUILD_CRYPTO), no)
erikj295c3d62013-12-05 09:25:31 +0100184
185 US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED := \
186 $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/US_export_policy.jar
187 US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED := \
188 $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/US_export_policy.jar
189
ihse554e46f2013-11-14 11:19:32 +0100190 #
191 # TODO fix so that SetupArchive does not write files into SRCS
192 # then we don't need this extra copying
193 #
194 # NOTE: We currently do not place restrictions on our limited export
erikj295c3d62013-12-05 09:25:31 +0100195 # policy. This was not a typo. This means we are shipping the same file
196 # for both limimted and unlimited US_export_policy.jar.
ihse554e46f2013-11-14 11:19:32 +0100197 #
198 US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited
erikj295c3d62013-12-05 09:25:31 +0100199 US_EXPORT_POLICY_JAR_TMP := \
200 $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/US_export_policy_jar.tmp
ihse554e46f2013-11-14 11:19:32 +0100201
202 $(US_EXPORT_POLICY_JAR_TMP)/%: $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
203 $(install-file)
204
205 US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
206
207 $(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR, $(US_EXPORT_POLICY_JAR_DEPS), \
208 SRCS := $(US_EXPORT_POLICY_JAR_TMP), \
209 SUFFIXES := .policy, \
erikj295c3d62013-12-05 09:25:31 +0100210 JAR := $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED), \
ihse554e46f2013-11-14 11:19:32 +0100211 EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
212 SKIP_METAINF := true))
213
erikj295c3d62013-12-05 09:25:31 +0100214 $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED): $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
215 $(ECHO) $(LOG_INFO) Copying unlimited $(patsubst $(OUTPUT_ROOT)/%,%,$@)
216 $(install-file)
217
218 TARGETS += $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED) \
219 $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
ihse554e46f2013-11-14 11:19:32 +0100220endif
221
222ifndef OPENJDK
erikj295c3d62013-12-05 09:25:31 +0100223 ifeq ($(UNLIMITED_CRYPTO), true)
224 $(error No prebuilt unlimited crypto jars available)
225 endif
ihse554e46f2013-11-14 11:19:32 +0100226 $(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
erikj295c3d62013-12-05 09:25:31 +0100227 $(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
ihse554e46f2013-11-14 11:19:32 +0100228 $(install-file)
229else
erikj295c3d62013-12-05 09:25:31 +0100230 ifeq ($(UNLIMITED_CRYPTO), true)
231 $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
ihse554e46f2013-11-14 11:19:32 +0100232 $(install-file)
erikj295c3d62013-12-05 09:25:31 +0100233 else
234 $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED)
235 $(install-file)
236 endif
ihse554e46f2013-11-14 11:19:32 +0100237endif
238
erikj295c3d62013-12-05 09:25:31 +0100239TARGETS += $(US_EXPORT_POLICY_JAR_DST)
ihse554e46f2013-11-14 11:19:32 +0100240
241##########################################################################################
242
243LOCAL_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/local_policy.jar
ihse554e46f2013-11-14 11:19:32 +0100244
245ifneq ($(BUILD_CRYPTO), no)
erikj295c3d62013-12-05 09:25:31 +0100246
247 LOCAL_POLICY_JAR_LIMITED_UNSIGNED := \
248 $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/local_policy.jar
249 LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED := \
250 $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/local_policy.jar
251
ihse554e46f2013-11-14 11:19:32 +0100252 #
253 # TODO fix so that SetupArchive does not write files into SRCS
254 # then we don't need this extra copying
255 #
erikj295c3d62013-12-05 09:25:31 +0100256 LOCAL_POLICY_JAR_LIMITED_TMP := \
257 $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/local_policy_jar.tmp
258 LOCAL_POLICY_JAR_UNLIMITED_TMP := \
259 $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/local_policy_jar.tmp
ihse554e46f2013-11-14 11:19:32 +0100260
erikj295c3d62013-12-05 09:25:31 +0100261 $(LOCAL_POLICY_JAR_LIMITED_TMP)/%: $(JDK_TOPDIR)/make/data/cryptopolicy/limited/%
ihse554e46f2013-11-14 11:19:32 +0100262 $(install-file)
263
erikj295c3d62013-12-05 09:25:31 +0100264 $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/%: $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited/%
265 $(install-file)
266
267 $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_LIMITED, \
268 $(LOCAL_POLICY_JAR_LIMITED_TMP)/exempt_local.policy \
269 $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \
270 SRCS := $(LOCAL_POLICY_JAR_LIMITED_TMP), \
ihse554e46f2013-11-14 11:19:32 +0100271 SUFFIXES := .policy, \
erikj295c3d62013-12-05 09:25:31 +0100272 JAR := $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED), \
273 EXTRA_MANIFEST_ATTR := Crypto-Strength: limited, \
ihse554e46f2013-11-14 11:19:32 +0100274 SKIP_METAINF := true))
275
erikj295c3d62013-12-05 09:25:31 +0100276 $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_UNLIMITED, \
277 $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \
278 SRCS := $(LOCAL_POLICY_JAR_UNLIMITED_TMP), \
279 SUFFIXES := .policy, \
280 JAR := $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED), \
281 EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
282 SKIP_METAINF := true))
283
284 TARGETS += $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED) $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
285
286 ifndef OPENJDK
287 $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/README.txt: \
288 $(JDK_TOPDIR)/make/closed/javax/crypto/doc/README.txt
289 $(install-file)
290
291 TARGETS += $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/README.txt
292 endif
ihse554e46f2013-11-14 11:19:32 +0100293endif
294
295ifndef OPENJDK
296 $(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
erikj295c3d62013-12-05 09:25:31 +0100297 $(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
ihse554e46f2013-11-14 11:19:32 +0100298 $(install-file)
299else
erikj295c3d62013-12-05 09:25:31 +0100300 ifeq ($(UNLIMITED_CRYPTO), true)
301 $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
ihse554e46f2013-11-14 11:19:32 +0100302 $(install-file)
erikj295c3d62013-12-05 09:25:31 +0100303 else
304 $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED)
305 $(install-file)
306 endif
ihse554e46f2013-11-14 11:19:32 +0100307endif
308
erikj295c3d62013-12-05 09:25:31 +0100309TARGETS += $(LOCAL_POLICY_JAR_DST)
ihse554e46f2013-11-14 11:19:32 +0100310
311##########################################################################################
312
313ifeq ($(OPENJDK_TARGET_OS), windows)
314
315 SUNMSCAPI_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunmscapi.jar
erikj295c3d62013-12-05 09:25:31 +0100316 SUNMSCAPI_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunmscapi.jar
ihse554e46f2013-11-14 11:19:32 +0100317
318 $(eval $(call SetupArchive,BUILD_SUNMSCAPI_JAR, , \
319 SRCS := $(JDK_OUTPUTDIR)/classes_security, \
320 SUFFIXES := .class, \
321 INCLUDES := sun/security/mscapi, \
322 JAR := $(SUNMSCAPI_JAR_UNSIGNED), \
323 MANIFEST := $(JCE_MANIFEST), \
324 SKIP_METAINF := true))
325
326 $(SUNMSCAPI_JAR_UNSIGNED): $(JCE_MANIFEST)
327
328 ifndef OPENJDK
329 SUNMSCAPI_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/mscapi/sunmscapi.jar
330 $(SUNMSCAPI_JAR_DST): $(SUNMSCAPI_JAR_SRC)
erikj295c3d62013-12-05 09:25:31 +0100331 @$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
ihse554e46f2013-11-14 11:19:32 +0100332 $(install-file)
333 else
334 $(SUNMSCAPI_JAR_DST): $(SUNMSCAPI_JAR_UNSIGNED)
335 $(install-file)
336 endif
337
erikj295c3d62013-12-05 09:25:31 +0100338 TARGETS += $(SUNMSCAPI_JAR_UNSIGNED) $(SUNMSCAPI_JAR_DST)
ihse554e46f2013-11-14 11:19:32 +0100339
340endif
341
342##########################################################################################
343
344ifeq ($(OPENJDK_TARGET_OS), solaris)
345 ifndef OPENJDK
346
347 UCRYPTO_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/ucrypto.jar
erikj295c3d62013-12-05 09:25:31 +0100348 UCRYPTO_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/ucrypto.jar
ihse554e46f2013-11-14 11:19:32 +0100349 UCRYPTO_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ucrypto/ucrypto.jar
350
351 $(eval $(call SetupArchive,BUILD_UCRYPTO_JAR, , \
352 SRCS := $(JDK_OUTPUTDIR)/classes_security, \
353 SUFFIXES := .class, \
354 INCLUDES := com/oracle/security/ucrypto, \
355 JAR := $(UCRYPTO_JAR_UNSIGNED), \
356 MANIFEST := $(JCE_MANIFEST), \
357 SKIP_METAINF := true))
358
359 $(UCRYPTO_JAR_UNSIGNED): $(JCE_MANIFEST)
360
361 $(UCRYPTO_JAR_DST): $(UCRYPTO_JAR_SRC)
erikj295c3d62013-12-05 09:25:31 +0100362 @$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
ihse554e46f2013-11-14 11:19:32 +0100363 $(install-file)
364
erikj295c3d62013-12-05 09:25:31 +0100365 TARGETS += $(UCRYPTO_JAR_UNSIGNED) $(UCRYPTO_JAR_DST)
ihse554e46f2013-11-14 11:19:32 +0100366
367 endif
368endif
369
erikj295c3d62013-12-05 09:25:31 +0100370all: $(TARGETS)
ihse554e46f2013-11-14 11:19:32 +0100371
372.PHONY: default all