jdk/makefiles/CreateJars.gmk
author amurillo
Wed, 15 Aug 2012 16:49:38 -0700
changeset 13465 d3fc5d192448
parent 13353 a043d6778c4c
child 13583 dc0017b1a452
permissions -rw-r--r--
7191765: make jdk8 the default jprt release for hs24 Reviewed-by: jcoomes

#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include Setup.gmk

default: all

include Tools.gmk

#
# This makefile...so that altering will trigger rebuilding include/exclude-lists => jars
#
MAKEFILE=$(JDK_TOPDIR)/makefiles/CreateJars.gmk

MAINMANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf
BEANMANIFEST := $(JDK_TOPDIR)/make/javax/swing/beaninfo/manifest

JARS:=

##########################################################################################

JCONSOLE_JAR_DEPS := \
  $(shell $(FIND) $(JDK_OUTPUTDIR)/classes/sun/tools/jconsole/ -name "_the.package") \
  $(shell $(FIND) $(JDK_OUTPUTDIR)/classes/com/sun/tools/jconsole/ -name "_the.package")

$(eval $(call SetupArchive,BUILD_JCONSOLE_JAR,$(JCONSOLE_JAR_DEPS),\
		SRCS:=$(JDK_OUTPUTDIR)/classes,\
		SUFFIXES:=.class .gif .png .properties,\
		INCLUDES:=sun/tools/jconsole com/sun/tools/jconsole,\
		JARMAIN:=sun.tools.jconsole.JConsole,\
		JAR:=$(JDK_OUTPUTDIR)/lib/jconsole.jar,\
		SKIP_METAINF:=true))

JARS+=$(JDK_OUTPUTDIR)/lib/jconsole.jar

##########################################################################################

DNS_JAR_DEPS := \
  $(shell $(FIND) $(JDK_OUTPUTDIR)/classes/sun/net/spi/nameservice/dns/ -name "_the.package") \

$(eval $(call SetupArchive,BUILD_DNS_JAR,$(DNS_JAR_DEPS),\
		SRCS:=$(JDK_OUTPUTDIR)/classes,\
		INCLUDES:=sun/net/spi/nameservice/dns,\
		EXTRA_FILES:=META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor,\
		JAR:=$(JDK_OUTPUTDIR)/lib/ext/dnsns.jar,\
		SKIP_METAINF:=true))

JARS+=$(JDK_OUTPUTDIR)/lib/ext/dnsns.jar

##########################################################################################

LOCALEDATA_INCLUDE_PATTERNS := \
	sun/text/resources/*_ar* \
	sun/text/resources/*_hi* \
	sun/text/resources/*_iw* \
	sun/text/resources/*_iw* \
	sun/text/resources/*_ja* \
	sun/text/resources/*_ko* \
	sun/text/resources/*_th.* \
	sun/text/resources/*_th_* \
	sun/text/resources/*_vi* \
	sun/text/resources/*_zh* \
	sun/text/resources/*Data_th \
	sun/text/resources/thai_dict \
	sun/util/resources/*_ar* \
	sun/util/resources/*_hi* \
	sun/util/resources/*_iw* \
	sun/util/resources/*_iw* \
	sun/util/resources/*_ja* \
	sun/util/resources/*_ko* \
	sun/util/resources/*_th_* \
	sun/util/resources/*_th.* \
	sun/util/resources/*_vi* \
	sun/util/resources/*_zh*

LOCALEDATA_INCLUDES := $(patsubst $(JDK_OUTPUTDIR)/classes/%,%,\
	$(foreach i,$(LOCALEDATA_INCLUDE_PATTERNS), $(wildcard $(JDK_OUTPUTDIR)/classes/$i)))

$(eval $(call SetupArchive,BUILD_LOCALEDATA_JAR,,\
		SRCS:=$(JDK_OUTPUTDIR)/classes,\
		SUFFIXES:=.class _dict _th,\
		INCLUDES:=$(LOCALEDATA_INCLUDES),\
		JAR:=$(JDK_OUTPUTDIR)/lib/ext/localedata.jar,\
		SKIP_METAINF:=true))

JARS+=$(JDK_OUTPUTDIR)/lib/ext/localedata.jar

##########################################################################################
# rt.jar and resources.jar are being built in the same way as in the old build. They require
# the files to be in a certain order and converting that is not easy and will not be needed
# in jigsaw anyway.

# Exclude list for rt.jar and resources.jar
RT_JAR_EXCLUDES := \
	com/sun/javadoc \
	com/sun/jdi \
	com/sun/jarsigner \
	com/sun/source \
	com/sun/istack/internal/tools \
	META-INF/services/com.sun.jdi.connect.Connector \
	META-INF/services/com.sun.jdi.connect.spi.TransportService \
	META-INF/services/com.sun.tools.xjc.Plugin \
	com/sun/tools \
	sun/jvmstat \
	sun/nio/cs/ext \
	sun/awt/HKSCS.class \
	sun/awt/motif/X11GB2312\$$$$Decoder.class \
	sun/awt/motif/X11GB2312\$$$$Encoder.class \
	sun/awt/motif/X11GB2312.class \
	sun/awt/motif/X11GBK\$$$$Encoder.class \
	sun/awt/motif/X11GBK.class \
	sun/awt/motif/X11KSC5601\$$$$Decoder.class \
	sun/awt/motif/X11KSC5601\$$$$Encoder.class \
	sun/awt/motif/X11KSC5601.class \
	META-INF/services/java.nio.charset.spi.CharsetProvider \
	sun/rmi/rmic \
	sun/tools/asm \
	sun/tools/java \
	sun/tools/javac \
	com/sun/tools/classfile \
	com/sun/tools/javap \
	sun/tools/jcmd \
	sun/tools/jconsole \
	sun/tools/jps \
	sun/tools/jstat \
	sun/tools/jstatd \
	sun/tools/native2ascii \
	sun/tools/serialver \
	sun/tools/tree \
	sun/tools/util \
	sun/security/tools/JarBASE64Encoder.class \
	sun/security/tools/JarSigner.class \
	sun/security/tools/JarSignerParameters.class \
	sun/security/tools/JarSignerResources.class \
	sun/security/tools/JarSignerResources_ja.class \
	sun/security/tools/JarSignerResources_zh_CN.class \
	sun/security/tools/SignatureFile\$$$$Block.class \
	sun/security/tools/SignatureFile.class \
	sun/security/tools/TimestampedSigner.class \
	sun/security/provider/Sun.class \
	sun/security/rsa/SunRsaSign.class \
	sun/security/ssl \
	sun/security/ec/ECDHKeyAgreement.class \
	sun/security/ec/ECDSASignature\$$$$Raw.class \
	sun/security/ec/ECDSASignature\$$$$SHA1.class \
	sun/security/ec/ECDSASignature\$$$$SHA224.class \
	sun/security/ec/ECDSASignature\$$$$SHA256.class \
	sun/security/ec/ECDSASignature\$$$$SHA384.class \
	sun/security/ec/ECDSASignature\$$$$SHA512.class \
	sun/security/ec/ECDSASignature.class \
	sun/security/ec/ECKeyPairGenerator.class \
	sun/security/ec/SunEC\$$$$1.class \
	sun/security/ec/SunEC.class \
	sun/security/ec/SunECEntries.class \
	sun/security/pkcs11 \
	com/sun/net/ssl/internal/ssl \
	javax/crypto \
	sun/security/internal \
	com/sun/crypto/provider \
	META-INF/services/com.sun.tools.attach.spi.AttachProvider \
	com/sun/tools/attach \
	org/relaxng/datatype \
	com/sun/codemodel \
	com/sun/xml/internal/dtdparser \
	com/sun/xml/internal/rngom \
	com/sun/xml/internal/xsom \
	com/sun/tools/script/shell \
	sun/tools/attach \
	sun/tools/jstack \
	sun/tools/jinfo \
	sun/tools/jmap \
	sun/net/spi/nameservice/dns \
	META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor \
	javax/swing/beaninfo \
	javax/swing/AbstractButtonBeanInfo.class \
	javax/swing/BoxBeanInfo.class \
	javax/swing/JAppletBeanInfo.class \
	javax/swing/JButtonBeanInfo.class \
	javax/swing/JCheckBoxBeanInfo.class \
	javax/swing/JCheckBoxMenuItemBeanInfo.class \
	javax/swing/JColorChooserBeanInfo.class \
	javax/swing/JComboBoxBeanInfo.class \
	javax/swing/JComponentBeanInfo.class \
	javax/swing/JDesktopPaneBeanInfo.class \
	javax/swing/JDialogBeanInfo.class \
	javax/swing/JEditorPaneBeanInfo.class \
	javax/swing/JFileChooserBeanInfo.class \
	javax/swing/JFormattedTextFieldBeanInfo.class \
	javax/swing/JFrameBeanInfo.class \
	javax/swing/JInternalFrameBeanInfo.class \
	javax/swing/JLabelBeanInfo.class \
	javax/swing/JLayeredPaneBeanInfo.class \
	javax/swing/JListBeanInfo.class \
	javax/swing/JMenuBarBeanInfo.class \
	javax/swing/JMenuBeanInfo.class \
	javax/swing/JMenuItemBeanInfo.class \
	javax/swing/JOptionPaneBeanInfo.class \
	javax/swing/JPanelBeanInfo.class \
	javax/swing/JPasswordFieldBeanInfo.class \
	javax/swing/JPopupMenuBeanInfo.class \
	javax/swing/JProgressBarBeanInfo.class \
	javax/swing/JRadioButtonBeanInfo.class \
	javax/swing/JRadioButtonMenuItemBeanInfo.class \
	javax/swing/JScrollBarBeanInfo.class \
	javax/swing/JScrollPaneBeanInfo.class \
	javax/swing/JSeparatorBeanInfo.class \
	javax/swing/JSliderBeanInfo.class \
	javax/swing/JSpinnerBeanInfo.class \
	javax/swing/JSplitPaneBeanInfo.class \
	javax/swing/JTabbedPaneBeanInfo.class \
	javax/swing/JTableBeanInfo.class \
	javax/swing/JTextAreaBeanInfo.class \
	javax/swing/JTextFieldBeanInfo.class \
	javax/swing/JTextPaneBeanInfo.class \
	javax/swing/JToggleButtonBeanInfo.class \
	javax/swing/JToolBarBeanInfo.class \
	javax/swing/JTreeBeanInfo.class \
	javax/swing/JWindowBeanInfo.class \
	javax/swing/SwingBeanInfoBase.class \
	javax/swing/text/JTextComponentBeanInfo.class \
	sun/swing/BeanInfoUtils.class \
	$(LOCALEDATA_INCLUDES)

# These files should never be put into rt.jar
# but due to a misstake...some are put there if embedded
#
ifneq ($(JAVASE_EMBEDDED), true)
# normal (correct) case
RT_JAR_EXCLUDES += \
	com/oracle/jrockit/jfr \
	oracle/jrockit/jfr
else
# embedded (broken) case
RT_JAR_EXCLUDES += \
  oracle/jrockit/jfr/parser \
  oracle/jrockit/jfr/tools \
  oracle/jrockit/jfr/NativeOptions.class \
  oracle/jrockit/jfr/RepositoryChunkHandler.class
endif

ifeq ($(OPENJDK_TARGET_OS), macosx)
        RT_JAR_EXCLUDES += com/sun/nio/sctp \
                           sun/nio/ch/sctp \
                           sun/jdbc \
                           sun/nio/ch/DevPollArrayWrapper\$$$$Updator.class \
                           sun/nio/ch/DevPollArrayWrapper.class \
                           sun/nio/ch/DevPollSelectorImpl.class \
                           sun/nio/ch/DevPollSelectorProvider.class \
                           sun/nio/ch/EPollArrayWrapper\$$$$Updator.class \
                           sun/nio/ch/EPollArrayWrapper.class \
                           sun/nio/ch/EPollSelectorImpl.class \
                           sun/nio/ch/EPollSelectorProvider.class
endif

# Find all files in the classes dir to use as dependencies. This could be more fine granular.
ALL_FILES_IN_CLASSES := $(shell $(FIND) $(JDK_OUTPUTDIR)/classes -type f \
			| $(GREP) -v -e '/_the\.*' -e '^_the\.*')

RT_JAR_MANIFEST_FILE := $(JDK_OUTPUTDIR)/lib/_the.rt.jar_manifest
RESOURCE_JAR_MANIFEST_FILE := $(JDK_OUTPUTDIR)/lib/_the.resources.jar_manifest

$(RT_JAR_MANIFEST_FILE): $(MAINMANIFEST) $(BEANMANIFEST)
	$(MKDIR) -p $(@D)
	$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" 		\
	       -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
	       $(MAINMANIFEST) >> $@
	$(ECHO) >> $@
	$(CAT) $(BEANMANIFEST) >> $@

$(RESOURCE_JAR_MANIFEST_FILE): $(MAINMANIFEST)
	$(MKDIR) -p $(@D)
	$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" 		\
	       -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
	       $(MAINMANIFEST) >> $@

$(JDK_OUTPUTDIR)/lib/_the.jars.exclude: $(MAKEFILE)
	$(MKDIR) -p $(@D)
	$(call ListPathsSafely,RT_JAR_EXCLUDES,\n, >> $@)

$(JDK_OUTPUTDIR)/lib/classlist : $(JDK_TOPDIR)/make/tools/sharing/classlist.$(OPENJDK_TARGET_OS) \
  $(MAKEFILE)
	$(MKDIR) -p $(@D)
	$(RM) -f $@.temp
	$(TOOL_ADDJSUM) $< $@.temp
	$(MV) $@.temp $@

$(JDK_OUTPUTDIR)/lib/_the.jars.contents: $(BUILD_TOOLS) $(JDK_OUTPUTDIR)/lib/_the.jars.exclude \
					 $(ALL_FILES_IN_CLASSES) $(JDK_OUTPUTDIR)/lib/classlist
	$(MKDIR) -p $(@D)
	$(RM) $@.temp
	($(CD) $(JDK_OUTPUTDIR)/classes && \
	    $(TOOL_JARREORDER) \
		-o  $@.temp $(JDK_OUTPUTDIR)/lib/classlist $(JDK_OUTPUTDIR)/lib/_the.jars.exclude . )
	$(MV) $@.temp $@

$(JDK_OUTPUTDIR)/lib/_the.rt.jar.contents: $(JDK_OUTPUTDIR)/lib/_the.jars.contents
	$(GREP) -e '\.class$$' $(JDK_OUTPUTDIR)/lib/_the.jars.contents > $@

$(JDK_OUTPUTDIR)/lib/_the.resources.jar.contents: $(JDK_OUTPUTDIR)/lib/_the.jars.contents
	$(GREP) -v -e '\.class$$' -e '/_the\.*' -e '^_the\.*' $(JDK_OUTPUTDIR)/lib/_the.jars.contents > $@

RT_JAR_CREATE_OPTIONS := c0fm
ifeq ($(COMPRESS_JARS), true)
    RT_JAR_CREATE_OPTIONS := cfm
endif

$(JDK_OUTPUTDIR)/lib/rt.jar: $(JDK_OUTPUTDIR)/lib/_the.rt.jar.contents $(RT_JAR_MANIFEST_FILE)
	$(ECHO) Creating rt.jar
	$(CD) $(JDK_OUTPUTDIR)/classes && \
	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@ $(RT_JAR_MANIFEST_FILE) \
	        @$(JDK_OUTPUTDIR)/lib/_the.rt.jar.contents

$(JDK_OUTPUTDIR)/lib/resources.jar: $(JDK_OUTPUTDIR)/lib/_the.resources.jar.contents \
				    $(RESOURCE_JAR_MANIFEST_FILE)
	$(ECHO) Creating resources.jar
	$(CD) $(JDK_OUTPUTDIR)/classes && \
	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@ $(RESOURCE_JAR_MANIFEST_FILE) \
	        @$(JDK_OUTPUTDIR)/lib/_the.resources.jar.contents

JARS+=$(JDK_OUTPUTDIR)/lib/rt.jar $(JDK_OUTPUTDIR)/lib/resources.jar

##########################################################################################

CHARSETS_JAR_DEPS :=

ifneq ($(OPENJDK_TARGET_OS), windows)
    CHARSETS_EXTRA_FILES:=sun/awt/motif/X11GBK.class \
                          sun/awt/motif/X11GB2312\$$$$Decoder.class \
                          sun/awt/motif/X11GB2312.class \
                          sun/awt/motif/X11KSC5601\$$$$Decoder.class \
                          sun/awt/motif/X11KSC5601\$$$$Encoder.class \
                          sun/awt/motif/X11GB2312\$$$$Encoder.class \
                          sun/awt/motif/X11GBK\$$$$Encoder.class \
                          sun/awt/motif/X11KSC5601.class
endif

$(eval $(call SetupArchive,BUILD_CHARSETS_JAR,$(CHARSETS_JAR_DEPS),\
		SRCS:=$(JDK_OUTPUTDIR)/classes, \
		SUFFIXES:=.class .dat,\
		INCLUDES:=sun/nio/cs/ext,\
		EXTRA_FILES := sun/awt/HKSCS.class \
			       $(CHARSETS_EXTRA_FILES) \
                               META-INF/services/java.nio.charset.spi.CharsetProvider, \
		JAR:=$(JDK_OUTPUTDIR)/lib/charsets.jar, \
		SKIP_METAINF := true, \
                CHECK_COMPRESS_JAR:=true))

JARS+=$(JDK_OUTPUTDIR)/lib/charsets.jar

##########################################################################################

ifeq ($(ENABLE_JFR), true)
    $(eval $(call SetupArchive,BUILD_JFR_JAR,,\
		SRCS:=$(JDK_OUTPUTDIR)/classes,\
		INCLUDES:=com/oracle/jrockit/jfr \
			  oracle/jrockit/jfr,\
		JAR:=$(JDK_OUTPUTDIR)/lib/jfr.jar,\
		SKIP_METAINF:=true,\
		MANIFEST:=$(MAINMANIFEST), \
                CHECK_COMPRESS_JAR:=true))

    JARS+=$(JDK_OUTPUTDIR)/lib/jfr.jar
endif

##########################################################################################

$(eval $(call SetupArchive,BUILD_JSSE_JAR,,\
		SRCS:=$(JDK_OUTPUTDIR)/classes,\
		INCLUDES:=sun/security/provider/Sun.class \
			  sun/security/rsa/SunRsaSign.class \
			  sun/security/ssl \
			  com/sun/net/ssl/internal/ssl,\
		JAR:=$(JDK_OUTPUTDIR)/lib/jsse.jar,\
		SKIP_METAINF:=true,\
		MANIFEST:=$(MAINMANIFEST), \
                CHECK_COMPRESS_JAR:=true))

JARS+=$(JDK_OUTPUTDIR)/lib/jsse.jar

##########################################################################################

ifneq ($(OPENJDK_TARGET_OS)-$(ARCH_DATA_MODEL),windows-64)
    SUNPKCS11_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunpkcs11.jar

    ifndef OPENJDK

        SUNPKCS11_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/pkcs11/sunpkcs11.jar

        $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_SRC)
		@$(ECHO) "\n>>>Installing prebuilt SunPKCS11 provider..."
		$(RM) $@
		$(CP) $< $@

    else

         $(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR,$(SUNPKCS11_JAR_DEPS),\
		SRCS:=$(JDK_OUTPUTDIR)/classes, \
		SUFFIXES:=.class,\
		INCLUDES:=sun/security/pkcs11,\
		JAR:=$(SUNPKCS11_JAR_DST), \
		SKIP_METAINF := true))

    endif

    JARS += $(SUNPKCS11_JAR_DST)
endif

##########################################################################################

SUNEC_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunec.jar

ifndef OPENJDK

SUNEC_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ec/sunec.jar

$(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
	@$(ECHO) "\n>>>Installing prebuilt SunEC provider..."
	$(RM) $@
	$(CP) $< $@

else

$(eval $(call SetupArchive,BUILD_SUNEC_JAR,,\
		SRCS:=$(JDK_OUTPUTDIR)/classes, \
		SUFFIXES:=.class,\
		INCLUDES:=sun/security/ec,\
		EXCLUDE_FILES := sun/security/ec/ECKeyFactory.class \
			sun/security/ec/ECParameters.class \
			sun/security/ec/ECPrivateKeyImpl.class \
			sun/security/ec/ECPublicKeyImpl.class \
			sun/security/ec/NamedCurve.class \
			sun/security/ec/ECKeyFactory*,\
		JAR:=$(SUNEC_JAR_DST), \
		SKIP_METAINF := true))

endif

JARS += $(SUNEC_JAR_DST)

##########################################################################################

$(eval $(call SetupArchive,BUILD_SWINGBEANS_JAR,,\
		SRCS:=$(JDK_OUTPUTDIR)/classes,\
		SUFFIXES:=BeanInfo.class .gif,\
		INCLUDES:=javax/swing sun/swing,\
		EXCLUDES:=javax/swing/plaf,\
		EXTRA_FILES:=javax/swing/SwingBeanInfoBase.class sun/swing/BeanInfoUtils.class,\
		JAR:=$(JDK_OUTPUTDIR)/lib/dt.jar,\
		SKIP_METAINF:=true))

JARS+=$(JDK_OUTPUTDIR)/lib/dt.jar

##########################################################################################

SUNJCE_PROVIDER_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunjce_provider.jar

ifndef OPENJDK
    SUNJCE_PROVIDER_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/sunjce_provider.jar

    $(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_SRC)
	@$(ECHO) "\n>>>Installing prebuilt SunJCE provider..."
	$(RM) $@
	$(CP) $< $@
else

    $(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR,$(SUNJCE_PROVIDER_JAR_DEPS),\
		SRCS:=$(JDK_OUTPUTDIR)/classes, \
		SUFFIXES:=.class,\
		INCLUDES:= com/sun/crypto/provider,\
		JAR:=$(SUNJCE_PROVIDER_JAR_DST), \
		MANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf, \
		EXTRA_MANIFEST_ATTR := Extension-Name: javax.crypto\nImplementation-Vendor-Id: com.sun, \
		SKIP_METAINF := true))
endif

JARS += $(SUNJCE_PROVIDER_JAR_DST)

JCE_JAR_DST := $(JDK_OUTPUTDIR)/lib/jce.jar

ifndef OPENJDK

JCE_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar

$(JCE_JAR_DST) : $(JCE_JAR_SRC)
	@$(ECHO) "\n>>>Installing prebuilt jce.jar..."
	$(RM) $@
	$(CP) $< $@

else

$(eval $(call SetupArchive,BUILD_JCE_JAR,$(JCE_JAR_DEPS),\
		SRCS:=$(JDK_OUTPUTDIR)/classes, \
		SUFFIXES:=.class,\
		INCLUDES:= javax/crypto sun/security/internal,\
		JAR:=$(JCE_JAR_DST), \
		MANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf, \
		EXTRA_MANIFEST_ATTR := Extension-Name: javax.crypto\nImplementation-Vendor-Id: com.sun, \
		SKIP_METAINF := true))
endif

JARS += $(JCE_JAR_DST)

##########################################################################################

ifdef OPENJDK

#
# TODO fix so that SetupArchive does not write files into SRCS
#   then we don't need this extra copying
#
US_EXPORT_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar
US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
US_EXPORT_POLICY_JAR_TMP := $(JDK_OUTPUTDIR)/US_export_policy_jar.tmp

$(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
	$(MKDIR) -p $(@D)
	$(CP) $< $@

US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy

$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\
		SRCS:=$(US_EXPORT_POLICY_JAR_TMP), \
		SUFFIXES:= .policy,\
		JAR:=$(US_EXPORT_POLICY_JAR_DST), \
		EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
		SKIP_METAINF := true))

JARS += $(US_EXPORT_POLICY_JAR_DST)

endif

##########################################################################################


ifdef OPENJDK

#
# TODO fix so that SetupArchive does not write files into SRCS
#   then we don't need this extra copying
#
LOCAL_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/local_policy.jar
LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
LOCAL_POLICY_JAR_TMP := $(JDK_OUTPUTDIR)/local_policy_jar.tmp

LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy $(LOCAL_POLICY_JAR_TMP)/default_local.policy

$(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/%
	$(MKDIR) -p $(@D)
	$(CP) $< $@

$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\
		SRCS:=$(LOCAL_POLICY_JAR_TMP),\
		SUFFIXES:= .policy,\
		JAR:=$(LOCAL_POLICY_JAR_DST), \
		EXTRA_MANIFEST_ATTR := Crypto-Strength: limited, \
		SKIP_METAINF := true))

JARS += $(LOCAL_POLICY_JAR_DST)

endif

##########################################################################################

ifeq ($(OPENJDK_TARGET_OS),windows)

SUNMSCAPI_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunmscapi.jar

ifndef OPENJDK
SUNMSCAPI_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/mscapi/sunmscapi.jar

$(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_SRC)
	@$(ECHO) "\n>>>Installing prebuilt SunMSCAPI provider..."
	$(RM) $@
	$(CP) $< $@

else

$(eval $(call SetupArchive,BUILD_SUNMSCAPI_JAR,$(SUNMSCAPI_JAR_DEPS),\
		SRCS:=$(JDK_OUTPUTDIR)/classes, \
		SUFFIXES:=.class,\
		INCLUDES:= sun/security/mscapi,\
		JAR:=$(SUNMSCAPI_JAR_DST), \
		MANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf, \
		EXTRA_MANIFEST_ATTR := Extension-Name: javax.crypto\nImplementation-Vendor-Id: com.sun, \
		SKIP_METAINF := true))
endif

JARS += $(SUNMSCAPI_JAR_DST)

endif

##########################################################################################

ifeq ($(OPENJDK_TARGET_OS),solaris)
ifndef OPENJDK

UCRYPTO_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/ucrypto.jar
UCRYPTO_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ucrypto/ucrypto.jar

$(UCRYPTO_JAR_DST) : $(UCRYPTO_JAR_SRC)
	@$(ECHO) "\n>>>Installing prebuilt OracleUcrypto provider..."
	$(RM) $@
	$(CP) $< $@

JARS += $(UCRYPTO_JAR_DST)

endif
endif

##########################################################################################

TOOLS_JAR_INCLUDES := \
	sun/tools/asm		\
	sun/tools/jar		\
	sun/tools/java		\
	sun/tools/javac		\
	sun/tools/jcmd		\
	sun/tools/jps		\
	sun/tools/jstat		\
	sun/tools/jstatd	\
	sun/tools/native2ascii	\
	sun/tools/serialver	\
	sun/tools/tree		\
	sun/tools/util		\
	sun/security/tools/JarBASE64Encoder.class \
	sun/security/tools/JarSigner.class \
	sun/security/tools/JarSignerParameters.class \
	sun/security/tools/JarSignerResources.class \
	sun/security/tools/JarSignerResources_ja.class \
	sun/security/tools/JarSignerResources_zh_CN.class \
	sun/security/tools/SignatureFile* \
	sun/security/tools/TimestampedSigner.class \
	sun/rmi/rmic		\
	sun/applet		\
	sun/jvmstat		\
	com/sun/javadoc		\
	com/sun/jdi		\
	com/sun/jarsigner	\
	com/sun/source          \
	com/sun/tools/classfile \
	com/sun/tools/doclets   \
	com/sun/tools/example/debug/expr \
	com/sun/tools/example/debug/tty  \
	com/sun/tools/extcheck  \
	com/sun/tools/hat       \
	com/sun/tools/javac     \
	com/sun/tools/javadoc   \
	com/sun/tools/javah     \
	com/sun/tools/javap     \
	com/sun/tools/corba     \
	com/sun/tools/internal/xjc       \
	com/sun/tools/internal/ws       \
	com/sun/istack/internal/tools       \
	com/sun/tools/internal/jxc/ap   \
	com/sun/tools/internal/ws/wscompile/plugin/at_generated \
        com/sun/codemodel       \
        com/sun/tools/internal/jxc             \
        com/sun/xml/internal/rngom       \
        com/sun/xml/internal/xsom       \
        org/relaxng/datatype   \
	com/sun/xml/internal/dtdparser \
	com/sun/tools/jdi	\
	com/sun/tools/script/shell	\
	com/sun/tools/attach	\
	sun/tools/attach	\
	sun/tools/jstack        \
	sun/tools/jinfo         \
	sun/tools/jmap

$(eval $(call SetupArchive,BUILD_TOOLS_JAR,$(TOOLS_JAR_DEPS),\
		SRCS:=$(JDK_OUTPUTDIR)/classes,\
		SUFFIXES:=.class .prp .gif .properties .xml .css .xsd .js .html .txt .java \
			  Tool aliasmap options,\
		INCLUDES:=$(TOOLS_JAR_INCLUDES),\
		EXTRA_FILES:=META-INF/services/com.sun.jdi.connect.Connector \
			     META-INF/services/com.sun.jdi.connect.spi.TransportService \
			     META-INF/services/com.sun.tools.attach.spi.AttachProvider \
			     META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin \
			     META-INF/services/com.sun.tools.internal.xjc.Plugin,\
		JAR:=$(JDK_OUTPUTDIR)/lib/tools.jar,\
		SKIP_METAINF:=true, \
                CHECK_COMPRESS_JAR:=true))

JARS+=$(JDK_OUTPUTDIR)/lib/tools.jar

##########################################################################################

include $(JDK_TOPDIR)/makefiles/docs/CORE_PKGS.gmk
include $(JDK_TOPDIR)/makefiles/docs/NON_CORE_PKGS.gmk

# The compiler should not issue a "Proprietary" warning when compiling
# classes in the com.sun.java.swing.plaf packages, since we've always
# allowed, and even advocated, extending them (see bug 6476749).
#
# This approach is NOT to be used as a general purpose way to avoid such
# compiler warnings for non-core packages. The correct way is to document
# the packages in NON_CORE_PKGS.gmk, and include them in the NON_CORE_PKGS
# definition.
#
# Swing has taken this approach only as a temporary measure to avoid
# the compiler warnings until we can properly document these packages.
# This is covered under 6491853.
EXCLUDE_PROPWARN_PKGS = com.sun.java.swing.plaf.windows  \
                        com.sun.java.swing.plaf.motif    \
                        com.sun.java.swing.plaf.gtk

#
# Include the exported private packages in ct.sym.
# This is an interim solution until the ct.sym is replaced
# with a new module system (being discussed for JDK 8).
#
EXPORTED_PRIVATE_PKGS = com.sun.servicetag \
                        com.oracle.net \
                        com.oracle.nio

$(IMAGES_OUTPUTDIR)/symbols/_the.symbols: $(JDK_OUTPUTDIR)/lib/rt.jar
	$(RM) -rf $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
	$(MKDIR) -p $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
	$(JAVA) \
		-Xbootclasspath/a:$(JDK_OUTPUTDIR)/classes \
		$(JAVAC_JARS) \
	    -XDprocess.packages -proc:only \
	    -processor com.sun.tools.javac.sym.CreateSymbols \
	    -Acom.sun.tools.javac.sym.Jar=$(JDK_OUTPUTDIR)/lib/rt.jar \
	    -Acom.sun.tools.javac.sym.Dest=$(IMAGES_OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
	    $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS)
	$(TOUCH) $@

MAKE_SURE_DIR_EXISTS_DUMMY := $(shell $(MKDIR) -p $(IMAGES_OUTPUTDIR)/symbols)
$(eval $(call SetupArchive,BUILD_CT_SYM,$(IMAGES_OUTPUTDIR)/symbols/_the.symbols,\
		SRCS:=$(IMAGES_OUTPUTDIR)/symbols,\
		INCLUDES:=META-INF/sym,\
		JAR:=$(JDK_OUTPUTDIR)/lib/ct.sym, \
		CHECK_COMPRESS_JAR:=true))

JARS+=$(JDK_OUTPUTDIR)/lib/ct.sym

##########################################################################################

SRC_ZIP_INCLUDES = \
	java/applet			\
	java/awt			\
	java/beans			\
	java/io				\
	java/lang			\
	java/math			\
	java/net			\
	java/nio			\
	java/rmi			\
	java/security			\
	java/sql			\
	java/text			\
	java/util			\
	com/sun/corba			\
	com/sun/image/codec/jpeg	\
	com/sun/imageio                 \
	com/sun/java/swing		\
	com/sun/javadoc			\
	com/sun/jmx			\
	com/sun/source			\
	com/sun/naming			\
	com/sun/security/auth		\
	com/sun/security/jgss		\
	javax/accessibility		\
	javax/annotation		\
	javax/script			\
	javax/imageio			\
	javax/lang			\
	javax/management		\
	javax/naming			\
	javax/print			\
	javax/rmi			\
	javax/security			\
	javax/sound			\
	javax/sql			\
	javax/swing			\
	javax/tools			\
	javax/xml			\
	com/sun/org/apache		\
	com/sun/java_cup		\
	com/sun/jlex	        	\
	org/ietf			\
	org/omg				\
	org/w3c/dom			\
	org/xml/sax

SRC_ZIP_SRCS = $(JDK_TOPDIR)/src/share/classes $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes
SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/gensrc
SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/impsrc
SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/gendocsrc_rmic
ifndef OPENJDK
  SRC_ZIP_SRCS += $(JDK_TOPDIR)/src/closed/share/classes
endif

# Need to copy launcher src files into desired directory structure
# before zipping the sources.
LAUNCHER_SRC_FILES := $(wildcard $(JDK_TOPDIR)/src/share/bin/*) \
                      $(wildcard $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin/java_md*)
LAUNCHER_ZIP_SRC := $(patsubst $(JDK_TOPDIR)/src/share/bin/%,$(IMAGES_OUTPUTDIR)/src/launcher/%,\
		    $(patsubst $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin/%,$(IMAGES_OUTPUTDIR)/src/launcher/%,\
			$(LAUNCHER_SRC_FILES)))

$(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/share/bin/%
	$(MKDIR) -p $(@D)
	$(CP) $< $@

$(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/bin/%
	$(MKDIR) -p $(@D)
	$(CP) $< $@

$(IMAGES_OUTPUTDIR)/src.zip: $(LAUNCHER_ZIP_SRC)

# This dir needs to exsist before macro is evaluated to avoid warning from find.
MAKE_SURE_DIR_EXISTS_DUMMY := $(shell $(MKDIR) -p $(IMAGES_OUTPUTDIR)/src)
$(eval $(call SetupZipArchive,BUILD_SRC_ZIP,\
		SRC:=$(SRC_ZIP_SRCS) $(IMAGES_OUTPUTDIR)/src,\
		INCLUDES:=$(SRC_ZIP_INCLUDES) launcher,\
		SUFFIXES:=.java .c .h,\
		ZIP:=$(IMAGES_OUTPUTDIR)/src.zip,\
		EXTRA_DEPS:=$(LAUNCHER_ZIP_SRC)))

JARS+=$(IMAGES_OUTPUTDIR)/src.zip

##########################################################################################

all: $(JARS)

.PHONY: default all