annotate make/sun/security/pkcs11/Makefile @ 0:37a05a11f281

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children b70fc43afb8c
rev   line source
duke@0 1 #
duke@0 2 # Copyright 2003-2007 Sun Microsystems, Inc. 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
duke@0 7 # published by the Free Software Foundation. Sun designates this
duke@0 8 # particular file as subject to the "Classpath" exception as provided
duke@0 9 # by Sun 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 #
duke@0 21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 22 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 23 # have any 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 #
duke@0 62 # all/clobber/clean The usual, plus the native libraries.
duke@0 63 # If OpenJDK, installs sunpkcs11.jar.
duke@0 64 # If JDK, installs prebuilt
duke@0 65 # sunpkcs11.jar.
duke@0 66 #
duke@0 67 # jar Builds/installs sunpkcs11.jar
duke@0 68 # If OpenJDK, does not sign.
duke@0 69 # If JDK, tries to sign.
duke@0 70 #
duke@0 71 # Other lesser-used Targets (JDK/OPENJDK):
duke@0 72 #
duke@0 73 # build-jar Builds sunpkcs11.jar
duke@0 74 # (does not sign/install)
duke@0 75 #
duke@0 76 # install-jar Alias for "jar" above.
duke@0 77 #
duke@0 78 # Other targets (JDK only):
duke@0 79 #
duke@0 80 # sign Alias for sign-jar
duke@0 81 # sign-jar Builds/signs sunpkcs11.jar (no install)
duke@0 82 #
duke@0 83 # release Builds all targets in preparation
duke@0 84 # for workspace integration.
duke@0 85 #
duke@0 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
duke@0 95 include $(BUILDDIR)/common/Defs.gmk
duke@0 96 include $(BUILDDIR)/javax/crypto/Defs-jce.gmk
duke@0 97
duke@0 98 #
duke@0 99 # C and Java Files
duke@0 100 #
duke@0 101 include FILES_c.gmk
duke@0 102
duke@0 103 #
duke@0 104 # Subdirectories of these are automatically included.
duke@0 105 #
duke@0 106 AUTO_FILES_JAVA_DIRS = sun/security/pkcs11
duke@0 107
duke@0 108 #
duke@0 109 # Java files that define native methods
duke@0 110 #
duke@0 111 FILES_export = \
duke@0 112 sun/security/pkcs11/wrapper/PKCS11.java \
duke@0 113 sun/security/pkcs11/Secmod.java
duke@0 114
duke@0 115 #
duke@0 116 # Find native code
duke@0 117 #
duke@0 118 vpath %.c \
duke@0 119 $(SHARE_SRC)/native/sun/security/pkcs11/wrapper \
duke@0 120 $(PLATFORM_SRC)/native/sun/security/pkcs11/wrapper \
duke@0 121
duke@0 122 #
duke@0 123 # Find include files
duke@0 124 #
duke@0 125 OTHER_INCLUDES += \
duke@0 126 -I$(SHARE_SRC)/native/sun/security/pkcs11/wrapper \
duke@0 127 -I$(PLATFORM_SRC)/native/sun/security/pkcs11/wrapper
duke@0 128
duke@0 129 #
duke@0 130 # Rules
duke@0 131 #
duke@0 132 CLASSDESTDIR = $(TEMPDIR)/classes
duke@0 133
duke@0 134 include $(BUILDDIR)/common/Mapfile-vers.gmk
duke@0 135
duke@0 136 include $(BUILDDIR)/common/Library.gmk
duke@0 137
duke@0 138 #
duke@0 139 # Libraries to link
duke@0 140 #
duke@0 141 ifeq ($(PLATFORM), windows)
duke@0 142 OTHER_LDLIBS = $(JVMLIB)
duke@0 143 else
duke@0 144 OTHER_LDLIBS = -ldl $(JVMLIB)
duke@0 145 endif
duke@0 146
duke@0 147 #
duke@0 148 # We use a variety of subdirectories in the $(TEMPDIR) depending on what
duke@0 149 # part of the build we're doing. Both OPENJDK/JDK builds are initially
duke@0 150 # done in the unsigned area. When files are signed in JDK,
duke@0 151 # they will be placed in the appropriate area.
duke@0 152 #
duke@0 153 UNSIGNED_DIR = $(TEMPDIR)/unsigned
duke@0 154
duke@0 155 #
duke@0 156 # Rules
duke@0 157 #
duke@0 158
duke@0 159 ifdef OPENJDK
duke@0 160 all: build-jar install-jar
duke@0 161 else
duke@0 162 all: build-jar install-prebuilt
duke@0 163 $(build-warning)
duke@0 164 endif
duke@0 165
duke@0 166
duke@0 167 # =====================================================
duke@0 168 # Build the unsigned sunpkcs11.jar file.
duke@0 169 #
duke@0 170
duke@0 171 JAR_DESTFILE = $(EXTDIR)/sunpkcs11.jar
duke@0 172
duke@0 173 #
duke@0 174 # The sunpkcs11.jar needs to be in the extension class directory,
duke@0 175 # therefore none of its classes can appear in $(CLASSBINDIR).
duke@0 176 # Currently no one is using any of the PKCS11 internals, so these files
duke@0 177 # should not have been built.
duke@0 178 #
duke@0 179
duke@0 180 #
duke@0 181 # Since the -C option to jar is used below, each directory entry must be
duke@0 182 # preceded with the appropriate directory to "cd" into.
duke@0 183 #
duke@0 184 JAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS))
duke@0 185
duke@0 186 build-jar: $(UNSIGNED_DIR)/sunpkcs11.jar
duke@0 187
duke@0 188 #
duke@0 189 # Build sunpkcs11.jar.
duke@0 190 #
duke@0 191 $(UNSIGNED_DIR)/sunpkcs11.jar: build
duke@0 192 $(prep-target)
duke@0 193 $(BOOT_JAR_CMD) cf $@ $(JAR_DIRS) \
duke@0 194 $(JAR_JFLAGS)
duke@0 195 @$(java-vm-cleanup)
duke@0 196
duke@0 197
duke@0 198 ifndef OPENJDK
duke@0 199 # =====================================================
duke@0 200 # Sign the provider jar file. Not needed for OpenJDK.
duke@0 201 #
duke@0 202
duke@0 203 SIGNED_DIR = $(TEMPDIR)/signed
duke@0 204
duke@0 205 sign: sign-jar
duke@0 206
duke@0 207 sign-jar: $(SIGNED_DIR)/sunpkcs11.jar
duke@0 208
duke@0 209 $(SIGNED_DIR)/sunpkcs11.jar: $(UNSIGNED_DIR)/sunpkcs11.jar
duke@0 210 $(sign-file)
duke@0 211
duke@0 212
duke@0 213 # =====================================================
duke@0 214 # Create the Release Engineering files. Signed builds, etc.
duke@0 215 #
duke@0 216
duke@0 217 release: $(SIGNED_DIR)/sunpkcs11.jar
duke@0 218 $(RM) $(RELEASE_DIR)/sunpkcs11.jar
duke@0 219 $(MKDIR) -p $(RELEASE_DIR)
duke@0 220 $(CP) $(SIGNED_DIR)/sunpkcs11.jar $(RELEASE_DIR)
duke@0 221 $(release-warning)
duke@0 222
duke@0 223 endif # OPENJDK
duke@0 224
duke@0 225
duke@0 226 # =====================================================
duke@0 227 # Install routines.
duke@0 228 #
duke@0 229
duke@0 230 #
duke@0 231 # Install sunpkcs11.jar, depending on which type is requested.
duke@0 232 #
duke@0 233 install-jar jar: $(JAR_DESTFILE)
duke@0 234 ifndef OPENJDK
duke@0 235 $(release-warning)
duke@0 236 endif
duke@0 237
duke@0 238 ifdef OPENJDK
duke@0 239 $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunpkcs11.jar
duke@0 240 else
duke@0 241 $(JAR_DESTFILE): $(SIGNED_DIR)/sunpkcs11.jar
duke@0 242 endif
duke@0 243 $(install-file)
duke@0 244
duke@0 245 ifndef OPENJDK
duke@0 246 install-prebuilt:
duke@0 247 @$(ECHO) "\n>>>Installing prebuilt SunPKCS11 provider..."
duke@0 248 $(RM) $(JAR_DESTFILE)
duke@0 249 $(CP) $(PREBUILT_DIR)/pkcs11/sunpkcs11.jar $(JAR_DESTFILE)
duke@0 250 endif
duke@0 251
duke@0 252
duke@0 253 # =====================================================
duke@0 254 # Support routines.
duke@0 255 #
duke@0 256
duke@0 257 clobber clean::
duke@0 258 $(RM) -r $(JAR_DESTFILE) $(TEMPDIR)
duke@0 259
duke@0 260 .PHONY: build-jar jar install-jar
duke@0 261 ifndef OPENJDK
duke@0 262 .PHONY: sign sign-jar release install-prebuilt
duke@0 263 endif