Makefile revision 5108
11e9368a226272085c337e9e74b79808c16fbdbaTinderbox User# Copyright (c) 2009, 2012, Oracle and/or its affiliates. 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
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# under the terms of the GNU General Public License version 2 only, as
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# published by the Free Software Foundation. Oracle designates this
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# particular file as subject to the "Classpath" exception as provided
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# by Oracle in the LICENSE file that accompanied this code.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This code is distributed in the hope that it will be useful, but WITHOUT
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# version 2 for more details (a copy is included in the LICENSE file that
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# or visit www.oracle.com if you need additional information or have any
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Makefile for building sunec.jar and sunec native library.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This file was derived from make/com/sun/crypto/provider/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
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# routines are called.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This Makefile does the "real" build of the JCE files. For OpenJDK,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# the jar files built here are installed directly into the OpenJDK.
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrews# 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
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# 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.
983df82baf1d7d0b668c98cf45928a19f175c6e7Tinderbox User# SPECIAL NOTE TO JCE/JDK developers: The source files must eventually
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# be built, signed, and then the resulting jar files MUST BE CHECKED
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# INTO THE CLOSED PART OF THE WORKSPACE*. This separate step *MUST NOT
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# BE FORGOTTEN*, otherwise a bug fixed in the source code will not be
983df82baf1d7d0b668c98cf45928a19f175c6e7Tinderbox User# reflected in the shipped binaries. The "release" target should be
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# used to generate the required files.
983df82baf1d7d0b668c98cf45928a19f175c6e7Tinderbox User# There are a number of targets to help both JDK/OpenJDK developers.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Main Targets (JDK/OPENJDK):
983df82baf1d7d0b668c98cf45928a19f175c6e7Tinderbox User# all/clobber/clean The usual, plus the native libraries.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# If OpenJDK, installs sunec.jar.
983df82baf1d7d0b668c98cf45928a19f175c6e7Tinderbox User# If JDK, installs prebuilt
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# If OpenJDK, does not sign.
fa535fa05f36a1a45027faf9d116cfa3249d9d72Tinderbox User# If JDK, tries to sign.
fa535fa05f36a1a45027faf9d116cfa3249d9d72Tinderbox User# Other lesser-used Targets (JDK/OPENJDK):
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# build-jar Builds sunec.jar
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# install-jar Alias for "jar" above.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Other targets (JDK only):
a1ad6695ed6f988406cf155aa26376f84f73bcb9Automatic Updater# sign Alias for sign-jar
10b865e9187fc77cae02f106ddcc9e03eecdfe06Tinderbox User# sign-jar Builds/signs sunec.jar (no install)
44d0f0256fbdce130a18655023c3b06bacacbd61Automatic Updater# release Builds all targets in preparation
10b865e9187fc77cae02f106ddcc9e03eecdfe06Tinderbox User# for workspace integration.
10b865e9187fc77cae02f106ddcc9e03eecdfe06Tinderbox User# 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
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# (signing) against a read-only build. If the OUTPUTDIR
10b865e9187fc77cae02f106ddcc9e03eecdfe06Tinderbox User# isn't writable, the build currently crashes out.
10b865e9187fc77cae02f106ddcc9e03eecdfe06Tinderbox User # =====================================================
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews # Where to place the output, in case we're building from a read-only
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # build area. (e.g. a release engineering build.)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Location for the newly built classfiles.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Exclude the sources that get built by ../other/Makefile
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Some licensees do not get the native ECC sources, but we still need to
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# be able to build "all" for them. Check here to see if the sources are
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# available. If not, then skip them.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if [ -d $(SHARE_SRC)/native/$(PKGDIR)/impl ] ; then \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Java files that define native methods
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # C and C++ files
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews # Find native code
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews # Find include files
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews OTHER_INCLUDES += -I$(SHARE_SRC)/native/$(PKGDIR)/impl
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Compiler flags
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein OTHER_CFLAGS += -DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Libraries to link
afb33f777af856f8c3382604a7a8ffdfe2b512c5Automatic Updater include $(BUILDDIR)/common/Mapfile-vers.gmk
afb33f777af856f8c3382604a7a8ffdfe2b512c5Automatic Updaterelse # NATIVE_ECC_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,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# they will be placed in the appropriate area.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# =====================================================
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Build the unsigned sunec.jar file.
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))
ceeb18e6907a10547859faa340ecad83bedae90cMark Andrews# =====================================================
ceeb18e6907a10547859faa340ecad83bedae90cMark Andrews# Sign the provider jar file. Not needed for OpenJDK.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein$(SIGNED_DIR)/sunec.jar: $(UNSIGNED_DIR)/sunec.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 $(ECHO) "Couldn't find $(UNSIGNED_DIR)/sunec.jar"; \
3a32ac2a720653083c7a22cb654b86c398f6d4c8Tinderbox User# =====================================================
3a32ac2a720653083c7a22cb654b86c398f6d4c8Tinderbox User# Create the Release Engineering files. Signed builds, etc.
3a32ac2a720653083c7a22cb654b86c398f6d4c8Tinderbox User $(CP) $(SIGNED_DIR)/sunec.jar $(JCE_BUILD_DIR)/release
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# =====================================================
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Install routines.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Install sunec.jar, depending on which type is requested.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein @$(ECHO) "\n>>>Installing prebuilt SunEC provider..."
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(CP) $(PREBUILT_DIR)/ec/sunec.jar $(JAR_DESTFILE)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# =====================================================
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Support routines.