blob: 21647889201acfed2594d08c0ae06c52b158a93e [file] [log] [blame]
ihse554e46f2013-11-14 11:19:32 +01001#
lana959c3a02013-11-25 09:40:25 -08002# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
ihse554e46f2013-11-14 11:19:32 +01003# 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
26include $(SPEC)
27include MakeBase.gmk
28
29# (The terms "OpenJDK" and "JDK" below refer to OpenJDK and Oracle JDK
30# builds respectively.)
31#
32# JCE builds are very different between OpenJDK and JDK. The OpenJDK JCE
33# jar files do not require signing, but those for JDK do. If an unsigned
34# jar file is installed into JDK, things will break when the crypto
35# routines are called.
36#
37# All jars are created in CreateJars.gmk. This Makefile does the signing
38# of the jars for JDK.
39#
40# For JDK, the binaries use pre-built/pre-signed binary files stored in
41# the closed workspace that are not shipped in the OpenJDK workspaces.
42# We still build the JDK files to verify the files compile, and in
43# preparation for possible signing. Developers working on JCE in JDK
44# must sign the JCE files before testing. The JCE signing key is kept
45# separate from the JDK workspace to prevent its disclosure.
46#
47# SPECIAL NOTE TO JCE/JDK developers: The source files must eventually
48# be built, signed, and then the resulting jar files MUST BE CHECKED
49# INTO THE CLOSED PART OF THE WORKSPACE*. This separate step *MUST NOT
50# BE FORGOTTEN*, otherwise a bug fixed in the source code will not be
lana959c3a02013-11-25 09:40:25 -080051# reflected in the shipped binaries.
52#
53# Please consult with Release Engineering, which is responsible for
54# creating the final JCE builds suitable for checkin.
ihse554e46f2013-11-14 11:19:32 +010055#
56
57# Default target
58all:
59
60ifndef OPENJDK
61
62README-MAKEFILE_WARNING := \
lana959c3a02013-11-25 09:40:25 -080063 "\nPlease read jdk/make/SignJars.gmk for further build instructions.\n"
ihse554e46f2013-11-14 11:19:32 +010064
65#
66# Location for JCE codesigning key.
67#
68SIGNING_KEY_DIR := /security/ws/JCE-signing/src
69SIGNING_KEYSTORE := $(SIGNING_KEY_DIR)/KeyStore.jks
70SIGNING_PASSPHRASE := $(SIGNING_KEY_DIR)/passphrase.txt
71SIGNING_ALIAS := oracle_jce_rsa
72
73#
74# Defines for signing the various jar files.
75#
76check-keystore:
77 @if [ ! -f $(SIGNING_KEYSTORE) -o ! -f $(SIGNING_PASSPHRASE) ]; then \
78 $(PRINTF) "\n$(SIGNING_KEYSTORE): Signing mechanism *NOT* available..."; \
79 $(PRINTF) $(README-MAKEFILE_WARNING); \
80 exit 2; \
81 fi
82
erikj295c3d62013-12-05 09:25:31 +010083$(JDK_OUTPUTDIR)/jce/signed/%: $(JDK_OUTPUTDIR)/jce/unsigned/%
ihse554e46f2013-11-14 11:19:32 +010084 $(call install-file)
85 $(JARSIGNER) -keystore $(SIGNING_KEYSTORE) \
86 $@ $(SIGNING_ALIAS) < $(SIGNING_PASSPHRASE)
87 @$(PRINTF) "\nJar codesigning finished.\n"
88
lana959c3a02013-11-25 09:40:25 -080089JAR_LIST := \
90 jce.jar \
erikj295c3d62013-12-05 09:25:31 +010091 policy/limited/local_policy.jar \
92 policy/limited/US_export_policy.jar \
93 policy/unlimited/local_policy.jar \
94 policy/unlimited/US_export_policy.jar \
ihse554e46f2013-11-14 11:19:32 +010095 sunec.jar \
96 sunjce_provider.jar \
97 sunpkcs11.jar \
lana959c3a02013-11-25 09:40:25 -080098 sunmscapi.jar \
99 ucrypto.jar \
100 #
ihse554e46f2013-11-14 11:19:32 +0100101
erikj295c3d62013-12-05 09:25:31 +0100102UNSIGNED_JARS := $(wildcard $(addprefix $(JDK_OUTPUTDIR)/jce/unsigned/, $(JAR_LIST)))
lana959c3a02013-11-25 09:40:25 -0800103
104ifeq ($(UNSIGNED_JARS), )
erikj295c3d62013-12-05 09:25:31 +0100105 $(error No jars found in $(JDK_OUTPUTDIR)/jce/unsigned/)
lana959c3a02013-11-25 09:40:25 -0800106endif
107
erikj295c3d62013-12-05 09:25:31 +0100108SIGNED_JARS := $(patsubst $(JDK_OUTPUTDIR)/jce/unsigned/%,$(JDK_OUTPUTDIR)/jce/signed/%, \
109 $(UNSIGNED_JARS))
ihse554e46f2013-11-14 11:19:32 +0100110
111$(SIGNED_JARS): check-keystore
112
erikj295c3d62013-12-05 09:25:31 +0100113$(JDK_OUTPUTDIR)/jce/signed/policy/unlimited/README.txt: \
114 $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/README.txt
115 $(install-file)
116
117all: $(SIGNED_JARS) $(JDK_OUTPUTDIR)/jce/signed/policy/unlimited/README.txt
lana959c3a02013-11-25 09:40:25 -0800118 @$(PRINTF) "\n*** The jar files built by the 'sign-jars' target are developer ***"
119 @$(PRINTF) "\n*** builds only and *MUST NOT* be checked into the closed workspace. ***"
120 @$(PRINTF) "\n*** ***"
121 @$(PRINTF) "\n*** Please consult with Release Engineering: they will generate ***"
122 @$(PRINTF) "\n*** the proper binaries for the closed workspace. ***"
123 @$(PRINTF) "\n"
ihse554e46f2013-11-14 11:19:32 +0100124 @$(PRINTF) $(README-MAKEFILE_WARNING)
125
126endif # !OPENJDK