Makefile revision 0
19c7b1a0293498a3e36692c59646ed6e15ffc8d0Tinderbox User# Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ec5347e2c775f027573ce5648b910361aa926c01Automatic 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
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# particular file as subject to the "Classpath" exception as provided
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# by Sun in the LICENSE file that accompanied this code.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# This code is distributed in the hope that it will be useful, but WITHOUT
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# version 2 for more details (a copy is included in the LICENSE file that
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# accompanied this code).
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User# You should have received a copy of the GNU General Public License version
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# 2 along with this work; if not, write to the Free Software Foundation,
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# CA 95054 USA or visit www.sun.com if you need additional information or
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# have any questions.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Makefile for building jce.jar and the various cryptographic strength
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# policy jar files.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# (The terms "OpenJDK" and "JDK" below refer to OpenJDK and Sun JDK builds
86b0285d7e65601645db4090d62ee6cb63abad6cAndreas Gustafsson# respectively.)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# JCE builds are very different between OpenJDK and JDK. The OpenJDK JCE
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# jar files do not require signing, but those for JDK do. If an unsigned
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# jar file is installed into JDK, things will break when the crypto
c1a883f2e04d94e99c433b1f6cfd0c0338f4ed85Mark Andrews# routines are called.
19c7b1a0293498a3e36692c59646ed6e15ffc8d0Tinderbox User# This Makefile does the "real" build of the JCE files. There are some
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# javac options currently specific to JCE, so we recompile now to make
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# sure any implicit compilations didn't use any incorrect flags.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# For OpenJDK, the jar files built here are installed directly into the
f5d30e2864e048a42c4dc1134993ae7efdb5d6c3Mark Andrews# For JDK, the binaries use pre-built/pre-signed/pre-obfuscated binary
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# files stored in the closed workspace that are not shipped in the
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# OpenJDK workspaces. We still build the JDK files here to verify the
86b0285d7e65601645db4090d62ee6cb63abad6cAndreas Gustafsson# files compile, and in preparation for possible signing and
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# obfuscation. Developers working on JCE in JDK must sign the JCE files
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# before testing: obfuscation is optional during development. The JCE
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# signing key is kept separate from the JDK workspace to prevent its
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# disclosure. The obfuscation tool has not been licensed for general
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# SPECIAL NOTE TO JCE/JDK developers: The source files must eventually
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# be built, obfuscated, signed, and the resulting jar files *MUST BE
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# CHECKED INTO THE CLOSED PART OF THE WORKSPACE*. This separate step
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# *MUST NOT BE FORGOTTEN*, otherwise a bug fixed in the source code will
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# not be reflected in the shipped binaries. The "release" target should
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# be used to generate the required files.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# There are a number of targets to help both JDK/OpenJDK developers.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Main Targets (JDK/OPENJDK):
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# If OpenJDK, installs
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# jce.jar/limited policy files.
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# If JDK, installs prebuilt
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# If OpenJDK, does not sign
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# If JDK, tries to sign
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# Other lesser-used Targets (JDK/OPENJDK):
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# build-jar Builds jce.jar (does not sign/install)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# build-policy Builds policy files (does not sign/install)
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# install-jar Alias for "jar" above
86b0285d7e65601645db4090d62ee6cb63abad6cAndreas Gustafsson# install-limited Builds/installs limited policy files
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# If OpenJDK, does not sign
30eec077db2bdcb6f2a0dc388a3cdde2ede75ec1Mark Andrews# If JDK, tries to sign
86b0285d7e65601645db4090d62ee6cb63abad6cAndreas Gustafsson# install-unlimited Builds/nstalls unlimited policy files
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# If OpenJDK, does not sign
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# If JDK, tries to sign
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Other targets (JDK only):
86b0285d7e65601645db4090d62ee6cb63abad6cAndreas Gustafsson# sign Alias for sign-jar and sign-policy
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# sign-jar Builds/signs jce.jar file (no install)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# sign-policy Builds/signs policy files (no install)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# release Builds all targets in preparation
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# for workspace integration.
8eea877894ea5bcf5cdd9ca124a8601ad421d753Andreas Gustafsson# install-prebuilt Installs the pre-built jar files
8eea877894ea5bcf5cdd9ca124a8601ad421d753Andreas Gustafsson# This makefile was written to support parallel target execution.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Location for the newly built classfiles.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Subdirectories of these are automatically included.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Some licensees do not get the security sources, but we still need to
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# be able to build "all" for them. Check here to see if the sources were
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# available. If not, then we don't need to continue this rule.
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafssonall: build-jar install-jar build-policy install-limited
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinelse # OPENJDK
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinelse # FILES_java/policy files available
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# We use a variety of subdirectories in the $(TEMPDIR) depending on what
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# part of the build we're doing. Both OPENJDK/JDK builds are initially
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# done in the unsigned area. When files are signed or obfuscated in JDK,
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# they will be placed in the appropriate areas.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# =====================================================
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Build the unsigned jce.jar file. Signing/obfuscation comes later.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# JCE building is somewhat involved.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# OpenJDK: Since we do not ship prebuilt JCE files, previous compiles
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# in the build may have needed JCE class signatures. There were then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# implicitly built by javac (likely using the boot javac). While using
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# those class files was fine for signatures, we need to rebuild using
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# the right compiler.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# JDK: Even through the jce.jar was previously installed, since the
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# source files are accessible in the source directories, they will
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# always be "newer" than the prebuilt files inside the jar, and thus
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# make will always rebuild them. (We could "hide" the JCE source in a
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# separate directory, but that would make the build logic for JDK and
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# OpenJDK more complicated.)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Thus in either situation, we shouldn't use these files.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# To make sure the classes were built with the right compiler options,
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# delete the existing files in $(CLASSBINDIR), rebuild the right way in a
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# directory under $(TEMPDIR), then copy the files back to
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# $(CLASSBINDIR). Building in $(TEMPDIR) allows us to use our make
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# infrastructure without modification: .classes.list, macros, etc.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# The list of directories that will be remade from scratch, using the
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinDELETE_DIRS = $(patsubst %, $(CLASSBINDIR)/%, $(AUTO_FILES_JAVA_DIRS))
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Since the -C option to jar is used below, each directory entry must be
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# preceded with the appropriate directory to "cd" into.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinJAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS))
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Build jce.jar, then replace the previously built JCE files in the
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# classes directory with these. This ensures we have consistently built
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# files throughout the workspaces.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein$(UNSIGNED_DIR)/jce.jar: prebuild build $(JCE_MANIFEST_FILE)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $(BOOT_JAR_CMD) cmf $(JCE_MANIFEST_FILE) $@ $(JAR_DIRS) \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# =====================================================
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# Build the unsigned policy files.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Given the current state of world export/import policies,
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# these settings work for Sun's situation. This note is not
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# legal guidance, you must still resolve any export/import issues
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# applicable for your situation. Contact your export/import
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# counsel for more information.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinUNSIGNED_POLICY_BUILDDIR = $(UNSIGNED_DIR)/policy
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Build the unsigned unlimited policy files.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $(UNSIGNED_POLICY_BUILDDIR)/unlimited/local_policy.jar
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein$(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar: \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $(BOOT_JAR_CMD) cmf policy/unlimited/UNLIMITED $@ \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein$(UNSIGNED_POLICY_BUILDDIR)/unlimited/local_policy.jar: \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $(BOOT_JAR_CMD) cmf policy/unlimited/UNLIMITED $@ \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Build the unsigned limited policy files.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# NOTE: We currently do not place restrictions on our limited export
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# policy. This was not a typo.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein$(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar: \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein$(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar: \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $(UNSIGNED_POLICY_BUILDDIR)/unlimited/local_policy.jar \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# =====================================================
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Sign the various jar files. Not needed for OpenJDK.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $(patsubst $(UNSIGNED_POLICY_BUILDDIR)/%,$(SIGNED_POLICY_BUILDDIR)/%, \
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson$(SIGNED_DIR)/jce.jar: $(UNSIGNED_DIR)/jce.jar
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein$(SIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar: \
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson$(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein$(SIGNED_POLICY_BUILDDIR)/unlimited/local_policy.jar: \
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson$(UNSIGNED_POLICY_BUILDDIR)/unlimited/local_policy.jar
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein$(SIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar: \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein$(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar
$(presign)
$(preobfus)
@# The sun.security.internal classes are currently not obfuscated
@# so that they are included in the jce.jar file.
$(JAR_JFLAGS)
$(RM) -r \
$(CP) -r \
$(RELEASE_DIR)
$(CP) \
cd $(RELEASE_DIR) ; \
# Install jce.jar, depending on which type is requested.
$(RM) \
$(RM) \
$(CP) \