jdk/make/lib/SecurityLibraries.gmk
author michaelm
Thu, 24 Oct 2013 20:39:21 +0100
changeset 22339 e91bfaf4360d
parent 22336 a5de9b85e983
child 22607 ba232b417248
permissions -rw-r--r--
8011786: Better applet networking Reviewed-by: alanb, chegar

#
# Copyright (c) 2011, 2013, 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.
#

LIBJAAS_MAPFILE :=
ifneq ($(OPENJDK_TARGET_OS), solaris)
  LIBJAAS_EXCLUDE_FILES := Solaris.c
else
  # only on solaris...wonder why
  LIBJAAS_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjaas/mapfile-vers
endif

LIBJAAS_NAME := jaas_unix
ifeq ($(OPENJDK_TARGET_OS), windows)
  LIBJAAS_NAME := jaas_nt
endif

$(eval $(call SetupNativeCompilation,BUILD_LIBJAAS, \
    LIBRARY := $(LIBJAAS_NAME), \
    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
    SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/security/auth/module, \
    LANG := C, \
    OPTIMIZATION := LOW, \
    CFLAGS := $(CFLAGS_JDKLIB), \
    MAPFILE := $(LIBJAAS_MAPFILE), \
    LDFLAGS := $(filter-out -ljava, $(LDFLAGS_JDKLIB)) \
        $(call SET_SHARED_LIBRARY_ORIGIN), \
    LDFLAGS_windows := netapi32.lib user32.lib mpr.lib advapi32.lib, \
    LDFLAGS_SUFFIX_windows := $(LDFLAGS_JDKLIB_SUFFIX), \
    LDFLAGS_SUFFIX_solaris := -lc, \
    EXCLUDE_FILES := $(LIBJAAS_EXCLUDE_FILES), \
    VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
    RC_FLAGS := $(RC_FLAGS) \
        -D "JDK_FNAME=$(LIBJAAS_NAME).dll" \
        -D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
        -D "JDK_FTYPE=0x2L", \
    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjaas, \
    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))

$(BUILD_LIBJAAS): $(BUILD_LIBJAVA)

BUILD_LIBRARIES += $(BUILD_LIBJAAS)

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

$(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC, \
    LIBRARY := j2pcsc, \
    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
    SRC := $(JDK_TOPDIR)/src/share/native/sun/security/smartcardio \
        $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio, \
    LANG := C, \
    CFLAGS_posix := -D__sun_jdk, \
    OPTIMIZATION := LOW, \
    CFLAGS := $(CFLAGS_JDKLIB) \
        -I$(JDK_TOPDIR)/src/share/native/sun/security/smartcardio \
        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio \
        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio/MUSCLE, \
    MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pcsc/mapfile-vers, \
    LDFLAGS := $(LDFLAGS_JDKLIB) \
        $(call SET_SHARED_LIBRARY_ORIGIN), \
    LDFLAGS_SUFFIX_posix := $(LIBDL), \
    LDFLAGS_SUFFIX_windows := winscard.lib, \
    LDFLAGS_SUFFIX_solaris := -lc, \
    VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
    RC_FLAGS := $(RC_FLAGS) \
        -D "JDK_FNAME=j2pcsc.dll" \
        -D "JDK_INTERNAL_NAME=j2pcsc" \
        -D "JDK_FTYPE=0x2L", \
    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2pcsc, \
    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))

BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC)

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

ifneq ($(OPENJDK_TARGET_OS), windows)
  $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS, \
      LIBRARY := j2gss, \
      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
      SRC := $(JDK_TOPDIR)/src/share/native/sun/security/jgss/wrapper \
          $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/jgss/wrapper, \
      LANG := C, \
      OPTIMIZATION := LOW, \
      CFLAGS := $(CFLAGS_JDKLIB) \
          -I$(JDK_TOPDIR)/src/share/native/sun/security/jgss/wrapper \
          -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/jgss/wrapper, \
      MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2gss/mapfile-vers, \
      LDFLAGS := $(LDFLAGS_JDKLIB) \
          $(call SET_SHARED_LIBRARY_ORIGIN), \
      LDFLAGS_SUFFIX := $(LIBDL), \
      LDFLAGS_SUFFIX_solaris := -lc, \
      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2gss, \
      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))

  BUILD_LIBRARIES += $(BUILD_LIBJ2GSS)
endif

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

ifneq ($(BUILD_CRYPTO), no)
  BUILD_LIBKRB5_NAME :=
  ifeq ($(OPENJDK_TARGET_OS), windows)
    BUILD_LIBKRB5_NAME := w2k_lsa_auth
    BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5
    BUILD_LIBKRB5_LIBS := advapi32.lib Secur32.lib netapi32.lib kernel32.lib user32.lib \
        gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib \
        ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib
  else ifeq ($(OPENJDK_TARGET_OS), macosx)
    BUILD_LIBKRB5_NAME := osxkrb5
    BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/share/native/sun/security/krb5
    BUILD_LIBKRB5_LIBS := -framework Kerberos
  endif

  ifneq ($(BUILD_LIBKRB5_NAME), )
    $(eval $(call SetupNativeCompilation,BUILD_LIBKRB5, \
        LIBRARY := $(BUILD_LIBKRB5_NAME), \
        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
        SRC := $(BUILD_LIBKRB5_SRC), \
        LANG := C, \
        OPTIMIZATION := LOW, \
        CFLAGS := $(CFLAGS_JDKLIB) \
            -I$(JDK_TOPDIR)/src/share/native/sun/security/krb5 \
            -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5, \
        LDFLAGS := $(LDFLAGS_JDKLIB) \
            $(call SET_SHARED_LIBRARY_ORIGIN), \
        LDFLAGS_SUFFIX := $(BUILD_LIBKRB5_LIBS), \
        VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
        RC_FLAGS := $(RC_FLAGS) \
            -D "JDK_FNAME=$(BUILD_LIBKRB5_NAME).dll" \
            -D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
            -D "JDK_FTYPE=0x2L", \
        OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libkrb5, \
        DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))

    BUILD_LIBRARIES += $(BUILD_LIBKRB5)
  endif
endif

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

ifeq ($(OPENJDK_TARGET_OS), windows)

  $(eval $(call SetupNativeCompilation,BUILD_LIBSUNMSCAPI, \
      LIBRARY := sunmscapi, \
      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
      SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/mscapi, \
      LANG := C++, \
      OPTIMIZATION := LOW, \
      CFLAGS := $(CFLAGS_JDKLIB) \
          -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/mscapi, \
      LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
          $(call SET_SHARED_LIBRARY_ORIGIN), \
      LDFLAGS_SUFFIX := Crypt32.Lib advapi32.lib, \
      VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
      RC_FLAGS := $(RC_FLAGS) \
          -D "JDK_FNAME=sunmscapi.dll" \
          -D "JDK_INTERNAL_NAME=sunmscapi" \
          -D "JDK_FTYPE=0x2L", \
      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsunmscapi, \
      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))

  BUILD_LIBRARIES += $(BUILD_LIBSUNMSCAPI)
endif

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

$(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \
    LIBRARY := j2pkcs11, \
    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
    SRC := $(JDK_TOPDIR)/src/share/native/sun/security/pkcs11 \
        $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11 \
        $(JDK_TOPDIR)/src/share/native/sun/security/pkcs11/wrapper \
        $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11/wrapper, \
    LANG := C, \
    OPTIMIZATION := LOW, \
    CFLAGS := $(CFLAGS_JDKLIB) \
        -I$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11 \
        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11 \
        -I$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11/wrapper \
        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11/wrapper, \
    MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pkcs11/mapfile-vers, \
    LDFLAGS := $(LDFLAGS_JDKLIB) \
        $(call SET_SHARED_LIBRARY_ORIGIN), \
    LDFLAGS_SUFFIX_posix := $(LIBDL), \
    LDFLAGS_SUFFIX_solaris := -lc, \
    VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
    RC_FLAGS := $(RC_FLAGS) \
        -D "JDK_FNAME=j2pkcs11.dll" \
        -D "JDK_INTERNAL_NAME=j2pkcs11" \
        -D "JDK_FTYPE=0x2L", \
    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2pkcs11, \
    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))

BUILD_LIBRARIES += $(BUILD_LIBJ2PKCS11)

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

ifeq ($(ENABLE_INTREE_EC), yes)

  BUILD_LIBSUNEC_FLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/security/ec \
      -I$(JDK_TOPDIR)/src/share/native/sun/security/ec/impl

  #
  # On sol-sparc...all libraries are compiled with -xregs=no%appl
  # (set in CFLAGS_REQUIRED_sparc)
  #
  # except!!! libsunec.so
  #
  ECC_JNI_SOLSPARC_FILTER :=
  ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
    ECC_JNI_SOLSPARC_FILTER := -xregs=no%appl
  endif

  $(eval $(call SetupNativeCompilation,BUILD_LIBSUNEC, \
      LIBRARY := sunec, \
      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
      SRC := $(JDK_TOPDIR)/src/share/native/sun/security/ec \
          $(JDK_TOPDIR)/src/share/native/sun/security/ec/impl, \
      LANG := C++, \
      OPTIMIZATION := LOW, \
      CFLAGS := $(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CFLAGS_JDKLIB)) \
          $(BUILD_LIBSUNEC_FLAGS) \
          -DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B, \
      CXXFLAGS := $(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CXXFLAGS_JDKLIB)) \
          $(BUILD_LIBSUNEC_FLAGS), \
      MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsunec/mapfile-vers, \
      LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
      LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN), \
      LDFLAGS_SUFFIX := $(LIBCXX), \
      LDFLAGS_SUFFIX_linux := -lc, \
      LDFLAGS_SUFFIX_solaris := -lc, \
      VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
      RC_FLAGS := $(RC_FLAGS) \
          -D "JDK_FNAME=sunec.dll" \
          -D "JDK_INTERNAL_NAME=sunec" \
          -D "JDK_FTYPE=0x2L", \
      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsunec, \
      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))

  BUILD_LIBRARIES += $(BUILD_LIBSUNEC)
endif

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

ifeq ($(OPENJDK_TARGET_OS), solaris)
  ifndef OPENJDK

    $(eval $(call SetupNativeCompilation,BUILD_LIBJ2UCRYPTO, \
        LIBRARY := j2ucrypto, \
        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
        SRC := $(JDK_TOPDIR)/src/closed/solaris/native/com/oracle/security/ucrypto, \
        LANG := C, \
        OPTIMIZATION := LOW, \
        CFLAGS := $(CFLAGS_JDKLIB) \
            -I$(JDK_TOPDIR)/src/closed/solaris/native/com/oracle/security/ucrypto, \
        MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2ucrypto/mapfile-vers, \
        LDFLAGS := $(LDFLAGS_JDKLIB), \
        LDFLAGS_SUFFIX := $(LIBDL), \
        LDFLAGS_SUFFIX_solaris := -lc, \
        OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2ucrypto, \
        DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))

    $(BUILD_LIBJ2UCRYPTO): $(BUILD_LIBJAVA)

    BUILD_LIBRARIES += $(BUILD_LIBJ2UCRYPTO)

  endif
endif