make/common/JdkNativeCompilation.gmk
author ihse
Thu, 15 Mar 2018 01:20:47 +0100
changeset 49244 995a5556edfa
child 50471 f0aeede1b855
child 56311 e05b4241302b
permissions -rw-r--r--
8199639: Introduce SetupJdkLibrary and SetupJdkExecutable Reviewed-by: erikj
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
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    35
# Setup make rules for creating a native shared library with suitable defaults
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    36
# for the OpenJDK project.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    37
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    38
# 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
    39
# and the targets generated are listed in a variable by that name.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    40
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    41
# Remaining parameters are named arguments. These are all passed on to
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    42
# SetupNativeCompilation, except for 
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    43
#   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    44
SetupJdkLibrary = $(NamedParamsMacroTemplate)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    45
define SetupJdkLibraryBody
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    46
  ifeq ($$($1_OUTPUT_DIR), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    47
    $1_OUTPUT_DIR := $$(call FindLibDirForModule, $$(MODULE))
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    48
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    49
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    50
  ifeq ($$($1_OBJECT_DIR), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    51
    $1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/lib$$($1_NAME)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    52
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    53
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    54
  ifeq ($$($1_VERSIONINFO_RESOURCE), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    55
    $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    56
  else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    57
    $1_VERSIONINFO_RESOURCE :=
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    58
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    59
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    60
  ifeq ($$($1_RC_FLAGS), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    61
    $1_RC_FLAGS :=  $(RC_FLAGS) \
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    62
        -D "JDK_FNAME=$$($1_NAME).dll" \
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    63
        -D "JDK_INTERNAL_NAME=$$($1_NAME)" \
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    64
        -D "JDK_FTYPE=0x2L"
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    65
  else ifeq ($$($1_RC_FLAGS), DISABLE)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    66
    $1_RC_FLAGS :=
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    67
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    68
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    69
  $1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    70
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    71
  # Since we reuse the rule name ($1), all our arguments will pass through.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    72
  # We lose in transparency, but gain in brevity in this call...
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    73
  $$(eval $$(call SetupNativeCompilation, $1, ))
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    74
endef
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    75
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    76
# Setup make rules for creating a native executable with suitable defaults for
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    77
# the OpenJDK project.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    78
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    79
# 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
    80
# and the targets generated are listed in a variable by that name.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    81
#
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    82
# Remaining parameters are named arguments. These are all passed on to
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    83
# SetupNativeCompilation, except for 
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    84
#   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    85
SetupJdkExecutable = $(NamedParamsMacroTemplate)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    86
define SetupJdkExecutableBody
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    87
  $1_TYPE := EXECUTABLE
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    88
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    89
  ifeq ($$($1_OUTPUT_DIR), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    90
    $1_OUTPUT_DIR := $$(call FindExecutableDirForModule, $$(MODULE))
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    91
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    92
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    93
  ifeq ($$($1_OBJECT_DIR), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    94
    $1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/$$($1_NAME)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    95
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    96
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    97
  ifeq ($$($1_VERSIONINFO_RESOURCE), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    98
    $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
    99
  else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   100
    $1_VERSIONINFO_RESOURCE :=
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   101
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   102
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   103
  ifeq ($$($1_RC_FLAGS), )
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   104
    $1_RC_FLAGS :=  $(RC_FLAGS) \
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   105
        -D "JDK_FNAME=$$($1_NAME).exe" \
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   106
        -D "JDK_INTERNAL_NAME=$$($1_NAME)" \
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   107
        -D "JDK_FTYPE=0x01L"
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   108
  else ifeq ($$($1_RC_FLAGS), DISABLE)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   109
    $1_RC_FLAGS :=
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   110
  endif
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   111
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   112
  $1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   113
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   114
  # Since we reuse the rule name ($1), all our arguments will pass through.
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   115
  # We lose in transparency, but gain in brevity in this call...
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   116
  $$(eval $$(call SetupNativeCompilation, $1))
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   117
endef
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   118
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
diff changeset
   119
endif # _JDK_NATIVE_COMPILATION_GMK