Makefile revision 5482
15256N/A#
15256N/A# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
14045N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
14045N/A#
10819N/A# This code is free software; you can redistribute it and/or modify it
10819N/A# under the terms of the GNU General Public License version 2 only, as
10819N/A# published by the Free Software Foundation. Oracle designates this
10819N/A# particular file as subject to the "Classpath" exception as provided
10828N/A# by Oracle in the LICENSE file that accompanied this code.
10828N/A#
10819N/A# This code is distributed in the hope that it will be useful, but WITHOUT
10819N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10819N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
10819N/A# version 2 for more details (a copy is included in the LICENSE file that
10819N/A# accompanied this code).
15256N/A#
15256N/A# You should have received a copy of the GNU General Public License version
15256N/A# 2 along with this work; if not, write to the Free Software Foundation,
14045N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
10828N/A#
10828N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
10828N/A# or visit www.oracle.com if you need additional information or have any
15256N/A# questions.
15256N/A#
10819N/A
10819N/A#
10819N/A# Makefile for building jce.jar and the various cryptographic strength
10819N/A# policy jar files.
10819N/A#
10819N/A
14045N/A#
14045N/A# (The terms "OpenJDK" and "JDK" below refer to OpenJDK and Sun JDK builds
14045N/A# respectively.)
14045N/A#
14045N/A# JCE builds are very different between OpenJDK and JDK. The OpenJDK JCE
10819N/A# jar files do not require signing, but those for JDK do. If an unsigned
10819N/A# jar file is installed into JDK, things will break when the crypto
10819N/A# routines are called.
10819N/A#
10819N/A# This Makefile does the "real" build of the JCE files. There are some
10819N/A# javac options currently specific to JCE, so we recompile now to make
10819N/A# sure any implicit compilations didn't use any incorrect flags.
10819N/A#
10819N/A# For OpenJDK, the jar files built here are installed directly into the
10819N/A# OpenJDK.
10819N/A#
14045N/A# For JDK, the binaries use pre-built/pre-signed binary files stored in
10819N/A# the closed workspace that are not shipped in the OpenJDK workspaces.
10819N/A# We still build the JDK files here to verify the files compile, and in
10819N/A# preparation for possible signing. Developers working on JCE in JDK
14045N/A# must sign the JCE files before testing. The JCE signing key is kept
10819N/A# separate from the JDK workspace to prevent its disclosure.
14045N/A#
14045N/A# SPECIAL NOTE TO JCE/JDK developers: The source files must eventually
12239N/A# be built and signed, and the resulting jar files *MUST BE CHECKED INTO
12239N/A# THE CLOSED PART OF THE WORKSPACE*. This separate step *MUST NOT BE
12239N/A# FORGOTTEN*, otherwise a bug fixed in the source code will not be
12239N/A# reflected in the shipped binaries. The "release" target should be
12239N/A# used to generate the required files.
12239N/A#
12239N/A# There are a number of targets to help both JDK/OpenJDK developers.
12239N/A#
12239N/A# Main Targets (JDK/OPENJDK):
12239N/A#
12239N/A# all/clobber/clean The usual.
12239N/A# If OpenJDK: builds/installs the
12239N/A# jce.jar/limited policy files.
12239N/A# If JDK: builds but does not install.
12239N/A# During full tops-down builds,
12239N/A# prebuilt/presigned jce.jar &
12239N/A# limited policy files are copied
12239N/A# in by make/java/redist/Makefile.
12239N/A# If you are working in this directory
12239N/A# and want to install the prebuilts,
12239N/A# use the "install-prebuilt" target.
12239N/A#
12239N/A# jar Builds/installs jce.jar
12752N/A# If OpenJDK, does not sign
12755N/A# If JDK, tries to sign
12929N/A#
10819N/A# Other lesser-used Targets (JDK/OPENJDK):
12752N/A#
12752N/A# build-jar Builds jce.jar (does not sign/install)
10819N/A#
10819N/A# build-policy Builds policy files (does not sign/install)
10819N/A#
10819N/A# install-jar Alias for "jar" above
10819N/A#
10819N/A# install-limited Builds/installs limited policy files
10819N/A# If OpenJDK, does not sign
10819N/A# If JDK, tries to sign
10819N/A# install-unlimited Builds/nstalls unlimited policy files
10819N/A# If OpenJDK, does not sign
10819N/A# If JDK, tries to sign
10819N/A#
10819N/A# Other targets (JDK only):
10819N/A#
10819N/A# sign Alias for sign-jar and sign-policy
10819N/A# sign-jar Builds/signs jce.jar file (no install)
10819N/A# sign-policy Builds/signs policy files (no install)
10819N/A#
10819N/A# release Builds all targets in preparation
10819N/A# for workspace integration.
10819N/A#
10819N/A# install-prebuilt Installs the pre-built jar files
10819N/A#
10819N/A# This makefile was written to support parallel target execution.
10819N/A#
10819N/A
10819N/ABUILDDIR = ../..
10819N/APACKAGE = javax.crypto
10819N/APRODUCT = sun
10819N/A
10819N/A#
10819N/A# The following is for when we need to do postprocessing
10819N/A# (signing) against a read-only build. If the OUTPUTDIR
10819N/A# isn't writable, the build currently crashes out.
10819N/A#
10819N/Aifndef OPENJDK
10819N/A ifdef ALT_JCE_BUILD_DIR
10819N/A # =====================================================
10819N/A # Where to place the output, in case we're building from a read-only
10819N/A # build area. (e.g. a release engineering build.)
10819N/A JCE_BUILD_DIR=${ALT_JCE_BUILD_DIR}
10819N/A IGNORE_WRITABLE_OUTPUTDIR_TEST=true
10819N/A else
10819N/A JCE_BUILD_DIR=${TEMPDIR}
10819N/A endif
10819N/Aendif
10819N/A
10819N/Ainclude $(BUILDDIR)/common/Defs.gmk
10819N/A
10819N/A#
10819N/A# Location for the newly built classfiles.
10819N/A#
10819N/ACLASSDESTDIR = $(TEMPDIR)/classes
10819N/A
10819N/A#
10819N/A# Subdirectories of these are automatically included.
10819N/A#
10819N/AAUTO_FILES_JAVA_DIRS = \
10819N/A javax/crypto \
10819N/A sun/security/internal/interfaces \
10819N/A sun/security/internal/spec
10819N/A
10819N/Ainclude $(BUILDDIR)/common/Classes.gmk
12752N/A
12755N/A#
12929N/A# Rules
10819N/A#
12752N/A
12752N/A#
12752N/A# Some licensees do not get the security sources, but we still need to
10819N/A# be able to build "all" for them. Check here to see if the sources were
10819N/A# available. If not, then we don't need to continue this rule.
10819N/A#
10819N/A
10819N/Aifdef OPENJDK
10819N/Aifdef UNLIMITED_CRYPTO
10819N/APOLICY = install-unlimited
10819N/Aelse
10819N/APOLICY = install-limited
10819N/Aendif
10819N/Aall: build-jar install-jar build-policy $(POLICY)
10819N/Aelse # OPENJDK
10819N/Aifeq ($(strip $(FILES_java)),)
10819N/Aall:
10819N/A $(no-source-warning)
10819N/Aelse # FILES_java/policy files available
10819N/Aall: build-jar build-policy
10819N/A $(build-warning)
10819N/Aendif # $(FILES_java)/policy files available
10819N/Aendif # OPENJDK
10819N/A
10819N/A#
10819N/A# We use a variety of subdirectories in the $(TEMPDIR) depending on what
10819N/A# part of the build we're doing. Both OPENJDK/JDK builds are initially
10819N/A# done in the unsigned area. When files are signed in JDK, they will be
10819N/A# placed in the appropriate areas.
10819N/A#
10819N/AUNSIGNED_DIR = $(TEMPDIR)/unsigned
10819N/A
10819N/Ainclude Defs-jce.gmk
10819N/A
10819N/A
10819N/A# =====================================================
10819N/A# Build the unsigned jce.jar file. Signing comes later.
10819N/A#
10819N/A
10819N/AJAR_DESTFILE = $(LIBDIR)/jce.jar
10819N/A
10819N/A#
10819N/A# JCE building is somewhat involved.
10819N/A#
10819N/A# OpenJDK: Since we do not ship prebuilt JCE files, previous compiles
10819N/A# in the build may have needed JCE class signatures. There were then
10819N/A# implicitly built by javac (likely using the boot javac). While using
10819N/A# those class files was fine for signatures, we need to rebuild using
10819N/A# the right compiler.
10819N/A#
10819N/A# JDK: Even through the jce.jar was previously installed, since the
10819N/A# source files are accessible in the source directories, they will
10819N/A# always be "newer" than the prebuilt files inside the jar, and thus
10819N/A# make will always rebuild them. (We could "hide" the JCE source in a
10819N/A# separate directory, but that would make the build logic for JDK and
10819N/A# OpenJDK more complicated.)
10819N/A#
10819N/A# Thus in either situation, we shouldn't use these files.
10819N/A#
10819N/A# To make sure the classes were built with the right compiler options,
10819N/A# delete the existing files in $(CLASSBINDIR), rebuild the right way in a
10819N/A# directory under $(TEMPDIR), then copy the files back to
10819N/A# $(CLASSBINDIR). Building in $(TEMPDIR) allows us to use our make
10819N/A# infrastructure without modification: .classes.list, macros, etc.
10819N/A#
10819N/A
10819N/A#
10819N/A# The list of directories that will be remade from scratch, using the
10819N/A# right compilers/options.
10819N/A#
10819N/ADELETE_DIRS = $(patsubst %, $(CLASSBINDIR)/%, $(AUTO_FILES_JAVA_DIRS))
10819N/A
10819N/A#
10819N/A# Since the -C option to jar is used below, each directory entry must be
10819N/A# preceded with the appropriate directory to "cd" into.
10819N/A#
10819N/AJAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS))
10819N/A
10819N/Abuild-jar: $(UNSIGNED_DIR)/jce.jar
10819N/A
10819N/A#
10819N/A# Build jce.jar, then replace the previously built JCE files in the
10819N/A# classes directory with these. This ensures we have consistently built
10819N/A# files throughout the workspaces.
10819N/A#
10819N/A$(UNSIGNED_DIR)/jce.jar: prebuild build $(JCE_MANIFEST_FILE)
10819N/A $(prep-target)
10819N/A $(BOOT_JAR_CMD) cmf $(JCE_MANIFEST_FILE) $@ $(JAR_DIRS) \
10819N/A $(BOOT_JAR_JFLAGS)
10819N/A $(CP) -r $(CLASSDESTDIR)/* $(CLASSBINDIR)
10819N/A @$(java-vm-cleanup)
10819N/A
10819N/Abuild: prebuild
10819N/A
10819N/Aprebuild:
10819N/A $(RM) -r $(DELETE_DIRS)
10819N/A
10819N/A
10819N/A# =====================================================
10819N/A# Build the unsigned policy files.
10819N/A#
10819N/A# Given the current state of world export/import policies,
10819N/A# these settings work for Sun's situation. This note is not
10819N/A# legal guidance, you must still resolve any export/import issues
10819N/A# applicable for your situation. Contact your export/import
10819N/A# counsel for more information.
10819N/A#
10819N/A
10819N/APOLICY_DESTDIR = $(LIBDIR)/security
10819N/AUNSIGNED_POLICY_BUILDDIR = $(UNSIGNED_DIR)/policy
10819N/A
10819N/Abuild-policy: unlimited limited
10819N/A
10819N/A#
10819N/A# Build the unsigned unlimited policy files.
10819N/A#
10819N/Aunlimited: \
10819N/A $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar \
10819N/A $(UNSIGNED_POLICY_BUILDDIR)/unlimited/local_policy.jar
10819N/A
10819N/A$(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar: \
10819N/A policy/unlimited/default_US_export.policy \
10819N/A policy/unlimited/UNLIMITED
10819N/A $(prep-target)
10819N/A $(BOOT_JAR_CMD) cmf policy/unlimited/UNLIMITED $@ \
10819N/A -C policy/unlimited default_US_export.policy \
10819N/A $(BOOT_JAR_JFLAGS)
10819N/A @$(java-vm-cleanup)
10819N/A
10819N/A$(UNSIGNED_POLICY_BUILDDIR)/unlimited/local_policy.jar: \
10819N/A policy/unlimited/default_local.policy \
10819N/A policy/unlimited/UNLIMITED
10819N/A $(prep-target)
10819N/A $(BOOT_JAR_CMD) cmf policy/unlimited/UNLIMITED $@ \
10819N/A -C policy/unlimited default_local.policy \
10819N/A $(BOOT_JAR_JFLAGS)
10819N/A @$(java-vm-cleanup)
10819N/A
10819N/A#
10819N/A# Build the unsigned limited policy files.
10819N/A#
10819N/A# NOTE: We currently do not place restrictions on our limited export
10819N/A# policy. This was not a typo.
10819N/A#
10819N/Alimited: \
10819N/A $(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar \
10819N/A $(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar
10819N/A
10819N/A$(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar: \
10819N/A $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar
10819N/A $(install-file)
10819N/A
10819N/A$(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar: \
10819N/A policy/limited/default_local.policy \
10819N/A policy/limited/exempt_local.policy \
10819N/A policy/limited/LIMITED
10819N/A $(prep-target)
10819N/A $(BOOT_JAR_CMD) cmf policy/limited/LIMITED $@ \
10819N/A -C policy/limited default_local.policy \
10819N/A -C policy/limited exempt_local.policy \
10819N/A $(BOOT_JAR_JFLAGS)
10819N/A @$(java-vm-cleanup)
10819N/A
10819N/AUNSIGNED_POLICY_FILES = \
10819N/A $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar \
10819N/A $(UNSIGNED_POLICY_BUILDDIR)/unlimited/local_policy.jar \
10819N/A $(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar \
10819N/A $(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar \
10819N/A
10819N/A
10819N/Aifndef OPENJDK
10819N/A# =====================================================
10819N/A# Sign the various jar files. Not needed for OpenJDK.
10819N/A#
10819N/A
10819N/ASIGNED_DIR = $(JCE_BUILD_DIR)/signed
10819N/ASIGNED_POLICY_BUILDDIR = $(SIGNED_DIR)/policy
10819N/A
10819N/ASIGNED_POLICY_FILES = \
10819N/A $(patsubst $(UNSIGNED_POLICY_BUILDDIR)/%,$(SIGNED_POLICY_BUILDDIR)/%, \
10819N/A $(UNSIGNED_POLICY_FILES))
10819N/A
10819N/Asign: sign-jar sign-policy
10819N/A
10819N/Asign-jar: $(SIGNED_DIR)/jce.jar
10819N/A
10819N/Asign-policy: $(SIGNED_POLICY_FILES)
10819N/A
10819N/Aifndef ALT_JCE_BUILD_DIR
10819N/A$(SIGNED_DIR)/jce.jar: $(UNSIGNED_DIR)/jce.jar
10819N/Aelse
10819N/A#
10819N/A# We have to remove the build dependency, otherwise, we'll try to rebuild it
10819N/A# which we can't do on a read-only filesystem.
10819N/A#
10819N/A$(SIGNED_DIR)/jce.jar:
10819N/A @if [ ! -r $(UNSIGNED_DIR)/jce.jar ] ; then \
10819N/A $(ECHO) "Couldn't find $(UNSIGNED_DIR)/jce.jar"; \
10819N/A exit 1; \
10819N/A fi
10819N/Aendif
10819N/A $(call sign-file, $(UNSIGNED_DIR)/jce.jar)
10819N/A
10819N/A$(SIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar: \
10819N/A $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar
10819N/A $(call sign-file, $<)
10819N/A
10819N/A$(SIGNED_POLICY_BUILDDIR)/unlimited/local_policy.jar: \
10819N/A $(UNSIGNED_POLICY_BUILDDIR)/unlimited/local_policy.jar
10819N/A $(call sign-file, $<)
10819N/A
10819N/A$(SIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar: \
10819N/A $(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar
10819N/A $(call sign-file, $<)
10819N/A
10819N/A$(SIGNED_POLICY_BUILDDIR)/limited/local_policy.jar: \
10819N/A $(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar
10819N/A $(call sign-file, $<)
10819N/A
10819N/A
10819N/A# =====================================================
10819N/A# Create the Release Engineering files. Signed builds,
10819N/A# unlimited policy file distribution, etc.
10819N/A#
10819N/A
10819N/ACLOSED_DIR = $(BUILDDIR)/closed/javax/crypto
10819N/A
10819N/Arelease: $(SIGNED_DIR)/jce.jar sign-policy $(CLOSED_DIR)/doc/README.txt
10819N/A $(RM) -r \
10819N/A $(JCE_BUILD_DIR)/release/UnlimitedJCEPolicy \
10819N/A $(JCE_BUILD_DIR)/release/jce.jar \
10819N/A $(JCE_BUILD_DIR)/release/US_export_policy.jar \
10819N/A $(JCE_BUILD_DIR)/release/local_policy.jar \
10819N/A $(JCE_BUILD_DIR)/release/UnlimitedJCEPolicy.zip
10819N/A $(MKDIR) -p $(JCE_BUILD_DIR)/release/UnlimitedJCEPolicy
10819N/A $(CP) $(SIGNED_DIR)/jce.jar $(JCE_BUILD_DIR)/release
10819N/A $(CP) \
10819N/A $(SIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar \
10819N/A $(SIGNED_POLICY_BUILDDIR)/limited/local_policy.jar \
10819N/A $(JCE_BUILD_DIR)/release
10819N/A $(CP) \
10819N/A $(SIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar \
10819N/A $(SIGNED_POLICY_BUILDDIR)/unlimited/local_policy.jar \
10819N/A $(CLOSED_DIR)/doc/README.txt \
10819N/A $(JCE_BUILD_DIR)/release/UnlimitedJCEPolicy
10819N/A cd $(JCE_BUILD_DIR)/release ; \
10819N/A $(ZIPEXE) -qr UnlimitedJCEPolicy.zip UnlimitedJCEPolicy
10819N/A $(release-warning)
10819N/A
10819N/Aendif # OPENJDK
10819N/A
10819N/A
10819N/A# =====================================================
10819N/A# Install routines.
10819N/A#
10819N/A
10819N/A#
10819N/A# Install jce.jar, depending on which type is requested.
10819N/A#
10819N/Ainstall-jar jar: $(JAR_DESTFILE)
10819N/Aifndef OPENJDK
10819N/A $(release-warning)
10819N/Aendif
10819N/A
10819N/Aifdef OPENJDK
10819N/A$(JAR_DESTFILE): $(UNSIGNED_DIR)/jce.jar
10819N/Aelse
10819N/A$(JAR_DESTFILE): $(SIGNED_DIR)/jce.jar
10819N/Aendif
10819N/A $(install-file)
10819N/A
12929N/A#
10819N/A# Install the appropriate policy file, depending on the type of build.
12929N/A#
12929N/Aifdef OPENJDK
10819N/AINSTALL_POLICYDIR = $(UNSIGNED_POLICY_BUILDDIR)
12929N/Aelse
12929N/AINSTALL_POLICYDIR = $(SIGNED_POLICY_BUILDDIR)
12929N/Aendif
12929N/A
10819N/Ainstall-limited-jars: \
10819N/A $(INSTALL_POLICYDIR)/limited/US_export_policy.jar \
10819N/A $(INSTALL_POLICYDIR)/limited/local_policy.jar
10819N/A $(MKDIR) -p $(POLICY_DESTDIR)
12929N/A $(RM) \
10819N/A $(POLICY_DESTDIR)/US_export_policy.jar \
10819N/A $(POLICY_DESTDIR)/local_policy.jar
10819N/A $(CP) $^ $(POLICY_DESTDIR)
10819N/A
10819N/Ainstall-limited: install-limited-jars
10819N/Aifndef OPENJDK
10819N/A $(release-warning)
10819N/Aendif
10819N/A
10819N/Ainstall-unlimited-jars: \
10819N/A $(INSTALL_POLICYDIR)/unlimited/US_export_policy.jar \
10819N/A $(INSTALL_POLICYDIR)/unlimited/local_policy.jar
10819N/A $(MKDIR) -p $(POLICY_DESTDIR)
10819N/A $(RM) \
10819N/A $(POLICY_DESTDIR)/US_export_policy.jar \
10819N/A $(POLICY_DESTDIR)/local_policy.jar
10819N/A $(CP) $^ $(POLICY_DESTDIR)
10819N/A
12929N/Ainstall-unlimited: install-unlimited-jars
10819N/Aifndef OPENJDK
10819N/A $(release-warning)
10819N/Aendif
10819N/A
10819N/Aifndef OPENJDK
10819N/Ainstall-prebuilt-jars:
10819N/A @$(ECHO) "\n>>>Installing prebuilt JCE framework..."
10819N/A $(RM) $(JAR_DESTFILE) \
12929N/A $(POLICY_DESTDIR)/US_export_policy.jar \
12929N/A $(POLICY_DESTDIR)/local_policy.jar
12929N/A $(CP) $(PREBUILT_DIR)/jce/jce.jar $(JAR_DESTFILE)
10819N/A $(CP) \
12929N/A $(PREBUILT_DIR)/jce/US_export_policy.jar \
12929N/A $(PREBUILT_DIR)/jce/local_policy.jar \
12929N/A $(POLICY_DESTDIR)
12929N/A
12929N/Ainstall-prebuilt: install-prebuilt-jars
12929N/Aendif
10819N/A
10819N/A# =====================================================
12929N/A# Support routines.
10819N/A#
10819N/A
10819N/Aclobber clean::
10819N/A $(RM) -r $(JAR_DESTFILE) $(POLICY_DESTDIR)/US_export_policy.jar \
10819N/A $(POLICY_DESTDIR)/local_policy.jar $(DELETE_DIRS) $(TEMPDIR) \
10819N/A $(JCE_BUILD_DIR)
10819N/A
12239N/A.PHONY: build-jar jar build-policy unlimited limited install-jar \
10819N/A install-limited install-unlimited
10819N/Aifndef OPENJDK
10819N/A.PHONY: sign sign-jar sign-policy release install-prebuilt
10819N/Aendif
10819N/A