make/common/JdkNativeCompilation.gmk
author rriggs
Wed, 02 Oct 2019 13:57:03 -0400
changeset 58446 5c83830390ba
parent 55157 1cccaaf46c7b
child 58846 f9ac726ab347
permissions -rw-r--r--
8231663: Incorrect GPL header in some RMI/SQL package-info.java files Reviewed-by: bpb, iris, lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49244
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
     1
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
     2
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
     4
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    10
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    15
# accompanied this code).
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    16
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    20
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    23
# questions.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    24
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    25
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    26
ifndef _JDK_NATIVE_COMPILATION_GMK
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    27
_JDK_NATIVE_COMPILATION_GMK := 1
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    28
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    29
ifeq ($(_MAKEBASE_GMK), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    30
  $(error You must include MakeBase.gmk prior to including JdkNativeCompilation.gmk)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    31
endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    32
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    33
include NativeCompilation.gmk
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    34
50471
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    35
# Hook to include the corresponding custom file, if present.
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    36
$(eval $(call IncludeCustomExtension, common/JdkNativeCompilation.gmk))
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    37
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    38
FindSrcDirsForLib += \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    39
  $(call uniq, $(wildcard \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    40
      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    41
      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    42
      $(TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    43
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    44
FindSrcDirsForComponent += \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    45
  $(call uniq, $(wildcard \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    46
      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/$(strip $2) \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    47
      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/$(strip $2) \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    48
      $(TOPDIR)/src/$(strip $1)/share/native/$(strip $2)))
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    49
52022
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    50
# Find a library
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    51
# Param 1 - module name
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    52
# Param 2 - library name
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    53
# Param 3 - optional subdir for library
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    54
FindLib = \
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    55
    $(call FindLibDirForModule, \
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    56
        $(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX)
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    57
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    58
# Find a static library
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    59
# Param 1 - module name
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    60
# Param 2 - library name
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    61
# Param 3 - optional subdir for library
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    62
FindStaticLib = \
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    63
    $(addprefix $(SUPPORT_OUTPUTDIR)/native/, \
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    64
        $(strip $1)$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(STATIC_LIBRARY_SUFFIX))
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    65
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    66
# If only generating compile_commands.json, make these return empty to avoid
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    67
# declaring dependencies.
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    68
ifeq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    69
  FindLib =
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    70
  FindStaticLib =
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    71
endif
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 50847
diff changeset
    72
50471
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    73
GetJavaHeaderDir = \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    74
  $(wildcard $(SUPPORT_OUTPUTDIR)/headers/$(strip $1))
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    75
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    76
# Process a dir description such as "java.base:headers" into a set of proper absolute paths.
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    77
ProcessDir = \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    78
  $(if $(findstring :, $1), \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    79
    $(call FindSrcDirsForComponent, $(firstword $(subst :, , $1)), $(lastword $(subst :, , $1))) \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    80
  , \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    81
    $(if $(filter /%, $1), \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    82
      $1 \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    83
    , \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    84
      $(call FindSrcDirsForComponent, $(MODULE), $1) \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    85
    ) \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    86
  )
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    87
49244
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    88
# Setup make rules for creating a native shared library with suitable defaults
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    89
# for the OpenJDK project.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    90
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    91
# Parameter 1 is the name of the rule. This name is used as variable prefix,
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    92
# and the targets generated are listed in a variable by that name.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    93
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    94
# Remaining parameters are named arguments. These are all passed on to
50471
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    95
# SetupNativeCompilation, except for
49244
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    96
#   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
50471
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    97
#   EXTRA_HEADER_DIRS -- additional directories to look for headers in
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    98
#   EXTRA_SRC -- additional directories to look for source in
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
    99
#   EXCLUDE_SRC_PATTERNS -- exclude source dirs matching these patterns from
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   100
#     appearing in SRC.
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   101
#   HEADERS_FROM_SRC -- if false, does not add source dirs automatically as
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   102
#     header include dirs. (Defaults to true.)
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   103
#   SRC -- this is passed on, but preprocessed to accept source dir designations
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   104
#     such as "java.base:headers".
49244
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   105
SetupJdkLibrary = $(NamedParamsMacroTemplate)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   106
define SetupJdkLibraryBody
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   107
  ifeq ($$($1_OUTPUT_DIR), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   108
    $1_OUTPUT_DIR := $$(call FindLibDirForModule, $$(MODULE))
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   109
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   110
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   111
  ifeq ($$($1_OBJECT_DIR), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   112
    $1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/lib$$($1_NAME)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   113
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   114
50471
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   115
  ifeq ($$($1_SRC), )
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   116
    $1_SRC := $$(call FindSrcDirsForLib, $$(MODULE), $$($1_NAME))
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   117
  else
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   118
    $1_SRC := $$(foreach dir, $$($1_SRC), $$(call ProcessDir, $$(dir)))
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   119
  endif
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   120
  ifneq ($$($1_EXTRA_SRC), )
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   121
    $1_SRC += $$(foreach dir, $$($1_EXTRA_SRC), $$(call ProcessDir, $$(dir)))
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   122
  endif
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   123
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   124
  ifneq ($$($1_EXCLUDE_SRC_PATTERNS), )
55157
1cccaaf46c7b 8225140: Build fails if directory contains 'unix'
erikj
parents: 52022
diff changeset
   125
    $1_SRC_WITHOUT_WORKSPACE_ROOT := $$(patsubst $$(WORKSPACE_ROOT)/%, %, $$($1_SRC))
1cccaaf46c7b 8225140: Build fails if directory contains 'unix'
erikj
parents: 52022
diff changeset
   126
    $1_EXCLUDE_SRC := $$(addprefix %, $$(call containing, $$($1_EXCLUDE_SRC_PATTERNS), \
1cccaaf46c7b 8225140: Build fails if directory contains 'unix'
erikj
parents: 52022
diff changeset
   127
        $$($1_SRC_WITHOUT_WORKSPACE_ROOT)))
50471
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   128
    $1_SRC := $$(filter-out $$($1_EXCLUDE_SRC), $$($1_SRC))
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   129
  endif
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   130
49244
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   131
  ifeq ($$($1_VERSIONINFO_RESOURCE), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   132
    $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   133
  else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   134
    $1_VERSIONINFO_RESOURCE :=
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   135
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   136
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   137
  ifeq ($$($1_RC_FLAGS), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   138
    $1_RC_FLAGS :=  $(RC_FLAGS) \
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   139
        -D "JDK_FNAME=$$($1_NAME).dll" \
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   140
        -D "JDK_INTERNAL_NAME=$$($1_NAME)" \
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   141
        -D "JDK_FTYPE=0x2L"
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   142
  else ifeq ($$($1_RC_FLAGS), DISABLE)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   143
    $1_RC_FLAGS :=
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   144
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   145
50471
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   146
  ifneq ($$($1_HEADERS_FROM_SRC), false)
50847
b970fae53807 8205616: Build fails with system headers after 8204572
glaubitz
parents: 50471
diff changeset
   147
    $1_SRC_HEADER_FLAGS := $$(addprefix -I, $$(wildcard $$($1_SRC)))
50471
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   148
  endif
50847
b970fae53807 8205616: Build fails with system headers after 8204572
glaubitz
parents: 50471
diff changeset
   149
  # Always add the java header dir
b970fae53807 8205616: Build fails with system headers after 8204572
glaubitz
parents: 50471
diff changeset
   150
  $1_SRC_HEADER_FLAGS += $$(addprefix -I, $$(call GetJavaHeaderDir, $$(MODULE)))
b970fae53807 8205616: Build fails with system headers after 8204572
glaubitz
parents: 50471
diff changeset
   151
50471
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   152
  ifneq ($$($1_EXTRA_HEADER_DIRS), )
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   153
    $1_PROCESSED_EXTRA_HEADER_DIRS := $$(foreach dir, $$($1_EXTRA_HEADER_DIRS), \
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   154
        $$(call ProcessDir, $$(dir)))
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   155
    $1_EXTRA_HEADER_FLAGS := $$(addprefix -I, $$($1_PROCESSED_EXTRA_HEADER_DIRS))
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   156
  endif
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   157
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   158
  ifneq ($$($1_CFLAGS), )
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   159
    $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   160
  endif
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   161
  ifneq ($$($1_CXXFLAGS), )
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   162
    $1_CXXFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   163
  endif
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   164
  ifeq ($$($1_CFLAGS)$$($1_CXXFLAGS), )
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   165
    $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   166
  endif
49244
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   167
  $1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   168
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   169
  # Since we reuse the rule name ($1), all our arguments will pass through.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   170
  # We lose in transparency, but gain in brevity in this call...
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   171
  $$(eval $$(call SetupNativeCompilation, $1, ))
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   172
endef
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   173
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   174
# Setup make rules for creating a native executable with suitable defaults for
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   175
# the OpenJDK project.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   176
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   177
# Parameter 1 is the name of the rule. This name is used as variable prefix,
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   178
# and the targets generated are listed in a variable by that name.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   179
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   180
# Remaining parameters are named arguments. These are all passed on to
50471
f0aeede1b855 8204572: SetupJdkLibrary should setup SRC and -I flags automatically
ihse
parents: 49244
diff changeset
   181
# SetupNativeCompilation, except for
49244
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   182
#   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   183
SetupJdkExecutable = $(NamedParamsMacroTemplate)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   184
define SetupJdkExecutableBody
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   185
  $1_TYPE := EXECUTABLE
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   186
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   187
  ifeq ($$($1_OUTPUT_DIR), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   188
    $1_OUTPUT_DIR := $$(call FindExecutableDirForModule, $$(MODULE))
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   189
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   190
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   191
  ifeq ($$($1_OBJECT_DIR), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   192
    $1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/$$($1_NAME)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   193
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   194
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   195
  ifeq ($$($1_VERSIONINFO_RESOURCE), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   196
    $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   197
  else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   198
    $1_VERSIONINFO_RESOURCE :=
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   199
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   200
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   201
  ifeq ($$($1_RC_FLAGS), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   202
    $1_RC_FLAGS :=  $(RC_FLAGS) \
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   203
        -D "JDK_FNAME=$$($1_NAME).exe" \
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   204
        -D "JDK_INTERNAL_NAME=$$($1_NAME)" \
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   205
        -D "JDK_FTYPE=0x01L"
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   206
  else ifeq ($$($1_RC_FLAGS), DISABLE)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   207
    $1_RC_FLAGS :=
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   208
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   209
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   210
  $1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   211
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   212
  # Since we reuse the rule name ($1), all our arguments will pass through.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   213
  # We lose in transparency, but gain in brevity in this call...
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   214
  $$(eval $$(call SetupNativeCompilation, $1))
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   215
endef
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   216
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   217
endif # _JDK_NATIVE_COMPILATION_GMK