jdk

Форк
0
/
JdkNativeCompilation.gmk 
486 строк · 18.3 Кб
1
#
2
# Copyright (c) 2018, 2024, 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
# Hook to include the corresponding custom file, if present.
36
$(eval $(call IncludeCustomExtension, common/JdkNativeCompilation.gmk))
37

38
FindSrcDirsForComponent += \
39
  $(call uniq, $(wildcard \
40
      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/$(strip $2) \
41
      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/$(strip $2) \
42
      $(TOPDIR)/src/$(strip $1)/share/native/$(strip $2)))
43

44
# Find a library. Used for declaring dependencies on libraries in different
45
# modules.
46
# Param 1 - module name
47
# Param 2 - library name
48
# Param 3 - optional subdir for library
49
FindLib = \
50
    $(call FindLibDirForModule, \
51
        $(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX)
52

53
# Find a static library
54
# Param 1 - module name
55
# Param 2 - library name
56
# Param 3 - optional subdir for library
57
FindStaticLib = \
58
    $(addprefix $(SUPPORT_OUTPUTDIR)/native/, \
59
        $(strip $1)$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(STATIC_LIBRARY_SUFFIX))
60

61
# If only generating compile_commands.json, make these return empty to avoid
62
# declaring dependencies.
63
ifeq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
64
  FindLib =
65
  FindStaticLib =
66
endif
67
# If building static versions of libraries, make these return empty to avoid
68
# declaring dependencies.
69
ifeq ($(STATIC_LIBS), true)
70
  FindLib =
71
  FindStaticLib =
72
endif
73

74
# Returns the module specific java header dir if it exists.
75
# Param 1 - module name
76
GetJavaHeaderDir = \
77
  $(if $(strip $1),$(wildcard $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)))
78

79
HOTSPOT_INCLUDE_DIR := $(TOPDIR)/src/hotspot/share/include \
80
    $(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include
81

82
# Preprocess a source dir destination. Pass on absolute paths unchanged. Expand
83
# description such as "java.base:headers" into a set of proper absolute paths,
84
# by looking in $MODULE/[shared|$OS|$OSTYPE]/native.
85
# Treat *:libjvm as a special case, and replace it with the proper hotspot
86
# include directories.
87
ProcessSrcDir = \
88
  $(if $(findstring :, $1), \
89
    $(if $(filter %:libjvm, $1), \
90
      $(HOTSPOT_INCLUDE_DIR) \
91
    , \
92
      $(call FindSrcDirsForComponent, $(firstword $(subst :, , $1)), \
93
          $(lastword $(subst :, , $1))) \
94
    ) \
95
  , \
96
    $(if $(filter /%, $1), \
97
      $1 \
98
    , \
99
      $(if $(filter libjvm, $1), \
100
        $(HOTSPOT_INCLUDE_DIR) \
101
      , \
102
        $(call FindSrcDirsForComponent, $(MODULE), $1) \
103
      ) \
104
    ) \
105
  )
106

107
# Create a proper LIBPATH for the given library. Sets result in $1_$2_LIBPATH.
108
# $1: The name of the rule (namespace)
109
# $2: The safe namespace of the library
110
define ResolveLibPath
111
  # Determine proper LIBPATH. This is quite messy due to historical reasons,
112
  # and because we need to have special treatment for "gtest:" and ":jvm".
113
  ifneq ($$($1_$2_MODULE), gtest)
114
    ifneq ($$($1_$2_NAME), jvm)
115
      # This is the common case
116
      ifeq ($$(call isTargetOs, windows), true)
117
        $1_$2_LIBPATH := $$(SUPPORT_OUTPUTDIR)/native/$$($1_$2_MODULE)/lib$$($1_$2_NAME)
118
      else
119
        ifeq ($(STATIC_LIBS), true)
120
          $1_$2_LIBPATH := $$(SUPPORT_OUTPUTDIR)/native/$$($1_$2_MODULE)/lib$$($1_$2_NAME)/static
121
        else ifeq ($$($1_$2_STATIC_LIBRARY), true)
122
          $1_$2_LIBPATH := $$(SUPPORT_OUTPUTDIR)/native/$$($1_$2_MODULE)
123
        else
124
          $1_$2_LIBPATH := $$(SUPPORT_OUTPUTDIR)/modules_libs/$$($1_$2_MODULE)
125
        endif
126
      endif
127
    else
128
      # Special treatment for hotspot
129
      ifeq ($(CREATING_BUILDJDK), true)
130
        # When building a buildjdk, it's always only the server variant
131
        $1_$2_JVM_VARIANT_PATH := server
132
      else
133
        $1_$2_JVM_VARIANT_PATH := $(JVM_VARIANT_MAIN)
134
      endif
135
      ifeq ($$(call isTargetOs, windows), true)
136
        ifeq ($(STATIC_LIBS), true)
137
          $1_$2_LIBPATH := $$(HOTSPOT_OUTPUTDIR)/variant-$$($1_$2_JVM_VARIANT_PATH)/libjvm/objs/static
138
        else
139
          $1_$2_LIBPATH := $$(SUPPORT_OUTPUTDIR)/modules_libs/$$($1_$2_MODULE)
140
        endif
141
      else
142
        ifeq ($(STATIC_LIBS), true)
143
          $1_$2_LIBPATH := $$(HOTSPOT_OUTPUTDIR)/variant-$$($1_$2_JVM_VARIANT_PATH)/libjvm/objs/static
144
        else
145
          $1_$2_LIBPATH := $$(SUPPORT_OUTPUTDIR)/modules_libs/$$($1_$2_MODULE)/$$($1_$2_JVM_VARIANT_PATH)
146
        endif
147
      endif
148
    endif
149
  else
150
    # Special treatment for virtual module "gtest"
151
    ifeq ($$($1_$2_NAME), jvm)
152
      ifeq ($$(call isTargetOs, windows), true)
153
        ifeq ($(STATIC_LIBS), true)
154
          $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/gtest/objs/static
155
        else
156
          $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/gtest/objs
157
        endif
158
      else
159
        ifeq ($(STATIC_LIBS), true)
160
          $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/gtest/objs/static
161
        else
162
          $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/gtest
163
        endif
164
      endif
165
    else ifeq ($$($1_$2_NAME), gtest)
166
      $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/libgtest
167
      ifeq ($(STATIC_LIBS), true)
168
        $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/libgtest/objs/static
169
      else
170
        $1_$2_LIBPATH := $$(JVM_OUTPUTDIR)/libgtest
171
      endif
172
    endif
173
  endif
174
endef
175

176
# Process a JDK library designation such as "java.desktop:jawt" into the needed
177
# additions to EXTRA_LINK_DEPS, LDFLAGS, LIBS and EXTRA_HEADER_DIRS.
178
# $1: The name of the rule (namespace)
179
# $2: The safe namespace of the library
180
# $3: The actual string given to represent the library
181
define AddJdkLibrary
182
  $1_$2_NAME := $$(strip $$(lastword $$(subst :, , $3)))
183
  $1_$2_MODULE := $$(strip $$(patsubst %$$($1_$2_NAME), %, $3))
184

185
  ifeq ($$(filter lib%, $$($1_$2_NAME)),)
186
    $$(error Library name $$($1_$2_NAME) missing lib prefix in $1)
187
  endif
188
  $1_$2_NAME := $$(strip $$(patsubst lib%, %, $$($1_$2_NAME)))
189

190
  ifeq ($$($1_$2_MODULE),)
191
    $1_$2_MODULE := $$(MODULE)
192
  else
193
    $1_$2_MODULE := $$(strip $$(patsubst %:, %, $$($1_$2_MODULE)))
194
  endif
195

196
  # Determine if the library in question is static.
197
  # Ideally, we should not hardcode these
198
  ifeq ($(call isTargetOs, aix)+$$($1_$2_MODULE):$$($1_$2_NAME), true+java.base:jli)
199
     $1_$2_STATIC_LIBRARY := true
200
  endif
201
  ifeq ($$($1_$2_MODULE):$$($1_$2_NAME), gtest:gtest)
202
     $1_$2_STATIC_LIBRARY := true
203
  endif
204

205
  # Setup $1_$2_LIBPATH.
206
  $$(eval $$(call ResolveLibPath,$1,$2))
207

208
  $1_EXTRA_HEADER_DIRS += $$($1_$2_MODULE):lib$$($1_$2_NAME)
209

210
  ifneq ($(STATIC_LIBS), true)
211
    ifeq ($$(call isTargetOs, windows), true)
212
      ifeq ($$(filter -libpath:$$($1_$2_LIBPATH), $$($1_LDFLAGS)), )
213
        $1_LDFLAGS += -libpath:$$($1_$2_LIBPATH)
214
      endif
215
      $1_LIBS += $$($1_$2_NAME)$(STATIC_LIBRARY_SUFFIX)
216
      $1_$2_LIBFILE := $(LIBRARY_PREFIX)$$($1_$2_NAME)$(STATIC_LIBRARY_SUFFIX)
217
    else
218
      ifeq ($$(filter -L$$($1_$2_LIBPATH), $$($1_LDFLAGS)), )
219
        $1_LDFLAGS += -L$$($1_$2_LIBPATH)
220
      endif
221
      $1_LIBS += -l$$($1_$2_NAME)
222
      ifeq ($$($1_$2_STATIC_LIBRARY), true)
223
        $1_$2_LIBFILE := $(LIBRARY_PREFIX)$$($1_$2_NAME)$(STATIC_LIBRARY_SUFFIX)
224
      else
225
        $1_$2_LIBFILE := $(LIBRARY_PREFIX)$$($1_$2_NAME)$(SHARED_LIBRARY_SUFFIX)
226
      endif
227
    endif
228

229
    $1_EXTRA_LINK_DEPS += $$($1_$2_LIBPATH)/$$($1_$2_LIBFILE)
230
  endif
231
endef
232

233
GLOBAL_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/common/version.rc
234

235
JDK_RCFLAGS=$(RCFLAGS) \
236
    -D"JDK_VERSION_STRING=$(VERSION_STRING)" \
237
    -D"JDK_COMPANY=$(JDK_RC_COMPANY_NAME)" \
238
    -D"JDK_VER=$(VERSION_NUMBER_FOUR_POSITIONS)" \
239
    -D"JDK_COPYRIGHT=Copyright \xA9 $(COPYRIGHT_YEAR)" \
240
    -D"JDK_NAME=$(JDK_RC_NAME) $(VERSION_SHORT)" \
241
    -D"JDK_FVER=$(subst .,$(COMMA),$(VERSION_NUMBER_FOUR_POSITIONS))"
242

243
# Setup make rules for creating a native binary with suitable defaults
244
# for the OpenJDK project. This macro is mostly considered to be an internal
245
# support version. Please use SetupJdkLibrary or SetupJdkExecutable instead.
246
#
247
# Parameter 1 is the name of the rule. This name is used as variable prefix,
248
# and the targets generated are listed in a variable by that name.
249
#
250
# Remaining parameters are named arguments. These are all passed on to
251
# SetupNativeCompilation. This macro also adds the following additional
252
# arguments:
253
#
254
#   SRC -- this is passed on after preprocessing. The preprocessing will pass on
255
#     absolute paths unchanged, but relative paths will be expanded to include
256
#     all directories with this name in $MODULE/[shared|$OS|$OSTYPE]/native.
257
#   EXTRA_SRC -- additional directories to look for source in. This is processed
258
#     like SRC.
259
#   EXCLUDE_SRC_PATTERNS -- exclude source dirs matching these patterns from
260
#     appearing in SRC.
261
#   EXTRA_HEADER_DIRS -- additional directories to look for headers in. This can
262
#     be specified either as an absolute path, or relative directory names which
263
#     are preprocessed like SRC, or in the format <module>:<directory>, which
264
#     will be processed like SRC but for the given module. The names
265
#     "java.base:libjvm" and "gtest:libjvm" symbolise virtual libraries that
266
#     will be replaced with proper values for hotspot.
267
#   HEADERS_FROM_SRC -- if false, does not add source dirs automatically as
268
#     header include dirs. (Defaults to true.)
269
#   JDK_LIBS -- libraries generated by the JDK build system to link against.
270
#     These take the form <module>:<basename>. For the current module, the
271
#     module name and colon can be omitted. The basename should be specified
272
#     as the source directory, e.g. "libjava". The gtest module is a virtual
273
#     module that will be replaced with correct values for gtest. When
274
#     specifying JDK_LIBS, suitable values for EXTRA_LINK_DEPS, LDFLAGS, LIBS
275
#     and EXTRA_HEADER_DIRS will be added.
276
#   JDK_LIBS_<os> or JDK_LIBS_<osType> -- additional JDK_LIBS for the given OS
277
#     or OS type only
278
#   EXTRA_RCFLAGS -- additional RCFLAGS to append.
279
#   RC_FILEDESC -- override the default FILEDESC for Windows version.rc
280
#   DEFAULT_LIBCXX -- if false, do not add LIBCXX to LIBS for C++ compilations
281
#   DEFAULT_CFLAGS -- if false, do not add default CFLAGS and CXXFLAGS
282
#   DEFAULT_LDFLAGS -- if false, do not add default LDFLAGS
283
#   CFLAGS_FILTER_OUT -- flags to filter out from default CFLAGS
284
#   CXXFLAGS_FILTER_OUT -- flags to filter out from default CXXFLAGS
285
#   LDFLAGS_FILTER_OUT -- flags to filter out from default LDFLAGS
286
#   LD_SET_ORIGIN -- if false, do not add SET_*_ORIGIN flags to LDFLAGS
287
#   APPEND_LDFLAGS -- a quirk to have additional LDFLAGS that will be set after
288
#     the origin flags
289
#   DEFAULT_VERSIONINFO_RESOURCE -- if false, do not set the default
290
#     VERSIONINFO_RESOURCE
291
#
292
SetupJdkNativeCompilation = $(NamedParamsMacroTemplate)
293
define SetupJdkNativeCompilationBody
294
  ifeq ($$($1_TYPE), EXECUTABLE)
295
    $1_NATIVE_DIR_PREFIX :=
296
    $1_MODULES_PATH := modules_cmds
297
    $1_RC_EXT := exe
298
    $1_RC_FTYPE := 0x1L
299
  else
300
    $1_NATIVE_DIR_PREFIX := lib
301
    $1_MODULES_PATH := modules_libs
302
    $1_RC_EXT := dll
303
    $1_RC_FTYPE := 0x2L
304
  endif
305

306
  ifeq ($$($1_OUTPUT_DIR), )
307
    ifneq ($$(MODULE), )
308
      ifeq ($$($1_TYPE), STATIC_LIBRARY)
309
        $1_OUTPUT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)
310
      else
311
        $1_OUTPUT_DIR := $$(SUPPORT_OUTPUTDIR)/$$($1_MODULES_PATH)/$$(strip $$(MODULE))
312
      endif
313
    else
314
      $$(error Must specify OUTPUT_DIR in a MODULE free context)
315
    endif
316
  endif
317

318
  ifeq ($$($1_OBJECT_DIR), )
319
    ifneq ($$(MODULE), )
320
      $1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/$$($1_NATIVE_DIR_PREFIX)$$($1_NAME)
321
    else
322
      $$(error Must specify OBJECT_DIR in a MODULE free context)
323
    endif
324
  endif
325

326
  ifneq ($$($1_DEFAULT_LIBCXX), false)
327
    ifeq ($$($1_LINK_TYPE), C++)
328
      $1_LIBS += $(LIBCXX)
329
    endif
330
  endif
331

332
  ifeq ($$($1_SRC), )
333
    ifneq ($$(MODULE), )
334
      $1_SRC := $$(call FindSrcDirsForComponent, $$(MODULE), $$($1_NATIVE_DIR_PREFIX)$$($1_NAME))
335
    else
336
      ifeq ($$($1_EXTRA_FILES), )
337
        $$(error Must specify SRC or EXTRA_FILES in a MODULE free context)
338
      endif
339
    endif
340
  else
341
    $1_SRC := $$(foreach dir, $$($1_SRC), $$(call ProcessSrcDir, $$(dir)))
342
  endif
343
  ifneq ($$($1_EXTRA_SRC), )
344
    $1_SRC += $$(foreach dir, $$($1_EXTRA_SRC), $$(call ProcessSrcDir, $$(dir)))
345
  endif
346

347
  ifneq ($$($1_EXCLUDE_SRC_PATTERNS), )
348
    $1_SRC_WITHOUT_WORKSPACE_ROOT := $$(patsubst $$(WORKSPACE_ROOT)/%, %, $$($1_SRC))
349
    $1_EXCLUDE_SRC := $$(addprefix %, $$(call containing, $$($1_EXCLUDE_SRC_PATTERNS), \
350
        $$($1_SRC_WITHOUT_WORKSPACE_ROOT)))
351
    $1_SRC := $$(filter-out $$($1_EXCLUDE_SRC), $$($1_SRC))
352
  endif
353

354
  ifneq ($$($1_DEFAULT_VERSIONINFO_RESOURCE), false)
355
    ifeq ($$($1_VERSIONINFO_RESOURCE), )
356
      $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
357
    endif
358
  endif
359

360
  ifeq ($$($1_RC_FILEDESC), )
361
    $1_RC_FILEDESC := $(JDK_RC_NAME) binary
362
  endif
363
  $1_RCFLAGS := $(JDK_RCFLAGS) \
364
      -D"JDK_FILEDESC=$$($1_RC_FILEDESC)" \
365
      -D"JDK_FNAME=$$($1_NAME).$$($1_RC_EXT)" \
366
      -D"JDK_INTERNAL_NAME=$$($1_NAME)" \
367
      -D"JDK_FTYPE=$$($1_RC_FTYPE)" \
368
      -I$(TOPDIR)/src/java.base/windows/native/common \
369
      $$($1_EXTRA_RCFLAGS)
370

371
  ifneq ($$($1_HEADERS_FROM_SRC), false)
372
    $1_SRC_HEADER_FLAGS := $$(addprefix -I, $$(wildcard $$($1_SRC)))
373
  endif
374

375
  # Add the module specific java header dir
376
  ifneq ($$(MODULE), )
377
    $1_SRC_HEADER_FLAGS += $$(addprefix -I, $$(call GetJavaHeaderDir, $$(MODULE)))
378
  endif
379

380
  $1_JDK_LIBS += $$($1_JDK_LIBS_$$(OPENJDK_TARGET_OS))
381
  $1_JDK_LIBS += $$($1_JDK_LIBS_$$(OPENJDK_TARGET_OS_TYPE))
382
  $$(foreach lib, $$($1_JDK_LIBS), \
383
    $$(eval $$(call AddJdkLibrary,$1,$$(subst :,_,$$(lib)),$$(lib))) \
384
  )
385

386
  # Add the include path for jni.h to all native compilations
387
  $1_EXTRA_HEADER_DIRS += \
388
      $(SUPPORT_OUTPUTDIR)/modules_include/java.base \
389
      java.base:include \
390
      #
391

392
  $1_PROCESSED_EXTRA_HEADER_DIRS := $$(foreach dir, $$($1_EXTRA_HEADER_DIRS), \
393
      $$(call ProcessSrcDir, $$(dir)))
394
  $1_EXTRA_HEADER_FLAGS := $$(addprefix -I, $$($1_PROCESSED_EXTRA_HEADER_DIRS))
395

396
  ifneq ($$($1_DEFAULT_CFLAGS), false)
397
    ifeq ($$($1_TYPE), EXECUTABLE)
398
      # Set the default flags first to be able to override
399
      $1_CFLAGS := $$(filter-out $$($1_CFLAGS_FILTER_OUT), $$(CFLAGS_JDKEXE)) $$($1_CFLAGS)
400

401
      # Set the default flags first to be able to override
402
      $1_CXXFLAGS := $$(filter-out $$($1_CXXFLAGS_FILTER_OUT), $$(CXXFLAGS_JDKEXE)) $$($1_CXXFLAGS)
403
    else
404
      # Set the default flags first to be able to override
405
      $1_CFLAGS := $$(filter-out $$($1_CFLAGS_FILTER_OUT), $$(CFLAGS_JDKLIB)) $$($1_CFLAGS)
406

407
      # Set the default flags first to be able to override
408
      $1_CXXFLAGS := $$(filter-out $$($1_CXXFLAGS_FILTER_OUT), $$(CXXFLAGS_JDKLIB)) $$($1_CXXFLAGS)
409
    endif
410
  endif
411

412
  ifneq ($$($1_CFLAGS), )
413
    $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
414
  endif
415
  ifneq ($$($1_CXXFLAGS), )
416
    $1_CXXFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
417
  endif
418
  ifeq ($$($1_CFLAGS)$$($1_CXXFLAGS), )
419
    $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
420
  endif
421

422
  ifneq ($$($1_DEFAULT_LDFLAGS), false)
423
    ifeq ($$($1_TYPE), EXECUTABLE)
424
      # Set the default flags first to be able to override
425
      $1_LDFLAGS := $$(filter-out $$($1_LDFLAGS_FILTER_OUT), $$(LDFLAGS_JDKEXE)) $$($1_LDFLAGS)
426
    else
427
      # Set the default flags first to be able to override
428
      $1_LDFLAGS := $$(filter-out $$($1_LDFLAGS_FILTER_OUT), $$(LDFLAGS_JDKLIB)) $$($1_LDFLAGS)
429
    endif
430
  endif
431

432
  ifneq ($$($1_LD_SET_ORIGIN), false)
433
    ifeq ($$($1_TYPE), EXECUTABLE)
434
      $1_LDFLAGS += $$(call SET_EXECUTABLE_ORIGIN)
435
    else
436
      $1_LDFLAGS += $$(call SET_SHARED_LIBRARY_ORIGIN)
437
    endif
438
  endif
439
  # APPEND_LDFLAGS, if it exists, must be set after the origin flags
440
  # This is a workaround to keep existing behavior
441
  $1_LDFLAGS += $$($1_APPEND_LDFLAGS)
442

443
  # Since we reuse the rule name ($1), all our arguments will pass through.
444
  # We lose in transparency, but gain in brevity in this call...
445
  $$(eval $$(call SetupNativeCompilation, $1))
446
endef
447

448
# Setup make rules for creating a native library with suitable defaults
449
# for the OpenJDK project. The default is to create a shared library,
450
# but by passing TYPE := STATIC_LIBARY, a static library can be created.
451
#
452
# Parameter 1 is the name of the rule. This name is used as variable prefix,
453
# and the targets generated are listed in a variable by that name.
454
#
455
# Remaining parameters are named arguments. These are all passed on to
456
# SetupJdkNativeCompilation. Please see that macro for details.
457
SetupJdkLibrary = $(NamedParamsMacroTemplate)
458
define SetupJdkLibraryBody
459
  # If type is unspecified, default to LIBRARY
460
  ifeq ($$($1_TYPE), )
461
    $1_TYPE := LIBRARY
462
  endif
463

464
  # Since we reuse the rule name ($1), all our arguments will pass through.
465
  # We lose in transparency, but gain in brevity in this call...
466
  $$(eval $$(call SetupJdkNativeCompilation, $1))
467
endef
468

469
# Setup make rules for creating a native executable with suitable defaults
470
# for the OpenJDK project.
471
#
472
# Parameter 1 is the name of the rule. This name is used as variable prefix,
473
# and the targets generated are listed in a variable by that name.
474
#
475
# Remaining parameters are named arguments. These are all passed on to
476
# SetupJdkNativeCompilation. Please see that macro for details.
477
SetupJdkExecutable = $(NamedParamsMacroTemplate)
478
define SetupJdkExecutableBody
479
  $1_TYPE := EXECUTABLE
480

481
  # Since we reuse the rule name ($1), all our arguments will pass through.
482
  # We lose in transparency, but gain in brevity in this call...
483
  $$(eval $$(call SetupJdkNativeCompilation, $1))
484
endef
485

486
endif # _JDK_NATIVE_COMPILATION_GMK
487

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.