author | ihse |
Thu, 03 May 2018 14:30:20 +0200 | |
branch | ihse-jdk-library-branch |
changeset 56511 | 2b67c11c0db6 |
parent 56488 | a6cb200daa5d |
child 56517 | cb0f21f5f307 |
permissions | -rw-r--r-- |
49244 | 1 |
# |
2 |
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
# |
|
5 |
# This code is free software; you can redistribute it and/or modify it |
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
|
7 |
# published by the Free Software Foundation. Oracle designates this |
|
8 |
# particular file as subject to the "Classpath" exception as provided |
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
|
10 |
# |
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
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 |
||
56433
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
35 |
# Hook to include the corresponding custom file, if present. |
56456 | 36 |
$(eval $(call IncludeCustomExtension, common/JdkNativeCompilation.gmk)) |
56433
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
37 |
|
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
38 |
FindSrcDirsForLib += \ |
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
39 |
$(call uniq, $(wildcard \ |
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
40 |
$(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \ |
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
41 |
$(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \ |
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
42 |
$(TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2))) |
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
43 |
|
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
44 |
FindSrcDirsForComponent += \ |
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
45 |
$(call uniq, $(wildcard \ |
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
46 |
$(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/$(strip $2) \ |
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
47 |
$(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/$(strip $2) \ |
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
48 |
$(TOPDIR)/src/$(strip $1)/share/native/$(strip $2))) |
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
49 |
|
56454 | 50 |
FindHeaderDirForModule = \ |
51 |
$(wildcard $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)) |
|
52 |
||
49244 | 53 |
# Setup make rules for creating a native shared library with suitable defaults |
54 |
# for the OpenJDK project. |
|
55 |
# |
|
56 |
# Parameter 1 is the name of the rule. This name is used as variable prefix, |
|
57 |
# and the targets generated are listed in a variable by that name. |
|
58 |
# |
|
59 |
# Remaining parameters are named arguments. These are all passed on to |
|
56433
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
60 |
# SetupNativeCompilation, except for |
49244 | 61 |
# EXTRA_RC_FLAGS -- additional RC_FLAGS to append. |
56511 | 62 |
# EXTRA_HEADER_DIRS -- additional directories to look for headers in |
63 |
# EXTRA_SRC -- additional directories to look for source in |
|
49244 | 64 |
SetupJdkLibrary = $(NamedParamsMacroTemplate) |
65 |
define SetupJdkLibraryBody |
|
66 |
ifeq ($$($1_OUTPUT_DIR), ) |
|
67 |
$1_OUTPUT_DIR := $$(call FindLibDirForModule, $$(MODULE)) |
|
68 |
endif |
|
69 |
||
70 |
ifeq ($$($1_OBJECT_DIR), ) |
|
71 |
$1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/lib$$($1_NAME) |
|
72 |
endif |
|
73 |
||
56433
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
74 |
ifeq ($$($1_SRC), ) |
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
75 |
$1_SRC := $$(call FindSrcDirsForLib, $$(MODULE), $$($1_NAME)) |
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
76 |
endif |
56511 | 77 |
$1_PRE_SRC := $$($1_SRC) |
78 |
ifneq ($$($1_EXTRA_SRC), ) |
|
79 |
$1_SRC += $$($1_EXTRA_SRC) |
|
80 |
endif |
|
56433
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
81 |
|
49244 | 82 |
ifeq ($$($1_VERSIONINFO_RESOURCE), ) |
83 |
$1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE) |
|
84 |
else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE) |
|
85 |
$1_VERSIONINFO_RESOURCE := |
|
86 |
endif |
|
87 |
||
88 |
ifeq ($$($1_RC_FLAGS), ) |
|
89 |
$1_RC_FLAGS := $(RC_FLAGS) \ |
|
90 |
-D "JDK_FNAME=$$($1_NAME).dll" \ |
|
91 |
-D "JDK_INTERNAL_NAME=$$($1_NAME)" \ |
|
92 |
-D "JDK_FTYPE=0x2L" |
|
93 |
else ifeq ($$($1_RC_FLAGS), DISABLE) |
|
94 |
$1_RC_FLAGS := |
|
95 |
endif |
|
96 |
||
56433
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
97 |
ifneq ($$($1_HEADERS_FROM_SRC), false) |
56511 | 98 |
$1_SRC_HEADER_FLAGS := $$(foreach dir, $$(wildcard $$($1_SRC) $$($1_EXTRA_SRC) \ |
99 |
$$(call FindHeaderDirForModule, $$(MODULE))), -I$$(dir)) |
|
56433
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
100 |
endif |
56511 | 101 |
ifneq ($$($1_EXTRA_HEADER_DIRS), ) |
102 |
$1_EXTRA_HEADER_FLAGS := $$(foreach dir, $$($1_EXTRA_HEADER_DIRS), -I$$(dir)) |
|
103 |
endif |
|
104 |
||
56464 | 105 |
ifneq ($$($1_CFLAGS), ) |
56511 | 106 |
$1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS) |
56464 | 107 |
endif |
108 |
ifneq ($$($1_CXXFLAGS), ) |
|
56511 | 109 |
$1_CXXFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS) |
56464 | 110 |
endif |
111 |
ifeq ($$($1_CFLAGS)$$($1_CXXFLAGS), ) |
|
56511 | 112 |
$1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS) |
56464 | 113 |
endif |
49244 | 114 |
$1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS) |
115 |
||
116 |
# Since we reuse the rule name ($1), all our arguments will pass through. |
|
117 |
# We lose in transparency, but gain in brevity in this call... |
|
118 |
$$(eval $$(call SetupNativeCompilation, $1, )) |
|
119 |
endef |
|
120 |
||
121 |
# Setup make rules for creating a native executable with suitable defaults for |
|
122 |
# the OpenJDK project. |
|
123 |
# |
|
124 |
# Parameter 1 is the name of the rule. This name is used as variable prefix, |
|
125 |
# and the targets generated are listed in a variable by that name. |
|
126 |
# |
|
127 |
# Remaining parameters are named arguments. These are all passed on to |
|
56433
c3cf838aa2da
Initial fix for setting SRC automatically + HEADER_FLAGS.
ihse
parents:
56311
diff
changeset
|
128 |
# SetupNativeCompilation, except for |
49244 | 129 |
# EXTRA_RC_FLAGS -- additional RC_FLAGS to append. |
130 |
SetupJdkExecutable = $(NamedParamsMacroTemplate) |
|
131 |
define SetupJdkExecutableBody |
|
132 |
$1_TYPE := EXECUTABLE |
|
133 |
||
134 |
ifeq ($$($1_OUTPUT_DIR), ) |
|
135 |
$1_OUTPUT_DIR := $$(call FindExecutableDirForModule, $$(MODULE)) |
|
136 |
endif |
|
137 |
||
138 |
ifeq ($$($1_OBJECT_DIR), ) |
|
139 |
$1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/$$($1_NAME) |
|
140 |
endif |
|
141 |
||
142 |
ifeq ($$($1_VERSIONINFO_RESOURCE), ) |
|
143 |
$1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE) |
|
144 |
else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE) |
|
145 |
$1_VERSIONINFO_RESOURCE := |
|
146 |
endif |
|
147 |
||
148 |
ifeq ($$($1_RC_FLAGS), ) |
|
149 |
$1_RC_FLAGS := $(RC_FLAGS) \ |
|
150 |
-D "JDK_FNAME=$$($1_NAME).exe" \ |
|
151 |
-D "JDK_INTERNAL_NAME=$$($1_NAME)" \ |
|
152 |
-D "JDK_FTYPE=0x01L" |
|
153 |
else ifeq ($$($1_RC_FLAGS), DISABLE) |
|
154 |
$1_RC_FLAGS := |
|
155 |
endif |
|
156 |
||
157 |
$1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS) |
|
158 |
||
159 |
# Since we reuse the rule name ($1), all our arguments will pass through. |
|
160 |
# We lose in transparency, but gain in brevity in this call... |
|
161 |
$$(eval $$(call SetupNativeCompilation, $1)) |
|
162 |
endef |
|
163 |
||
164 |
endif # _JDK_NATIVE_COMPILATION_GMK |