annotate make/sun/security/pkcs11/Makefile @ 5457:0e2200a8762c

7195931: UnsatisfiedLinkError on PKCS11.C_GetOperationState while using NSS from jre7u6+ 7197071: Makefiles for various security providers aren't including the default manifest. Reviewed-by: valeriep, mullan, katleman
author wetmore
date Tue, 11 Sep 2012 17:57:47 -0700
parents ba975a730f4b
children
rev   line source
duke@0 1 #
coffeys@4579 2 # Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
duke@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 #
duke@0 5 # This code is free software; you can redistribute it and/or modify it
duke@0 6 # under the terms of the GNU General Public License version 2 only, as
ohair@2362 7 # published by the Free Software Foundation. Oracle designates this
duke@0 8 # particular file as subject to the "Classpath" exception as provided
ohair@2362 9 # by Oracle in the LICENSE file that accompanied this code.
duke@0 10 #
duke@0 11 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 14 # version 2 for more details (a copy is included in the LICENSE file that
duke@0 15 # accompanied this code).
duke@0 16 #
duke@0 17 # You should have received a copy of the GNU General Public License version
duke@0 18 # 2 along with this work; if not, write to the Free Software Foundation,
duke@0 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 20 #
ohair@2362 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@2362 22 # or visit www.oracle.com if you need additional information or have any
ohair@2362 23 # questions.
duke@0 24 #
duke@0 25
duke@0 26 #
duke@0 27 # Makefile for building sunpkcs11.jar and native libraries.
duke@0 28 #
duke@0 29 # This file was derived from make/com/sun/crypto/provider/Makefile.
duke@0 30 #
duke@0 31
duke@0 32 #
duke@0 33 # (The terms "OpenJDK" and "JDK" below refer to OpenJDK and Sun JDK builds
duke@0 34 # respectively.)
duke@0 35 #
duke@0 36 # JCE builds are very different between OpenJDK and JDK. The OpenJDK JCE
duke@0 37 # jar files do not require signing, but those for JDK do. If an unsigned
duke@0 38 # jar file is installed into JDK, things will break when the crypto
duke@0 39 # routines are called.
duke@0 40 #
duke@0 41 # This Makefile does the "real" build of the JCE files. For OpenJDK,
duke@0 42 # the jar files built here are installed directly into the OpenJDK.
duke@0 43 #
duke@0 44 # For JDK, the binaries use pre-built/pre-signed binary files stored in
duke@0 45 # the closed workspace that are not shipped in the OpenJDK workspaces.
duke@0 46 # We still build the JDK files here to verify the files compile, and in
duke@0 47 # preparation for possible signing. Developers working on JCE in JDK
duke@0 48 # must sign the JCE files before testing. The JCE signing key is kept
duke@0 49 # separate from the JDK workspace to prevent its disclosure.
duke@0 50 #
duke@0 51 # SPECIAL NOTE TO JCE/JDK developers: The source files must eventually
duke@0 52 # be built, signed, and then the resulting jar files MUST BE CHECKED
duke@0 53 # INTO THE CLOSED PART OF THE WORKSPACE*. This separate step *MUST NOT
duke@0 54 # BE FORGOTTEN*, otherwise a bug fixed in the source code will not be
duke@0 55 # reflected in the shipped binaries. The "release" target should be
duke@0 56 # used to generate the required files.
duke@0 57 #
duke@0 58 # There are a number of targets to help both JDK/OpenJDK developers.
duke@0 59 #
duke@0 60 # Main Targets (JDK/OPENJDK):
duke@0 61 #
wetmore@1460 62 # all/clobber/clean The usual, plus the native libraries.
wetmore@1460 63 # If OpenJDK, installs sunpkcs11.jar.
wetmore@1460 64 # If JDK, installs prebuilt
wetmore@1460 65 # sunpkcs11.jar.
duke@0 66 #
wetmore@1460 67 # jar Builds/installs sunpkcs11.jar
wetmore@1460 68 # If OpenJDK, does not sign.
wetmore@1460 69 # If JDK, tries to sign.
duke@0 70 #
duke@0 71 # Other lesser-used Targets (JDK/OPENJDK):
duke@0 72 #
wetmore@1460 73 # build-jar Builds sunpkcs11.jar
wetmore@1460 74 # (does not sign/install)
duke@0 75 #
wetmore@1460 76 # install-jar Alias for "jar" above.
duke@0 77 #
duke@0 78 # Other targets (JDK only):
duke@0 79 #
wetmore@1460 80 # sign Alias for sign-jar
wetmore@1460 81 # sign-jar Builds/signs sunpkcs11.jar (no install)
duke@0 82 #
wetmore@1460 83 # release Builds all targets in preparation
wetmore@1460 84 # for workspace integration.
duke@0 85 #
wetmore@1460 86 # install-prebuilt Installs the pre-built jar files
duke@0 87 #
duke@0 88 # This makefile was written to support parallel target execution.
duke@0 89 #
duke@0 90
duke@0 91 BUILDDIR = ../../..
duke@0 92 PACKAGE = sun.security.pkcs11
duke@0 93 LIBRARY = j2pkcs11
duke@0 94 PRODUCT = sun
wetmore@160 95
wetmore@160 96 #
wetmore@160 97 # The following is for when we need to do postprocessing
wetmore@160 98 # (signing/obfuscation) against a read-only build. If the OUTPUTDIR
wetmore@160 99 # isn't writable, the build currently crashes out.
wetmore@160 100 #
wetmore@160 101 ifndef OPENJDK
wetmore@160 102 ifdef ALT_JCE_BUILD_DIR
wetmore@160 103 # =====================================================
wetmore@160 104 # Where to place the output, in case we're building from a read-only
wetmore@160 105 # build area. (e.g. a release engineering build.)
wetmore@160 106 JCE_BUILD_DIR=${ALT_JCE_BUILD_DIR}
wetmore@160 107 IGNORE_WRITABLE_OUTPUTDIR_TEST=true
wetmore@160 108 else
wetmore@160 109 JCE_BUILD_DIR=${TEMPDIR}
wetmore@160 110 endif
wetmore@160 111 endif
wetmore@160 112
duke@0 113 include $(BUILDDIR)/common/Defs.gmk
duke@0 114
duke@0 115 #
duke@0 116 # C and Java Files
duke@0 117 #
duke@0 118 include FILES_c.gmk
duke@0 119
duke@0 120 #
duke@0 121 # Subdirectories of these are automatically included.
duke@0 122 #
duke@0 123 AUTO_FILES_JAVA_DIRS = sun/security/pkcs11
duke@0 124
duke@0 125 #
duke@0 126 # Java files that define native methods
duke@0 127 #
duke@0 128 FILES_export = \
duke@0 129 sun/security/pkcs11/wrapper/PKCS11.java \
duke@0 130 sun/security/pkcs11/Secmod.java
duke@0 131
duke@0 132 #
duke@0 133 # Find native code
duke@0 134 #
duke@0 135 vpath %.c \
duke@0 136 $(SHARE_SRC)/native/sun/security/pkcs11/wrapper \
duke@0 137 $(PLATFORM_SRC)/native/sun/security/pkcs11/wrapper \
duke@0 138
duke@0 139 #
duke@0 140 # Find include files
duke@0 141 #
duke@0 142 OTHER_INCLUDES += \
duke@0 143 -I$(SHARE_SRC)/native/sun/security/pkcs11/wrapper \
duke@0 144 -I$(PLATFORM_SRC)/native/sun/security/pkcs11/wrapper
duke@0 145
duke@0 146 #
duke@0 147 # Rules
duke@0 148 #
duke@0 149 CLASSDESTDIR = $(TEMPDIR)/classes
coffeys@5136 150 JAVAHFLAGS = -bootclasspath \
coffeys@5136 151 "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
duke@0 152
duke@0 153 include $(BUILDDIR)/common/Mapfile-vers.gmk
duke@0 154
duke@0 155 include $(BUILDDIR)/common/Library.gmk
duke@0 156
duke@0 157 #
duke@0 158 # Libraries to link
duke@0 159 #
duke@0 160 ifeq ($(PLATFORM), windows)
duke@0 161 OTHER_LDLIBS = $(JVMLIB)
duke@0 162 else
michaelm@4628 163 OTHER_LDLIBS = $(LIBDL) $(JVMLIB)
duke@0 164 endif
duke@0 165
mchung@2080 166 # Other config files
mchung@2080 167 SUNPKCS11_CFG =
mchung@2080 168
mchung@2080 169 ifeq ($(PLATFORM), solaris)
mchung@2080 170 SUNPKCS11_CFG = sunpkcs11-cfg
mchung@2080 171 endif # PLATFORM
mchung@2080 172
mchung@2080 173 SUNPKCS11_CFG_SRC = $(TOPDIR)/src/share/lib/security/sunpkcs11-solaris.cfg
mchung@2080 174 SUNPKCS11_CFG_BUILD = $(LIBDIR)/security/sunpkcs11-solaris.cfg
mchung@2080 175
duke@0 176 #
duke@0 177 # We use a variety of subdirectories in the $(TEMPDIR) depending on what
duke@0 178 # part of the build we're doing. Both OPENJDK/JDK builds are initially
duke@0 179 # done in the unsigned area. When files are signed in JDK,
duke@0 180 # they will be placed in the appropriate area.
duke@0 181 #
duke@0 182 UNSIGNED_DIR = $(TEMPDIR)/unsigned
duke@0 183
duke@0 184 #
duke@0 185 # Rules
duke@0 186 #
duke@0 187
duke@0 188 ifdef OPENJDK
mchung@2080 189 all: $(SUNPKCS11_CFG) build-jar install-jar
duke@0 190 else
mchung@2080 191 all: $(SUNPKCS11_CFG) build-jar install-prebuilt
duke@0 192 $(build-warning)
duke@0 193 endif
duke@0 194
mchung@2080 195 sunpkcs11-cfg: $(SUNPKCS11_CFG_BUILD)
mchung@2080 196
mchung@2080 197 $(SUNPKCS11_CFG_BUILD): $(SUNPKCS11_CFG_SRC)
mchung@2080 198 $(install-file)
mchung@2080 199
wetmore@160 200 include $(BUILDDIR)/javax/crypto/Defs-jce.gmk
wetmore@160 201
duke@0 202
duke@0 203 # =====================================================
duke@0 204 # Build the unsigned sunpkcs11.jar file.
duke@0 205 #
duke@0 206
duke@0 207 JAR_DESTFILE = $(EXTDIR)/sunpkcs11.jar
duke@0 208
duke@0 209 #
duke@0 210 # The sunpkcs11.jar needs to be in the extension class directory,
duke@0 211 # therefore none of its classes can appear in $(CLASSBINDIR).
duke@0 212 # Currently no one is using any of the PKCS11 internals, so these files
duke@0 213 # should not have been built.
duke@0 214 #
duke@0 215
duke@0 216 #
duke@0 217 # Since the -C option to jar is used below, each directory entry must be
duke@0 218 # preceded with the appropriate directory to "cd" into.
duke@0 219 #
duke@0 220 JAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS))
duke@0 221
duke@0 222 build-jar: $(UNSIGNED_DIR)/sunpkcs11.jar
duke@0 223
duke@0 224 #
duke@0 225 # Build sunpkcs11.jar.
duke@0 226 #
wetmore@5457 227 $(UNSIGNED_DIR)/sunpkcs11.jar: build $(JCE_MANIFEST_FILE)
duke@0 228 $(prep-target)
wetmore@5457 229 $(BOOT_JAR_CMD) cmf $(JCE_MANIFEST_FILE) $@ $(JAR_DIRS) \
ohair@459 230 $(BOOT_JAR_JFLAGS)
duke@0 231 @$(java-vm-cleanup)
duke@0 232
duke@0 233
duke@0 234 ifndef OPENJDK
duke@0 235 # =====================================================
duke@0 236 # Sign the provider jar file. Not needed for OpenJDK.
duke@0 237 #
duke@0 238
wetmore@160 239 SIGNED_DIR = $(JCE_BUILD_DIR)/signed
duke@0 240
duke@0 241 sign: sign-jar
duke@0 242
duke@0 243 sign-jar: $(SIGNED_DIR)/sunpkcs11.jar
duke@0 244
wetmore@160 245 ifndef ALT_JCE_BUILD_DIR
duke@0 246 $(SIGNED_DIR)/sunpkcs11.jar: $(UNSIGNED_DIR)/sunpkcs11.jar
wetmore@160 247 else
wetmore@160 248 #
wetmore@160 249 # We have to remove the build dependency, otherwise, we'll try to rebuild it
wetmore@160 250 # which we can't do on a read-only filesystem.
wetmore@160 251 #
wetmore@160 252 $(SIGNED_DIR)/sunpkcs11.jar:
wetmore@160 253 @if [ ! -r $(UNSIGNED_DIR)/sunpkcs11.jar ] ; then \
wetmore@160 254 $(ECHO) "Couldn't find $(UNSIGNED_DIR)/sunpkcs11.jar"; \
wetmore@160 255 exit 1; \
wetmore@160 256 fi
wetmore@160 257 endif
wetmore@160 258 $(call sign-file, $(UNSIGNED_DIR)/sunpkcs11.jar)
duke@0 259
duke@0 260
duke@0 261 # =====================================================
duke@0 262 # Create the Release Engineering files. Signed builds, etc.
duke@0 263 #
duke@0 264
duke@0 265 release: $(SIGNED_DIR)/sunpkcs11.jar
wetmore@160 266 $(RM) $(JCE_BUILD_DIR)/release/sunpkcs11.jar
wetmore@160 267 $(MKDIR) -p $(JCE_BUILD_DIR)/release
wetmore@160 268 $(CP) $(SIGNED_DIR)/sunpkcs11.jar $(JCE_BUILD_DIR)/release
duke@0 269 $(release-warning)
duke@0 270
duke@0 271 endif # OPENJDK
duke@0 272
duke@0 273
duke@0 274 # =====================================================
duke@0 275 # Install routines.
duke@0 276 #
duke@0 277
duke@0 278 #
duke@0 279 # Install sunpkcs11.jar, depending on which type is requested.
duke@0 280 #
duke@0 281 install-jar jar: $(JAR_DESTFILE)
duke@0 282 ifndef OPENJDK
duke@0 283 $(release-warning)
duke@0 284 endif
duke@0 285
duke@0 286 ifdef OPENJDK
duke@0 287 $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunpkcs11.jar
duke@0 288 else
duke@0 289 $(JAR_DESTFILE): $(SIGNED_DIR)/sunpkcs11.jar
duke@0 290 endif
mchung@3686 291 $(install-file)
duke@0 292
duke@0 293 ifndef OPENJDK
duke@0 294 install-prebuilt:
duke@0 295 @$(ECHO) "\n>>>Installing prebuilt SunPKCS11 provider..."
duke@0 296 $(RM) $(JAR_DESTFILE)
duke@0 297 $(CP) $(PREBUILT_DIR)/pkcs11/sunpkcs11.jar $(JAR_DESTFILE)
duke@0 298 endif
duke@0 299
duke@0 300
duke@0 301 # =====================================================
duke@0 302 # Support routines.
duke@0 303 #
duke@0 304
duke@0 305 clobber clean::
wetmore@160 306 $(RM) -r $(JAR_DESTFILE) $(TEMPDIR) $(JCE_BUILD_DIR)
mchung@2080 307 $(RM) $(SUNPKCS11_CFG_BUILD)
duke@0 308
duke@0 309 .PHONY: build-jar jar install-jar
duke@0 310 ifndef OPENJDK
duke@0 311 .PHONY: sign sign-jar release install-prebuilt
duke@0 312 endif