1 # 2 # Copyright (c) 2007, 2010, 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 include $(BUILDDIR)/common/Defs.gmk 117 118 # 119 # Location for the newly built classfiles. 120 # 121 CLASSDESTDIR = $(TEMPDIR)/classes 122 123 # 124 # Subdirectories of these are automatically included. 125 # 126 AUTO_FILES_JAVA_DIRS = \ 127 com/sun/crypto/provider 128 129 include $(BUILDDIR)/common/Classes.gmk 130 131 # 132 # Rules 133 # 134 135 # 136 # Some licensees do not get the security sources, but we still need to 137 # be able to build "all" for them. Check here to see if the sources were 138 # available. If not, then we don't need to continue this rule. 139 # 140 141 ifdef OPENJDK 142 all: build-jar install-jar 143 else # OPENJDK 144 ifeq ($(strip $(FILES_java)),) 145 all: install-prebuilt 146 $(no-source-warning) 147 else # FILES_java available 148 all: build-jar install-prebuilt 149 $(build-warning) 150 endif # $(FILES_java) available 151 endif # OPENJDK 152 153 # 154 # We use a variety of subdirectories in the $(TEMPDIR) depending on what 155 # part of the build we're doing. Both OPENJDK/JDK builds are initially 156 # done in the unsigned area. When files are signed in JDK, they will be 157 # placed in the appropriate areas. 158 # 159 UNSIGNED_DIR = $(TEMPDIR)/unsigned 160 161 include $(BUILDDIR)/javax/crypto/Defs-jce.gmk 162 163 164 # ===================================================== 165 # Build the unsigned sunjce_provider.jar file. 166 # 167 168 JAR_DESTFILE = $(EXTDIR)/sunjce_provider.jar 169 170 # 171 # The sunjce_provider.jar needs to be in the extension class directory, 172 # therefore none of its classes should appear in $(CLASSBINDIR). 173 # Currently no one is using any of the SunJCE internals, so these files 174 # should not have been built. 175 # 176 177 # 178 # Since the -C option to jar is used below, each directory entry must be 179 # preceded with the appropriate directory to "cd" into. 180 # 181 JAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS)) 182 183 build-jar: $(UNSIGNED_DIR)/sunjce_provider.jar 184 185 # 186 # Build sunjce_provider.jar. 187 # 188 $(UNSIGNED_DIR)/sunjce_provider.jar: build $(JCE_MANIFEST_FILE) 189 $(prep-target) 190 $(BOOT_JAR_CMD) cmf $(JCE_MANIFEST_FILE) $@ $(JAR_DIRS) \ 191 $(BOOT_JAR_JFLAGS) 192 @$(java-vm-cleanup) 193 194 195 ifndef OPENJDK 196 # ===================================================== 197 # Sign the provider jar file. Not needed for OpenJDK. 198 # 199 200 SIGNED_DIR = $(JCE_BUILD_DIR)/signed 201 202 sign: sign-jar 203 204 sign-jar: $(SIGNED_DIR)/sunjce_provider.jar 205 206 ifndef ALT_JCE_BUILD_DIR 207 $(SIGNED_DIR)/sunjce_provider.jar: $(UNSIGNED_DIR)/sunjce_provider.jar 208 else 209 # 210 # We have to remove the build dependency, otherwise, we'll try to rebuild it 211 # which we can't do on a read-only filesystem. 212 # 213 $(SIGNED_DIR)/sunjce_provider.jar: 214 @if [ ! -r $(UNSIGNED_DIR)/sunjce_provider.jar ] ; then \ 215 $(ECHO) "Couldn't find $(UNSIGNED_DIR)/sunjce_provider.jar"; \ 216 exit 1; \ 217 fi 218 endif 219 $(call sign-file, $(UNSIGNED_DIR)/sunjce_provider.jar) 220 221 222 # ===================================================== 223 # Create the Release Engineering files. Signed builds, etc. 224 # 225 226 release: $(SIGNED_DIR)/sunjce_provider.jar 227 $(RM) $(JCE_BUILD_DIR)/release/sunjce_provider.jar 228 $(MKDIR) -p $(JCE_BUILD_DIR)/release 229 $(CP) $(SIGNED_DIR)/sunjce_provider.jar $(JCE_BUILD_DIR)/release 230 $(release-warning) 231 232 endif # OPENJDK 233 234 235 # ===================================================== 236 # Install routines. 237 # 238 239 # 240 # Install sunjce_provider.jar, depending on which type is requested. 241 # 242 install-jar jar: $(JAR_DESTFILE) 243 ifndef OPENJDK 244 $(release-warning) 245 endif 246 247 ifdef OPENJDK 248 $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunjce_provider.jar 249 else 250 $(JAR_DESTFILE): $(SIGNED_DIR)/sunjce_provider.jar 251 endif 252 $(install-file) 253 254 ifndef OPENJDK 255 install-prebuilt: 256 @$(ECHO) "\n>>>Installing prebuilt SunJCE provider..." 257 $(RM) $(JAR_DESTFILE) 258 $(CP) $(PREBUILT_DIR)/jce/sunjce_provider.jar $(JAR_DESTFILE) 259 endif 260 261 262 # ===================================================== 263 # Support routines. 264 # 265 266 clobber clean:: 267 $(RM) -r $(JAR_DESTFILE) $(TEMPDIR) $(JCE_BUILD_DIR) 268 269 .PHONY: build-jar jar install-jar 270 ifndef OPENJDK 271 .PHONY: sign sign-jar release install-prebuilt 272 endif