1 # 2 # Copyright (c) 2011, 2020, 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, modules/java.base/Lib.gmk)) 30 31 # Prepare the find cache. 32 $(call FillFindCache, $(wildcard $(TOPDIR)/src/java.base/*/native)) 33 34 ################################################################################ 35 # Create all the core libraries 36 37 include lib/CoreLibraries.gmk 38 39 ################################################################################ 40 # Create the network library 41 42 $(eval $(call SetupJdkLibrary, BUILD_LIBNET, \ 43 NAME := net, \ 44 OPTIMIZATION := LOW, \ 45 CFLAGS := $(CFLAGS_JDKLIB), \ 46 DISABLED_WARNINGS_gcc := format-nonliteral unused-function, \ 47 DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand \ 48 format-nonliteral undef, \ 49 DISABLED_WARNINGS_microsoft := 4244 4047 4133 4996, \ 50 LDFLAGS := $(LDFLAGS_JDKLIB) \ 51 $(call SET_SHARED_LIBRARY_ORIGIN), \ 52 LDFLAGS_windows := -delayload:secur32.dll -delayload:iphlpapi.dll, \ 53 LIBS_unix := -ljvm -ljava, \ 54 LIBS_linux := $(LIBDL) -lpthread, \ 55 LIBS_aix := $(LIBDL),\ 56 LIBS_windows := ws2_32.lib jvm.lib secur32.lib iphlpapi.lib winhttp.lib \ 57 delayimp.lib $(WIN_JAVA_LIB) advapi32.lib, \ 58 LIBS_macosx := -framework CoreFoundation -framework CoreServices, \ 59 )) 60 61 $(BUILD_LIBNET): $(BUILD_LIBJAVA) 62 63 TARGETS += $(BUILD_LIBNET) 64 65 ################################################################################ 66 # Create the nio library 67 68 $(eval $(call SetupJdkLibrary, BUILD_LIBNIO, \ 69 NAME := nio, \ 70 OPTIMIZATION := HIGH, \ 71 WARNINGS_AS_ERRORS_xlc := false, \ 72 CFLAGS := $(CFLAGS_JDKLIB), \ 73 DISABLED_WARNINGS_gcc := undef, \ 74 DISABLED_WARNINGS_clang := undef, \ 75 EXTRA_HEADER_DIRS := \ 76 libnio/ch \ 77 libnio/fs \ 78 libnet, \ 79 LDFLAGS := $(LDFLAGS_JDKLIB) \ 80 $(call SET_SHARED_LIBRARY_ORIGIN), \ 81 LIBS_unix := -ljava -lnet, \ 82 LIBS_linux := -lpthread $(LIBDL), \ 83 LIBS_aix := $(LIBDL), \ 84 LIBS_macosx := \ 85 -framework CoreFoundation -framework CoreServices, \ 86 LIBS_windows := jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \ 87 $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet/net.lib \ 88 advapi32.lib, \ 89 )) 90 91 TARGETS += $(BUILD_LIBNIO) 92 93 $(BUILD_LIBNIO): $(BUILD_LIBNET) 94 95 ################################################################################ 96 # Create the macosx security library 97 98 ifeq ($(call isTargetOs, macosx), true) 99 # JavaNativeFoundation framework not supported in static builds 100 ifneq ($(STATIC_BUILD), true) 101 102 $(eval $(call SetupJdkLibrary, BUILD_LIBOSXSECURITY, \ 103 NAME := osxsecurity, \ 104 OPTIMIZATION := LOW, \ 105 CFLAGS := $(CFLAGS_JDKLIB), \ 106 DISABLED_WARNINGS_clang := deprecated-declarations \ 107 missing-method-return-type, \ 108 LDFLAGS := $(LDFLAGS_JDKLIB) \ 109 -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \ 110 $(call SET_SHARED_LIBRARY_ORIGIN), \ 111 LIBS := \ 112 -lobjc \ 113 -framework JavaNativeFoundation \ 114 -framework CoreServices \ 115 -framework Security \ 116 $(JDKLIB_LIBS), \ 117 )) 118 119 $(BUILD_LIBOSXSECURITY): $(BUILD_LIBJAVA) 120 121 TARGETS += $(BUILD_LIBOSXSECURITY) 122 123 endif 124 endif 125 126 ################################################################################ 127 # Create the jsig library 128 129 ifeq ($(call isTargetOsType, unix), true) 130 ifeq ($(STATIC_BUILD), false) 131 $(eval $(call SetupJdkLibrary, BUILD_LIBJSIG, \ 132 NAME := jsig, \ 133 OPTIMIZATION := LOW, \ 134 CFLAGS := $(CFLAGS_JDKLIB) $(LIBJSIG_CFLAGS), \ 135 DISABLED_WARNINGS_gcc := undef, \ 136 LDFLAGS := $(LDFLAGS_JDKLIB) \ 137 $(call SET_SHARED_LIBRARY_ORIGIN), \ 138 LIBS_linux := $(LIBDL), \ 139 LIBS_aix := $(LIBDL), \ 140 )) 141 142 TARGETS += $(BUILD_LIBJSIG) 143 144 ############################################################################ 145 # Create symlinks to libjsig in each JVM variant sub dir 146 ifneq ($(STATIC_LIBS), true) 147 LIB_OUTPUTDIR := $(call FindLibDirForModule, java.base) 148 149 # $1 variant subdir 150 define CreateSymlinks 151 # Always symlink from libdir/variant/libjsig.so -> ../libjsig.so. 152 $(LIB_OUTPUTDIR)/$1/$(call SHARED_LIBRARY,jsig): \ 153 $(LIB_OUTPUTDIR)/$(call SHARED_LIBRARY,jsig) 154 $$(call MakeDir, $$(@D)) 155 $(RM) $$@ 156 $(LN) -s ../$$(@F) $$@ 157 158 TARGETS += $(LIB_OUTPUTDIR)/$1/$(call SHARED_LIBRARY,jsig) 159 endef 160 161 # The subdir is the same as the variant for client and minimal, for all 162 # others it's server. 163 VARIANT_SUBDIRS := $(filter client minimal, $(JVM_VARIANTS)) \ 164 $(if $(filter-out client minimal, $(JVM_VARIANTS)), server) 165 $(foreach v, $(VARIANT_SUBDIRS), $(eval $(call CreateSymlinks,$v))) 166 endif 167 ############################################################################ 168 169 endif 170 endif 171 172 ################################################################################ 173 # Create the symbols file for static builds. 174 175 ifeq ($(STATIC_BUILD), true) 176 JAVA_BASE_EXPORT_SYMBOLS_SRC := \ 177 $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)jli.symbols \ 178 $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)java.symbols \ 179 $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)net.symbols \ 180 $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)nio.symbols \ 181 $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)verify.symbols \ 182 $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)zip.symbols \ 183 $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)jimage.symbols \ 184 $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/server/$(LIBRARY_PREFIX)jvm.symbols \ 185 # 186 187 JAVA_BASE_EXPORT_SYMBOL_FILE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/java.base.symbols 188 189 $(JAVA_BASE_EXPORT_SYMBOL_FILE): $(JAVA_BASE_EXPORT_SYMBOLS_SRC) 190 $(call LogInfo, Generating java.base.symbols file) 191 $(CAT) $^ > $@ 192 193 # The individual symbol files is generated when the respective lib is built 194 $(JAVA_BASE_EXPORT_SYMBOLS_SRC): $(BUILD_LIBJLI) $(BUILD_LIBJAVA) \ 195 $(BUILD_LIBNET) $(BUILD_LIBNIO) $(BUILD_LIBVERIFY) $(BUILD_LIBZIP) \ 196 $(BUILD_LIBJIMAGE) 197 198 TARGETS += $(JAVA_BASE_EXPORT_SYMBOL_FILE) 199 endif 200 201 ################################################################################ 202 # Copy tzmappings file for Windows 203 204 ifeq ($(call isTargetOs, windows), true) 205 $(eval $(call SetupCopyFiles, COPY_TZMAPPINGS, \ 206 FILES := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/windows/conf/tzmappings, \ 207 DEST := $(call FindLibDirForModule, $(MODULE)), \ 208 )) 209 TARGETS += $(COPY_TZMAPPINGS) 210 endif