Makefile revision 4596
885f47576842cf3c569315b9a48bd9f0ca03f203Automatic Updater# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
71bd43eebd9d6e42dbcae62b730f5b6508d5acd8Automatic Updater# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater# This code is free software; you can redistribute it and/or modify it
2bb3422dc683c013db7042f5736240de6b86f182Automatic Updater# under the terms of the GNU General Public License version 2 only, as
7b67cfadd077feb0ec3e6c78385ba0d845a9789bMark Andrews# published by the Free Software Foundation. Oracle designates this
75b70a68aefaa17ac4e768d5ed85d2f50d471490Automatic Updater# particular file as subject to the "Classpath" exception as provided
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater# by Oracle in the LICENSE file that accompanied this code.
90ff38a0d8deaf5f9c2aa5916d99b2e572d28738Automatic Updater# This code is distributed in the hope that it will be useful, but WITHOUT
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6c6a121295b30772cbf3dd75a51fb9d883051a0eAutomatic Updater# version 2 for more details (a copy is included in the LICENSE file that
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# accompanied this code).
bc0a53583d92309bebcf93c408e2f3247ebd3d3cAutomatic Updater# You should have received a copy of the GNU General Public License version
56874aef380a64a2c183b7c282c3e7a361d67fa1Automatic Updater# 2 along with this work; if not, write to the Free Software Foundation,
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# or visit www.oracle.com if you need additional information or have any
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# Makefile for building sunec.jar and sunec native library.
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# This file was derived from make/com/sun/crypto/provider/Makefile.
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# (The terms "OpenJDK" and "JDK" below refer to OpenJDK and Sun JDK builds
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# respectively.)
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# JCE builds are very different between OpenJDK and JDK. The OpenJDK JCE
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt# jar files do not require signing, but those for JDK do. If an unsigned
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# jar file is installed into JDK, things will break when the crypto
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# routines are called.
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# This Makefile does the "real" build of the JCE files. For OpenJDK,
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# the jar files built here are installed directly into the OpenJDK.
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt# For JDK, the binaries use pre-built/pre-signed binary files stored in
2d2dc37599979c83495510f8af8d1756753aa2c5Automatic Updater# the closed workspace that are not shipped in the OpenJDK workspaces.
2d2dc37599979c83495510f8af8d1756753aa2c5Automatic Updater# We still build the JDK files here to verify the files compile, and in
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt# preparation for possible signing. Developers working on JCE in JDK
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# must sign the JCE files before testing. The JCE signing key is kept
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# separate from the JDK workspace to prevent its disclosure.
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# SPECIAL NOTE TO JCE/JDK developers: The source files must eventually
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# be built, signed, and then the resulting jar files MUST BE CHECKED
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater# INTO THE CLOSED PART OF THE WORKSPACE*. This separate step *MUST NOT
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater# BE FORGOTTEN*, otherwise a bug fixed in the source code will not be
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# reflected in the shipped binaries. The "release" target should be
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# used to generate the required files.
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# There are a number of targets to help both JDK/OpenJDK developers.
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrews# Main Targets (JDK/OPENJDK):
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# all/clobber/clean The usual, plus the native libraries.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# If OpenJDK, installs sunec.jar.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# If JDK, installs prebuilt
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater# If OpenJDK, does not sign.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# If JDK, tries to sign.
80faf1588895fd26490f82f95a7a1b771df1c324Automatic Updater# Other lesser-used Targets (JDK/OPENJDK):
ca904804e43f663f08eb1ac9d6d617930b9a3cd3Automatic Updater# build-jar Builds sunec.jar
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews# install-jar Alias for "jar" above.
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# Other targets (JDK only):
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# sign Alias for sign-jar
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# sign-jar Builds/signs sunec.jar (no install)
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# release Builds all targets in preparation
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# for workspace integration.
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# install-prebuilt Installs the pre-built jar files
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# This makefile was written to support parallel target execution.
52367885450d8f61d4f2d63292beb15ba8f39ac7Automatic Updater# The following is for when we need to do postprocessing
2a31bd531072824ef252c18303859d6af7451b00Francis Dupont# (signing) against a read-only build. If the OUTPUTDIR
2a31bd531072824ef252c18303859d6af7451b00Francis Dupont# isn't writable, the build currently crashes out.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # =====================================================
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # Where to place the output, in case we're building from a read-only
885f47576842cf3c569315b9a48bd9f0ca03f203Automatic Updater # build area. (e.g. a release engineering build.)
fe80a4909bf62b602feaf246866e9d29f7654194Automatic Updater# Location for the newly built classfiles.
d145b64cacc8d9cda51f9924ec70cd4661c3e2cfAutomatic Updater# Exclude the sources that get built by ../other/Makefile
19b3dc94bce93fa76bd7e066f9298630dbc9dcb4Automatic Updater# Some licensees do not get the native ECC sources, but we still need to
d145b64cacc8d9cda51f9924ec70cd4661c3e2cfAutomatic Updater# be able to build "all" for them. Check here to see if the sources are
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# available. If not, then skip them.
0df8ead472f207020f8da22a185fe4b945248ab8Automatic Updater if [ -d $(SHARE_SRC)/native/$(PKGDIR)/impl ] ; then \
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater # Java files that define native methods
7f94d9a8162c9a96b56e66176702b66e79d8e1a2Automatic Updater JAVAHFLAGS = -bootclasspath "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater # C and C++ files
4cda4fd158d6ded5586bacea8c388445d99611eaAutomatic Updater # Find native code
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # Find include files
5ae0e2c8b72fa44237edeb37d1945b1c3535ca39Automatic Updater OTHER_INCLUDES += -I$(SHARE_SRC)/native/$(PKGDIR)/impl
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # Compiler flags
bc0a53583d92309bebcf93c408e2f3247ebd3d3cAutomatic Updater OTHER_CFLAGS += -DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B
7f94d9a8162c9a96b56e66176702b66e79d8e1a2Automatic Updater # Libraries to link
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater include $(BUILDDIR)/common/Mapfile-vers.gmk
00be0f9f61d4c6bf197d000bfa1a6b7e70ea0866Automatic Updaterelse # NATIVE_ECC_AVAILABLE
3857cb6fcabeb79d85de4b3e3e4ab99912b701f8Mark Andrews# We use a variety of subdirectories in the $(TEMPDIR) depending on what
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater# part of the build we're doing. Both OPENJDK/JDK builds are initially
80faf1588895fd26490f82f95a7a1b771df1c324Automatic Updater# done in the unsigned area. When files are signed in JDK,
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# they will be placed in the appropriate area.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtoninclude $(BUILDDIR)/javax/crypto/Defs-jce.gmk
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# =====================================================
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# Build the unsigned sunec.jar file.
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# Since the -C option to jar is used below, each directory entry must be
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews# preceded with the appropriate directory to "cd" into.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian WellingtonJAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS))
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# =====================================================
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# Sign the provider jar file. Not needed for OpenJDK.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington$(SIGNED_DIR)/sunec.jar: $(UNSIGNED_DIR)/sunec.jar
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# We have to remove the build dependency, otherwise, we'll try to rebuild it
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# which we can't do on a read-only filesystem.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington @if [ ! -r $(UNSIGNED_DIR)/sunec.jar ] ; then \
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington $(ECHO) "Couldn't find $(UNSIGNED_DIR)/sunec.jar"; \
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington $(call sign-file, $(UNSIGNED_DIR)/sunec.jar)
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# =====================================================
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# Create the Release Engineering files. Signed builds, etc.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington $(CP) $(SIGNED_DIR)/sunec.jar $(JCE_BUILD_DIR)/release
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# =====================================================
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# Install routines.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# Install sunec.jar, depending on which type is requested.
ae7e54b14c946e0984c191554db9abb4893f9349Automatic Updater @$(ECHO) "\n>>>Installing prebuilt SunEC provider..."
ae7e54b14c946e0984c191554db9abb4893f9349Automatic Updater $(CP) $(PREBUILT_DIR)/ec/sunec.jar $(JAR_DESTFILE)
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington# =====================================================
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington# Support routines.
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews $(RM) -r $(JAR_DESTFILE) $(TEMPDIR) $(JCE_BUILD_DIR)