|
1 # |
|
2 # Copyright (c) 2009, 2011, 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 |
|
26 # |
|
27 # Makefile for building sunec.jar and sunec native library. |
|
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 sunec.jar. |
|
64 # If JDK, installs prebuilt |
|
65 # sunec.jar. |
|
66 # |
|
67 # jar Builds/installs sunec.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 sunec.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 sunec.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.ec |
|
93 PRODUCT = sun |
|
94 |
|
95 # |
|
96 # The following is for when we need to do postprocessing |
|
97 # (signing) against a read-only build. If the OUTPUTDIR |
|
98 # isn't writable, the build currently crashes out. |
|
99 # |
|
100 ifndef OPENJDK |
|
101 ifdef ALT_JCE_BUILD_DIR |
|
102 # ===================================================== |
|
103 # Where to place the output, in case we're building from a read-only |
|
104 # build area. (e.g. a release engineering build.) |
|
105 JCE_BUILD_DIR=${ALT_JCE_BUILD_DIR} |
|
106 IGNORE_WRITABLE_OUTPUTDIR_TEST=true |
|
107 else |
|
108 JCE_BUILD_DIR=${TEMPDIR} |
|
109 endif |
|
110 endif |
|
111 |
|
112 JAVAC_MAX_WARNINGS=false |
|
113 JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation |
|
114 JAVAC_WARNINGS_FATAL=true |
|
115 include $(BUILDDIR)/common/Defs.gmk |
|
116 |
|
117 # |
|
118 # Location for the newly built classfiles. |
|
119 # |
|
120 CLASSDESTDIR = $(TEMPDIR)/classes |
|
121 |
|
122 # |
|
123 # Java files |
|
124 # |
|
125 AUTO_FILES_JAVA_DIRS = $(PKGDIR) |
|
126 |
|
127 # |
|
128 # Exclude the sources that get built by ../other/Makefile |
|
129 # |
|
130 AUTO_JAVA_PRUNE = \ |
|
131 ECKeyFactory.java \ |
|
132 ECParameters.java \ |
|
133 ECPrivateKeyImpl.java \ |
|
134 ECPublicKeyImpl.java \ |
|
135 NamedCurve.java |
|
136 |
|
137 # |
|
138 # Some licensees do not get the native ECC sources, but we still need to |
|
139 # be able to build "all" for them. Check here to see if the sources are |
|
140 # available. If not, then skip them. |
|
141 # |
|
142 |
|
143 NATIVE_ECC_AVAILABLE := $(shell \ |
|
144 if [ -d $(SHARE_SRC)/native/$(PKGDIR)/impl ] ; then \ |
|
145 $(ECHO) true; \ |
|
146 else \ |
|
147 $(ECHO) false; \ |
|
148 fi) |
|
149 |
|
150 ifeq ($(NATIVE_ECC_AVAILABLE), true) |
|
151 |
|
152 LIBRARY = sunec |
|
153 |
|
154 # |
|
155 # Java files that define native methods |
|
156 # |
|
157 FILES_export = \ |
|
158 $(PKGDIR)/ECDHKeyAgreement.java \ |
|
159 $(PKGDIR)/ECDSASignature.java \ |
|
160 $(PKGDIR)/ECKeyPairGenerator.java |
|
161 |
|
162 JAVAHFLAGS += -Xbootclasspath/p:$(CLASSDESTDIR) |
|
163 |
|
164 # |
|
165 # C and C++ files |
|
166 # |
|
167 include FILES_c.gmk |
|
168 |
|
169 FILES_cpp = ECC_JNI.cpp |
|
170 |
|
171 CPLUSPLUSLIBRARY=true |
|
172 |
|
173 FILES_m = mapfile-vers |
|
174 |
|
175 # |
|
176 # Find native code |
|
177 # |
|
178 vpath %.cpp $(SHARE_SRC)/native/$(PKGDIR) |
|
179 |
|
180 vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/impl |
|
181 |
|
182 # |
|
183 # Find include files |
|
184 # |
|
185 OTHER_INCLUDES += -I$(SHARE_SRC)/native/$(PKGDIR)/impl |
|
186 |
|
187 # |
|
188 # Compiler flags |
|
189 # |
|
190 OTHER_CFLAGS += -DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B |
|
191 |
|
192 # |
|
193 # Libraries to link |
|
194 # |
|
195 ifneq ($(PLATFORM), windows) |
|
196 OTHER_LDLIBS = $(LIBCXX) |
|
197 endif |
|
198 |
|
199 include $(BUILDDIR)/common/Mapfile-vers.gmk |
|
200 |
|
201 include $(BUILDDIR)/common/Library.gmk |
|
202 |
|
203 else # NATIVE_ECC_AVAILABLE |
|
204 |
|
205 include $(BUILDDIR)/common/Classes.gmk |
|
206 |
|
207 endif # NATIVE_ECC_AVAILABLE |
|
208 |
|
209 # |
|
210 # We use a variety of subdirectories in the $(TEMPDIR) depending on what |
|
211 # part of the build we're doing. Both OPENJDK/JDK builds are initially |
|
212 # done in the unsigned area. When files are signed in JDK, |
|
213 # they will be placed in the appropriate area. |
|
214 # |
|
215 UNSIGNED_DIR = $(TEMPDIR)/unsigned |
|
216 |
|
217 include $(BUILDDIR)/javax/crypto/Defs-jce.gmk |
|
218 |
|
219 # |
|
220 # Rules |
|
221 # |
|
222 |
|
223 ifdef OPENJDK |
|
224 all: build-jar install-jar |
|
225 else |
|
226 all: build-jar install-prebuilt |
|
227 $(build-warning) |
|
228 endif |
|
229 |
|
230 |
|
231 # ===================================================== |
|
232 # Build the unsigned sunec.jar file. |
|
233 # |
|
234 |
|
235 JAR_DESTFILE = $(EXTDIR)/sunec.jar |
|
236 |
|
237 # |
|
238 # Since the -C option to jar is used below, each directory entry must be |
|
239 # preceded with the appropriate directory to "cd" into. |
|
240 # |
|
241 JAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS)) |
|
242 |
|
243 build-jar: $(UNSIGNED_DIR)/sunec.jar |
|
244 |
|
245 # |
|
246 # Build sunec.jar. |
|
247 # |
|
248 $(UNSIGNED_DIR)/sunec.jar: build |
|
249 $(prep-target) |
|
250 $(BOOT_JAR_CMD) cf $@ $(JAR_DIRS) \ |
|
251 $(BOOT_JAR_JFLAGS) |
|
252 @$(java-vm-cleanup) |
|
253 |
|
254 |
|
255 ifndef OPENJDK |
|
256 # ===================================================== |
|
257 # Sign the provider jar file. Not needed for OpenJDK. |
|
258 # |
|
259 |
|
260 SIGNED_DIR = $(JCE_BUILD_DIR)/signed |
|
261 |
|
262 sign: sign-jar |
|
263 |
|
264 sign-jar: $(SIGNED_DIR)/sunec.jar |
|
265 |
|
266 ifndef ALT_JCE_BUILD_DIR |
|
267 $(SIGNED_DIR)/sunec.jar: $(UNSIGNED_DIR)/sunec.jar |
|
268 else |
|
269 # |
|
270 # We have to remove the build dependency, otherwise, we'll try to rebuild it |
|
271 # which we can't do on a read-only filesystem. |
|
272 # |
|
273 $(SIGNED_DIR)/sunec.jar: |
|
274 @if [ ! -r $(UNSIGNED_DIR)/sunec.jar ] ; then \ |
|
275 $(ECHO) "Couldn't find $(UNSIGNED_DIR)/sunec.jar"; \ |
|
276 exit 1; \ |
|
277 fi |
|
278 endif |
|
279 $(call sign-file, $(UNSIGNED_DIR)/sunec.jar) |
|
280 |
|
281 |
|
282 # ===================================================== |
|
283 # Create the Release Engineering files. Signed builds, etc. |
|
284 # |
|
285 |
|
286 release: $(SIGNED_DIR)/sunec.jar |
|
287 $(RM) $(JCE_BUILD_DIR)/release/sunec.jar |
|
288 $(MKDIR) -p $(JCE_BUILD_DIR)/release |
|
289 $(CP) $(SIGNED_DIR)/sunec.jar $(JCE_BUILD_DIR)/release |
|
290 $(release-warning) |
|
291 |
|
292 endif # OPENJDK |
|
293 |
|
294 |
|
295 # ===================================================== |
|
296 # Install routines. |
|
297 # |
|
298 |
|
299 # |
|
300 # Install sunec.jar, depending on which type is requested. |
|
301 # |
|
302 install-jar jar: $(JAR_DESTFILE) |
|
303 ifndef OPENJDK |
|
304 $(release-warning) |
|
305 endif |
|
306 |
|
307 ifdef OPENJDK |
|
308 $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunec.jar |
|
309 else |
|
310 $(JAR_DESTFILE): $(SIGNED_DIR)/sunec.jar |
|
311 endif |
|
312 $(install-file) |
|
313 |
|
314 ifndef OPENJDK |
|
315 install-prebuilt: |
|
316 @$(ECHO) "\n>>>Installing prebuilt SunEC provider..." |
|
317 $(RM) $(JAR_DESTFILE) |
|
318 $(CP) $(PREBUILT_DIR)/ec/sunec.jar $(JAR_DESTFILE) |
|
319 endif |
|
320 |
|
321 |
|
322 # ===================================================== |
|
323 # Support routines. |
|
324 # |
|
325 |
|
326 clobber clean:: |
|
327 $(RM) -r $(JAR_DESTFILE) $(TEMPDIR) $(JCE_BUILD_DIR) |
|
328 |
|
329 .PHONY: build-jar jar install-jar |
|
330 ifndef OPENJDK |
|
331 .PHONY: sign sign-jar release install-prebuilt |
|
332 endif |