annotate make/sun/security/pkcs11/Makefile @ 2362:00cd9dc3c2b5

6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
author ohair
date Tue, 25 May 2010 15:58:33 -0700
parents d30f2e22fffd
children 861213cb02c3
rev   line source
duke@0 1 #
ohair@2362 2 # Copyright (c) 2003, 2009, 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 = ../../..
mchung@2080 92 MODULE = security-sunpkcs11
duke@0 93 PACKAGE = sun.security.pkcs11
duke@0 94 LIBRARY = j2pkcs11
duke@0 95 PRODUCT = sun
wetmore@160 96
wetmore@160 97 #
wetmore@160 98 # The following is for when we need to do postprocessing
wetmore@160 99 # (signing/obfuscation) against a read-only build. If the OUTPUTDIR
wetmore@160 100 # isn't writable, the build currently crashes out.
wetmore@160 101 #
wetmore@160 102 ifndef OPENJDK
wetmore@160 103 ifdef ALT_JCE_BUILD_DIR
wetmore@160 104 # =====================================================
wetmore@160 105 # Where to place the output, in case we're building from a read-only
wetmore@160 106 # build area. (e.g. a release engineering build.)
wetmore@160 107 JCE_BUILD_DIR=${ALT_JCE_BUILD_DIR}
wetmore@160 108 IGNORE_WRITABLE_OUTPUTDIR_TEST=true
wetmore@160 109 else
wetmore@160 110 JCE_BUILD_DIR=${TEMPDIR}
wetmore@160 111 endif
wetmore@160 112 endif
wetmore@160 113
duke@0 114 include $(BUILDDIR)/common/Defs.gmk
duke@0 115
duke@0 116 #
duke@0 117 # C and Java Files
duke@0 118 #
duke@0 119 include FILES_c.gmk
duke@0 120
duke@0 121 #
duke@0 122 # Subdirectories of these are automatically included.
duke@0 123 #
duke@0 124 AUTO_FILES_JAVA_DIRS = sun/security/pkcs11
duke@0 125
duke@0 126 #
duke@0 127 # Java files that define native methods
duke@0 128 #
duke@0 129 FILES_export = \
duke@0 130 sun/security/pkcs11/wrapper/PKCS11.java \
duke@0 131 sun/security/pkcs11/Secmod.java
duke@0 132
duke@0 133 #
duke@0 134 # Find native code
duke@0 135 #
duke@0 136 vpath %.c \
duke@0 137 $(SHARE_SRC)/native/sun/security/pkcs11/wrapper \
duke@0 138 $(PLATFORM_SRC)/native/sun/security/pkcs11/wrapper \
duke@0 139
duke@0 140 #
duke@0 141 # Find include files
duke@0 142 #
duke@0 143 OTHER_INCLUDES += \
duke@0 144 -I$(SHARE_SRC)/native/sun/security/pkcs11/wrapper \
duke@0 145 -I$(PLATFORM_SRC)/native/sun/security/pkcs11/wrapper
duke@0 146
duke@0 147 #
duke@0 148 # Rules
duke@0 149 #
duke@0 150 CLASSDESTDIR = $(TEMPDIR)/classes
duke@0 151
duke@0 152 include $(BUILDDIR)/common/Mapfile-vers.gmk
duke@0 153
duke@0 154 include $(BUILDDIR)/common/Library.gmk
duke@0 155
duke@0 156 #
duke@0 157 # Libraries to link
duke@0 158 #
duke@0 159 ifeq ($(PLATFORM), windows)
duke@0 160 OTHER_LDLIBS = $(JVMLIB)
duke@0 161 else
duke@0 162 OTHER_LDLIBS = -ldl $(JVMLIB)
duke@0 163 endif
duke@0 164
mchung@2080 165 # Other config files
mchung@2080 166 SUNPKCS11_CFG =
mchung@2080 167
mchung@2080 168 ifeq ($(PLATFORM), solaris)
mchung@2080 169 SUNPKCS11_CFG = sunpkcs11-cfg
mchung@2080 170 endif # PLATFORM
mchung@2080 171
mchung@2080 172 SUNPKCS11_CFG_SRC = $(TOPDIR)/src/share/lib/security/sunpkcs11-solaris.cfg
mchung@2080 173 SUNPKCS11_CFG_BUILD = $(LIBDIR)/security/sunpkcs11-solaris.cfg
mchung@2080 174
duke@0 175 #
duke@0 176 # We use a variety of subdirectories in the $(TEMPDIR) depending on what
duke@0 177 # part of the build we're doing. Both OPENJDK/JDK builds are initially
duke@0 178 # done in the unsigned area. When files are signed in JDK,
duke@0 179 # they will be placed in the appropriate area.
duke@0 180 #
duke@0 181 UNSIGNED_DIR = $(TEMPDIR)/unsigned
duke@0 182
duke@0 183 #
duke@0 184 # Rules
duke@0 185 #
duke@0 186
duke@0 187 ifdef OPENJDK
mchung@2080 188 all: $(SUNPKCS11_CFG) build-jar install-jar
duke@0 189 else
mchung@2080 190 all: $(SUNPKCS11_CFG) build-jar install-prebuilt
duke@0 191 $(build-warning)
duke@0 192 endif
duke@0 193
mchung@2080 194 sunpkcs11-cfg: $(SUNPKCS11_CFG_BUILD)
mchung@2080 195
mchung@2080 196 $(SUNPKCS11_CFG_BUILD): $(SUNPKCS11_CFG_SRC)
mchung@2080 197 $(install-file)
mchung@2080 198
wetmore@160 199 include $(BUILDDIR)/javax/crypto/Defs-jce.gmk
wetmore@160 200
duke@0 201
duke@0 202 # =====================================================
duke@0 203 # Build the unsigned sunpkcs11.jar file.
duke@0 204 #
duke@0 205
duke@0 206 JAR_DESTFILE = $(EXTDIR)/sunpkcs11.jar
duke@0 207
duke@0 208 #
duke@0 209 # The sunpkcs11.jar needs to be in the extension class directory,
duke@0 210 # therefore none of its classes can appear in $(CLASSBINDIR).
duke@0 211 # Currently no one is using any of the PKCS11 internals, so these files
duke@0 212 # should not have been built.
duke@0 213 #
duke@0 214
duke@0 215 #
duke@0 216 # Since the -C option to jar is used below, each directory entry must be
duke@0 217 # preceded with the appropriate directory to "cd" into.
duke@0 218 #
duke@0 219 JAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS))
duke@0 220
duke@0 221 build-jar: $(UNSIGNED_DIR)/sunpkcs11.jar
duke@0 222
duke@0 223 #
duke@0 224 # Build sunpkcs11.jar.
duke@0 225 #
duke@0 226 $(UNSIGNED_DIR)/sunpkcs11.jar: build
duke@0 227 $(prep-target)
duke@0 228 $(BOOT_JAR_CMD) cf $@ $(JAR_DIRS) \
ohair@459 229 $(BOOT_JAR_JFLAGS)
duke@0 230 @$(java-vm-cleanup)
duke@0 231
duke@0 232
duke@0 233 ifndef OPENJDK
duke@0 234 # =====================================================
duke@0 235 # Sign the provider jar file. Not needed for OpenJDK.
duke@0 236 #
duke@0 237
wetmore@160 238 SIGNED_DIR = $(JCE_BUILD_DIR)/signed
duke@0 239
duke@0 240 sign: sign-jar
duke@0 241
duke@0 242 sign-jar: $(SIGNED_DIR)/sunpkcs11.jar
duke@0 243
wetmore@160 244 ifndef ALT_JCE_BUILD_DIR
duke@0 245 $(SIGNED_DIR)/sunpkcs11.jar: $(UNSIGNED_DIR)/sunpkcs11.jar
wetmore@160 246 else
wetmore@160 247 #
wetmore@160 248 # We have to remove the build dependency, otherwise, we'll try to rebuild it
wetmore@160 249 # which we can't do on a read-only filesystem.
wetmore@160 250 #
wetmore@160 251 $(SIGNED_DIR)/sunpkcs11.jar:
wetmore@160 252 @if [ ! -r $(UNSIGNED_DIR)/sunpkcs11.jar ] ; then \
wetmore@160 253 $(ECHO) "Couldn't find $(UNSIGNED_DIR)/sunpkcs11.jar"; \
wetmore@160 254 exit 1; \
wetmore@160 255 fi
wetmore@160 256 endif
wetmore@160 257 $(call sign-file, $(UNSIGNED_DIR)/sunpkcs11.jar)
duke@0 258
duke@0 259
duke@0 260 # =====================================================
duke@0 261 # Create the Release Engineering files. Signed builds, etc.
duke@0 262 #
duke@0 263
duke@0 264 release: $(SIGNED_DIR)/sunpkcs11.jar
wetmore@160 265 $(RM) $(JCE_BUILD_DIR)/release/sunpkcs11.jar
wetmore@160 266 $(MKDIR) -p $(JCE_BUILD_DIR)/release
wetmore@160 267 $(CP) $(SIGNED_DIR)/sunpkcs11.jar $(JCE_BUILD_DIR)/release
duke@0 268 $(release-warning)
duke@0 269
duke@0 270 endif # OPENJDK
duke@0 271
duke@0 272
duke@0 273 # =====================================================
duke@0 274 # Install routines.
duke@0 275 #
duke@0 276
duke@0 277 #
duke@0 278 # Install sunpkcs11.jar, depending on which type is requested.
duke@0 279 #
duke@0 280 install-jar jar: $(JAR_DESTFILE)
duke@0 281 ifndef OPENJDK
duke@0 282 $(release-warning)
duke@0 283 endif
duke@0 284
duke@0 285 ifdef OPENJDK
duke@0 286 $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunpkcs11.jar
duke@0 287 else
duke@0 288 $(JAR_DESTFILE): $(SIGNED_DIR)/sunpkcs11.jar
duke@0 289 endif
mchung@2080 290 $(install-non-module-file)
duke@0 291
duke@0 292 ifndef OPENJDK
duke@0 293 install-prebuilt:
duke@0 294 @$(ECHO) "\n>>>Installing prebuilt SunPKCS11 provider..."
duke@0 295 $(RM) $(JAR_DESTFILE)
duke@0 296 $(CP) $(PREBUILT_DIR)/pkcs11/sunpkcs11.jar $(JAR_DESTFILE)
duke@0 297 endif
duke@0 298
duke@0 299
duke@0 300 # =====================================================
duke@0 301 # Support routines.
duke@0 302 #
duke@0 303
duke@0 304 clobber clean::
wetmore@160 305 $(RM) -r $(JAR_DESTFILE) $(TEMPDIR) $(JCE_BUILD_DIR)
mchung@2080 306 $(RM) $(SUNPKCS11_CFG_BUILD)
duke@0 307
duke@0 308 .PHONY: build-jar jar install-jar
duke@0 309 ifndef OPENJDK
duke@0 310 .PHONY: sign sign-jar release install-prebuilt
duke@0 311 endif