Makefile revision 4632
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# This code is free software; you can redistribute it and/or modify it
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# under the terms of the GNU General Public License version 2 only, as
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# published by the Free Software Foundation. Oracle designates this
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# particular file as subject to the "Classpath" exception as provided
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# by Oracle in the LICENSE file that accompanied this code.
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# This code is distributed in the hope that it will be useful, but WITHOUT
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# version 2 for more details (a copy is included in the LICENSE file that
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# accompanied this code).
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# You should have received a copy of the GNU General Public License version
df14cce4dfffe6714159d81699105027ff9e25c3cilix# 2 along with this work; if not, write to the Free Software Foundation,
dd077ad5b18808e4d36956554368377cf25c2eb6cilix# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6b76ef6bb3e9b4e1cc83e01cd81a55bbd0450989cilix# or visit www.oracle.com if you need additional information or have any
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# questions.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# Makefile for building sunpkcs11.jar and native libraries.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# This file was derived from make/com/sun/crypto/provider/Makefile.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# (The terms "OpenJDK" and "JDK" below refer to OpenJDK and Sun JDK builds
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# respectively.)
32461c0cc717f51ba84908e1eea5b1ee150cf27ecilix# JCE builds are very different between OpenJDK and JDK. The OpenJDK JCE
32461c0cc717f51ba84908e1eea5b1ee150cf27ecilix# jar files do not require signing, but those for JDK do. If an unsigned
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould# jar file is installed into JDK, things will break when the crypto
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# routines are called.
71dea9c6fbd2fd6d73cce6f1ed96151d51ada58fcilix# This Makefile does the "real" build of the JCE files. For OpenJDK,
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# the jar files built here are installed directly into the OpenJDK.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# For JDK, the binaries use pre-built/pre-signed binary files stored in
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# the closed workspace that are not shipped in the OpenJDK workspaces.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# We still build the JDK files here to verify the files compile, and in
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# preparation for possible signing. Developers working on JCE in JDK
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# must sign the JCE files before testing. The JCE signing key is kept
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# separate from the JDK workspace to prevent its disclosure.
43d06c7da14a174c6b2b41f9849b0cf098de4770mental# SPECIAL NOTE TO JCE/JDK developers: The source files must eventually
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# be built, signed, and then the resulting jar files MUST BE CHECKED
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# INTO THE CLOSED PART OF THE WORKSPACE*. This separate step *MUST NOT
90a3966dd44e306d23febc15ebd65cde07d7a4ddTed Gould# BE FORGOTTEN*, otherwise a bug fixed in the source code will not be
307028df56a44d307292d92f319456ad88d6081fcilix# reflected in the shipped binaries. The "release" target should be
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# used to generate the required files.
dd077ad5b18808e4d36956554368377cf25c2eb6cilix# There are a number of targets to help both JDK/OpenJDK developers.
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# Main Targets (JDK/OPENJDK):
1423c02f5f579ff35d29755089334211f6a0645dcilix# all/clobber/clean The usual, plus the native libraries.
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# If OpenJDK, installs sunpkcs11.jar.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# If JDK, installs prebuilt
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# If OpenJDK, does not sign.
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# If JDK, tries to sign.
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# Other lesser-used Targets (JDK/OPENJDK):
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# build-jar Builds sunpkcs11.jar
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# (does not sign/install)
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# install-jar Alias for "jar" above.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# Other targets (JDK only):
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# sign Alias for sign-jar
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# sign-jar Builds/signs sunpkcs11.jar (no install)
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# release Builds all targets in preparation
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# for workspace integration.
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# install-prebuilt Installs the pre-built jar files
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# This makefile was written to support parallel target execution.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# The following is for when we need to do postprocessing
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# (signing/obfuscation) against a read-only build. If the OUTPUTDIR
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# isn't writable, the build currently crashes out.
307028df56a44d307292d92f319456ad88d6081fcilix # =====================================================
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix # Where to place the output, in case we're building from a read-only
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix # build area. (e.g. a release engineering build.)
dd077ad5b18808e4d36956554368377cf25c2eb6cilix# C and Java Files
1423c02f5f579ff35d29755089334211f6a0645dcilix# Subdirectories of these are automatically included.
b9314c4c1c56471487e07aa368f0e311d29bee58cilix# Java files that define native methods
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# Find native code
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# Find include files
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# Libraries to link
725274d44aa54f0543dbd2397cdd68b8afd5d20acilix# Other config files
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilixSUNPKCS11_CFG_SRC = $(TOPDIR)/src/share/lib/security/sunpkcs11-solaris.cfg
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilixSUNPKCS11_CFG_BUILD = $(LIBDIR)/security/sunpkcs11-solaris.cfg
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# We use a variety of subdirectories in the $(TEMPDIR) depending on what
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# part of the build we're doing. Both OPENJDK/JDK builds are initially
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# done in the unsigned area. When files are signed in JDK,
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# they will be placed in the appropriate area.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# =====================================================
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# Build the unsigned sunpkcs11.jar file.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# The sunpkcs11.jar needs to be in the extension class directory,
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# therefore none of its classes can appear in $(CLASSBINDIR).
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# Currently no one is using any of the PKCS11 internals, so these files
b2dfb5760b4ff97eabdaa0272ba7ed7f0dd8c6ebcilix# should not have been built.
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# Since the -C option to jar is used below, each directory entry must be
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# preceded with the appropriate directory to "cd" into.
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilixJAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS))
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# =====================================================
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# Sign the provider jar file. Not needed for OpenJDK.
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix$(SIGNED_DIR)/sunpkcs11.jar: $(UNSIGNED_DIR)/sunpkcs11.jar
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# We have to remove the build dependency, otherwise, we'll try to rebuild it
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# which we can't do on a read-only filesystem.
7985c9edf0662afa7802203e6277d89673789a39cilix $(ECHO) "Couldn't find $(UNSIGNED_DIR)/sunpkcs11.jar"; \
43d06c7da14a174c6b2b41f9849b0cf098de4770mental# =====================================================
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix# Create the Release Engineering files. Signed builds, etc.
1d882e9533b20c0e0783e9d17fcd3f5466fa422fcilix $(CP) $(SIGNED_DIR)/sunpkcs11.jar $(JCE_BUILD_DIR)/release
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# =====================================================
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# Install routines.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# Install sunpkcs11.jar, depending on which type is requested.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix @$(ECHO) "\n>>>Installing prebuilt SunPKCS11 provider..."
dd077ad5b18808e4d36956554368377cf25c2eb6cilix $(CP) $(PREBUILT_DIR)/pkcs11/sunpkcs11.jar $(JAR_DESTFILE)
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# =====================================================
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# Support routines.