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