< prev index next >

make/common/JdkNativeCompilation.gmk

Print this page




  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 ifndef _JDK_NATIVE_COMPILATION_GMK
  27 _JDK_NATIVE_COMPILATION_GMK := 1
  28 
  29 ifeq ($(_MAKEBASE_GMK), )
  30   $(error You must include MakeBase.gmk prior to including JdkNativeCompilation.gmk)
  31 endif
  32 
  33 include NativeCompilation.gmk
  34 






























  35 # Setup make rules for creating a native shared library with suitable defaults
  36 # for the OpenJDK project.
  37 #
  38 # Parameter 1 is the name of the rule. This name is used as variable prefix,
  39 # and the targets generated are listed in a variable by that name.
  40 #
  41 # Remaining parameters are named arguments. These are all passed on to
  42 # SetupNativeCompilation, except for 
  43 #   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.








  44 SetupJdkLibrary = $(NamedParamsMacroTemplate)
  45 define SetupJdkLibraryBody
  46   ifeq ($$($1_OUTPUT_DIR), )
  47     $1_OUTPUT_DIR := $$(call FindLibDirForModule, $$(MODULE))
  48   endif
  49 
  50   ifeq ($$($1_OBJECT_DIR), )
  51     $1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/lib$$($1_NAME)
  52   endif
  53 














  54   ifeq ($$($1_VERSIONINFO_RESOURCE), )
  55     $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
  56   else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
  57     $1_VERSIONINFO_RESOURCE :=
  58   endif
  59 
  60   ifeq ($$($1_RC_FLAGS), )
  61     $1_RC_FLAGS :=  $(RC_FLAGS) \
  62         -D "JDK_FNAME=$$($1_NAME).dll" \
  63         -D "JDK_INTERNAL_NAME=$$($1_NAME)" \
  64         -D "JDK_FTYPE=0x2L"
  65   else ifeq ($$($1_RC_FLAGS), DISABLE)
  66     $1_RC_FLAGS :=
  67   endif
  68 


















  69   $1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
  70 
  71   # Since we reuse the rule name ($1), all our arguments will pass through.
  72   # We lose in transparency, but gain in brevity in this call...
  73   $$(eval $$(call SetupNativeCompilation, $1, ))
  74 endef
  75 
  76 # Setup make rules for creating a native executable with suitable defaults for
  77 # the OpenJDK project.
  78 #
  79 # Parameter 1 is the name of the rule. This name is used as variable prefix,
  80 # and the targets generated are listed in a variable by that name.
  81 #
  82 # Remaining parameters are named arguments. These are all passed on to
  83 # SetupNativeCompilation, except for 
  84 #   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
  85 SetupJdkExecutable = $(NamedParamsMacroTemplate)
  86 define SetupJdkExecutableBody
  87   $1_TYPE := EXECUTABLE
  88 




  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 ifndef _JDK_NATIVE_COMPILATION_GMK
  27 _JDK_NATIVE_COMPILATION_GMK := 1
  28 
  29 ifeq ($(_MAKEBASE_GMK), )
  30   $(error You must include MakeBase.gmk prior to including JdkNativeCompilation.gmk)
  31 endif
  32 
  33 include NativeCompilation.gmk
  34 
  35 # Hook to include the corresponding custom file, if present.
  36 $(eval $(call IncludeCustomExtension, common/JdkNativeCompilation.gmk))
  37 
  38 FindSrcDirsForLib += \
  39   $(call uniq, $(wildcard \
  40       $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
  41       $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
  42       $(TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
  43 
  44 FindSrcDirsForComponent += \
  45   $(call uniq, $(wildcard \
  46       $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/$(strip $2) \
  47       $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/$(strip $2) \
  48       $(TOPDIR)/src/$(strip $1)/share/native/$(strip $2)))
  49 
  50 GetJavaHeaderDir = \
  51   $(wildcard $(SUPPORT_OUTPUTDIR)/headers/$(strip $1))
  52 
  53 # Process a dir description such as "java.base:headers" into a set of proper absolute paths.
  54 ProcessDir = \
  55   $(if $(findstring :, $1), \
  56     $(call FindSrcDirsForComponent, $(firstword $(subst :, , $1)), $(lastword $(subst :, , $1))) \
  57   , \
  58     $(if $(filter /%, $1), \
  59       $1 \
  60     , \
  61       $(call FindSrcDirsForComponent, $(MODULE), $1) \
  62     ) \
  63   )
  64 
  65 # Setup make rules for creating a native shared library with suitable defaults
  66 # for the OpenJDK project.
  67 #
  68 # Parameter 1 is the name of the rule. This name is used as variable prefix,
  69 # and the targets generated are listed in a variable by that name.
  70 #
  71 # Remaining parameters are named arguments. These are all passed on to
  72 # SetupNativeCompilation, except for
  73 #   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
  74 #   EXTRA_HEADER_DIRS -- additional directories to look for headers in
  75 #   EXTRA_SRC -- additional directories to look for source in
  76 #   EXCLUDE_SRC_PATTERNS -- exclude source dirs matching these patterns from
  77 #     appearing in SRC.
  78 #   HEADERS_FROM_SRC -- if false, does not add source dirs automatically as
  79 #     header include dirs. (Defaults to true.)
  80 #   SRC -- this is passed on, but preprocessed to accept source dir designations
  81 #     such as "java.base:headers".
  82 SetupJdkLibrary = $(NamedParamsMacroTemplate)
  83 define SetupJdkLibraryBody
  84   ifeq ($$($1_OUTPUT_DIR), )
  85     $1_OUTPUT_DIR := $$(call FindLibDirForModule, $$(MODULE))
  86   endif
  87 
  88   ifeq ($$($1_OBJECT_DIR), )
  89     $1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/lib$$($1_NAME)
  90   endif
  91 
  92   ifeq ($$($1_SRC), )
  93     $1_SRC := $$(call FindSrcDirsForLib, $$(MODULE), $$($1_NAME))
  94   else
  95     $1_SRC := $$(foreach dir, $$($1_SRC), $$(call ProcessDir, $$(dir)))
  96   endif
  97   ifneq ($$($1_EXTRA_SRC), )
  98     $1_SRC += $$(foreach dir, $$($1_EXTRA_SRC), $$(call ProcessDir, $$(dir)))
  99   endif
 100 
 101   ifneq ($$($1_EXCLUDE_SRC_PATTERNS), )
 102     $1_EXCLUDE_SRC := $$(call containing, $$($1_EXCLUDE_SRC_PATTERNS), $$($1_SRC))
 103     $1_SRC := $$(filter-out $$($1_EXCLUDE_SRC), $$($1_SRC))
 104   endif
 105 
 106   ifeq ($$($1_VERSIONINFO_RESOURCE), )
 107     $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
 108   else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
 109     $1_VERSIONINFO_RESOURCE :=
 110   endif
 111 
 112   ifeq ($$($1_RC_FLAGS), )
 113     $1_RC_FLAGS :=  $(RC_FLAGS) \
 114         -D "JDK_FNAME=$$($1_NAME).dll" \
 115         -D "JDK_INTERNAL_NAME=$$($1_NAME)" \
 116         -D "JDK_FTYPE=0x2L"
 117   else ifeq ($$($1_RC_FLAGS), DISABLE)
 118     $1_RC_FLAGS :=
 119   endif
 120 
 121   ifneq ($$($1_HEADERS_FROM_SRC), false)
 122     $1_SRC_HEADER_FLAGS := $$(foreach dir, $$(wildcard $$($1_SRC) \
 123         $$(call GetJavaHeaderDir, $$(MODULE))), -I$$(dir))
 124   endif
 125   ifneq ($$($1_EXTRA_HEADER_DIRS), )
 126     $1_PROCESSED_EXTRA_HEADER_DIRS :=  $$(foreach dir, $$($1_EXTRA_HEADER_DIRS), $$(call ProcessDir, $$(dir)))
 127     $1_EXTRA_HEADER_FLAGS := $$(foreach dir, $$($1_PROCESSED_EXTRA_HEADER_DIRS), -I$$(dir))
 128   endif
 129 
 130   ifneq ($$($1_CFLAGS), )
 131     $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
 132   endif
 133   ifneq ($$($1_CXXFLAGS), )
 134     $1_CXXFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
 135   endif
 136   ifeq ($$($1_CFLAGS)$$($1_CXXFLAGS), )
 137     $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
 138   endif
 139   $1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
 140 
 141   # Since we reuse the rule name ($1), all our arguments will pass through.
 142   # We lose in transparency, but gain in brevity in this call...
 143   $$(eval $$(call SetupNativeCompilation, $1, ))
 144 endef
 145 
 146 # Setup make rules for creating a native executable with suitable defaults for
 147 # the OpenJDK project.
 148 #
 149 # Parameter 1 is the name of the rule. This name is used as variable prefix,
 150 # and the targets generated are listed in a variable by that name.
 151 #
 152 # Remaining parameters are named arguments. These are all passed on to
 153 # SetupNativeCompilation, except for
 154 #   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
 155 SetupJdkExecutable = $(NamedParamsMacroTemplate)
 156 define SetupJdkExecutableBody
 157   $1_TYPE := EXECUTABLE
 158 


< prev index next >