Makefile revision 2080
794b79e6bbc3f5db1ea6ae154d739b9f1ef1a375Tinderbox User# Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
75c0816e8295e180f4bc7f10db3d0d880383bc1cMark Andrews# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater# This code is free software; you can redistribute it and/or modify it
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# under the terms of the GNU General Public License version 2 only, as
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# published by the Free Software Foundation. Sun designates this
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# particular file as subject to the "Classpath" exception as provided
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# by Sun in the LICENSE file that accompanied this code.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This code is distributed in the hope that it will be useful, but WITHOUT
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# version 2 for more details (a copy is included in the LICENSE file that
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# accompanied this code).
ea94d370123a5892f6c47a97f21d1b28d44bb168Tinderbox User# You should have received a copy of the GNU General Public License version
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# 2 along with this work; if not, write to the Free Software Foundation,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# CA 95054 USA or visit www.sun.com if you need additional information or
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# have any questions.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Makefile for building sunjce_provider.jar.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This file was derived from make/javax/crypto/Makefile.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# (The terms "OpenJDK" and "JDK" below refer to OpenJDK and Sun JDK builds
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# respectively.)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# JCE builds are very different between OpenJDK and JDK. The OpenJDK JCE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# jar files do not require signing, but those for JDK do. If an unsigned
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# jar file is installed into JDK, things will break when the crypto
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# routines are called.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This Makefile does the "real" build of the JCE files. There are some
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# javac options currently specific to JCE, so we recompile now to make
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# sure any implicit compilations didn't use any incorrect flags.
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# For OpenJDK, the jar files built here are installed directly into the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# For JDK, the binaries use pre-built/pre-signed binary files stored in
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# the closed workspace that are not shipped in the OpenJDK workspaces.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# We still build the JDK files here to verify the files compile, and in
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# preparation for possible signing. Developers working on JCE in JDK
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# must sign the JCE files before testing. The JCE signing key is kept
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# separate from the JDK workspace to prevent its disclosure.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# SPECIAL NOTE TO JCE/JDK developers: The source files must eventually
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# be built and signed, and the resulting jar files MUST BE CHECKED INTO
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# THE CLOSED PART OF THE WORKSPACE*. This separate step *MUST NOT BE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# FORGOTTEN*, otherwise a bug fixed in the source code will not be
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# reflected in the shipped binaries. The "release" target should be
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# used to generate the required files.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# There are a number of targets to help both JDK/OpenJDK developers.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Main Targets (JDK/OPENJDK):
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# If OpenJDK, installs sunjce_provider.jar.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# If JDK, installs prebuilt
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# If OpenJDK, does not sign.
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# If JDK, tries to sign.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Other lesser-used Targets (JDK/OPENJDK):
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# build-jar Builds sunjce_provider.jar
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# install-jar Alias for "jar" above.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Other targets (JDK only):
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# sign Alias for sign-jar
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# sign-jar Builds/signs sunjce_provider.jar (no install)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# release Builds all targets in preparation
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# for workspace integration.
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# install-prebuilt Installs the pre-built jar files
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This makefile was written to support parallel target execution.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# The following is for when we need to do postprocessing
794b79e6bbc3f5db1ea6ae154d739b9f1ef1a375Tinderbox User# (signing) against a read-only build. If the OUTPUTDIR
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# isn't writable, the build currently crashes out.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # =====================================================
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Where to place the output, in case we're building from a read-only
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # build area. (e.g. a release engineering build.)
8eea877894ea5bcf5cdd9ca124a8601ad421d753Andreas Gustafsson# Location for the newly built classfiles.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Subdirectories of these are automatically included.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Some licensees do not get the security sources, but we still need to
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# be able to build "all" for them. Check here to see if the sources were
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# available. If not, then we don't need to continue this rule.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinelse # OPENJDK
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinelse # FILES_java available
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# We use a variety of subdirectories in the $(TEMPDIR) depending on what
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# part of the build we're doing. Both OPENJDK/JDK builds are initially
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# done in the unsigned area. When files are signed in JDK, they will be
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# placed in the appropriate areas.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# =====================================================
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Build the unsigned sunjce_provider.jar file.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# The sunjce_provider.jar needs to be in the extension class directory,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# therefore none of its classes should appear in $(CLASSBINDIR).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Currently no one is using any of the SunJCE internals, so these files
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# should not have been built.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Since the -C option to jar is used below, each directory entry must be
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# preceded with the appropriate directory to "cd" into.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinJAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS))
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein$(UNSIGNED_DIR)/sunjce_provider.jar: build $(JCE_MANIFEST_FILE)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(BOOT_JAR_CMD) cmf $(JCE_MANIFEST_FILE) $@ $(JAR_DIRS) \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# =====================================================
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Sign the provider jar file. Not needed for OpenJDK.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein$(SIGNED_DIR)/sunjce_provider.jar: $(UNSIGNED_DIR)/sunjce_provider.jar
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# We have to remove the build dependency, otherwise, we'll try to rebuild it
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# which we can't do on a read-only filesystem.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein @if [ ! -r $(UNSIGNED_DIR)/sunjce_provider.jar ] ; then \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(ECHO) "Couldn't find $(UNSIGNED_DIR)/sunjce_provider.jar"; \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(call sign-file, $(UNSIGNED_DIR)/sunjce_provider.jar)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# =====================================================
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Create the Release Engineering files. Signed builds, etc.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(RM) $(JCE_BUILD_DIR)/release/sunjce_provider.jar
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(CP) $(SIGNED_DIR)/sunjce_provider.jar $(JCE_BUILD_DIR)/release
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# =====================================================
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Install routines.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Install sunjce_provider.jar, depending on which type is requested.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein$(JAR_DESTFILE): $(UNSIGNED_DIR)/sunjce_provider.jar
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein$(JAR_DESTFILE): $(SIGNED_DIR)/sunjce_provider.jar
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein @$(ECHO) "\n>>>Installing prebuilt SunJCE provider..."
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(CP) $(PREBUILT_DIR)/jce/sunjce_provider.jar $(JAR_DESTFILE)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# =====================================================
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Support routines.