2
|
1 |
#
|
|
2 |
# Copyright 2003-2007 Sun Microsystems, Inc. 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. Sun designates this
|
|
8 |
# particular file as subject to the "Classpath" exception as provided
|
|
9 |
# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
22 |
# CA 95054 USA or visit www.sun.com if you need additional information or
|
|
23 |
# have any questions.
|
|
24 |
#
|
|
25 |
|
|
26 |
#
|
|
27 |
# Makefile for building sunpkcs11.jar and native libraries.
|
|
28 |
#
|
|
29 |
# This file was derived from make/com/sun/crypto/provider/Makefile.
|
|
30 |
#
|
|
31 |
|
|
32 |
#
|
|
33 |
# (The terms "OpenJDK" and "JDK" below refer to OpenJDK and Sun JDK builds
|
|
34 |
# respectively.)
|
|
35 |
#
|
|
36 |
# JCE builds are very different between OpenJDK and JDK. The OpenJDK JCE
|
|
37 |
# jar files do not require signing, but those for JDK do. If an unsigned
|
|
38 |
# jar file is installed into JDK, things will break when the crypto
|
|
39 |
# routines are called.
|
|
40 |
#
|
|
41 |
# This Makefile does the "real" build of the JCE files. For OpenJDK,
|
|
42 |
# the jar files built here are installed directly into the OpenJDK.
|
|
43 |
#
|
|
44 |
# For JDK, the binaries use pre-built/pre-signed binary files stored in
|
|
45 |
# the closed workspace that are not shipped in the OpenJDK workspaces.
|
|
46 |
# We still build the JDK files here to verify the files compile, and in
|
|
47 |
# preparation for possible signing. Developers working on JCE in JDK
|
|
48 |
# must sign the JCE files before testing. The JCE signing key is kept
|
|
49 |
# separate from the JDK workspace to prevent its disclosure.
|
|
50 |
#
|
|
51 |
# SPECIAL NOTE TO JCE/JDK developers: The source files must eventually
|
|
52 |
# be built, signed, and then the resulting jar files MUST BE CHECKED
|
|
53 |
# INTO THE CLOSED PART OF THE WORKSPACE*. This separate step *MUST NOT
|
|
54 |
# BE FORGOTTEN*, otherwise a bug fixed in the source code will not be
|
|
55 |
# reflected in the shipped binaries. The "release" target should be
|
|
56 |
# used to generate the required files.
|
|
57 |
#
|
|
58 |
# There are a number of targets to help both JDK/OpenJDK developers.
|
|
59 |
#
|
|
60 |
# Main Targets (JDK/OPENJDK):
|
|
61 |
#
|
|
62 |
# all/clobber/clean The usual, plus the native libraries.
|
|
63 |
# If OpenJDK, installs sunpkcs11.jar.
|
|
64 |
# If JDK, installs prebuilt
|
|
65 |
# sunpkcs11.jar.
|
|
66 |
#
|
|
67 |
# jar Builds/installs sunpkcs11.jar
|
|
68 |
# If OpenJDK, does not sign.
|
|
69 |
# If JDK, tries to sign.
|
|
70 |
#
|
|
71 |
# Other lesser-used Targets (JDK/OPENJDK):
|
|
72 |
#
|
|
73 |
# build-jar Builds sunpkcs11.jar
|
|
74 |
# (does not sign/install)
|
|
75 |
#
|
|
76 |
# install-jar Alias for "jar" above.
|
|
77 |
#
|
|
78 |
# Other targets (JDK only):
|
|
79 |
#
|
|
80 |
# sign Alias for sign-jar
|
|
81 |
# sign-jar Builds/signs sunpkcs11.jar (no install)
|
|
82 |
#
|
|
83 |
# release Builds all targets in preparation
|
|
84 |
# for workspace integration.
|
|
85 |
#
|
|
86 |
# install-prebuilt Installs the pre-built jar files
|
|
87 |
#
|
|
88 |
# This makefile was written to support parallel target execution.
|
|
89 |
#
|
|
90 |
|
|
91 |
BUILDDIR = ../../..
|
|
92 |
PACKAGE = sun.security.pkcs11
|
|
93 |
LIBRARY = j2pkcs11
|
|
94 |
PRODUCT = sun
|
|
95 |
include $(BUILDDIR)/common/Defs.gmk
|
|
96 |
include $(BUILDDIR)/javax/crypto/Defs-jce.gmk
|
|
97 |
|
|
98 |
#
|
|
99 |
# C and Java Files
|
|
100 |
#
|
|
101 |
include FILES_c.gmk
|
|
102 |
|
|
103 |
#
|
|
104 |
# Subdirectories of these are automatically included.
|
|
105 |
#
|
|
106 |
AUTO_FILES_JAVA_DIRS = sun/security/pkcs11
|
|
107 |
|
|
108 |
#
|
|
109 |
# Java files that define native methods
|
|
110 |
#
|
|
111 |
FILES_export = \
|
|
112 |
sun/security/pkcs11/wrapper/PKCS11.java \
|
|
113 |
sun/security/pkcs11/Secmod.java
|
|
114 |
|
|
115 |
#
|
|
116 |
# Find native code
|
|
117 |
#
|
|
118 |
vpath %.c \
|
|
119 |
$(SHARE_SRC)/native/sun/security/pkcs11/wrapper \
|
|
120 |
$(PLATFORM_SRC)/native/sun/security/pkcs11/wrapper \
|
|
121 |
|
|
122 |
#
|
|
123 |
# Find include files
|
|
124 |
#
|
|
125 |
OTHER_INCLUDES += \
|
|
126 |
-I$(SHARE_SRC)/native/sun/security/pkcs11/wrapper \
|
|
127 |
-I$(PLATFORM_SRC)/native/sun/security/pkcs11/wrapper
|
|
128 |
|
|
129 |
#
|
|
130 |
# Rules
|
|
131 |
#
|
|
132 |
CLASSDESTDIR = $(TEMPDIR)/classes
|
|
133 |
|
|
134 |
include $(BUILDDIR)/common/Mapfile-vers.gmk
|
|
135 |
|
|
136 |
include $(BUILDDIR)/common/Library.gmk
|
|
137 |
|
|
138 |
#
|
|
139 |
# Libraries to link
|
|
140 |
#
|
|
141 |
ifeq ($(PLATFORM), windows)
|
|
142 |
OTHER_LDLIBS = $(JVMLIB)
|
|
143 |
else
|
|
144 |
OTHER_LDLIBS = -ldl $(JVMLIB)
|
|
145 |
endif
|
|
146 |
|
|
147 |
#
|
|
148 |
# We use a variety of subdirectories in the $(TEMPDIR) depending on what
|
|
149 |
# part of the build we're doing. Both OPENJDK/JDK builds are initially
|
|
150 |
# done in the unsigned area. When files are signed in JDK,
|
|
151 |
# they will be placed in the appropriate area.
|
|
152 |
#
|
|
153 |
UNSIGNED_DIR = $(TEMPDIR)/unsigned
|
|
154 |
|
|
155 |
#
|
|
156 |
# Rules
|
|
157 |
#
|
|
158 |
|
|
159 |
ifdef OPENJDK
|
|
160 |
all: build-jar install-jar
|
|
161 |
else
|
|
162 |
all: build-jar install-prebuilt
|
|
163 |
$(build-warning)
|
|
164 |
endif
|
|
165 |
|
|
166 |
|
|
167 |
# =====================================================
|
|
168 |
# Build the unsigned sunpkcs11.jar file.
|
|
169 |
#
|
|
170 |
|
|
171 |
JAR_DESTFILE = $(EXTDIR)/sunpkcs11.jar
|
|
172 |
|
|
173 |
#
|
|
174 |
# The sunpkcs11.jar needs to be in the extension class directory,
|
|
175 |
# therefore none of its classes can appear in $(CLASSBINDIR).
|
|
176 |
# Currently no one is using any of the PKCS11 internals, so these files
|
|
177 |
# should not have been built.
|
|
178 |
#
|
|
179 |
|
|
180 |
#
|
|
181 |
# Since the -C option to jar is used below, each directory entry must be
|
|
182 |
# preceded with the appropriate directory to "cd" into.
|
|
183 |
#
|
|
184 |
JAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS))
|
|
185 |
|
|
186 |
build-jar: $(UNSIGNED_DIR)/sunpkcs11.jar
|
|
187 |
|
|
188 |
#
|
|
189 |
# Build sunpkcs11.jar.
|
|
190 |
#
|
|
191 |
$(UNSIGNED_DIR)/sunpkcs11.jar: build
|
|
192 |
$(prep-target)
|
|
193 |
$(BOOT_JAR_CMD) cf $@ $(JAR_DIRS) \
|
|
194 |
$(JAR_JFLAGS)
|
|
195 |
@$(java-vm-cleanup)
|
|
196 |
|
|
197 |
|
|
198 |
ifndef OPENJDK
|
|
199 |
# =====================================================
|
|
200 |
# Sign the provider jar file. Not needed for OpenJDK.
|
|
201 |
#
|
|
202 |
|
|
203 |
SIGNED_DIR = $(TEMPDIR)/signed
|
|
204 |
|
|
205 |
sign: sign-jar
|
|
206 |
|
|
207 |
sign-jar: $(SIGNED_DIR)/sunpkcs11.jar
|
|
208 |
|
|
209 |
$(SIGNED_DIR)/sunpkcs11.jar: $(UNSIGNED_DIR)/sunpkcs11.jar
|
|
210 |
$(sign-file)
|
|
211 |
|
|
212 |
|
|
213 |
# =====================================================
|
|
214 |
# Create the Release Engineering files. Signed builds, etc.
|
|
215 |
#
|
|
216 |
|
|
217 |
release: $(SIGNED_DIR)/sunpkcs11.jar
|
|
218 |
$(RM) $(RELEASE_DIR)/sunpkcs11.jar
|
|
219 |
$(MKDIR) -p $(RELEASE_DIR)
|
|
220 |
$(CP) $(SIGNED_DIR)/sunpkcs11.jar $(RELEASE_DIR)
|
|
221 |
$(release-warning)
|
|
222 |
|
|
223 |
endif # OPENJDK
|
|
224 |
|
|
225 |
|
|
226 |
# =====================================================
|
|
227 |
# Install routines.
|
|
228 |
#
|
|
229 |
|
|
230 |
#
|
|
231 |
# Install sunpkcs11.jar, depending on which type is requested.
|
|
232 |
#
|
|
233 |
install-jar jar: $(JAR_DESTFILE)
|
|
234 |
ifndef OPENJDK
|
|
235 |
$(release-warning)
|
|
236 |
endif
|
|
237 |
|
|
238 |
ifdef OPENJDK
|
|
239 |
$(JAR_DESTFILE): $(UNSIGNED_DIR)/sunpkcs11.jar
|
|
240 |
else
|
|
241 |
$(JAR_DESTFILE): $(SIGNED_DIR)/sunpkcs11.jar
|
|
242 |
endif
|
|
243 |
$(install-file)
|
|
244 |
|
|
245 |
ifndef OPENJDK
|
|
246 |
install-prebuilt:
|
|
247 |
@$(ECHO) "\n>>>Installing prebuilt SunPKCS11 provider..."
|
|
248 |
$(RM) $(JAR_DESTFILE)
|
|
249 |
$(CP) $(PREBUILT_DIR)/pkcs11/sunpkcs11.jar $(JAR_DESTFILE)
|
|
250 |
endif
|
|
251 |
|
|
252 |
|
|
253 |
# =====================================================
|
|
254 |
# Support routines.
|
|
255 |
#
|
|
256 |
|
|
257 |
clobber clean::
|
|
258 |
$(RM) -r $(JAR_DESTFILE) $(TEMPDIR)
|
|
259 |
|
|
260 |
.PHONY: build-jar jar install-jar
|
|
261 |
ifndef OPENJDK
|
|
262 |
.PHONY: sign sign-jar release install-prebuilt
|
|
263 |
endif
|