1 #
   2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 include LibCommon.gmk
  27 
  28 # Hook to include the corresponding custom file, if present.
  29 $(eval $(call IncludeCustomExtension, lib/Lib-java.base.gmk))
  30 
  31 # Prepare the find cache.
  32 LIB_java.base_SRC_DIRS += $(TOPDIR)/src/java.base/*/native
  33 
  34 $(eval $(call FillCacheFind, $(wildcard $(LIB_java.base_SRC_DIRS))))
  35 
  36 ################################################################################
  37 # Create all the core libraries
  38 
  39 include CoreLibraries.gmk
  40 
  41 ################################################################################
  42 # Create the network library
  43 
  44 LIBNET_SRC_DIRS := $(call FindSrcDirsForLib, java.base, net)
  45 
  46 $(eval $(call SetupJdkLibrary, BUILD_LIBNET, \
  47     NAME := net, \
  48     SRC := $(LIBNET_SRC_DIRS), \
  49     OPTIMIZATION := LOW, \
  50     CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
  51         $(LIBJAVA_HEADER_FLAGS) $(addprefix -I, $(LIBNET_SRC_DIRS)), \
  52     DISABLED_WARNINGS_gcc := format-nonliteral, \
  53     DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \
  54     DISABLED_WARNINGS_microsoft := 4244 4047 4133 4996, \
  55     DISABLED_WARNINGS_solstudio := E_ARG_INCOMPATIBLE_WITH_ARG_L, \
  56     MAPFILE := $(TOPDIR)/make/mapfiles/libnet/mapfile-vers, \
  57     LDFLAGS := $(LDFLAGS_JDKLIB) \
  58         $(call SET_SHARED_LIBRARY_ORIGIN), \
  59     LDFLAGS_windows := -delayload:secur32.dll -delayload:iphlpapi.dll, \
  60     LIBS_unix := -ljvm -ljava, \
  61     LIBS_linux := $(LIBDL) -lpthread, \
  62     LIBS_solaris := -lnsl -lsocket $(LIBDL), \
  63     LIBS_aix := $(LIBDL),\
  64     LIBS_windows := ws2_32.lib jvm.lib secur32.lib iphlpapi.lib winhttp.lib \
  65         delayimp.lib $(WIN_JAVA_LIB) advapi32.lib, \
  66     LIBS_macosx := -framework CoreFoundation -framework CoreServices, \
  67 ))
  68 
  69 $(BUILD_LIBNET): $(BUILD_LIBJAVA)
  70 
  71 TARGETS += $(BUILD_LIBNET)
  72 
  73 ################################################################################
  74 # Create the nio library
  75 
  76 BUILD_LIBNIO_SRC := \
  77     $(TOPDIR)/src/java.base/share/native/libnio \
  78     $(TOPDIR)/src/java.base/share/native/libnio/ch \
  79     $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio \
  80     $(sort $(wildcard \
  81       $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/ch \
  82       $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/fs \
  83       $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libnio/ch \
  84       $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libnio/fs)) \
  85     #
  86 
  87 BUILD_LIBNIO_CFLAGS := \
  88     $(addprefix -I, $(BUILD_LIBNIO_SRC)) \
  89     -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
  90     $(LIBJAVA_HEADER_FLAGS) \
  91     $(addprefix -I, $(BUILD_LIBNET_SRC))
  92 
  93 ifeq ($(OPENJDK_TARGET_OS), linux)
  94   BUILD_LIBNIO_MAPFILE := $(TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
  95 endif
  96 
  97 ifeq ($(OPENJDK_TARGET_OS), macosx)
  98   BUILD_LIBNIO_MAPFILE := $(TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
  99 endif
 100 
 101 ifeq ($(OPENJDK_TARGET_OS), solaris)
 102   BUILD_LIBNIO_MAPFILE := $(TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
 103 endif
 104 
 105 ifeq ($(OPENJDK_TARGET_OS), aix)
 106   BUILD_LIBNIO_MAPFILE := $(TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
 107 endif
 108 
 109 $(eval $(call SetupJdkLibrary, BUILD_LIBNIO, \
 110     NAME := nio, \
 111     SRC := $(BUILD_LIBNIO_SRC), \
 112     EXCLUDE_FILES := $(BUILD_LIBNIO_EXFILES), \
 113     OPTIMIZATION := HIGH, \
 114     WARNINGS_AS_ERRORS_xlc := false, \
 115     CFLAGS := $(CFLAGS_JDKLIB) \
 116         $(BUILD_LIBNIO_CFLAGS), \
 117     MAPFILE := $(BUILD_LIBNIO_MAPFILE), \
 118     LDFLAGS := $(LDFLAGS_JDKLIB) \
 119         $(call SET_SHARED_LIBRARY_ORIGIN), \
 120     LIBS_unix := -ljava -lnet, \
 121     LIBS_linux := -lpthread $(LIBDL), \
 122     LIBS_solaris := -ljvm -lsocket -lposix4 $(LIBDL) \
 123         -lsendfile, \
 124     LIBS_aix := $(LIBDL), \
 125     LIBS_macosx := \
 126         -framework CoreFoundation -framework CoreServices, \
 127     LIBS_windows := jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \
 128         $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet/net.lib \
 129         advapi32.lib, \
 130 ))
 131 
 132 TARGETS += $(BUILD_LIBNIO)
 133 
 134 $(BUILD_LIBNIO): $(BUILD_LIBNET)
 135 
 136 ################################################################################
 137 # Create the macosx security library
 138 
 139 ifeq ($(OPENJDK_TARGET_OS), macosx)
 140   # JavaNativeFoundation framework not supported in static builds
 141   ifneq ($(STATIC_BUILD), true)
 142 
 143     LIBOSXSECURITY_DIRS := $(TOPDIR)/src/java.base/macosx/native/libosxsecurity
 144     LIBOSXSECURITY_CFLAGS := -I$(LIBOSXSECURITY_DIRS) \
 145         $(LIBJAVA_HEADER_FLAGS) \
 146         -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
 147 
 148     $(eval $(call SetupJdkLibrary, BUILD_LIBOSXSECURITY, \
 149         NAME := osxsecurity, \
 150         SRC := $(LIBOSXSECURITY_DIRS), \
 151         OPTIMIZATION := LOW, \
 152         CFLAGS := $(CFLAGS_JDKLIB) \
 153             $(LIBOSXSECURITY_CFLAGS), \
 154         DISABLED_WARNINGS_clang := deprecated-declarations, \
 155         LDFLAGS := $(LDFLAGS_JDKLIB) \
 156             -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \
 157             $(call SET_SHARED_LIBRARY_ORIGIN) \
 158             -fobjc-link-runtime, \
 159         LIBS := \
 160             -framework JavaNativeFoundation \
 161             -framework CoreServices \
 162             -framework Security \
 163             $(JDKLIB_LIBS), \
 164     ))
 165 
 166     $(BUILD_LIBOSXSECURITY): $(BUILD_LIBJAVA)
 167 
 168     TARGETS += $(BUILD_LIBOSXSECURITY)
 169 
 170   endif
 171 endif
 172 
 173 ################################################################################
 174 # Create the symbols file for static builds.
 175 
 176 ifeq ($(STATIC_BUILD), true)
 177   JAVA_BASE_EXPORT_SYMBOLS_SRC := \
 178       $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jli/$(LIBRARY_PREFIX)jli.symbols \
 179       $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)java.symbols \
 180       $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)net.symbols \
 181       $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)nio.symbols \
 182       $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)verify.symbols \
 183       $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)zip.symbols \
 184       $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)jimage.symbols \
 185       $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/server/$(LIBRARY_PREFIX)jvm.symbols \
 186       #
 187 
 188   JAVA_BASE_EXPORT_SYMBOL_FILE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/java.base.symbols
 189 
 190   $(JAVA_BASE_EXPORT_SYMBOL_FILE): $(JAVA_BASE_EXPORT_SYMBOLS_SRC)
 191         $(call LogInfo, Generating java.base.symbols file)
 192         $(CAT) $^ > $@
 193 
 194   # The individual symbol files is generated when the respective lib is built
 195   $(JAVA_BASE_EXPORT_SYMBOLS_SRC): $(BUILD_LIBJLI) $(BUILD_LIBJAVA) \
 196       $(BUILD_LIBNET) $(BUILD_LIBNIO) $(BUILD_LIBVERIFY) $(BUILD_LIBZIP) \
 197       $(BUILD_LIBJIMAGE)
 198 
 199   TARGETS += $(JAVA_BASE_EXPORT_SYMBOL_FILE)
 200 endif