8328824: Clean up java.base native compilation

Reviewed-by: erikj
This commit is contained in:
Magnus Ihse Bursie 2024-03-25 15:04:38 +00:00
parent af15c68f3c
commit 26b2ec4847
7 changed files with 201 additions and 136 deletions

View File

@ -931,6 +931,11 @@ else
java.base-copy: build-hsdis
endif
# On Windows, we need to copy tzmappings generated by gensrc
ifeq ($(call isTargetOs, windows), true)
java.base-copy: java.base-gensrc
endif
# jdk.accessibility depends on java.desktop
jdk.accessibility-libs: java.desktop-libs

View File

@ -266,6 +266,19 @@ define SetupJdkExecutableBody
$1_LIBS += $(LIBCXX)
endif
ifeq ($$($1_SRC), )
ifneq ($$(MODULE), )
$1_SRC := $$(call FindSrcDirsForComponent, $$(MODULE), $$($1_NAME))
else
$$(error Must specify SRC in a MODULE free context)
endif
else
$1_SRC := $$(foreach dir, $$($1_SRC), $$(call ProcessDir, $$(dir)))
endif
ifneq ($$($1_EXTRA_SRC), )
$1_SRC += $$(foreach dir, $$($1_EXTRA_SRC), $$(call ProcessDir, $$(dir)))
endif
ifeq ($$($1_VERSIONINFO_RESOURCE), )
$1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
endif
@ -283,6 +296,12 @@ define SetupJdkExecutableBody
# Prepend JDK libs before external libs
$1_LIBS := $$($1_JDK_LIBS) $$($1_LIBS)
ifneq ($$($1_EXTRA_HEADER_DIRS), )
$1_PROCESSED_EXTRA_HEADER_DIRS := $$(foreach dir, $$($1_EXTRA_HEADER_DIRS), \
$$(call ProcessDir, $$(dir)))
$1_EXTRA_HEADER_FLAGS := $$(addprefix -I, $$($1_PROCESSED_EXTRA_HEADER_DIRS))
endif
ifneq ($$($1_DEFAULT_CFLAGS), false)
# Set the default flags first to be able to override
$1_CFLAGS := $$(filter-out $$($1_CFLAGS_FILTER_OUT), $$(CFLAGS_JDKEXE)) $$($1_CFLAGS)
@ -291,6 +310,16 @@ define SetupJdkExecutableBody
$1_CXXFLAGS := $$(filter-out $$($1_CXXFLAGS_FILTER_OUT), $$(CXXFLAGS_JDKEXE)) $$($1_CXXFLAGS)
endif
ifneq ($$($1_CFLAGS), )
$1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
endif
ifneq ($$($1_CXXFLAGS), )
$1_CXXFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
endif
ifeq ($$($1_CFLAGS)$$($1_CXXFLAGS), )
$1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
endif
ifneq ($$($1_DEFAULT_LDFLAGS), false)
# Set the default flags first to be able to override
$1_LDFLAGS := $$(filter-out $$($1_LDFLAGS_FILTER_OUT), $$(LDFLAGS_JDKEXE)) $$($1_LDFLAGS)

View File

@ -26,14 +26,13 @@
$(eval $(call IncludeCustomExtension, hotspot/lib/CompileGtest.gmk))
GTEST_TEST_SRC += $(TOPDIR)/test/hotspot/gtest
GTEST_LAUNCHER_SRC := $(TOPDIR)/test/hotspot/gtest/gtestLauncher.cpp
ifeq ($(ASAN_ENABLED), true)
GTEST_LAUNCHER_SRC += $(TOPDIR)/make/data/asan/asan_default_options.cpp
GTEST_LAUNCHER_EXTRA_FILES += $(TOPDIR)/make/data/asan/asan_default_options.cpp
endif
ifeq ($(LSAN_ENABLED), true)
GTEST_LAUNCHER_SRC += $(TOPDIR)/make/data/lsan/lsan_default_options.cpp
GTEST_LAUNCHER_EXTRA_FILES += $(TOPDIR)/make/data/lsan/lsan_default_options.cpp
endif
# On Windows, there are no internal debug symbols so must set copying to true
@ -136,7 +135,9 @@ $(eval $(call SetupJdkExecutable, BUILD_GTEST_LAUNCHER, \
TYPE := EXECUTABLE, \
LINK_TYPE := C++, \
OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \
EXTRA_FILES := $(GTEST_LAUNCHER_SRC), \
SRC := $(TOPDIR)/test/hotspot/gtest, \
INCLUDE_FILES := gtestLauncher.cpp, \
EXTRA_FILES := $(GTEST_LAUNCHER_EXTRA_FILES), \
OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/launcher-objs, \
DEFAULT_CFLAGS := false, \
CFLAGS := $(JVM_CFLAGS) \

View File

@ -246,6 +246,18 @@ ifeq ($(ENABLE_LIBFFI_BUNDLING), true)
TARGETS += $(COPY_LIBFFI)
endif
################################################################################
# Copy tzmappings file for Windows
ifeq ($(call isTargetOs, windows), true)
$(eval $(call SetupCopyFiles, COPY_TZMAPPINGS, \
FILES := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/windows/conf/tzmappings, \
DEST := $(call FindLibDirForModule, $(MODULE)), \
))
TARGETS += $(COPY_TZMAPPINGS)
endif
################################################################################
# Optionally copy hsdis into the image

View File

@ -28,10 +28,13 @@ include LauncherCommon.gmk
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, modules/java.base/Launcher.gmk))
JAVA_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/launcher/java.rc
JAVA_VERSION_INFO_RESOURCE := \
$(TOPDIR)/src/java.base/windows/native/launcher/java.rc
JAVA_RCFLAGS ?= -I$(TOPDIR)/src/java.base/windows/native/launcher/icons
################################################################################
## Build java
################################################################################
$(eval $(call SetupBuildLauncher, java, \
@ -41,6 +44,10 @@ $(eval $(call SetupBuildLauncher, java, \
OPTIMIZATION := HIGH, \
))
################################################################################
## Build javaw
################################################################################
ifeq ($(call isTargetOs, windows), true)
$(eval $(call SetupBuildLauncher, javaw, \
CFLAGS := -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \
@ -49,19 +56,24 @@ ifeq ($(call isTargetOs, windows), true)
))
endif
################################################################################
## Build keytool
################################################################################
$(eval $(call SetupBuildLauncher, keytool, \
MAIN_CLASS := sun.security.tools.keytool.Main, \
))
################################################################################
ifeq ($(call isTargetOs, linux), true)
##############################################################################
## Build jexec
##############################################################################
$(eval $(call SetupJdkExecutable, BUILD_JEXEC, \
NAME := jexec, \
SRC := $(TOPDIR)/src/$(MODULE)/unix/native/launcher, \
INCLUDE_FILES := jexec.c, \
OPTIMIZATION := LOW, \
CFLAGS := -I$(TOPDIR)/src/$(MODULE)/share/native/libjli, \
EXTRA_HEADER_DIRS := libjli, \
CFLAGS_linux := -fPIC, \
LD_SET_ORIGIN := false, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
@ -70,21 +82,21 @@ ifeq ($(call isTargetOs, linux), true)
TARGETS += $(BUILD_JEXEC)
endif
################################################################################
ifeq ($(call isTargetOsType, unix), true)
##############################################################################
## Build jspawnhelper
##############################################################################
$(eval $(call SetupJdkExecutable, BUILD_JSPAWNHELPER, \
NAME := jspawnhelper, \
SRC := $(TOPDIR)/src/$(MODULE)/unix/native/jspawnhelper, \
OPTIMIZATION := LOW, \
CFLAGS := $(VERSION_CFLAGS) \
-I$(TOPDIR)/src/$(MODULE)/unix/native/libjava, \
EXTRA_OBJECT_FILES := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava/childproc$(OBJ_SUFFIX), \
CFLAGS := $(VERSION_CFLAGS), \
EXTRA_HEADER_DIRS := libjava, \
EXTRA_OBJECT_FILES := \
$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava/childproc$(OBJ_SUFFIX), \
LD_SET_ORIGIN := false, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
))
TARGETS += $(BUILD_JSPAWNHELPER)
endif
################################################################################

View File

@ -37,7 +37,8 @@ $(call FillFindCache, $(wildcard $(TOPDIR)/src/java.base/*/native))
include lib/CoreLibraries.gmk
################################################################################
# Create the network library
## Build libnet
################################################################################
$(eval $(call SetupJdkLibrary, BUILD_LIBNET, \
NAME := net, \
@ -45,18 +46,22 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBNET, \
DISABLED_WARNINGS_gcc_net_util_md.c := format-nonliteral, \
DISABLED_WARNINGS_gcc_NetworkInterface.c := unused-function, \
DISABLED_WARNINGS_clang_net_util_md.c := format-nonliteral, \
DISABLED_WARNINGS_clang_aix_DefaultProxySelector.c := deprecated-non-prototype, \
DISABLED_WARNINGS_clang_aix_DefaultProxySelector.c := \
deprecated-non-prototype, \
DISABLED_WARNINGS_clang_aix_NetworkInterface.c := gnu-pointer-arith, \
DISABLED_WARNINGS_microsoft_InetAddress.c := 4244, \
DISABLED_WARNINGS_microsoft_ResolverConfigurationImpl.c := 4996, \
LDFLAGS_windows := -delayload:secur32.dll -delayload:iphlpapi.dll \
LDFLAGS_windows := -delayload:iphlpapi.dll -delayload:secur32.dll \
-delayload:winhttp.dll, \
LIBS_unix := -ljvm -ljava, \
JDK_LIBS_unix := -ljava -ljvm, \
JDK_LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \
LIBS_linux := $(LIBDL), \
LIBS_aix := $(LIBDL),\
LIBS_windows := ws2_32.lib jvm.lib secur32.lib iphlpapi.lib winhttp.lib \
delayimp.lib $(WIN_JAVA_LIB) advapi32.lib, \
LIBS_macosx := -framework CoreFoundation -framework CoreServices, \
LIBS_windows := advapi32.lib delayimp.lib iphlpapi.lib secur32.lib \
winhttp.lib ws2_32.lib, \
LIBS_macosx := \
-framework CoreFoundation \
-framework CoreServices, \
))
$(BUILD_LIBNET): $(BUILD_LIBJAVA)
@ -64,7 +69,8 @@ $(BUILD_LIBNET): $(BUILD_LIBJAVA)
TARGETS += $(BUILD_LIBNET)
################################################################################
# Create the nio library
## Build libnio
################################################################################
$(eval $(call SetupJdkLibrary, BUILD_LIBNIO, \
NAME := nio, \
@ -73,49 +79,48 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBNIO, \
libnio/ch \
libnio/fs \
libnet, \
LIBS_unix := -ljava -lnet, \
LIBS_linux := -lpthread $(LIBDL), \
JDK_LIBS_unix := -ljava -lnet, \
JDK_LIBS_windows := $(WIN_JAVA_LIB) jvm.lib \
$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet/net.lib, \
LIBS_linux := $(LIBDL) -lpthread, \
LIBS_aix := $(LIBDL), \
LIBS_macosx := \
-framework CoreFoundation -framework CoreServices, \
LIBS_windows := jvm.lib Mswsock.lib ws2_32.lib $(WIN_JAVA_LIB) \
$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet/net.lib \
advapi32.lib, \
-framework CoreFoundation \
-framework CoreServices, \
LIBS_windows := advapi32.lib mswsock.lib ws2_32.lib, \
))
TARGETS += $(BUILD_LIBNIO)
$(BUILD_LIBNIO): $(BUILD_LIBNET)
################################################################################
# Create the macosx security library
ifeq ($(call isTargetOs, macosx), true)
##############################################################################
## Build libosxsecurity
##############################################################################
$(eval $(call SetupJdkLibrary, BUILD_LIBOSXSECURITY, \
NAME := osxsecurity, \
OPTIMIZATION := LOW, \
DISABLED_WARNINGS_clang_KeystoreImpl.m := deprecated-declarations, \
LDFLAGS := -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base,\
LIBS := \
-lobjc \
JDK_LIBS := $(JDKLIB_LIBS), \
LIBS_macosx := -lobjc \
-framework CoreServices \
-framework Security \
-framework Foundation \
$(JDKLIB_LIBS), \
-framework Security, \
))
$(BUILD_LIBOSXSECURITY): $(BUILD_LIBJAVA)
TARGETS += $(BUILD_LIBOSXSECURITY)
endif
################################################################################
# Create the jsig library
ifeq ($(call isTargetOsType, unix)+$(STATIC_BUILD), true+false)
##############################################################################
## Build libjsig
##############################################################################
ifeq ($(call isTargetOsType, unix), true)
ifeq ($(STATIC_BUILD), false)
$(eval $(call SetupJdkLibrary, BUILD_LIBJSIG, \
NAME := jsig, \
OPTIMIZATION := LOW, \
@ -126,7 +131,7 @@ ifeq ($(call isTargetOsType, unix), true)
TARGETS += $(BUILD_LIBJSIG)
############################################################################
##############################################################################
# Create symlinks to libjsig in each JVM variant sub dir
ifneq ($(STATIC_LIBS), true)
LIB_OUTPUTDIR := $(call FindLibDirForModule, java.base)
@ -146,27 +151,24 @@ ifeq ($(call isTargetOsType, unix), true)
# The subdir is the same as the variant
$(foreach v, $(JVM_VARIANTS), $(eval $(call CreateSymlinks,$v)))
endif
############################################################################
endif
endif
################################################################################
# Create the symbols file for static builds.
ifeq ($(STATIC_BUILD), true)
STATIC_SYMBOLS_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
JAVA_BASE_EXPORT_SYMBOLS_SRC := \
$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)jli.symbols \
$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)java.symbols \
$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)net.symbols \
$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)nio.symbols \
$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)verify.symbols \
$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)zip.symbols \
$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)jimage.symbols \
$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/server/$(LIBRARY_PREFIX)jvm.symbols \
$(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)jli.symbols \
$(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)java.symbols \
$(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)net.symbols \
$(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)nio.symbols \
$(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)verify.symbols \
$(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)zip.symbols \
$(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)jimage.symbols \
$(STATIC_SYMBOLS_DIR)/server/$(LIBRARY_PREFIX)jvm.symbols \
#
JAVA_BASE_EXPORT_SYMBOL_FILE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/java.base.symbols
JAVA_BASE_EXPORT_SYMBOL_FILE := $(STATIC_SYMBOLS_DIR)/java.base.symbols
$(JAVA_BASE_EXPORT_SYMBOL_FILE): $(JAVA_BASE_EXPORT_SYMBOLS_SRC)
$(call LogInfo, Generating java.base.symbols file)
@ -181,56 +183,47 @@ ifeq ($(STATIC_BUILD), true)
endif
################################################################################
# Copy tzmappings file for Windows
ifeq ($(call isTargetOs, windows), true)
$(eval $(call SetupCopyFiles, COPY_TZMAPPINGS, \
FILES := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/windows/conf/tzmappings, \
DEST := $(call FindLibDirForModule, $(MODULE)), \
))
TARGETS += $(COPY_TZMAPPINGS)
endif
## Build libsyslookup
################################################################################
# Create system lookup
$(eval $(call SetupJdkLibrary, BUILD_SYSLOOKUPLIB, \
$(eval $(call SetupJdkLibrary, BUILD_LIBSYSLOOKUP, \
NAME := syslookup, \
LD_SET_ORIGIN := false, \
LDFLAGS_linux := -Wl$(COMMA)--no-as-needed, \
LDFLAGS_aix := -brtl -bexpfull, \
LIBS_linux := -lm -ldl, \
LIBS_aix := -lm -ldecNumber, \
LIBS_linux := $(LIBDL) $(LIBM), \
LIBS_aix := -ldecNumber $(LIBM), \
))
TARGETS += $(BUILD_SYSLOOKUPLIB)
################################################################################
# Create fallback linker lib
TARGETS += $(BUILD_LIBSYSLOOKUP)
ifeq ($(ENABLE_FALLBACK_LINKER), true)
##############################################################################
## Build libfallbackLinker
##############################################################################
$(eval $(call SetupJdkLibrary, BUILD_LIBFALLBACKLINKER, \
NAME := fallbackLinker, \
CFLAGS := $(LIBFFI_CFLAGS), \
LIBS := $(LIBFFI_LIBS), \
LIBS_windows := $(LIBFFI_LIBS) ws2_32.lib, \
LIBS_windows := ws2_32.lib, \
))
TARGETS += $(BUILD_LIBFALLBACKLINKER)
endif
################################################################################
ifeq ($(call isTargetOs, linux)+$(call isTargetCpu, x86_64)+$(INCLUDE_COMPILER2)+$(filter $(TOOLCHAIN_TYPE), gcc), true+true+true+gcc)
$(eval $(call SetupJdkLibrary, BUILD_LIB_SIMD_SORT, \
##############################################################################
## Build libsimdsort
##############################################################################
$(eval $(call SetupJdkLibrary, BUILD_LIBSIMD_SORT, \
NAME := simdsort, \
LINK_TYPE := C++, \
OPTIMIZATION := HIGH, \
CXXFLAGS := -std=c++17, \
LIBS_linux := -lm -ldl, \
LIBS_linux := $(LIBDL) $(LIBM), \
))
TARGETS += $(BUILD_LIB_SIMD_SORT)
TARGETS += $(BUILD_LIBSIMD_SORT)
endif
################################################################################

View File

@ -23,25 +23,27 @@
# questions.
#
##########################################################################################
################################################################################
## Build libverify
################################################################################
LIBVERIFY_OPTIMIZATION := HIGH
ifeq ($(call isTargetOs, linux), true)
ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
ifeq ($(call isTargetOs, linux)+$(COMPILE_WITH_DEBUG_SYMBOLS), true+true)
LIBVERIFY_OPTIMIZATION := LOW
endif
endif
$(eval $(call SetupJdkLibrary, BUILD_LIBVERIFY, \
NAME := verify, \
OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \
LIBS_unix := -ljvm, \
LIBS_windows := jvm.lib, \
JDK_LIBS_unix := -ljvm, \
JDK_LIBS_windows := jvm.lib, \
))
TARGETS += $(BUILD_LIBVERIFY)
##########################################################################################
################################################################################
## Build libjava
################################################################################
ifeq ($(call isTargetOs, macosx), true)
BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
@ -53,26 +55,28 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJAVA, \
OPTIMIZATION := HIGH, \
jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
ProcessImpl_md.c_CFLAGS := $(VERSION_CFLAGS), \
java_props_md.c_CFLAGS := -DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"', \
java_props_md.c_CFLAGS := \
-DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"', \
DISABLED_WARNINGS_gcc_ProcessImpl_md.c := unused-result, \
LDFLAGS_macosx := -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/, \
LIBS_unix := -ljvm, \
JDK_LIBS_unix := -ljvm, \
JDK_LIBS_windows := jvm.lib, \
LIBS_linux := $(LIBDL), \
LIBS_aix := $(LIBDL) $(LIBM),\
LIBS_macosx := -framework CoreFoundation \
LIBS_macosx := \
-framework CoreFoundation \
-framework Foundation \
-framework SystemConfiguration, \
LIBS_windows := jvm.lib \
shell32.lib ole32.lib \
advapi32.lib version.lib, \
LIBS_windows := advapi32.lib ole32.lib shell32.lib version.lib, \
))
TARGETS += $(BUILD_LIBJAVA)
$(BUILD_LIBJAVA): $(BUILD_LIBVERIFY)
##########################################################################################
################################################################################
## Build libzip
################################################################################
BUILD_LIBZIP_EXCLUDES :=
ifeq ($(USE_EXTERNAL_LIBZ), true)
@ -92,15 +96,18 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBZIP, \
DISABLED_WARNINGS_gcc_zip_util.c := unused-function, \
DISABLED_WARNINGS_clang := deprecated-non-prototype, \
DISABLED_WARNINGS_clang_gzwrite.c := format-nonliteral, \
LIBS_unix := -ljvm -ljava $(LIBZ_LIBS), \
LIBS_windows := jvm.lib $(WIN_JAVA_LIB), \
JDK_LIBS_unix := -ljava -ljvm, \
JDK_LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \
LIBS_unix := $(LIBZ_LIBS), \
))
$(BUILD_LIBZIP): $(BUILD_LIBJAVA)
TARGETS += $(BUILD_LIBZIP)
##########################################################################################
################################################################################
## Build libjimage
################################################################################
$(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \
NAME := jimage, \
@ -108,15 +115,18 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \
OPTIMIZATION := LOW, \
CFLAGS_unix := -UDEBUG, \
LDFLAGS := $(LDFLAGS_CXX_JDK), \
LIBS_unix := -ljvm -ldl, \
LIBS_windows := jvm.lib, \
JDK_LIBS_unix := -ljvm, \
JDK_LIBS_windows := jvm.lib, \
LIBS_unix := $(LIBDL), \
))
$(BUILD_LIBJIMAGE): $(BUILD_LIBJAVA)
TARGETS += $(BUILD_LIBJIMAGE)
##########################################################################################
################################################################################
## Build libjli
################################################################################
ifeq ($(call isTargetOs, macosx), true)
LIBJLI_EXCLUDE_FILES += java_md.c
@ -135,11 +145,10 @@ ifeq ($(call isTargetOs, windows), true)
endif
endif
LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
ifneq ($(USE_EXTERNAL_LIBZ), true)
# Extra files from the zlib.
LIBJLI_EXTRA_FILE_LIST := inflate.c inftrees.c inffast.c zadler32.c zcrc32.c zutil.c
LIBJLI_EXTRA_FILE_LIST := inflate.c inftrees.c inffast.c zadler32.c \
zcrc32.c zutil.c
LIBJLI_EXTRA_FILES += \
$(addprefix $(TOPDIR)/src/java.base/share/native/libzip/zlib/, \
@ -150,22 +159,25 @@ ifneq ($(USE_EXTERNAL_LIBZ), true)
# static libraries, we use the --whole-archive linker option.
# The duplicate objects in different static libraries cause linking
# errors due to duplicate symbols.
LIBJLI_STATIC_EXCLUDE_OBJS := $(subst .c,$(OBJ_SUFFIX),$(LIBJLI_EXTRA_FILE_LIST))
LIBJLI_STATIC_EXCLUDE_OBJS := \
$(subst .c,$(OBJ_SUFFIX),$(LIBJLI_EXTRA_FILE_LIST))
endif
$(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \
NAME := jli, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
OPTIMIZATION := HIGH, \
CFLAGS := $(LIBJLI_CFLAGS), \
CFLAGS := $(LIBJLI_CFLAGS) $(LIBZ_CFLAGS), \
DISABLED_WARNINGS_gcc := unused-function, \
DISABLED_WARNINGS_clang := format-nonliteral deprecated-non-prototype, \
LIBS_unix := $(LIBZ_LIBS), \
LIBS_linux := $(LIBDL) -lpthread, \
LIBS_aix := $(LIBDL),\
LIBS_macosx := -framework Cocoa -framework Security -framework ApplicationServices, \
LIBS_macosx := \
-framework ApplicationServices \
-framework Cocoa \
-framework Security, \
LIBS_windows := advapi32.lib comctl32.lib user32.lib, \
STATIC_LIB_EXCLUDE_OBJS := $(LIBJLI_STATIC_EXCLUDE_OBJS), \
))
@ -175,7 +187,8 @@ TARGETS += $(BUILD_LIBJLI)
LIBJLI_SRC_DIRS := $(call FindSrcDirsForComponent, java.base, libjli)
ifeq ($(call isTargetOs, aix), true)
# AIX also requires a static libjli because the compiler doesn't support '-rpath'
# AIX also requires a static libjli because the compiler doesn't support
# '-rpath'
$(eval $(call SetupNativeCompilation, BUILD_LIBJLI_STATIC, \
NAME := jli_static, \
TYPE := STATIC_LIBRARY, \
@ -185,11 +198,11 @@ ifeq ($(call isTargetOs, aix), true)
EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
OPTIMIZATION := HIGH, \
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS) \
$(addprefix -I, $(LIBJLI_SRC_DIRS)), \
DISABLED_WARNINGS_clang_aix := format-nonliteral deprecated-non-prototype, \
$(LIBZ_CFLAGS) (addprefix -I, $(LIBJLI_SRC_DIRS)), \
DISABLED_WARNINGS_clang_aix := format-nonliteral \
deprecated-non-prototype, \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static))
TARGETS += $(BUILD_LIBJLI_STATIC)
endif