# # Copyright (c) 2011, 2024, 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. # ################################################################################ ## Build libverify ################################################################################ LIBVERIFY_OPTIMIZATION := HIGH ifeq ($(call isTargetOs, linux)+$(COMPILE_WITH_DEBUG_SYMBOLS), true+true) LIBVERIFY_OPTIMIZATION := LOW endif $(eval $(call SetupJdkLibrary, BUILD_LIBVERIFY, \ NAME := verify, \ OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \ DISABLED_WARNINGS_gcc_check_code.c := unused-variable, \ DISABLED_WARNINGS_clang_check_code.c := unused-variable, \ EXTRA_HEADER_DIRS := libjava, \ JDK_LIBS := libjvm, \ )) TARGETS += $(BUILD_LIBVERIFY) ################################################################################ ## Build libjava ################################################################################ ifeq ($(call isTargetOs, macosx), true) BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c BUILD_LIBJAVA_java_props_macosx.c_CFLAGS := -x objective-c endif $(eval $(call SetupJdkLibrary, BUILD_LIBJAVA, \ NAME := java, \ OPTIMIZATION := HIGH, \ jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \ ProcessImpl_md.c_CFLAGS := $(VERSION_CFLAGS), \ java_props_md.c_CFLAGS := \ -DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"', \ DISABLED_WARNINGS_gcc_ProcessImpl_md.c := unused-result, \ DISABLED_WARNINGS_clang_TimeZone_md.c := unused-variable, \ JDK_LIBS := libjvm, \ LIBS_linux := $(LIBDL), \ LIBS_aix := $(LIBDL) $(LIBM), \ LIBS_macosx := \ -framework CoreFoundation \ -framework Foundation \ -framework SystemConfiguration, \ LIBS_windows := advapi32.lib ole32.lib shell32.lib version.lib, \ )) TARGETS += $(BUILD_LIBJAVA) ################################################################################ ## Build libzip ################################################################################ BUILD_LIBZIP_EXCLUDES := ifeq ($(USE_EXTERNAL_LIBZ), true) LIBZIP_EXCLUDES += zlib endif ifeq ($(LIBZIP_CAN_USE_MMAP), true) BUILD_LIBZIP_MMAP := -DUSE_MMAP endif $(eval $(call SetupJdkLibrary, BUILD_LIBZIP, \ NAME := zip, \ OPTIMIZATION := LOW, \ EXCLUDES := $(LIBZIP_EXCLUDES), \ CFLAGS := $(LIBZ_CFLAGS), \ CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \ DISABLED_WARNINGS_gcc_zip_util.c := unused-function, \ DISABLED_WARNINGS_clang := deprecated-non-prototype, \ DISABLED_WARNINGS_clang_gzwrite.c := format-nonliteral, \ DISABLED_WARNINGS_clang_zip_util.c := unused-function, \ JDK_LIBS := libjava libjvm, \ LIBS_unix := $(LIBZ_LIBS), \ )) TARGETS += $(BUILD_LIBZIP) ################################################################################ ## Build libjimage ################################################################################ $(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \ NAME := jimage, \ LINK_TYPE := C++, \ OPTIMIZATION := LOW, \ EXTRA_HEADER_DIRS := libjava, \ CFLAGS_unix := -UDEBUG, \ DISABLED_WARNINGS_gcc_imageDecompressor.cpp := unused-variable, \ DISABLED_WARNINGS_gcc_imageFile.cpp := unused-const-variable \ unused-variable, \ DISABLED_WARNINGS_clang_imageDecompressor.cpp := unused-variable, \ DISABLED_WARNINGS_clang_imageFile.cpp := unused-private-field \ unused-variable, \ LDFLAGS := $(LDFLAGS_CXX_JDK), \ JDK_LIBS := libjvm, \ LIBS_unix := $(LIBDL), \ )) TARGETS += $(BUILD_LIBJIMAGE) ################################################################################ ## Build libjli ################################################################################ ifeq ($(call isTargetOs, macosx), true) LIBJLI_EXCLUDE_FILES += java_md.c endif ifeq ($(call isTargetOs, windows), true) # Supply the name of the C runtime libs. ifneq ($(MSVCR_DLL), ) LIBJLI_CFLAGS += -DMSVCR_DLL_NAME='"$(notdir $(MSVCR_DLL))"' endif ifneq ($(VCRUNTIME_1_DLL), ) LIBJLI_CFLAGS += -DVCRUNTIME_1_DLL_NAME='"$(notdir $(VCRUNTIME_1_DLL))"' endif ifneq ($(MSVCP_DLL), ) LIBJLI_CFLAGS += -DMSVCP_DLL_NAME='"$(notdir $(MSVCP_DLL))"' endif endif 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_FILES += \ $(addprefix $(TOPDIR)/src/java.base/share/native/libzip/zlib/, \ $(LIBJLI_EXTRA_FILE_LIST)) # Do not include these libz objects in the static libjli library. # When statically linking the java launcher with all JDK and VM # 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)) endif ifeq ($(call isTargetOs, aix), true) # AIX requires a static libjli because the compiler doesn't support '-rpath' BUILD_LIBJLI_TYPE := STATIC_LIBRARY endif $(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \ NAME := jli, \ TYPE := $(BUILD_LIBJLI_TYPE), \ EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \ EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \ EXTRA_HEADER_DIRS := libjvm, \ OPTIMIZATION := HIGH, \ CFLAGS := $(LIBJLI_CFLAGS) $(LIBZ_CFLAGS), \ DISABLED_WARNINGS_gcc := unused-function unused-variable, \ DISABLED_WARNINGS_clang := deprecated-non-prototype format-nonliteral \ unused-function, \ DISABLED_WARNINGS_clang_java_md_macosx.m := unused-variable, \ LIBS_unix := $(LIBZ_LIBS), \ LIBS_linux := $(LIBDL) -lpthread, \ LIBS_macosx := \ -framework ApplicationServices \ -framework Cocoa \ -framework Security, \ LIBS_windows := advapi32.lib comctl32.lib user32.lib, \ STATIC_LIB_EXCLUDE_OBJS := $(LIBJLI_STATIC_EXCLUDE_OBJS), \ )) TARGETS += $(BUILD_LIBJLI)