diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index bcfda0cf51a..97a3ec14ecd 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -476,15 +476,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER], # Always enable optional macros for VM. ALWAYS_CFLAGS_JVM="-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS" - # Setup some hard coded includes - ALWAYS_CFLAGS_JDK=" \ - -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \ - -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \ - -I${TOPDIR}/src/java.base/share/native/libjava \ - -I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava \ - -I${TOPDIR}/src/hotspot/share/include \ - -I${TOPDIR}/src/hotspot/os/${HOTSPOT_TARGET_OS_TYPE}/include" - ############################################################################### # Adjust flags according to debug level. @@ -871,7 +862,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], $WARNING_CFLAGS $WARNING_CFLAGS_JVM $JVM_PICFLAG $FILE_MACRO_CFLAGS \ $REPRODUCIBLE_CFLAGS $BRANCH_PROTECTION_CFLAGS" - CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \ + CFLAGS_JDK_COMMON="$ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \ $OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \ $WARNING_CFLAGS $WARNING_CFLAGS_JDK $DEBUG_SYMBOLS_CFLAGS_JDK \ $FILE_MACRO_CFLAGS $REPRODUCIBLE_CFLAGS $BRANCH_PROTECTION_CFLAGS" diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4 index bf9b817ee72..acb815515a2 100644 --- a/make/autoconf/flags-ldflags.m4 +++ b/make/autoconf/flags-ldflags.m4 @@ -31,22 +31,11 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS], FLAGS_SETUP_LDFLAGS_HELPER # Setup the target toolchain - - # The target dir matches the name of VM variant - TARGET_JVM_VARIANT_PATH=$JVM_VARIANT_MAIN - - # On some platforms (mac) the linker warns about non existing -L dirs. FLAGS_SETUP_LDFLAGS_CPU_DEP([TARGET]) # Setup the build toolchain - - # When building a buildjdk, it's always only the server variant - BUILD_JVM_VARIANT_PATH=server - FLAGS_SETUP_LDFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_]) - LDFLAGS_TESTEXE="${TARGET_LDFLAGS_JDK_LIBPATH}" - AC_SUBST(LDFLAGS_TESTEXE) AC_SUBST(ADLC_LDFLAGS) ]) @@ -155,7 +144,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER], fi # Export some intermediate variables for compatibility - LDFLAGS_CXX_JDK="$BASIC_LDFLAGS_ONLYCXX $BASIC_LDFLAGS_ONLYCXX_JDK_ONLY $DEBUGLEVEL_LDFLAGS_JDK_ONLY" + LDFLAGS_CXX_JDK="$DEBUGLEVEL_LDFLAGS_JDK_ONLY" AC_SUBST(LDFLAGS_CXX_JDK) AC_SUBST(LDFLAGS_CXX_PARTIAL_LINKING) ]) @@ -197,20 +186,11 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP], fi fi - # JVM_VARIANT_PATH depends on if this is build or target... - if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then - $1_LDFLAGS_JDK_LIBPATH="-libpath:\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base" - else - $1_LDFLAGS_JDK_LIBPATH="-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \ - -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/${$1_JVM_VARIANT_PATH}" - fi - # Export variables according to old definitions, prefix with $2 if present. LDFLAGS_JDK_COMMON="$BASIC_LDFLAGS $BASIC_LDFLAGS_JDK_ONLY \ $OS_LDFLAGS $DEBUGLEVEL_LDFLAGS_JDK_ONLY ${$2EXTRA_LDFLAGS}" $2LDFLAGS_JDKLIB="$LDFLAGS_JDK_COMMON $BASIC_LDFLAGS_JDK_LIB_ONLY \ - ${$1_LDFLAGS_JDK_LIBPATH} $SHARED_LIBRARY_FLAGS \ - $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS" + $SHARED_LIBRARY_FLAGS $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS" $2LDFLAGS_JDKEXE="$LDFLAGS_JDK_COMMON $EXECUTABLE_LDFLAGS \ ${$1_CPU_EXECUTABLE_LDFLAGS} $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS" diff --git a/make/autoconf/libraries.m4 b/make/autoconf/libraries.m4 index 0aa42070a71..e29ef2221a6 100644 --- a/make/autoconf/libraries.m4 +++ b/make/autoconf/libraries.m4 @@ -129,12 +129,6 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES], LIB_TESTS_SETUP_GTEST - BASIC_JDKLIB_LIBS="" - BASIC_JDKLIB_LIBS_TARGET="" - if test "x$TOOLCHAIN_TYPE" != xmicrosoft; then - BASIC_JDKLIB_LIBS="-ljava -ljvm" - fi - # Math library BASIC_JVM_LIBS="$LIBM" @@ -170,12 +164,10 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES], LIB_SETUP_JVM_LIBS(BUILD) LIB_SETUP_JVM_LIBS(TARGET) - JDKLIB_LIBS="$BASIC_JDKLIB_LIBS" JVM_LIBS="$BASIC_JVM_LIBS $BASIC_JVM_LIBS_TARGET" - OPENJDK_BUILD_JDKLIB_LIBS="$BASIC_JDKLIB_LIBS" + OPENJDK_BUILD_JDKLIB_LIBS="" OPENJDK_BUILD_JVM_LIBS="$BASIC_JVM_LIBS $BASIC_JVM_LIBS_BUILD" - AC_SUBST(JDKLIB_LIBS) AC_SUBST(JVM_LIBS) AC_SUBST(OPENJDK_BUILD_JDKLIB_LIBS) AC_SUBST(OPENJDK_BUILD_JVM_LIBS) diff --git a/make/autoconf/spec.gmk.template b/make/autoconf/spec.gmk.template index 25fd98b5ee7..e90d9aabf04 100644 --- a/make/autoconf/spec.gmk.template +++ b/make/autoconf/spec.gmk.template @@ -555,7 +555,6 @@ SYSROOT := @SYSROOT@ # LDFLAGS used to link the jdk native libraries (C-code) LDFLAGS_JDKLIB := @LDFLAGS_JDKLIB@ -JDKLIB_LIBS := @JDKLIB_LIBS@ # LDFLAGS used to link the jdk native launchers (C-code) LDFLAGS_JDKEXE := @LDFLAGS_JDKEXE@ @@ -571,9 +570,6 @@ LDCXX := @LDCXX@ # The flags for linking libstdc++ linker. LIBCXX := @LIBCXX@ -# Compiler and linker flags used when building native tests -LDFLAGS_TESTEXE := @LDFLAGS_TESTEXE@ - # BUILD_CC/BUILD_LD is a compiler/linker that generates code that is runnable on the # build platform. BUILD_CC := @BUILD_ICECC@ @BUILD_CC@ diff --git a/make/common/JdkNativeCompilation.gmk b/make/common/JdkNativeCompilation.gmk index 49a1eb033a1..b425bdbae2b 100644 --- a/make/common/JdkNativeCompilation.gmk +++ b/make/common/JdkNativeCompilation.gmk @@ -76,18 +76,161 @@ endif GetJavaHeaderDir = \ $(if $(strip $1),$(wildcard $(SUPPORT_OUTPUTDIR)/headers/$(strip $1))) -# Process a dir description such as "java.base:headers" into a set of proper absolute paths. -ProcessDir = \ +HOTSPOT_INCLUDE_DIR := $(TOPDIR)/src/hotspot/share/include \ + $(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include + +# Preprocess a source dir destination. Pass on absolute paths unchanged. Expand +# description such as "java.base:headers" into a set of proper absolute paths, +# by looking in $MODULE/[shared|$OS|$OSTYPE]/native. +# Treat *:libjvm as a special case, and replace it with the proper hotspot +# include directories. +ProcessSrcDir = \ $(if $(findstring :, $1), \ - $(call FindSrcDirsForComponent, $(firstword $(subst :, , $1)), $(lastword $(subst :, , $1))) \ + $(if $(filter %:libjvm, $1), \ + $(HOTSPOT_INCLUDE_DIR) \ + , \ + $(call FindSrcDirsForComponent, $(firstword $(subst :, , $1)), \ + $(lastword $(subst :, , $1))) \ + ) \ , \ $(if $(filter /%, $1), \ $1 \ , \ - $(call FindSrcDirsForComponent, $(MODULE), $1) \ + $(if $(filter libjvm, $1), \ + $(HOTSPOT_INCLUDE_DIR) \ + , \ + $(call FindSrcDirsForComponent, $(MODULE), $1) \ + ) \ ) \ ) +# Create a proper LIBPATH for the given library. Sets result in $1_$2_LIBPATH. +# $1: The name of the rule (namespace) +# $2: The safe namespace of the library +define ResolveLibPath + # Determine proper LIBPATH. This is quite messy due to historical reasons, + # and because we need to have special treatment for "gtest:" and ":jvm". + ifneq ($$($1_$2_MODULE), gtest) + ifneq ($$($1_$2_NAME), jvm) + # This is the common case + ifeq ($$(call isTargetOs, windows), true) + $1_$2_LIBPATH := $$(SUPPORT_OUTPUTDIR)/native/$$($1_$2_MODULE)/lib$$($1_$2_NAME) + else + ifeq ($(STATIC_LIBS), true) + $1_$2_LIBPATH := $$(SUPPORT_OUTPUTDIR)/native/$$($1_$2_MODULE)/lib$$($1_$2_NAME)/static + else + $1_$2_LIBPATH := $$(SUPPORT_OUTPUTDIR)/modules_libs/$$($1_$2_MODULE) + endif + endif + else + # Special treatment for hotspot + ifeq ($(CREATING_BUILDJDK), true) + # When building a buildjdk, it's always only the server variant + $1_$2_JVM_VARIANT_PATH := server + else + $1_$2_JVM_VARIANT_PATH := $(JVM_VARIANT_MAIN) + endif + ifeq ($$(call isTargetOs, windows), true) + ifeq ($(STATIC_LIBS), true) + $1_$2_LIBPATH := $$(HOTSPOT_OUTPUTDIR)/variant-$$($1_$2_JVM_VARIANT_PATH)/libjvm/objs/static + else + $1_$2_LIBPATH := $$(SUPPORT_OUTPUTDIR)/modules_libs/$$($1_$2_MODULE) + endif + else + ifeq ($(STATIC_LIBS), true) + $1_$2_LIBPATH := $$(HOTSPOT_OUTPUTDIR)/variant-$$($1_$2_JVM_VARIANT_PATH)/libjvm/objs/static + else + $1_$2_LIBPATH := $$(SUPPORT_OUTPUTDIR)/modules_libs/$$($1_$2_MODULE)/$$($1_$2_JVM_VARIANT_PATH) + endif + endif + endif + else + # Special treatment for virtual module "gtest" + ifeq ($$($1_$2_NAME), jvm) + ifeq ($$(call isTargetOs, windows), true) + ifeq ($(STATIC_LIBS), true) + $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/gtest/objs/static + else + $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/gtest/objs + endif + else + ifeq ($(STATIC_LIBS), true) + $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/gtest/objs/static + else + $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/gtest + endif + endif + else ifeq ($$($1_$2_NAME), gtest) + $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/libgtest + ifeq ($(STATIC_LIBS), true) + $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/libgtest/objs/static + else + $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/libgtest + endif + endif + endif +endef + +# Process a JDK library designation such as "java.desktop:jawt" into the needed +# additions to EXTRA_LINK_DEPS, LDFLAGS, LIBS and EXTRA_HEADER_DIRS. +# $1: The name of the rule (namespace) +# $2: The safe namespace of the library +# $3: The actual string given to represent the library +define AddJdkLibrary + $1_$2_NAME := $$(strip $$(lastword $$(subst :, , $3))) + $1_$2_MODULE := $$(strip $$(patsubst %$$($1_$2_NAME), %, $3)) + + ifeq ($$(filter lib%, $$($1_$2_NAME)),) + $$(error Library name $$($1_$2_NAME) missing lib prefix in $1) + endif + $1_$2_NAME := $$(strip $$(patsubst lib%, %, $$($1_$2_NAME))) + + ifeq ($$($1_$2_MODULE),) + $1_$2_MODULE := $$(MODULE) + else + $1_$2_MODULE := $$(strip $$(patsubst %:, %, $$($1_$2_MODULE))) + endif + + # Determine if the library in question is static. + ifeq ($(STATIC_BUILD), true) + $1_$2_STATIC_LIBRARY := true + endif + # Ideally, we should not hardcode these + ifeq ($(call isTargetOs, aix)+$$($1_$2_MODULE):$$($1_$2_NAME), true+java.base:jli) + $1_$2_STATIC_LIBRARY := true + endif + ifeq ($$($1_$2_MODULE):$$($1_$2_NAME), gtest:gtest) + $1_$2_STATIC_LIBRARY := true + endif + + # Setup $1_$2_LIBPATH. + $$(eval $$(call ResolveLibPath,$1,$2)) + + $1_EXTRA_HEADER_DIRS += $$($1_$2_MODULE):lib$$($1_$2_NAME) + + ifneq ($(STATIC_LIBS), true) + ifeq ($$(call isTargetOs, windows), true) + ifeq ($$(filter -libpath:$$($1_$2_LIBPATH), $$($1_LDFLAGS)), ) + $1_LDFLAGS += -libpath:$$($1_$2_LIBPATH) + endif + $1_LIBS += $$($1_$2_NAME)$(STATIC_LIBRARY_SUFFIX) + $1_$2_LIBFILE := $(LIBRARY_PREFIX)$$($1_$2_NAME)$(STATIC_LIBRARY_SUFFIX) + else + ifeq ($$(filter -L$$($1_$2_LIBPATH), $$($1_LDFLAGS)), ) + $1_LDFLAGS += -L$$($1_$2_LIBPATH) + endif + $1_LIBS += -l$$($1_$2_NAME) + ifeq ($$($1_$2_STATIC_LIBRARY), true) + $1_$2_LIBFILE := $(LIBRARY_PREFIX)$$($1_$2_NAME)$(STATIC_LIBRARY_SUFFIX) + else + $1_$2_LIBFILE := $(LIBRARY_PREFIX)$$($1_$2_NAME)$(SHARED_LIBRARY_SUFFIX) + endif + endif + + $1_EXTRA_LINK_DEPS += $$($1_$2_LIBPATH)/$$($1_$2_LIBFILE) + endif +endef + GLOBAL_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/common/version.rc JDK_RCFLAGS=$(RCFLAGS) \ @@ -109,19 +252,32 @@ JDK_RCFLAGS=$(RCFLAGS) \ # SetupNativeCompilation. This macro also adds the following additional # arguments: # -# EXTRA_RCFLAGS -- additional RCFLAGS to append. -# EXTRA_HEADER_DIRS -- additional directories to look for headers in -# EXTRA_SRC -- additional directories to look for source in +# SRC -- this is passed on after preprocessing. The preprocessing will pass on +# absolute paths unchanged, but relative paths will be expanded to include +# all directories with this name in $MODULE/[shared|$OS|$OSTYPE]/native. +# EXTRA_SRC -- additional directories to look for source in. This is processed +# like SRC. # EXCLUDE_SRC_PATTERNS -- exclude source dirs matching these patterns from # appearing in SRC. +# EXTRA_HEADER_DIRS -- additional directories to look for headers in. This can +# be specified either as an absolute path, or relative directory names which +# are preprocessed like SRC, or in the format :, which +# will be processed like SRC but for the given module. The names +# "java.base:libjvm" and "gtest:libjvm" symbolise virtual libraries that +# will be replaced with proper values for hotspot. # HEADERS_FROM_SRC -- if false, does not add source dirs automatically as # header include dirs. (Defaults to true.) -# SRC -- this is passed on, but preprocessed to accept source dir designations -# RC_FILEDESC -- override the default FILEDESC for Windows version.rc -# such as "java.base:headers". -# JDK_LIBS -- libraries generated by the JDK build system to link against +# JDK_LIBS -- libraries generated by the JDK build system to link against. +# These take the form :. For the current module, the +# module name and colon can be omitted. The basename should be specified +# as the source directory, e.g. "libjava". The gtest module is a virtual +# module that will be replaced with correct values for gtest. When +# specifying JDK_LIBS, suitable values for EXTRA_LINK_DEPS, LDFLAGS, LIBS +# and EXTRA_HEADER_DIRS will be added. # JDK_LIBS_ or JDK_LIBS_ -- additional JDK_LIBS for the given OS # or OS type only +# EXTRA_RCFLAGS -- additional RCFLAGS to append. +# RC_FILEDESC -- override the default FILEDESC for Windows version.rc # DEFAULT_LIBCXX -- if false, do not add LIBCXX to LIBS for C++ compilations # DEFAULT_CFLAGS -- if false, do not add default CFLAGS and CXXFLAGS # DEFAULT_LDFLAGS -- if false, do not add default LDFLAGS @@ -183,10 +339,10 @@ define SetupJdkNativeCompilationBody endif endif else - $1_SRC := $$(foreach dir, $$($1_SRC), $$(call ProcessDir, $$(dir))) + $1_SRC := $$(foreach dir, $$($1_SRC), $$(call ProcessSrcDir, $$(dir))) endif ifneq ($$($1_EXTRA_SRC), ) - $1_SRC += $$(foreach dir, $$($1_EXTRA_SRC), $$(call ProcessDir, $$(dir))) + $1_SRC += $$(foreach dir, $$($1_EXTRA_SRC), $$(call ProcessSrcDir, $$(dir))) endif ifneq ($$($1_EXCLUDE_SRC_PATTERNS), ) @@ -224,14 +380,19 @@ define SetupJdkNativeCompilationBody $1_JDK_LIBS += $$($1_JDK_LIBS_$$(OPENJDK_TARGET_OS)) $1_JDK_LIBS += $$($1_JDK_LIBS_$$(OPENJDK_TARGET_OS_TYPE)) - # Prepend JDK libs before external libs - $1_LIBS := $$($1_JDK_LIBS) $$($1_LIBS) + $$(foreach lib, $$($1_JDK_LIBS), \ + $$(eval $$(call AddJdkLibrary,$1,$$(subst :,_,$$(lib)),$$(lib))) \ + ) - 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 + # Add the include path for jni.h to all native compilations + $1_EXTRA_HEADER_DIRS += \ + $(SUPPORT_OUTPUTDIR)/modules_include/java.base \ + java.base:include \ + # + + $1_PROCESSED_EXTRA_HEADER_DIRS := $$(foreach dir, $$($1_EXTRA_HEADER_DIRS), \ + $$(call ProcessSrcDir, $$(dir))) + $1_EXTRA_HEADER_FLAGS := $$(addprefix -I, $$($1_PROCESSED_EXTRA_HEADER_DIRS)) ifneq ($$($1_DEFAULT_CFLAGS), false) ifeq ($$($1_TYPE), EXECUTABLE) diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index f58976e34e0..afae920f755 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -84,6 +84,7 @@ include native/Paths.gmk # EXTRA_FILES List of extra files not in any of the SRC dirs # EXTRA_OBJECT_FILES List of extra object files to include when linking # EXTRA_DEPS List of extra dependencies to be added to each compiled file +# EXTRA_LINK_DEPS List of extra dependencies to be added to the link stage # VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run # RCFLAGS flags for RC. # EMBED_MANIFEST if true, embed manifest on Windows. diff --git a/make/common/TestFilesCompilation.gmk b/make/common/TestFilesCompilation.gmk index 5fc850d1d8b..8060a45fc68 100644 --- a/make/common/TestFilesCompilation.gmk +++ b/make/common/TestFilesCompilation.gmk @@ -69,7 +69,6 @@ define SetupTestFilesCompilationBody $1_COMPILATION_TYPE := EXECUTABLE $1_LOG_TYPE := executable $1_LD_SET_ORIGIN := false - $1_LDFLAGS := $(LDFLAGS_TESTEXE) else $$(error Unknown type: $$($1_TYPE)) endif @@ -103,17 +102,21 @@ define SetupTestFilesCompilationBody NAME := $$(unprefixed_name), \ TYPE := $$($1_COMPILATION_TYPE), \ LINK_TYPE := $(if $$(filter %.cpp, $$(file)), C++, C), \ + EXTRA_HEADER_DIRS := \ + java.base:libjava \ + java.base:libjvm, \ EXTRA_FILES := $$(file) $$($1_EXTRA_FILES), \ OBJECT_DIR := $$($1_OUTPUT_DIR)/support/$$(name), \ OUTPUT_DIR := $$($1_OUTPUT_DIR)/$$($1_OUTPUT_SUBDIR), \ CFLAGS := $$(TEST_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \ CXXFLAGS := $$(TEST_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \ LD_SET_ORIGIN := $$($1_LD_SET_ORIGIN), \ - LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$(name)), \ + LDFLAGS := $$($1_LDFLAGS_$$(name)), \ DISABLED_WARNINGS_gcc := format undef unused-function unused-value, \ DISABLED_WARNINGS_clang := undef format-nonliteral \ missing-field-initializers sometimes-uninitialized, \ DEFAULT_LIBCXX := false, \ + JDK_LIBS := $$($1_JDK_LIBS_$$(name)), \ LIBS := $$($1_LIBS_$$(name)), \ DEFAULT_VERSIONINFO_RESOURCE := false, \ OPTIMIZATION := $$(if $$($1_OPTIMIZATION_$$(name)),$$($1_OPTIMIZATION_$$(name)),LOW), \ diff --git a/make/common/modules/LauncherCommon.gmk b/make/common/modules/LauncherCommon.gmk index df8b4c36ffe..f072cbfb9bf 100644 --- a/make/common/modules/LauncherCommon.gmk +++ b/make/common/modules/LauncherCommon.gmk @@ -122,8 +122,6 @@ define SetupBuildLauncherBody endif endif - $1_WINDOWS_JLI_LIB := $(call FindStaticLib, java.base, jli, /libjli) - $1_EXTRA_FILES := $(LAUNCHER_SRC)/main.c ifeq ($(ASAN_ENABLED), true) @@ -148,17 +146,13 @@ define SetupBuildLauncherBody -DPROGNAME='"$1"' \ $$($1_CFLAGS), \ CFLAGS_windows := $$($1_CFLAGS_windows), \ + EXTRA_HEADER_DIRS := java.base:libjvm, \ DISABLED_WARNINGS_gcc := unused-function, \ LDFLAGS := $$($1_LDFLAGS), \ - LDFLAGS_linux := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \ - -L$(call FindLibDirForModule, java.base), \ - LDFLAGS_macosx := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \ - -L$(call FindLibDirForModule, java.base), \ - LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \ - JDK_LIBS_unix := -ljli, \ - JDK_LIBS_windows := \ - $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \ - $$($1_WINDOWS_JLI_LIB), \ + LDFLAGS_linux := $$(call SET_EXECUTABLE_ORIGIN,/../lib), \ + LDFLAGS_macosx := $$(call SET_EXECUTABLE_ORIGIN,/../lib), \ + JDK_LIBS := java.base:libjli, \ + JDK_LIBS_windows := java.base:libjava, \ LIBS := $$($1_LIBS), \ LIBS_unix := $(LIBZ_LIBS), \ LIBS_linux := $(LIBDL) -lpthread, \ @@ -178,15 +172,6 @@ define SetupBuildLauncherBody $$(BUILD_LAUNCHER_$1): $$(BUILD_PLIST_$1) - ifeq ($(call isTargetOs, aix), true) - $$(BUILD_LAUNCHER_$1): $(call FindStaticLib, java.base, jli) - endif - - ifeq ($(call isTargetOs, windows), true) - $$(BUILD_LAUNCHER_$1): $(call FindStaticLib, java.base, java, /libjava) \ - $$($1_WINDOWS_JLI_LIB) - endif - ifeq ($(call isTargetOs, macosx), true) $$(BUILD_LAUNCHER_$1): $$($1_PLIST_FILE) endif diff --git a/make/common/modules/LibCommon.gmk b/make/common/modules/LibCommon.gmk index bb23ca125f6..4e3570d9cd7 100644 --- a/make/common/modules/LibCommon.gmk +++ b/make/common/modules/LibCommon.gmk @@ -24,14 +24,3 @@ # include JdkNativeCompilation.gmk - -################################################################################ - -# Absolute paths to lib files on windows for use in LIBS. Should figure out a more -# elegant solution to this. -WIN_JAVA_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib - -# Put the libraries here. -INSTALL_LIBRARIES_HERE := $(call FindLibDirForModule, $(MODULE)) - -################################################################################ diff --git a/make/common/native/Link.gmk b/make/common/native/Link.gmk index 03bc04963c4..d9c566011a9 100644 --- a/make/common/native/Link.gmk +++ b/make/common/native/Link.gmk @@ -86,7 +86,7 @@ define CreateStaticLibrary $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) - $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_VARDEPS_FILE) + $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_EXTRA_LINK_DEPS) $$($1_VARDEPS_FILE) $1_AR_OBJ_ARG := $$($1_LD_OBJ_ARG) # With clang on linux, partial linking is enabled and 'AR' takes the output @@ -141,7 +141,7 @@ define CreateDynamicLibraryOrExecutable $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) - $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_VARDEPS_FILE) + $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_EXTRA_LINK_DEPS) $$($1_VARDEPS_FILE) $$($1_TARGET): $$($1_TARGET_DEPS) ifneq ($$($1_OBJ_FILE_LIST), ) diff --git a/make/common/native/LinkMicrosoft.gmk b/make/common/native/LinkMicrosoft.gmk index d49553c15e2..a85ee1379df 100644 --- a/make/common/native/LinkMicrosoft.gmk +++ b/make/common/native/LinkMicrosoft.gmk @@ -43,7 +43,10 @@ define CreateStaticLibraryMicrosoft $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) - $$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE) + $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_RES) $$($1_EXTRA_LINK_DEPS) \ + $$($1_VARDEPS_FILE) + + $$($1_TARGET): $$($1_TARGET_DEPS) ifneq ($$($1_OBJ_FILE_LIST), ) $$(eval $$(call ListPathsSafely, $1_ALL_OBJS, $$($1_OBJ_FILE_LIST))) endif @@ -87,7 +90,7 @@ define CreateDynamicLibraryOrExecutableMicrosoft $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \ - $$($1_VARDEPS_FILE) + $$($1_EXTRA_LINK_DEPS) $$($1_VARDEPS_FILE) $$($1_TARGET): $$($1_TARGET_DEPS) ifneq ($$($1_OBJ_FILE_LIST), ) diff --git a/make/hotspot/lib/CompileGtest.gmk b/make/hotspot/lib/CompileGtest.gmk index 58e6f1bb2ef..b59ed049cbc 100644 --- a/make/hotspot/lib/CompileGtest.gmk +++ b/make/hotspot/lib/CompileGtest.gmk @@ -110,9 +110,7 @@ $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBJVM, \ LD_SET_ORIGIN := false, \ DEFAULT_LDFLAGS := false, \ LDFLAGS := $(JVM_LDFLAGS), \ - LDFLAGS_unix := -L$(JVM_OUTPUTDIR)/libgtest, \ - JDK_LIBS_unix := -lgtest, \ - JDK_LIBS_windows := $(JVM_OUTPUTDIR)/libgtest/gtest.lib, \ + JDK_LIBS := gtest:libgtest, \ LIBS := $(JVM_LIBS), \ OPTIMIZATION := $(JVM_OPTIMIZATION), \ COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \ @@ -151,15 +149,12 @@ $(eval $(call SetupJdkExecutable, BUILD_GTEST_LAUNCHER, \ -I$(GTEST_FRAMEWORK_SRC)/googlemock \ -I$(GTEST_FRAMEWORK_SRC)/googlemock/include, \ LD_SET_ORIGIN := false, \ - LDFLAGS_unix := -L$(JVM_OUTPUTDIR)/gtest $(call SET_SHARED_LIBRARY_ORIGIN), \ - JDK_LIBS_unix := -ljvm, \ - JDK_LIBS_windows := $(JVM_OUTPUTDIR)/gtest/objs/jvm.lib, \ + LDFLAGS_unix := $(call SET_SHARED_LIBRARY_ORIGIN), \ + JDK_LIBS := gtest:libjvm, \ COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \ ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \ )) -$(BUILD_GTEST_LAUNCHER): $(BUILD_GTEST_LIBJVM) - TARGETS += $(BUILD_GTEST_LAUNCHER) ################################################################################ diff --git a/make/modules/java.base/Lib.gmk b/make/modules/java.base/Lib.gmk index bd0c8cc666b..d09e33d489f 100644 --- a/make/modules/java.base/Lib.gmk +++ b/make/modules/java.base/Lib.gmk @@ -53,8 +53,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBNET, \ DISABLED_WARNINGS_microsoft_ResolverConfigurationImpl.c := 4996, \ LDFLAGS_windows := -delayload:iphlpapi.dll -delayload:secur32.dll \ -delayload:winhttp.dll, \ - JDK_LIBS_unix := -ljava -ljvm, \ - JDK_LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \ + JDK_LIBS := libjava libjvm, \ LIBS_linux := $(LIBDL), \ LIBS_aix := $(LIBDL),\ LIBS_windows := advapi32.lib delayimp.lib iphlpapi.lib secur32.lib \ @@ -64,8 +63,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBNET, \ -framework CoreServices, \ )) -$(BUILD_LIBNET): $(BUILD_LIBJAVA) - TARGETS += $(BUILD_LIBNET) ################################################################################ @@ -78,10 +75,8 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBNIO, \ EXTRA_HEADER_DIRS := \ libnio/ch \ libnio/fs \ - libnet, \ - JDK_LIBS_unix := -ljava -lnet, \ - JDK_LIBS_windows := $(WIN_JAVA_LIB) jvm.lib \ - $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet/net.lib, \ + libjvm, \ + JDK_LIBS := libjava libnet, \ LIBS_linux := $(LIBDL) -lpthread, \ LIBS_aix := $(LIBDL), \ LIBS_macosx := \ @@ -92,8 +87,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBNIO, \ TARGETS += $(BUILD_LIBNIO) -$(BUILD_LIBNIO): $(BUILD_LIBNET) - ifeq ($(call isTargetOs, macosx), true) ############################################################################## ## Build libosxsecurity @@ -103,16 +96,13 @@ ifeq ($(call isTargetOs, macosx), true) NAME := osxsecurity, \ OPTIMIZATION := LOW, \ DISABLED_WARNINGS_clang_KeystoreImpl.m := deprecated-declarations, \ - LDFLAGS := -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base,\ - JDK_LIBS := $(JDKLIB_LIBS), \ + JDK_LIBS := libjava, \ LIBS_macosx := -lobjc \ -framework CoreServices \ -framework Foundation \ -framework Security, \ )) - $(BUILD_LIBOSXSECURITY): $(BUILD_LIBJAVA) - TARGETS += $(BUILD_LIBOSXSECURITY) endif @@ -204,6 +194,7 @@ ifeq ($(ENABLE_FALLBACK_LINKER), true) $(eval $(call SetupJdkLibrary, BUILD_LIBFALLBACKLINKER, \ NAME := fallbackLinker, \ + EXTRA_HEADER_DIRS := java.base:libjava, \ CFLAGS := $(LIBFFI_CFLAGS), \ LIBS := $(LIBFFI_LIBS), \ LIBS_windows := ws2_32.lib, \ diff --git a/make/modules/java.base/lib/CoreLibraries.gmk b/make/modules/java.base/lib/CoreLibraries.gmk index 75cd0328db8..7fed18491d1 100644 --- a/make/modules/java.base/lib/CoreLibraries.gmk +++ b/make/modules/java.base/lib/CoreLibraries.gmk @@ -35,8 +35,8 @@ endif $(eval $(call SetupJdkLibrary, BUILD_LIBVERIFY, \ NAME := verify, \ OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \ - JDK_LIBS_unix := -ljvm, \ - JDK_LIBS_windows := jvm.lib, \ + EXTRA_HEADER_DIRS := libjava, \ + JDK_LIBS := libjvm, \ )) TARGETS += $(BUILD_LIBVERIFY) @@ -58,9 +58,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJAVA, \ 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)/, \ - JDK_LIBS_unix := -ljvm, \ - JDK_LIBS_windows := jvm.lib, \ + JDK_LIBS := libjvm, \ LIBS_linux := $(LIBDL), \ LIBS_aix := $(LIBDL) $(LIBM),\ LIBS_macosx := \ @@ -72,8 +70,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJAVA, \ TARGETS += $(BUILD_LIBJAVA) -$(BUILD_LIBJAVA): $(BUILD_LIBVERIFY) - ################################################################################ ## Build libzip ################################################################################ @@ -96,13 +92,10 @@ $(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, \ - JDK_LIBS_unix := -ljava -ljvm, \ - JDK_LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \ + JDK_LIBS := libjava libjvm, \ LIBS_unix := $(LIBZ_LIBS), \ )) -$(BUILD_LIBZIP): $(BUILD_LIBJAVA) - TARGETS += $(BUILD_LIBZIP) ################################################################################ @@ -113,15 +106,13 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \ NAME := jimage, \ LINK_TYPE := C++, \ OPTIMIZATION := LOW, \ + EXTRA_HEADER_DIRS := libjava, \ CFLAGS_unix := -UDEBUG, \ LDFLAGS := $(LDFLAGS_CXX_JDK), \ - JDK_LIBS_unix := -ljvm, \ - JDK_LIBS_windows := jvm.lib, \ + JDK_LIBS := libjvm, \ LIBS_unix := $(LIBDL), \ )) -$(BUILD_LIBJIMAGE): $(BUILD_LIBJAVA) - TARGETS += $(BUILD_LIBJIMAGE) ################################################################################ @@ -173,6 +164,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \ 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, \ diff --git a/make/modules/java.desktop/Lib.gmk b/make/modules/java.desktop/Lib.gmk index f4cb41d6411..011e8375105 100644 --- a/make/modules/java.desktop/Lib.gmk +++ b/make/modules/java.desktop/Lib.gmk @@ -60,12 +60,11 @@ ifeq ($(call isTargetOs, aix), false) NAME := jsound, \ LINK_TYPE := $(LIBJSOUND_LINK_TYPE), \ OPTIMIZATION := LOW, \ + EXTRA_HEADER_DIRS := java.base:libjava, \ CFLAGS := $(LIBJSOUND_CFLAGS), \ CXXFLAGS := $(LIBJSOUND_CFLAGS), \ DISABLED_WARNINGS_gcc := undef, \ DISABLED_WARNINGS_clang := undef, \ - JDK_LIBS_unix := -ljava -ljvm, \ - JDK_LIBS_windows := $(WIN_JAVA_LIB), \ LIBS_linux := $(ALSA_LIBS), \ LIBS_macosx := \ -framework AudioToolbox \ @@ -77,8 +76,6 @@ ifeq ($(call isTargetOs, aix), false) LIBS_windows := advapi32.lib dsound.lib ole32.lib user32.lib winmm.lib, \ )) - $(BUILD_LIBJSOUND): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBJSOUND) endif @@ -94,7 +91,7 @@ ifeq ($(call isTargetOs, macosx), true) format-nonliteral, \ DISABLED_WARNINGS_clang_QueuingApplicationDelegate.m := \ objc-method-access, \ - JDK_LIBS_macosx := -ljava, \ + JDK_LIBS := java.base:libjava, \ LIBS_macosx := \ -framework Accelerate \ -framework ApplicationServices \ @@ -109,8 +106,6 @@ ifeq ($(call isTargetOs, macosx), true) -framework Security, \ )) - $(BUILD_LIBOSXAPP): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBOSXAPP) ############################################################################## @@ -120,10 +115,9 @@ ifeq ($(call isTargetOs, macosx), true) $(eval $(call SetupJdkLibrary, BUILD_LIBOSX, \ NAME := osx, \ OPTIMIZATION := LOW, \ - EXTRA_HEADER_DIRS := libosxapp, \ + EXTRA_HEADER_DIRS := java.base:libjava, \ DISABLED_WARNINGS_clang_CFileManager.m := deprecated-declarations, \ - LDFLAGS := -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop, \ - JDK_LIBS_macosx := $(JDKLIB_LIBS) -losxapp, \ + JDK_LIBS := libosxapp, \ LIBS_macosx := \ -framework ApplicationServices \ -framework Cocoa \ @@ -132,8 +126,4 @@ ifeq ($(call isTargetOs, macosx), true) )) TARGETS += $(BUILD_LIBOSX) - - $(BUILD_LIBOSX): $(call FindLib, java.desktop, osxapp) - - $(BUILD_LIBOSX): $(call FindLib, java.base, java) endif diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk index bc50106fd46..c30901e1543 100644 --- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk +++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk @@ -23,8 +23,6 @@ # questions. # -WIN_AWT_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt/awt.lib - LIBAWT_DEFAULT_HEADER_DIRS := \ common/awt/utility \ libawt/awt/image \ @@ -45,17 +43,15 @@ endif $(eval $(call SetupJdkLibrary, BUILD_LIBMLIB_IMAGE, \ NAME := mlib_image, \ EXTRA_SRC := common/awt/medialib, \ + EXTRA_HEADER_DIRS := java.base:libjava, \ EXCLUDE_FILES := mlib_c_ImageBlendTable.c, \ OPTIMIZATION := HIGHEST, \ CFLAGS := -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES -DMLIB_NO_LIBSUNMATH \ $(LIBMLIB_IMAGE_CFLAGS), \ DISABLED_WARNINGS_gcc := unused-function, \ - JDK_LIBS := $(JDKLIB_LIBS), \ LIBS_unix := $(LIBDL) $(LIBM), \ )) -$(BUILD_LIBMLIB_IMAGE): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBMLIB_IMAGE) ################################################################################ @@ -99,7 +95,6 @@ LIBAWT_EXTRA_HEADER_DIRS := \ common/awt/medialib \ libmlib_image \ include \ - java.base:libjava \ # LIBAWT_CFLAGS := -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES -DMLIB_NO_LIBSUNMATH @@ -138,14 +133,11 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBAWT, \ DISABLED_WARNINGS_clang_TransformHelper.c := sign-compare, \ DISABLED_WARNINGS_microsoft := 4244 4996, \ DISABLED_WARNINGS_microsoft_awt_Toolkit.cpp := 4267, \ - LDFLAGS_macosx := -L$(INSTALL_LIBRARIES_HERE), \ LDFLAGS_windows := -delayload:comctl32.dll -delayload:comdlg32.dll \ -delayload:gdi32.dll -delayload:imm32.dll -delayload:ole32.dll \ -delayload:shell32.dll -delayload:shlwapi.dll -delayload:user32.dll \ -delayload:winmm.dll -delayload:winspool.drv, \ - JDK_LIBS_unix := -ljava -ljvm, \ - JDK_LIBS_macosx := -lmlib_image, \ - JDK_LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \ + JDK_LIBS := java.base:libjava java.base:libjvm, \ LIBS_unix := $(LIBM), \ LIBS_linux := $(LIBDL), \ LIBS_aix := $(LIBDL),\ @@ -163,12 +155,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBAWT, \ EXTRA_RCFLAGS := $(LIBAWT_RCFLAGS), \ )) -$(BUILD_LIBAWT): $(call FindLib, java.base, java) - -ifeq ($(call isTargetOs, macosx), true) - $(BUILD_LIBAWT): $(BUILD_LIBMLIB_IMAGE) -endif - TARGETS += $(BUILD_LIBAWT) ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false) @@ -192,6 +178,7 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false) common/java2d/opengl \ common/java2d/x11 \ libpipewire/include \ + java.base:libjvm \ # ifeq ($(call isTargetOs, linux), true) @@ -251,18 +238,13 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false) DISABLED_WARNINGS_clang_aix_sun_awt_X11_GtkFileDialogPeer.c := \ parentheses, \ DISABLED_WARNINGS_clang_aix_awt_InputMethod.c := sign-compare, \ - LDFLAGS := -L$(INSTALL_LIBRARIES_HERE), \ - JDK_LIBS_unix := -lawt -ljava -ljvm, \ + JDK_LIBS := libawt java.base:libjava, \ LIBS_unix := $(LIBDL) $(LIBM) $(X_LIBS) -lX11 -lXext -lXi -lXrender \ -lXtst, \ LIBS_linux := -lpthread, \ STATIC_LIB_EXCLUDE_OBJS := $(LIBAWT_XAWT_STATIC_EXCLUDE_OBJS), \ )) - $(BUILD_LIBAWT_XAWT): $(call FindLib, java.base, java) - - $(BUILD_LIBAWT_XAWT): $(BUILD_LIBAWT) - TARGETS += $(BUILD_LIBAWT_XAWT) endif @@ -296,21 +278,18 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBLCMS, \ CFLAGS_windows := -DCMS_IS_WINDOWS_, \ EXTRA_HEADER_DIRS := \ common/awt/debug \ - libawt/java2d, \ + libawt/java2d \ + java.base:libjvm, \ HEADERS_FROM_SRC := $(LIBLCMS_HEADERS_FROM_SRC), \ DISABLED_WARNINGS_gcc := format-nonliteral type-limits \ stringop-truncation, \ DISABLED_WARNINGS_clang := format-nonliteral, \ - LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \ - JDK_LIBS_unix := -lawt -ljava -ljvm, \ - JDK_LIBS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \ + JDK_LIBS := libawt java.base:libjava, \ LIBS_unix := $(LCMS_LIBS) $(LIBM), \ )) TARGETS += $(BUILD_LIBLCMS) -$(BUILD_LIBLCMS): $(BUILD_LIBAWT) - ################################################################################ ## Build libjavajpeg ################################################################################ @@ -339,13 +318,10 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJAVAJPEG, \ DISABLED_WARNINGS_gcc_imageioJPEG.c := clobbered array-bounds, \ DISABLED_WARNINGS_gcc_jcmaster.c := implicit-fallthrough, \ DISABLED_WARNINGS_gcc_jdphuff.c := shift-negative-value, \ - JDK_LIBS := $(JDKLIB_LIBS), \ - JDK_LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \ + JDK_LIBS := java.base:libjava, \ LIBS := $(LIBJPEG_LIBS), \ )) -$(BUILD_LIBJAVAJPEG): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBJAVAJPEG) @@ -366,6 +342,7 @@ ifeq ($(call isTargetOs, windows macosx), false) common/awt/debug \ common/font \ common/java2d/opengl \ + java.base:libjvm \ # # These are the object files provided by the awt native @@ -386,14 +363,11 @@ ifeq ($(call isTargetOs, windows macosx), false) EXTRA_HEADER_DIRS := $(LIBAWT_HEADLESS_EXTRA_HEADER_DIRS), \ DISABLED_WARNINGS_gcc_X11Renderer.c := unused-function, \ DISABLED_WARNINGS_gcc_X11SurfaceData.c := unused-function, \ - LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \ - JDK_LIBS_unix := -lawt -ljava -ljvm, \ + JDK_LIBS := libawt java.base:libjava, \ LIBS_linux := $(LIBDL) $(LIBM), \ STATIC_LIB_EXCLUDE_OBJS := $(LIBAWT_HEADLESS_STATIC_EXCLUDE_OBJS), \ )) - $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT) - TARGETS += $(BUILD_LIBAWT_HEADLESS) endif @@ -467,7 +441,6 @@ else endif LIBFONTMANAGER_EXTRA_HEADER_DIRS := \ - libharfbuzz \ common/awt \ common/awt/utility \ common/font \ @@ -481,13 +454,7 @@ ifeq ($(FREETYPE_TO_USE), system) LIBFONTMANAGER_LIBS += $(FREETYPE_LIBS) else LIBFONTMANAGER_EXTRA_HEADER_DIRS += libfreetype/include - - ifeq ($(call isTargetOs, windows), true) - LIBFONTMANAGER_JDK_LIBS += \ - $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfreetype/freetype.lib - else - LIBFONTMANAGER_JDK_LIBS += -lfreetype - endif + LIBFONTMANAGER_JDK_LIBS += libfreetype endif LIBFONTMANAGER_OPTIMIZATION := HIGHEST @@ -533,12 +500,9 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \ DISABLED_WARNINGS_microsoft := $(HARFBUZZ_DISABLED_WARNINGS_microsoft), \ LDFLAGS := $(LDFLAGS_CXX_JDK), \ LDFLAGS_FILTER_OUT :=-Wl$(COMMA)-z$(COMMA)defs, \ - LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \ LDFLAGS_aix := -Wl$(COMMA)-berok, \ - JDK_LIBS := $(LIBFONTMANAGER_JDK_LIBS), \ - JDK_LIBS_unix := -lawt -ljava -ljvm, \ - JDK_LIBS_macosx := -lawt_lwawt, \ - JDK_LIBS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \ + JDK_LIBS := libawt java.base:libjava $(LIBFONTMANAGER_JDK_LIBS), \ + JDK_LIBS_macosx := libawt_lwawt, \ LIBS := $(LIBFONTMANAGER_LIBS), \ LIBS_unix := $(LIBM), \ LIBS_macosx := \ @@ -548,16 +512,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \ LIBS_windows := advapi32.lib gdi32.lib user32.lib, \ )) -$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT) - -ifeq ($(call isTargetOs, macosx), true) - $(BUILD_LIBFONTMANAGER): $(call FindLib, $(MODULE), awt_lwawt) -endif - -ifeq ($(FREETYPE_TO_USE), bundled) - $(BUILD_LIBFONTMANAGER): $(BUILD_LIBFREETYPE) -endif - TARGETS += $(BUILD_LIBFONTMANAGER) ################################################################################ @@ -566,6 +520,7 @@ TARGETS += $(BUILD_LIBFONTMANAGER) LIBJAWT_EXTRA_HEADER_DIRS := \ include \ + java.base:libjava \ # ifeq ($(call isTargetOs, windows), true) @@ -576,7 +531,7 @@ ifeq ($(call isTargetOs, windows), true) libawt/java2d \ libawt/java2d/windows \ libawt/windows \ - java.base:libjava \ + java.base:libjvm \ # else LIBJAWT_EXTRA_HEADER_DIRS += \ @@ -598,11 +553,11 @@ ifeq ($(call isTargetOs, windows)+$(call isTargetCpu, x86), true+true) endif ifeq ($(call isTargetOsType, unix)+$(call isTargetOs, macosx), true+false) - LIBJAWT_JDK_LIBS_unix := -lawt + LIBJAWT_JDK_LIBS_unix := libawt ifeq ($(ENABLE_HEADLESS_ONLY), false) - LIBJAWT_JDK_LIBS_unix += -lawt_xawt + LIBJAWT_JDK_LIBS_unix += libawt_xawt else - LIBJAWT_JDK_LIBS_unix += -lawt_headless + LIBJAWT_JDK_LIBS_unix += libawt_headless endif endif @@ -616,27 +571,14 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJAWT, \ DISABLED_WARNINGS_clang_jawt.m := sign-compare, \ EXTRA_HEADER_DIRS := $(LIBJAWT_EXTRA_HEADER_DIRS), \ LDFLAGS_windows := $(LDFLAGS_CXX_JDK), \ - LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \ LDFLAGS_macosx := -Wl$(COMMA)-rpath$(COMMA)@loader_path, \ - JDK_LIBS_unix := $(LIBJAWT_JDK_LIBS_unix) $(JDKLIB_LIBS), \ - JDK_LIBS_macosx := -lawt_lwawt, \ - JDK_LIBS_windows := $(WIN_AWT_LIB), \ + JDK_LIBS_unix := $(LIBJAWT_JDK_LIBS_unix), \ + JDK_LIBS_windows := libawt, \ + JDK_LIBS_macosx := libawt_lwawt, \ LIBS_macosx := -framework Cocoa, \ LIBS_windows := advapi32.lib $(LIBJAWT_LIBS_windows), \ )) -ifeq ($(call isTargetOs, windows), true) - $(BUILD_LIBJAWT): $(BUILD_LIBAWT) -else ifeq ($(call isTargetOs, macosx), true) - $(BUILD_LIBJAWT): $(call FindLib, $(MODULE), awt_lwawt) -else - ifeq ($(ENABLE_HEADLESS_ONLY), false) - $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT) - else - $(BUILD_LIBJAWT): $(call FindLib, $(MODULE), awt_headless) - endif -endif - TARGETS += $(BUILD_LIBJAWT) ifeq ($(call isTargetOs, windows), true) @@ -663,6 +605,7 @@ ifeq ($(ENABLE_HEADLESS_ONLY), false) common/awt/utility \ libosxapp \ java.base:libjava \ + java.base:libjvm \ # ifeq ($(USE_EXTERNAL_LIBGIF), false) @@ -758,11 +701,9 @@ ifeq ($(ENABLE_HEADLESS_ONLY), false) DISABLED_WARNINGS_microsoft_splashscreen_impl.c := 4018 4267 4244, \ DISABLED_WARNINGS_microsoft_splashscreen_png.c := 4267, \ DISABLED_WARNINGS_microsoft_splashscreen_sys.c := 4267 4244, \ - LDFLAGS_macosx := -L$(INSTALL_LIBRARIES_HERE), \ LDFLAGS_windows := -delayload:user32.dll, \ - JDK_LIBS := $(JDKLIB_LIBS), \ - JDK_LIBS_macosx := -losxapp, \ - JDK_LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \ + JDK_LIBS_windows := java.base:libjava, \ + JDK_LIBS_macosx := libosxapp, \ LIBS := $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(LIBZ_LIBS) $(PNG_LIBS), \ LIBS_unix := $(LIBM) -lpthread, \ LIBS_linux := $(LIBDL) $(X_LIBS) -lX11 -lXext, \ @@ -777,10 +718,6 @@ ifeq ($(ENABLE_HEADLESS_ONLY), false) )) TARGETS += $(BUILD_LIBSPLASHSCREEN) - - ifeq ($(call isTargetOs, macosx), true) - $(BUILD_LIBSPLASHSCREEN): $(call FindLib, $(MODULE), osxapp) - endif endif ifeq ($(call isTargetOs, macosx), true) @@ -803,7 +740,7 @@ ifeq ($(call isTargetOs, macosx), true) include \ common/awt/debug \ common/java2d/opengl \ - libosxapp \ + java.base:libjvm \ # LIBAWT_LWAWT_EXCLUDE_FILES := fontpath.c awt_Font.c X11Color.c @@ -833,8 +770,7 @@ ifeq ($(call isTargetOs, macosx), true) DISABLED_WARNINGS_clang_OGLBufImgOps.c := format-nonliteral, \ DISABLED_WARNINGS_clang_OGLPaints.c := format-nonliteral, \ DISABLED_WARNINGS_clang_PrinterView.m := enum-conversion, \ - LDFLAGS := -L$(INSTALL_LIBRARIES_HERE), \ - JDK_LIBS_macosx := -lawt -ljava -ljvm -lmlib_image -losxapp, \ + JDK_LIBS := libawt java.base:libjava libosxapp, \ LIBS_macosx := $(LIBM) \ -framework Accelerate \ -framework ApplicationServices \ @@ -851,14 +787,6 @@ ifeq ($(call isTargetOs, macosx), true) TARGETS += $(BUILD_LIBAWT_LWAWT) - $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBAWT) - - $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBMLIB_IMAGE) - - $(BUILD_LIBAWT_LWAWT): $(call FindLib, $(MODULE), osxapp) - - $(BUILD_LIBAWT_LWAWT): $(call FindLib, java.base, java) - ############################################################################## ## Build libosxui ############################################################################## @@ -867,7 +795,7 @@ ifeq ($(call isTargetOs, macosx), true) $(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/shaders.metal SHADERS_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/native/java.desktop/libosxui SHADERS_AIR := $(SHADERS_SUPPORT_DIR)/shaders.air - SHADERS_LIB := $(INSTALL_LIBRARIES_HERE)/shaders.metallib + SHADERS_LIB := $(call FindLibDirForModule, $(MODULE))/shaders.metallib $(eval $(call SetupExecute, metal_shaders, \ INFO := Running metal on $(notdir $(SHADERS_SRC)) (for libosxui.dylib), \ @@ -893,14 +821,12 @@ ifeq ($(call isTargetOs, macosx), true) NAME := osxui, \ OPTIMIZATION := LOW, \ EXTRA_HEADER_DIRS := \ - libawt_lwawt/awt \ - libosxapp, \ + libawt_lwawt/awt, \ DISABLED_WARNINGS_clang_AquaFileView.m := deprecated-declarations \ sign-compare, \ DISABLED_WARNINGS_clang_ScreenMenu.m := deprecated-declarations, \ APPEND_LDFLAGS := -Wl$(COMMA)-rpath$(COMMA)@loader_path, \ - LDFLAGS := -L$(INSTALL_LIBRARIES_HERE), \ - JDK_LIBS_macosx := -lawt -lawt_lwawt -ljava -ljvm -losxapp, \ + JDK_LIBS := java.base:libjava libosxapp, \ LIBS_macosx := \ -framework ApplicationServices \ -framework Carbon \ @@ -912,10 +838,4 @@ ifeq ($(call isTargetOs, macosx), true) TARGETS += $(BUILD_LIBOSXUI) $(BUILD_LIBOSXUI): $(SHADERS_LIB) - - $(BUILD_LIBOSXUI): $(BUILD_LIBAWT) - - $(BUILD_LIBOSXUI): $(call FindLib, $(MODULE), osxapp) - - $(BUILD_LIBOSXUI): $(BUILD_LIBAWT_LWAWT) endif diff --git a/make/modules/java.instrument/Lib.gmk b/make/modules/java.instrument/Lib.gmk index a6c1da8dfd3..675c1d8ccd3 100644 --- a/make/modules/java.instrument/Lib.gmk +++ b/make/modules/java.instrument/Lib.gmk @@ -36,14 +36,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBINSTRUMENT, \ CFLAGS_windows := -Dstrcasecmp=stricmp, \ CFLAGS_debug := -DJPLIS_LOGGING, \ CFLAGS_release := -DNO_JPLIS_LOGGING, \ - EXTRA_HEADER_DIRS := java.base:libjli, \ - LDFLAGS_linux := -L$(call FindLibDirForModule, java.base), \ - LDFLAGS_macosx := -L$(call FindLibDirForModule, java.base), \ - LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \ - JDK_LIBS := $(JDKLIB_LIBS), \ - JDK_LIBS_unix := -ljli, \ - JDK_LIBS_windows := $(WIN_JAVA_LIB) \ - $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib jvm.lib, \ + JDK_LIBS := java.base:libjava java.base:libjli java.base:libjvm, \ LIBS_unix := $(LIBZ_LIBS), \ LIBS_linux := $(LIBDL), \ LIBS_aix := $(LIBDL) -liconv, \ @@ -54,11 +47,4 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBINSTRUMENT, \ LIBS_windows := advapi32.lib, \ )) -ifeq ($(call isTargetOs, aix), true) - $(BUILD_LIBINSTRUMENT): $(call FindStaticLib, java.base, jli) -else - $(BUILD_LIBINSTRUMENT): $(call FindLib, java.base, jli) -endif -$(BUILD_LIBINSTRUMENT): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBINSTRUMENT) diff --git a/make/modules/java.management/Lib.gmk b/make/modules/java.management/Lib.gmk index 9f93c368c69..3d2e42e42ec 100644 --- a/make/modules/java.management/Lib.gmk +++ b/make/modules/java.management/Lib.gmk @@ -37,12 +37,9 @@ endif $(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT, \ NAME := management, \ OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \ - JDK_LIBS := $(JDKLIB_LIBS), \ - JDK_LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \ + JDK_LIBS := java.base:libjava java.base:libjvm, \ LIBS_aix := -lperfstat,\ LIBS_windows := advapi32.lib psapi.lib, \ )) -$(BUILD_LIBMANAGEMENT): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBMANAGEMENT) diff --git a/make/modules/java.prefs/Lib.gmk b/make/modules/java.prefs/Lib.gmk index 7c5d6dbb615..033768ffa1d 100644 --- a/make/modules/java.prefs/Lib.gmk +++ b/make/modules/java.prefs/Lib.gmk @@ -38,16 +38,11 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBPREFS, \ NAME := prefs, \ EXCLUDE_SRC_PATTERNS := $(LIBPREFS_EXCLUDE_SRC_PATTERNS), \ OPTIMIZATION := HIGH, \ - JDK_LIBS_unix := -ljvm, \ - JDK_LIBS_linux := -ljava, \ - JDK_LIBS_aix := -ljava, \ - JDK_LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \ + JDK_LIBS := java.base:libjava java.base:libjvm, \ LIBS_macosx := \ -framework CoreFoundation \ -framework Foundation, \ LIBS_windows := advapi32.lib, \ )) -$(BUILD_LIBPREFS): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBPREFS) diff --git a/make/modules/java.rmi/Lib.gmk b/make/modules/java.rmi/Lib.gmk index 45b3067caca..3f4a5bed893 100644 --- a/make/modules/java.rmi/Lib.gmk +++ b/make/modules/java.rmi/Lib.gmk @@ -31,11 +31,9 @@ include LibCommon.gmk $(eval $(call SetupJdkLibrary, BUILD_LIBRMI, \ NAME := rmi, \ + EXTRA_HEADER_DIRS := java.base:libjava, \ OPTIMIZATION := LOW, \ - JDK_LIBS_unix := -ljvm, \ - JDK_LIBS_windows := jvm.lib, \ + JDK_LIBS := java.base:libjvm, \ )) -$(BUILD_LIBRMI): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBRMI) diff --git a/make/modules/java.security.jgss/Lib.gmk b/make/modules/java.security.jgss/Lib.gmk index f5250c43999..4cef4576dea 100644 --- a/make/modules/java.security.jgss/Lib.gmk +++ b/make/modules/java.security.jgss/Lib.gmk @@ -32,6 +32,7 @@ include LibCommon.gmk $(eval $(call SetupJdkLibrary, BUILD_LIBJ2GSS, \ NAME := j2gss, \ OPTIMIZATION := LOW, \ + EXTRA_HEADER_DIRS := java.base:libjava, \ DISABLED_WARNINGS_gcc := undef, \ DISABLED_WARNINGS_clang := undef, \ LIBS_unix := $(LIBDL), \ @@ -47,7 +48,9 @@ ifeq ($(call isTargetOs, windows), true) $(eval $(call SetupJdkLibrary, BUILD_LIBSSPI_BRIDGE, \ NAME := sspi_bridge, \ OPTIMIZATION := LOW, \ - EXTRA_HEADER_DIRS := libj2gss, \ + EXTRA_HEADER_DIRS := \ + libj2gss \ + java.base:libjava, \ LIBS_windows := secur32.lib, \ )) @@ -63,6 +66,7 @@ ifneq ($(BUILD_CRYPTO), false) $(eval $(call SetupJdkLibrary, BUILD_LIBW2K_LSA_AUTH, \ NAME := w2k_lsa_auth, \ OPTIMIZATION := LOW, \ + EXTRA_HEADER_DIRS := java.base:libjava, \ LIBS_windows := advapi32.lib kernel32.lib secur32.lib ws2_32.lib, \ )) @@ -79,6 +83,7 @@ ifneq ($(BUILD_CRYPTO), false) $(eval $(call SetupJdkLibrary, BUILD_LIBOSXKRB5, \ NAME := osxkrb5, \ OPTIMIZATION := LOW, \ + EXTRA_HEADER_DIRS := java.base:libjava, \ DISABLED_WARNINGS_clang_nativeccache.c := deprecated-declarations, \ LIBS_macosx := \ -framework Cocoa \ diff --git a/make/modules/java.smartcardio/Lib.gmk b/make/modules/java.smartcardio/Lib.gmk index 7e7b8e5f009..1e647fd7e24 100644 --- a/make/modules/java.smartcardio/Lib.gmk +++ b/make/modules/java.smartcardio/Lib.gmk @@ -32,7 +32,9 @@ include LibCommon.gmk $(eval $(call SetupJdkLibrary, BUILD_LIBJ2PCSC, \ NAME := j2pcsc, \ CFLAGS_unix := -D__sun_jdk, \ - EXTRA_HEADER_DIRS := libj2pcsc/MUSCLE, \ + EXTRA_HEADER_DIRS := \ + libj2pcsc/MUSCLE \ + java.base:libjava, \ OPTIMIZATION := LOW, \ LIBS_unix := $(LIBDL), \ LIBS_windows := winscard.lib, \ diff --git a/make/modules/jdk.accessibility/Lib.gmk b/make/modules/jdk.accessibility/Lib.gmk index 64cb77821ce..657eec2ad4e 100644 --- a/make/modules/jdk.accessibility/Lib.gmk +++ b/make/modules/jdk.accessibility/Lib.gmk @@ -48,7 +48,7 @@ ifeq ($(call isTargetOs, windows), true) EXTRA_HEADER_DIRS := \ include/bridge \ java.desktop:include, \ - JDK_LIBS_windows := $(SUPPORT_OUTPUTDIR)/native/java.desktop/libjawt/jawt.lib, \ + JDK_LIBS := java.desktop:libjawt, \ LIBS_windows := advapi32.lib comdlg32.lib gdi32.lib kernel32.lib \ odbc32.lib odbccp32.lib ole32.lib oleaut32.lib shell32.lib \ user32.lib uuid.lib winspool.lib, \ @@ -56,8 +56,6 @@ ifeq ($(call isTargetOs, windows), true) $(ACCESSIBILITY_SRCDIR)/common/AccessBridgeStatusWindow.rc, \ ) - $$(BUILD_LIBJAVAACCESSBRIDGE$1): $(call FindStaticLib, java.desktop, jawt, /libjawt) - TARGETS += $$(BUILD_LIBJAVAACCESSBRIDGE$1) endef diff --git a/make/modules/jdk.attach/Lib.gmk b/make/modules/jdk.attach/Lib.gmk index 4298bc80097..8eefe7a4ec0 100644 --- a/make/modules/jdk.attach/Lib.gmk +++ b/make/modules/jdk.attach/Lib.gmk @@ -41,11 +41,8 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBATTACH, \ OPTIMIZATION := LOW, \ CFLAGS := $(LIBATTACH_CFLAGS), \ CFLAGS_windows := -Gy, \ - JDK_LIBS := $(JDKLIB_LIBS), \ - JDK_LIBS_windows := $(WIN_JAVA_LIB), \ + JDK_LIBS := java.base:libjava, \ LIBS_windows := advapi32.lib psapi.lib, \ )) -$(BUILD_LIBATTACH): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBATTACH) diff --git a/make/modules/jdk.crypto.cryptoki/Lib.gmk b/make/modules/jdk.crypto.cryptoki/Lib.gmk index a71e4f01882..9a21177af4f 100644 --- a/make/modules/jdk.crypto.cryptoki/Lib.gmk +++ b/make/modules/jdk.crypto.cryptoki/Lib.gmk @@ -32,6 +32,7 @@ include LibCommon.gmk $(eval $(call SetupJdkLibrary, BUILD_LIBJ2PKCS11, \ NAME := j2pkcs11, \ OPTIMIZATION := LOW, \ + EXTRA_HEADER_DIRS := java.base:libjava, \ DISABLED_WARNINGS_clang_p11_util.c := format-nonliteral, \ LIBS_unix := $(LIBDL), \ )) diff --git a/make/modules/jdk.crypto.mscapi/Lib.gmk b/make/modules/jdk.crypto.mscapi/Lib.gmk index f9089258699..39b83a21ae9 100644 --- a/make/modules/jdk.crypto.mscapi/Lib.gmk +++ b/make/modules/jdk.crypto.mscapi/Lib.gmk @@ -33,6 +33,7 @@ ifeq ($(call isTargetOs, windows), true) $(eval $(call SetupJdkLibrary, BUILD_LIBSUNMSCAPI, \ NAME := sunmscapi, \ OPTIMIZATION := LOW, \ + EXTRA_HEADER_DIRS := java.base:libjava, \ LDFLAGS := $(LDFLAGS_CXX_JDK), \ LIBS_windows := advapi32.lib crypt32.lib ncrypt.lib, \ )) diff --git a/make/modules/jdk.hotspot.agent/Lib.gmk b/make/modules/jdk.hotspot.agent/Lib.gmk index 326536878c9..48429a9004d 100644 --- a/make/modules/jdk.hotspot.agent/Lib.gmk +++ b/make/modules/jdk.hotspot.agent/Lib.gmk @@ -57,6 +57,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBSAPROC, \ NAME := saproc, \ LINK_TYPE := $(LIBSAPROC_LINK_TYPE), \ OPTIMIZATION := HIGH, \ + EXTRA_HEADER_DIRS := java.base:libjvm, \ DISABLED_WARNINGS_gcc := sign-compare, \ DISABLED_WARNINGS_gcc_ps_core.c := pointer-arith, \ DISABLED_WARNINGS_clang_ps_core.c := pointer-arith, \ @@ -66,8 +67,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBSAPROC, \ CFLAGS := $(LIBSAPROC_CFLAGS), \ CXXFLAGS := $(LIBSAPROC_CFLAGS) $(LIBSAPROC_CXXFLAGS), \ EXTRA_SRC := $(LIBSAPROC_EXTRA_SRC), \ - JDK_LIBS_unix := -ljava, \ - JDK_LIBS_windows := $(WIN_JAVA_LIB), \ + JDK_LIBS := java.base:libjava, \ LIBS_linux := $(LIBDL), \ LIBS_macosx := \ -framework CoreFoundation \ diff --git a/make/modules/jdk.internal.le/Lib.gmk b/make/modules/jdk.internal.le/Lib.gmk index 8c04107e0f5..e81137e0d53 100644 --- a/make/modules/jdk.internal.le/Lib.gmk +++ b/make/modules/jdk.internal.le/Lib.gmk @@ -34,8 +34,10 @@ ifeq ($(call isTargetOs, aix), false) NAME := le, \ LINK_TYPE := C++, \ OPTIMIZATION := LOW, \ + EXTRA_HEADER_DIRS := \ + java.base:libjava \ + java.base:libjvm, \ LD_SET_ORIGIN := false, \ - JDK_LIBS := $(JDKLIB_LIBS), \ LIBS_windows := user32.lib, \ )) diff --git a/make/modules/jdk.jdi/Lib.gmk b/make/modules/jdk.jdi/Lib.gmk index 8c620bf90e2..80a5664289b 100644 --- a/make/modules/jdk.jdi/Lib.gmk +++ b/make/modules/jdk.jdi/Lib.gmk @@ -36,7 +36,6 @@ ifeq ($(call isTargetOs, windows), true) EXTRA_HEADER_DIRS := \ jdk.jdwp.agent:include \ jdk.jdwp.agent:libjdwp/export, \ - JDK_LIBS := $(JDKLIB_LIBS), \ )) TARGETS += $(BUILD_LIBDT_SHMEM) diff --git a/make/modules/jdk.jdwp.agent/Lib.gmk b/make/modules/jdk.jdwp.agent/Lib.gmk index 17735dfe3d7..03fab3c39ea 100644 --- a/make/modules/jdk.jdwp.agent/Lib.gmk +++ b/make/modules/jdk.jdwp.agent/Lib.gmk @@ -40,8 +40,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBDT_SOCKET, \ LIBS_windows := iphlpapi.lib ws2_32.lib, \ )) -$(BUILD_LIBDT_SOCKET): $(call FindLib, java.base, java) - # Include socket transport with JDWP agent to allow for remote debugging TARGETS += $(BUILD_LIBDT_SOCKET) @@ -61,15 +59,14 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJDWP, \ DISABLED_WARNINGS_clang_log_messages.c := format-nonliteral, \ EXTRA_HEADER_DIRS := \ include \ - libjdwp/export, \ - JDK_LIBS := $(JDKLIB_LIBS), \ + libjdwp/export \ + java.base:libjava \ + java.base:libjvm, \ LIBS_linux := $(LIBDL), \ LIBS_macosx := -liconv, \ LIBS_aix := -liconv, \ )) -$(BUILD_LIBJDWP): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBJDWP) ################################################################################ diff --git a/make/modules/jdk.management.agent/Lib.gmk b/make/modules/jdk.management.agent/Lib.gmk index 7a578adc301..89de59d7fec 100644 --- a/make/modules/jdk.management.agent/Lib.gmk +++ b/make/modules/jdk.management.agent/Lib.gmk @@ -32,11 +32,8 @@ include LibCommon.gmk $(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT_AGENT, \ NAME := management_agent, \ OPTIMIZATION := LOW, \ - JDK_LIBS := $(JDKLIB_LIBS), \ - JDK_LIBS_windows := $(WIN_JAVA_LIB), \ + JDK_LIBS := java.base:libjava, \ LIBS_windows := advapi32.lib, \ )) -$(BUILD_LIBMANAGEMENT_AGENT): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBMANAGEMENT_AGENT) diff --git a/make/modules/jdk.management/Lib.gmk b/make/modules/jdk.management/Lib.gmk index 4e5c44a781a..8d7fae64872 100644 --- a/make/modules/jdk.management/Lib.gmk +++ b/make/modules/jdk.management/Lib.gmk @@ -46,12 +46,9 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT_EXT, \ OPTIMIZATION := $(LIBMANAGEMENT_EXT_OPTIMIZATION), \ DISABLED_WARNINGS_clang_UnixOperatingSystem.c := format-nonliteral, \ CFLAGS := $(LIBMANAGEMENT_EXT_CFLAGS), \ - JDK_LIBS := $(JDKLIB_LIBS), \ - JDK_LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \ + JDK_LIBS := java.base:libjava java.base:libjvm, \ LIBS_aix := -lperfstat,\ LIBS_windows := advapi32.lib psapi.lib, \ )) -$(BUILD_LIBMANAGEMENT_EXT): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBMANAGEMENT_EXT) diff --git a/make/modules/jdk.net/Lib.gmk b/make/modules/jdk.net/Lib.gmk index a0a9aff8cb8..e43d8427f5a 100644 --- a/make/modules/jdk.net/Lib.gmk +++ b/make/modules/jdk.net/Lib.gmk @@ -32,12 +32,9 @@ include LibCommon.gmk $(eval $(call SetupJdkLibrary, BUILD_LIBEXTNET, \ NAME := extnet, \ OPTIMIZATION := LOW, \ - JDK_LIBS_unix := -ljava, \ - JDK_LIBS_linux := -ljvm, \ - JDK_LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \ + EXTRA_HEADER_DIRS := java.base:libjvm, \ + JDK_LIBS := java.base:libjava, \ LIBS_windows := ws2_32.lib, \ )) -$(BUILD_LIBEXTNET): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBEXTNET) diff --git a/make/modules/jdk.sctp/Lib.gmk b/make/modules/jdk.sctp/Lib.gmk index 57b52b3cb11..a6d95a25154 100644 --- a/make/modules/jdk.sctp/Lib.gmk +++ b/make/modules/jdk.sctp/Lib.gmk @@ -35,13 +35,12 @@ ifeq ($(call isTargetOs, linux), true) OPTIMIZATION := LOW, \ EXTRA_HEADER_DIRS := \ $(call GetJavaHeaderDir, java.base) \ - java.base:libnet \ + java.base:libjvm \ + java.base:libnio \ java.base:libnio/ch, \ - JDK_LIBS_unix := -ljava -ljvm -lnet -lnio, \ + JDK_LIBS := java.base:libjava java.base:libnet, \ LIBS_linux := $(LIBDL) -lpthread, \ )) TARGETS += $(BUILD_LIBSCTP) - - $(BUILD_LIBSCTP): $(call FindLib, java.base, nio) endif diff --git a/make/modules/jdk.security.auth/Lib.gmk b/make/modules/jdk.security.auth/Lib.gmk index dad60be2376..a0d41004489 100644 --- a/make/modules/jdk.security.auth/Lib.gmk +++ b/make/modules/jdk.security.auth/Lib.gmk @@ -32,9 +32,8 @@ include LibCommon.gmk $(eval $(call SetupJdkLibrary, BUILD_LIBJAAS, \ NAME := jaas, \ OPTIMIZATION := LOW, \ + EXTRA_HEADER_DIRS := java.base:libjava, \ LIBS_windows := advapi32.lib mpr.lib netapi32.lib user32.lib, \ )) -$(BUILD_LIBJAAS): $(call FindLib, java.base, java) - TARGETS += $(BUILD_LIBJAAS) diff --git a/make/test/JtregNativeHotspot.gmk b/make/test/JtregNativeHotspot.gmk index 2c86ea2ddd0..33532f77974 100644 --- a/make/test/JtregNativeHotspot.gmk +++ b/make/test/JtregNativeHotspot.gmk @@ -842,9 +842,11 @@ ifeq ($(call isTargetOs, linux), true) BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libstepBreakPopReturn := -lpthread BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libIndyRedefineClass := -lpthread BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libredefineClasses := -lpthread - BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exeinvoke := -ljvm -lpthread - BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exestack-gap := -ljvm -lpthread - BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exestack-tls := -ljvm + BUILD_HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exeinvoke := java.base:libjvm + BUILD_HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exestack-gap := java.base:libjvm + BUILD_HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exestack-tls := java.base:libjvm + BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exeinvoke := -lpthread + BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exestack-gap := -lpthread BUILD_TEST_exeinvoke_exeinvoke.c_OPTIMIZATION := NONE BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exeFPRegs := -ldl BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libAsyncGetCallTraceTest := -ldl @@ -859,16 +861,15 @@ ifeq ($(call And, $(call isTargetOs, linux) $(call isTargetCpu, aarch64)), false endif -BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exesigtest := -ljvm +BUILD_HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exesigtest := java.base:libjvm +BUILD_HOTSPOT_JTREG_LIBRARIES_JDK_LIBS_libatExit := java.base:libjvm +BUILD_HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exedaemonDestroy := java.base:libjvm ifeq ($(call isTargetOs, windows), true) BUILD_HOTSPOT_JTREG_EXECUTABLES_CFLAGS_exeFPRegs := -MT BUILD_HOTSPOT_JTREG_EXCLUDE += exesigtest.c libterminatedThread.c libTestJNI.c libCompleteExit.c libMonitorWithDeadObjectTest.c libTestPsig.c exeGetCreatedJavaVMs.c - BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libatExit := jvm.lib - BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libnativeStack := jvm.lib - BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exedaemonDestroy := jvm.lib + BUILD_HOTSPOT_JTREG_LIBRARIES_JDK_LIBS_libnativeStack := java.base:libjvm else - BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exedaemonDestroy := -ljvm BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libbootclssearch_agent += -lpthread BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libsystemclssearch_agent += -lpthread BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libgetsysprop001 += -lpthread @@ -1503,11 +1504,11 @@ else BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libgetphase001 += -lpthread BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libgetphase002 += -lpthread BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libterminatedThread += -lpthread - BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libatExit += -ljvm BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libCompleteExit += -lpthread BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libMonitorWithDeadObjectTest += -lpthread BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libnativeStack += -lpthread - BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exeGetCreatedJavaVMs := -ljvm -lpthread + BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exeGetCreatedJavaVMs := -lpthread + BUILD_HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exeGetCreatedJavaVMs := java.base:libjvm BUILD_HOTSPOT_JTREG_EXCLUDE += libNativeException.c endif diff --git a/make/test/JtregNativeJdk.gmk b/make/test/JtregNativeJdk.gmk index 7cffc7311c7..ae830501635 100644 --- a/make/test/JtregNativeJdk.gmk +++ b/make/test/JtregNativeJdk.gmk @@ -53,28 +53,26 @@ BUILD_JDK_JTREG_EXECUTABLES_CFLAGS_exeJliLaunchTest := \ -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \ -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli +BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeJliLaunchTest := java.base:libjli +BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeCallerAccessTest := java.base:libjvm +BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeNullCallerTest := java.base:libjvm + +BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libstringPlatformChars := java.base:libjava +BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libTracePinnedThreads := java.base:libjvm +BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libNewDirectByteBuffer := java.base:libjava +BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libGetXSpace := java.base:libjava + # Platform specific setup ifeq ($(call isTargetOs, windows), true) BUILD_JDK_JTREG_EXCLUDE += libDirectIO.c libInheritedChannel.c \ libExplicitAttach.c libImplicitAttach.c \ exelauncher.c - WIN_LIB_JAVA := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib - BUILD_JDK_JTREG_LIBRARIES_LIBS_libstringPlatformChars := $(WIN_LIB_JAVA) - WIN_LIB_JLI := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib - BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeJliLaunchTest := $(WIN_LIB_JLI) - BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeCallerAccessTest := jvm.lib - BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerTest := $(LIBCXX) jvm.lib + BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerTest := $(LIBCXX) BUILD_JDK_JTREG_EXECUTABLES_LIBS_exerevokeall := advapi32.lib BUILD_JDK_JTREG_EXECUTABLES_CFLAGS_exeNullCallerTest := /EHsc - BUILD_JDK_JTREG_LIBRARIES_LIBS_libTracePinnedThreads := jvm.lib - BUILD_JDK_JTREG_LIBRARIES_LIBS_libNewDirectByteBuffer := $(WIN_LIB_JAVA) - BUILD_JDK_JTREG_LIBRARIES_LIBS_libGetXSpace := $(WIN_LIB_JAVA) else - BUILD_JDK_JTREG_LIBRARIES_LIBS_libstringPlatformChars := -ljava - BUILD_JDK_JTREG_LIBRARIES_LIBS_libDirectIO := -ljava - BUILD_JDK_JTREG_LIBRARIES_LIBS_libNewDirectByteBuffer := -ljava - BUILD_JDK_JTREG_LIBRARIES_LIBS_libGetXSpace := -ljava + BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libDirectIO := java.base:libjava BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libNativeThread := -pthread # java.lang.foreign tests @@ -84,28 +82,22 @@ else BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libLinkerInvokerModule := -pthread BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libLoaderLookupInvoker := -pthread - BUILD_JDK_JTREG_LIBRARIES_LIBS_libExplicitAttach := -ljvm + BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libExplicitAttach := java.base:libjvm BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libExplicitAttach := -pthread BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libImplicitAttach := -pthread - BUILD_JDK_JTREG_LIBRARIES_LIBS_libTracePinnedThreads := -ljvm BUILD_JDK_JTREG_EXCLUDE += exerevokeall.c ifeq ($(call isTargetOs, linux), true) - BUILD_JDK_JTREG_LIBRARIES_LIBS_libInheritedChannel := -ljava + BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libInheritedChannel := java.base:libjava BUILD_JDK_JTREG_EXECUTABLES_LIBS_exelauncher := -ldl endif - BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeJliLaunchTest := -ljli - ifeq ($(call isTargetOs, aix), true) - BUILD_JDK_JTREG_EXECUTABLES_LDFLAGS_exeJliLaunchTest := -L$(SUPPORT_OUTPUTDIR)/native/java.base - endif - BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeCallerAccessTest := -ljvm - BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerTest := $(LIBCXX) -ljvm + BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerTest := $(LIBCXX) endif ifeq ($(call isTargetOs, macosx), true) BUILD_JDK_JTREG_EXCLUDE += exelauncher.c BUILD_JDK_JTREG_LIBRARIES_LIBS_libTestMainKeyWindow := \ -framework Cocoa - BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeJniInvocationTest := -ljli + BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeJniInvocationTest := java.base:libjli BUILD_JDK_JTREG_LIBRARIES_LIBS_libTestDynamicStore := \ -framework Cocoa -framework SystemConfiguration else diff --git a/make/test/JtregNativeLibTest.gmk b/make/test/JtregNativeLibTest.gmk index 4bae9d9189c..7ab45cce878 100644 --- a/make/test/JtregNativeLibTest.gmk +++ b/make/test/JtregNativeLibTest.gmk @@ -48,11 +48,7 @@ BUILD_LIBTEST_JTREG_OUTPUT_DIR := $(OUTPUTDIR)/support/test/lib-test/jtreg/nativ BUILD_LIBTEST_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/lib-test/jtreg -ifeq ($(call isTargetOs, windows), true) - BUILD_LIBTEST_JTREG_EXECUTABLES_LIBS_exejvm-test-launcher := jvm.lib -else - BUILD_LIBTEST_JTREG_EXECUTABLES_LIBS_exejvm-test-launcher := -ljvm -endif +BUILD_LIBTEST_JTREG_EXECUTABLES_JDK_LIBS_exejvm-test-launcher := java.base:libjvm # This evaluation is expensive and should only be done if this target was # explicitly called.