|
1 # |
|
2 # Copyright (c) 2007, 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 sunjce_provider.jar. |
|
28 # |
|
29 # This file was derived from make/javax/crypto/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. There are some |
|
42 # javac options currently specific to JCE, so we recompile now to make |
|
43 # sure any implicit compilations didn't use any incorrect flags. |
|
44 # |
|
45 # For OpenJDK, the jar files built here are installed directly into the |
|
46 # OpenJDK. |
|
47 # |
|
48 # For JDK, the binaries use pre-built/pre-signed binary files stored in |
|
49 # the closed workspace that are not shipped in the OpenJDK workspaces. |
|
50 # We still build the JDK files here to verify the files compile, and in |
|
51 # preparation for possible signing. Developers working on JCE in JDK |
|
52 # must sign the JCE files before testing. The JCE signing key is kept |
|
53 # separate from the JDK workspace to prevent its disclosure. |
|
54 # |
|
55 # SPECIAL NOTE TO JCE/JDK developers: The source files must eventually |
|
56 # be built and signed, and the resulting jar files MUST BE CHECKED INTO |
|
57 # THE CLOSED PART OF THE WORKSPACE*. This separate step *MUST NOT BE |
|
58 # FORGOTTEN*, otherwise a bug fixed in the source code will not be |
|
59 # reflected in the shipped binaries. The "release" target should be |
|
60 # used to generate the required files. |
|
61 # |
|
62 # There are a number of targets to help both JDK/OpenJDK developers. |
|
63 # |
|
64 # Main Targets (JDK/OPENJDK): |
|
65 # |
|
66 # all/clobber/clean The usual. |
|
67 # If OpenJDK, installs sunjce_provider.jar. |
|
68 # If JDK, installs prebuilt |
|
69 # sunjce_provider.jar. |
|
70 # |
|
71 # jar Builds/installs sunjce_provider.jar |
|
72 # If OpenJDK, does not sign. |
|
73 # If JDK, tries to sign. |
|
74 # |
|
75 # Other lesser-used Targets (JDK/OPENJDK): |
|
76 # |
|
77 # build-jar Builds sunjce_provider.jar |
|
78 # (does not sign/install) |
|
79 # |
|
80 # install-jar Alias for "jar" above. |
|
81 # |
|
82 # Other targets (JDK only): |
|
83 # |
|
84 # sign Alias for sign-jar |
|
85 # sign-jar Builds/signs sunjce_provider.jar (no install) |
|
86 # |
|
87 # release Builds all targets in preparation |
|
88 # for workspace integration. |
|
89 # |
|
90 # install-prebuilt Installs the pre-built jar files |
|
91 # |
|
92 # This makefile was written to support parallel target execution. |
|
93 # |
|
94 |
|
95 BUILDDIR = ../../../.. |
|
96 PACKAGE = com.sun.crypto.provider |
|
97 PRODUCT = sun |
|
98 |
|
99 # |
|
100 # The following is for when we need to do postprocessing |
|
101 # (signing) against a read-only build. If the OUTPUTDIR |
|
102 # isn't writable, the build currently crashes out. |
|
103 # |
|
104 ifndef OPENJDK |
|
105 ifdef ALT_JCE_BUILD_DIR |
|
106 # ===================================================== |
|
107 # Where to place the output, in case we're building from a read-only |
|
108 # build area. (e.g. a release engineering build.) |
|
109 JCE_BUILD_DIR=${ALT_JCE_BUILD_DIR} |
|
110 IGNORE_WRITABLE_OUTPUTDIR_TEST=true |
|
111 else |
|
112 JCE_BUILD_DIR=${TEMPDIR} |
|
113 endif |
|
114 endif |
|
115 |
|
116 JAVAC_MAX_WARNINGS = false |
|
117 JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation |
|
118 JAVAC_WARNINGS_FATAL = true |
|
119 include $(BUILDDIR)/common/Defs.gmk |
|
120 |
|
121 # |
|
122 # Location for the newly built classfiles. |
|
123 # |
|
124 CLASSDESTDIR = $(TEMPDIR)/classes |
|
125 |
|
126 # |
|
127 # Subdirectories of these are automatically included. |
|
128 # |
|
129 AUTO_FILES_JAVA_DIRS = \ |
|
130 com/sun/crypto/provider |
|
131 |
|
132 include $(BUILDDIR)/common/Classes.gmk |
|
133 |
|
134 # |
|
135 # Rules |
|
136 # |
|
137 |
|
138 # |
|
139 # Some licensees do not get the security sources, but we still need to |
|
140 # be able to build "all" for them. Check here to see if the sources were |
|
141 # available. If not, then we don't need to continue this rule. |
|
142 # |
|
143 |
|
144 ifdef OPENJDK |
|
145 all: build-jar install-jar |
|
146 else # OPENJDK |
|
147 ifeq ($(strip $(FILES_java)),) |
|
148 all: install-prebuilt |
|
149 $(no-source-warning) |
|
150 else # FILES_java available |
|
151 all: build-jar install-prebuilt |
|
152 $(build-warning) |
|
153 endif # $(FILES_java) available |
|
154 endif # OPENJDK |
|
155 |
|
156 # |
|
157 # We use a variety of subdirectories in the $(TEMPDIR) depending on what |
|
158 # part of the build we're doing. Both OPENJDK/JDK builds are initially |
|
159 # done in the unsigned area. When files are signed in JDK, they will be |
|
160 # placed in the appropriate areas. |
|
161 # |
|
162 UNSIGNED_DIR = $(TEMPDIR)/unsigned |
|
163 |
|
164 include $(BUILDDIR)/javax/crypto/Defs-jce.gmk |
|
165 |
|
166 |
|
167 # ===================================================== |
|
168 # Build the unsigned sunjce_provider.jar file. |
|
169 # |
|
170 |
|
171 JAR_DESTFILE = $(EXTDIR)/sunjce_provider.jar |
|
172 |
|
173 # |
|
174 # The sunjce_provider.jar needs to be in the extension class directory, |
|
175 # therefore none of its classes should appear in $(CLASSBINDIR). |
|
176 # Currently no one is using any of the SunJCE 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)/sunjce_provider.jar |
|
187 |
|
188 # |
|
189 # Build sunjce_provider.jar. |
|
190 # |
|
191 $(UNSIGNED_DIR)/sunjce_provider.jar: build $(JCE_MANIFEST_FILE) |
|
192 $(prep-target) |
|
193 $(BOOT_JAR_CMD) cmf $(JCE_MANIFEST_FILE) $@ $(JAR_DIRS) \ |
|
194 $(BOOT_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 = $(JCE_BUILD_DIR)/signed |
|
204 |
|
205 sign: sign-jar |
|
206 |
|
207 sign-jar: $(SIGNED_DIR)/sunjce_provider.jar |
|
208 |
|
209 ifndef ALT_JCE_BUILD_DIR |
|
210 $(SIGNED_DIR)/sunjce_provider.jar: $(UNSIGNED_DIR)/sunjce_provider.jar |
|
211 else |
|
212 # |
|
213 # We have to remove the build dependency, otherwise, we'll try to rebuild it |
|
214 # which we can't do on a read-only filesystem. |
|
215 # |
|
216 $(SIGNED_DIR)/sunjce_provider.jar: |
|
217 @if [ ! -r $(UNSIGNED_DIR)/sunjce_provider.jar ] ; then \ |
|
218 $(ECHO) "Couldn't find $(UNSIGNED_DIR)/sunjce_provider.jar"; \ |
|
219 exit 1; \ |
|
220 fi |
|
221 endif |
|
222 $(call sign-file, $(UNSIGNED_DIR)/sunjce_provider.jar) |
|
223 |
|
224 |
|
225 # ===================================================== |
|
226 # Create the Release Engineering files. Signed builds, etc. |
|
227 # |
|
228 |
|
229 release: $(SIGNED_DIR)/sunjce_provider.jar |
|
230 $(RM) $(JCE_BUILD_DIR)/release/sunjce_provider.jar |
|
231 $(MKDIR) -p $(JCE_BUILD_DIR)/release |
|
232 $(CP) $(SIGNED_DIR)/sunjce_provider.jar $(JCE_BUILD_DIR)/release |
|
233 $(release-warning) |
|
234 |
|
235 endif # OPENJDK |
|
236 |
|
237 |
|
238 # ===================================================== |
|
239 # Install routines. |
|
240 # |
|
241 |
|
242 # |
|
243 # Install sunjce_provider.jar, depending on which type is requested. |
|
244 # |
|
245 install-jar jar: $(JAR_DESTFILE) |
|
246 ifndef OPENJDK |
|
247 $(release-warning) |
|
248 endif |
|
249 |
|
250 ifdef OPENJDK |
|
251 $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunjce_provider.jar |
|
252 else |
|
253 $(JAR_DESTFILE): $(SIGNED_DIR)/sunjce_provider.jar |
|
254 endif |
|
255 $(install-file) |
|
256 |
|
257 ifndef OPENJDK |
|
258 install-prebuilt: |
|
259 @$(ECHO) "\n>>>Installing prebuilt SunJCE provider..." |
|
260 $(RM) $(JAR_DESTFILE) |
|
261 $(CP) $(PREBUILT_DIR)/jce/sunjce_provider.jar $(JAR_DESTFILE) |
|
262 endif |
|
263 |
|
264 |
|
265 # ===================================================== |
|
266 # Support routines. |
|
267 # |
|
268 |
|
269 clobber clean:: |
|
270 $(RM) -r $(JAR_DESTFILE) $(TEMPDIR) $(JCE_BUILD_DIR) |
|
271 |
|
272 .PHONY: build-jar jar install-jar |
|
273 ifndef OPENJDK |
|
274 .PHONY: sign sign-jar release install-prebuilt |
|
275 endif |