30 $(error You must include MakeBase.gmk prior to including JdkNativeCompilation.gmk) |
30 $(error You must include MakeBase.gmk prior to including JdkNativeCompilation.gmk) |
31 endif |
31 endif |
32 |
32 |
33 include NativeCompilation.gmk |
33 include NativeCompilation.gmk |
34 |
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 |
35 # Setup make rules for creating a native shared library with suitable defaults |
65 # Setup make rules for creating a native shared library with suitable defaults |
36 # for the OpenJDK project. |
66 # for the OpenJDK project. |
37 # |
67 # |
38 # Parameter 1 is the name of the rule. This name is used as variable prefix, |
68 # 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. |
69 # and the targets generated are listed in a variable by that name. |
40 # |
70 # |
41 # Remaining parameters are named arguments. These are all passed on to |
71 # Remaining parameters are named arguments. These are all passed on to |
42 # SetupNativeCompilation, except for |
72 # SetupNativeCompilation, except for |
43 # EXTRA_RC_FLAGS -- additional RC_FLAGS to append. |
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". |
44 SetupJdkLibrary = $(NamedParamsMacroTemplate) |
82 SetupJdkLibrary = $(NamedParamsMacroTemplate) |
45 define SetupJdkLibraryBody |
83 define SetupJdkLibraryBody |
46 ifeq ($$($1_OUTPUT_DIR), ) |
84 ifeq ($$($1_OUTPUT_DIR), ) |
47 $1_OUTPUT_DIR := $$(call FindLibDirForModule, $$(MODULE)) |
85 $1_OUTPUT_DIR := $$(call FindLibDirForModule, $$(MODULE)) |
48 endif |
86 endif |
49 |
87 |
50 ifeq ($$($1_OBJECT_DIR), ) |
88 ifeq ($$($1_OBJECT_DIR), ) |
51 $1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/lib$$($1_NAME) |
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)) |
52 endif |
104 endif |
53 |
105 |
54 ifeq ($$($1_VERSIONINFO_RESOURCE), ) |
106 ifeq ($$($1_VERSIONINFO_RESOURCE), ) |
55 $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE) |
107 $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE) |
56 else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE) |
108 else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE) |
64 -D "JDK_FTYPE=0x2L" |
116 -D "JDK_FTYPE=0x2L" |
65 else ifeq ($$($1_RC_FLAGS), DISABLE) |
117 else ifeq ($$($1_RC_FLAGS), DISABLE) |
66 $1_RC_FLAGS := |
118 $1_RC_FLAGS := |
67 endif |
119 endif |
68 |
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), \ |
|
127 $$(call ProcessDir, $$(dir))) |
|
128 $1_EXTRA_HEADER_FLAGS := $$(addprefix -I, $$($1_PROCESSED_EXTRA_HEADER_DIRS)) |
|
129 endif |
|
130 |
|
131 ifneq ($$($1_CFLAGS), ) |
|
132 $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS) |
|
133 endif |
|
134 ifneq ($$($1_CXXFLAGS), ) |
|
135 $1_CXXFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS) |
|
136 endif |
|
137 ifeq ($$($1_CFLAGS)$$($1_CXXFLAGS), ) |
|
138 $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS) |
|
139 endif |
69 $1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS) |
140 $1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS) |
70 |
141 |
71 # Since we reuse the rule name ($1), all our arguments will pass through. |
142 # 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... |
143 # We lose in transparency, but gain in brevity in this call... |
73 $$(eval $$(call SetupNativeCompilation, $1, )) |
144 $$(eval $$(call SetupNativeCompilation, $1, )) |