make/common/JdkNativeCompilation.gmk
branchihse-jdk-library-branch
changeset 56433 c3cf838aa2da
parent 56311 e05b4241302b
child 56454 82c3ae69914f
--- a/make/common/JdkNativeCompilation.gmk	Thu Apr 12 14:11:59 2018 +0200
+++ b/make/common/JdkNativeCompilation.gmk	Mon Apr 16 11:48:41 2018 +0200
@@ -32,6 +32,22 @@
 
 include NativeCompilation.gmk
 
+# FIXME:LIBS
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, lib/LibCommon.gmk))
+
+FindSrcDirsForLib += \
+  $(call uniq, $(wildcard \
+      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
+      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
+      $(TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
+
+FindSrcDirsForComponent += \
+  $(call uniq, $(wildcard \
+      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/$(strip $2) \
+      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/$(strip $2) \
+      $(TOPDIR)/src/$(strip $1)/share/native/$(strip $2)))
+
 # Setup make rules for creating a native shared library with suitable defaults
 # for the OpenJDK project.
 #
@@ -39,8 +55,9 @@
 # and the targets generated are listed in a variable by that name.
 #
 # Remaining parameters are named arguments. These are all passed on to
-# SetupNativeCompilation, except for 
+# SetupNativeCompilation, except for
 #   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
+#   HEADER_FLAGS - where to look for headers! FIXME:LIBS
 SetupJdkLibrary = $(NamedParamsMacroTemplate)
 define SetupJdkLibraryBody
   ifeq ($$($1_OUTPUT_DIR), )
@@ -51,6 +68,10 @@
     $1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/lib$$($1_NAME)
   endif
 
+  ifeq ($$($1_SRC), )
+    $1_SRC := $$(call FindSrcDirsForLib, $$(MODULE), $$($1_NAME))
+  endif
+
   ifeq ($$($1_VERSIONINFO_RESOURCE), )
     $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
   else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
@@ -66,6 +87,11 @@
     $1_RC_FLAGS :=
   endif
 
+  ifneq ($$($1_HEADERS_FROM_SRC), false)
+    $1_SRC_HEADER_FLAGS := $$(foreach dir, $$($1_SRC), -I$$(dir))
+  endif
+  $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_HEADER_FLAGS)
+  $1_CXXFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_HEADER_FLAGS)
   $1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
 
   # Since we reuse the rule name ($1), all our arguments will pass through.
@@ -80,7 +106,7 @@
 # and the targets generated are listed in a variable by that name.
 #
 # Remaining parameters are named arguments. These are all passed on to
-# SetupNativeCompilation, except for 
+# SetupNativeCompilation, except for
 #   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
 SetupJdkExecutable = $(NamedParamsMacroTemplate)
 define SetupJdkExecutableBody