56287
|
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 |
|
|
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 include:
|
|
42 |
# NAME The base name for the resulting binary, excluding decorations (like *.exe)
|
|
43 |
# TYPE Type of binary (EXECUTABLE, LIBRARY or STATIC_LIBRARY). Default is LIBRARY.
|
|
44 |
# SUFFIX Override the default suffix for the output file
|
|
45 |
# TOOLCHAIN Name of toolchain setup to use. Defaults to TOOLCHAIN_DEFAULT.
|
|
46 |
# SRC one or more directory roots to scan for C/C++ files.
|
|
47 |
# CFLAGS the compiler flags to be used, used both for C and C++.
|
|
48 |
# CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS.
|
|
49 |
# LDFLAGS the linker flags to be used, used both for C and C++.
|
|
50 |
# LIBS the libraries to link to
|
|
51 |
# ARFLAGS the archiver flags to be used
|
|
52 |
# OBJECT_DIR the directory where we store the object files
|
|
53 |
# OUTPUT_DIR the directory where the resulting binary is put
|
|
54 |
# INCLUDES only pick source from these directories
|
|
55 |
# EXCLUDES do not pick source from these directories
|
|
56 |
# INCLUDE_FILES only compile exactly these files!
|
|
57 |
# EXCLUDE_FILES with these names
|
|
58 |
# EXCLUDE_PATTERN exclude files matching any of these substrings
|
|
59 |
# EXTRA_FILES List of extra files not in any of the SRC dirs
|
|
60 |
# EXTRA_OBJECT_FILES List of extra object files to include when linking
|
|
61 |
# VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
|
|
62 |
# RC_FLAGS flags for RC.
|
|
63 |
# EMBED_MANIFEST if true, embed manifest on Windows.
|
|
64 |
# MAPFILE mapfile
|
|
65 |
# REORDER reorder file
|
|
66 |
# USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the
|
|
67 |
# mapfile for the output symbols file
|
|
68 |
# CC the compiler to use, default is $(CC)
|
|
69 |
# LD the linker to use, default is $(LD)
|
|
70 |
# OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, HIGHEST_JVM, SIZE
|
|
71 |
# DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain
|
|
72 |
# DISABLED_WARNINGS_C_<toolchain> Disable the given warnings for the specified toolchain
|
|
73 |
# when compiling C code
|
|
74 |
# DISABLED_WARNINGS_CXX_<toolchain> Disable the given warnings for the specified
|
|
75 |
# toolchain when compiling C++ code
|
|
76 |
# STRIP_SYMBOLS Set to false to override global strip policy and always leave
|
|
77 |
# symbols in the binary, if the toolchain allows for it
|
|
78 |
# DEBUG_SYMBOLS Set to false to disable generation of debug symbols
|
|
79 |
# COPY_DEBUG_SYMBOLS Set to false to override global setting of debug symbol copying
|
|
80 |
# ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol
|
|
81 |
# zipping
|
|
82 |
# STRIPFLAGS Optionally change the flags given to the strip command
|
|
83 |
# PRECOMPILED_HEADER Header file to use as precompiled header
|
|
84 |
# PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
|
|
85 |
SetupJdkLibrary = $(NamedParamsMacroTemplate)
|
|
86 |
define SetupJdkLibraryBody
|
|
87 |
ifeq ($$($1_OUTPUT_DIR), )
|
|
88 |
$1_OUTPUT_DIR := $$(call FindLibDirForModule, $$(MODULE))
|
|
89 |
endif
|
|
90 |
|
|
91 |
ifeq ($$($1_OBJECT_DIR), )
|
|
92 |
$1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/lib$$($1_NAME)
|
|
93 |
endif
|
|
94 |
|
|
95 |
ifeq ($$($1_VERSIONINFO_RESOURCE), )
|
|
96 |
$1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
|
|
97 |
else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
|
|
98 |
$1_VERSIONINFO_RESOURCE :=
|
|
99 |
endif
|
|
100 |
|
|
101 |
ifeq ($$($1_RC_FLAGS), )
|
|
102 |
$1_RC_FLAGS := $(RC_FLAGS) \
|
|
103 |
-D "JDK_FNAME=$$($1_NAME).dll" \
|
|
104 |
-D "JDK_INTERNAL_NAME=$$($1_NAME)" \
|
|
105 |
-D "JDK_FTYPE=0x2L"
|
|
106 |
else ifeq ($$($1_RC_FLAGS), DISABLE)
|
|
107 |
$1_RC_FLAGS :=
|
|
108 |
endif
|
|
109 |
|
56308
|
110 |
$1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
|
|
111 |
|
56287
|
112 |
# Since we reuse the rule name ($1), all our arguments will pass through.
|
|
113 |
# We lose in transparency, but gain in brevity in this call...
|
|
114 |
$$(eval $$(call SetupNativeCompilation, $1, ))
|
|
115 |
endef
|
|
116 |
|
|
117 |
# Setup make rules for creating a native executable with suitable defaults for
|
|
118 |
# the OpenJDK project.
|
|
119 |
#
|
|
120 |
# Parameter 1 is the name of the rule. This name is used as variable prefix,
|
|
121 |
# and the targets generated are listed in a variable by that name.
|
|
122 |
#
|
|
123 |
# Remaining parameters are named arguments. These include:
|
|
124 |
# NAME The base name for the resulting binary, excluding decorations (like *.exe)
|
|
125 |
# TYPE Type of binary (EXECUTABLE, LIBRARY or STATIC_LIBRARY). Default is LIBRARY.
|
|
126 |
# SUFFIX Override the default suffix for the output file
|
|
127 |
# TOOLCHAIN Name of toolchain setup to use. Defaults to TOOLCHAIN_DEFAULT.
|
|
128 |
# SRC one or more directory roots to scan for C/C++ files.
|
|
129 |
# CFLAGS the compiler flags to be used, used both for C and C++.
|
|
130 |
# CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS.
|
|
131 |
# LDFLAGS the linker flags to be used, used both for C and C++.
|
|
132 |
# LIBS the libraries to link to
|
|
133 |
# ARFLAGS the archiver flags to be used
|
|
134 |
# OBJECT_DIR the directory where we store the object files
|
|
135 |
# OUTPUT_DIR the directory where the resulting binary is put
|
|
136 |
# INCLUDES only pick source from these directories
|
|
137 |
# EXCLUDES do not pick source from these directories
|
|
138 |
# INCLUDE_FILES only compile exactly these files!
|
|
139 |
# EXCLUDE_FILES with these names
|
|
140 |
# EXCLUDE_PATTERN exclude files matching any of these substrings
|
|
141 |
# EXTRA_FILES List of extra files not in any of the SRC dirs
|
|
142 |
# EXTRA_OBJECT_FILES List of extra object files to include when linking
|
|
143 |
# VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
|
|
144 |
# RC_FLAGS flags for RC.
|
|
145 |
# EMBED_MANIFEST if true, embed manifest on Windows.
|
|
146 |
# MAPFILE mapfile
|
|
147 |
# REORDER reorder file
|
|
148 |
# USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the
|
|
149 |
# mapfile for the output symbols file
|
|
150 |
# CC the compiler to use, default is $(CC)
|
|
151 |
# LD the linker to use, default is $(LD)
|
|
152 |
# OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, HIGHEST_JVM, SIZE
|
|
153 |
# DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain
|
|
154 |
# DISABLED_WARNINGS_C_<toolchain> Disable the given warnings for the specified toolchain
|
|
155 |
# when compiling C code
|
|
156 |
# DISABLED_WARNINGS_CXX_<toolchain> Disable the given warnings for the specified
|
|
157 |
# toolchain when compiling C++ code
|
|
158 |
# STRIP_SYMBOLS Set to false to override global strip policy and always leave
|
|
159 |
# symbols in the binary, if the toolchain allows for it
|
|
160 |
# DEBUG_SYMBOLS Set to false to disable generation of debug symbols
|
|
161 |
# COPY_DEBUG_SYMBOLS Set to false to override global setting of debug symbol copying
|
|
162 |
# ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol
|
|
163 |
# zipping
|
|
164 |
# STRIPFLAGS Optionally change the flags given to the strip command
|
|
165 |
# PRECOMPILED_HEADER Header file to use as precompiled header
|
|
166 |
# PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
|
|
167 |
SetupJdkExecutable = $(NamedParamsMacroTemplate)
|
|
168 |
define SetupJdkExecutableBody
|
|
169 |
$1_TYPE := EXECUTABLE
|
|
170 |
|
|
171 |
ifeq ($$($1_OUTPUT_DIR), )
|
|
172 |
$1_OUTPUT_DIR := $$(call FindExecutableDirForModule, $$(MODULE))
|
|
173 |
endif
|
|
174 |
|
|
175 |
ifeq ($$($1_OBJECT_DIR), )
|
|
176 |
$1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/$$($1_NAME)
|
|
177 |
endif
|
|
178 |
|
|
179 |
ifeq ($$($1_VERSIONINFO_RESOURCE), )
|
|
180 |
$1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
|
|
181 |
else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
|
|
182 |
$1_VERSIONINFO_RESOURCE :=
|
|
183 |
endif
|
|
184 |
|
|
185 |
ifeq ($$($1_RC_FLAGS), )
|
|
186 |
$1_RC_FLAGS := $(RC_FLAGS) \
|
|
187 |
-D "JDK_FNAME=$$($1_NAME).exe" \
|
|
188 |
-D "JDK_INTERNAL_NAME=$$($1_NAME)" \
|
|
189 |
-D "JDK_FTYPE=0x01L"
|
|
190 |
else ifeq ($$($1_RC_FLAGS), DISABLE)
|
|
191 |
$1_RC_FLAGS :=
|
|
192 |
endif
|
|
193 |
|
56309
|
194 |
$1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
|
|
195 |
|
56287
|
196 |
# Since we reuse the rule name ($1), all our arguments will pass through.
|
|
197 |
# We lose in transparency, but gain in brevity in this call...
|
|
198 |
$$(eval $$(call SetupNativeCompilation, $1))
|
|
199 |
endef
|
|
200 |
|
|
201 |
endif # _JDK_NATIVE_COMPILATION_GMK
|