make/lib/LibCommon.gmk

Print this page

        

@@ -21,31 +21,22 @@
 # 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.
 #
 
-default: all
-
 include $(SPEC)
 include MakeBase.gmk
 include NativeCompilation.gmk
 
 # Build tools
 include Tools.gmk
 
 GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
 
-# Put the libraries here. Different locations for different target apis.
-ifeq ($(OPENJDK_TARGET_OS_API), posix)
-  INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
-else
-  INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/bin
-endif
-
 # Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
 # elegant solution to this.
-WIN_JAVA_LIB := $(JDK_OUTPUTDIR)/objs/libjava/java.lib
+WIN_JAVA_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib
 
 # Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
 # not on other platforms.
 ifeq ($(OPENJDK_TARGET_OS), windows)
   DEBUG_ALL_BINARIES := true

@@ -55,28 +46,49 @@
 ifdef OPENJDK
   DEBUG_ALL_BINARIES := true
 endif
 
 ################################################################################
-
 # Find the default set of src dirs for a native library.
 # Param 1 - module name
 # Param 2 - library name
-FindSrcDirsForLib = $(call uniq, $(wildcard \
+define FindSrcDirsForLib 
+  $(call uniq, $(wildcard \
     $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
     $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_API_DIR)/native/lib$(strip $2) \
     $(JDK_TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
+endef
 
 ################################################################################
+# Find lib dir for module
+# Param 1 - module name
+ifeq ($(OPENJDK_TARGET_OS_API), posix)
+  define FindLibDirForModule
+    $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)$(OPENJDK_TARGET_CPU_LIBDIR)
+  endef
+else
+  define FindLibDirForModule
+    $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
+  endef
+endif
 
-# A lot of libraries are dependent on libjava. Define the name of that
-# library here to make dependency declarations to it possible in other files.
-BUILD_LIBJAVA := $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)java$(SHARED_LIBRARY_SUFFIX)
+################################################################################
+# Find a library
+# Param 1 - module name
+# Param 2 - library name
+# Param 3 - subdir for library
+define FindLib
+  $(call FindLibDirForModule, $(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX)
+endef
 
-# Also define the header include flags needed to compile against it.
+################################################################################
+# Define the header include flags needed to compile against it.
 LIBJAVA_HEADER_FLAGS := $(addprefix -I, $(call FindSrcDirsForLib, java.base, java))
 
+# Put the libraries here.
+INSTALL_LIBRARIES_HERE := $(call FindLibDirForModule, $(MODULE))
+
 ################################################################################
 
 # Define it here since there are multiple uses.
 ifeq ($(USE_EXTERNAL_LIBZ), true)
   LIBZ := -lz