make/launcher/LauncherCommon.gmk
author joehw
Wed, 13 Jun 2018 12:50:45 -0700
changeset 50552 7439ceaae8e4
parent 50126 98f57dff16f3
child 51783 4482acfef2a5
child 56687 f0d5c39dfbc1
child 56721 01b558efd286
child 56723 d927981eeb64
permissions -rw-r--r--
8201276: (fs) Add methods to Files for reading/writing a string from/to a file Reviewed-by: rriggs, smarks, sherman, forax, alanb, mli
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
     1
#
49070
d7859531621b 8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents: 47217
diff changeset
     2
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
     4
#
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    10
#
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    15
# accompanied this code).
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    16
#
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    20
#
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    23
# questions.
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    24
#
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    25
49244
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents: 49241
diff changeset
    26
include JdkNativeCompilation.gmk
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    27
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    28
ifeq ($(OPENJDK_TARGET_OS), macosx)
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    29
  ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN)
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    30
else
35781
88c56fe09cb8 8149647: Incremental enhancements from build-infra
ihse
parents: 35276
diff changeset
    31
  ifeq ($(OPENJDK_TARGET_OS), windows)
88c56fe09cb8 8149647: Incremental enhancements from build-infra
ihse
parents: 35276
diff changeset
    32
  endif
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 36511
diff changeset
    33
  ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,/../lib/jli)
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    34
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    35
  # Applications expect to be able to link against libjawt without invoking
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    36
  # System.loadLibrary("jawt") first. This was the behaviour described in the
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    37
  # devloper documentation of JAWT and what worked with OpenJDK6.
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    38
  ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 36511
diff changeset
    39
    ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,/../lib)
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    40
  endif
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    41
endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    42
49534
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    43
# Tell the compiler not to export any functions unless declared so in
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    44
# the source code. On Windows, this is the default and cannot be changed.
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    45
# On Mac, we have always exported all symbols, probably due to oversight
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    46
# and/or misunderstanding. To emulate this, don't hide any symbols
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    47
# by default.
50126
98f57dff16f3 8202322: AIX: symbol visibility flags not support on xlc 12.1
mbaesken
parents: 49534
diff changeset
    48
# On AIX/xlc we need at least xlc 13.1 for the symbol hiding
49534
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    49
# Also provide an override for non-conformant libraries.
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    50
ifeq ($(TOOLCHAIN_TYPE), gcc)
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    51
  LAUNCHER_CFLAGS += -fvisibility=hidden
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    52
  LDFLAGS_JDKEXE += -Wl,--exclude-libs,ALL
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    53
else ifeq ($(TOOLCHAIN_TYPE), clang)
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    54
  ifneq ($(OPENJDK_TARGET_OS), macosx)
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    55
    LAUNCHER_CFLAGS += -fvisibility=hidden
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    56
  endif
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    57
else ifeq ($(TOOLCHAIN_TYPE), solstudio)
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    58
  LAUNCHER_CFLAGS += -xldscope=hidden
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    59
else ifeq ($(TOOLCHAIN_TYPE), xlc)
50126
98f57dff16f3 8202322: AIX: symbol visibility flags not support on xlc 12.1
mbaesken
parents: 49534
diff changeset
    60
  ifneq ($(CC_VERSION_NUMBER), 12.1)
98f57dff16f3 8202322: AIX: symbol visibility flags not support on xlc 12.1
mbaesken
parents: 49534
diff changeset
    61
    CXXFLAGS_JDKEXE += -qvisibility=hidden
98f57dff16f3 8202322: AIX: symbol visibility flags not support on xlc 12.1
mbaesken
parents: 49534
diff changeset
    62
  endif
49534
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    63
endif
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    64
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    65
LAUNCHER_SRC := $(TOPDIR)/src/java.base/share/native/launcher
49534
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    66
LAUNCHER_CFLAGS += -I$(TOPDIR)/src/java.base/share/native/launcher \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    67
    -I$(TOPDIR)/src/java.base/share/native/libjli \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    68
    -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    69
    -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    70
    #
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    71
GLOBAL_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/common/version.rc
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    72
JAVA_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/launcher/java.rc
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    73
MACOSX_PLIST_DIR := $(TOPDIR)/src/java.base/macosx/native/launcher
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    74
JAVA_MANIFEST := $(TOPDIR)/src/java.base/windows/native/launcher/java.manifest
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    75
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    76
################################################################################
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    77
# Build standard launcher.
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    78
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    79
# Setup make rules for building a standard launcher.
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    80
#
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    81
# Parameter 1 is the name of the rule. This name is used as variable prefix,
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    82
# and the targets generated are listed in a variable by that name. It is also
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    83
# used as the name of the executable.
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    84
#
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    85
# Remaining parameters are named arguments. These include:
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 35781
diff changeset
    86
# MAIN_MODULE  The module of the main class to launch if different from the
9d0388c6b336 8142968: Module System implementation
alanb
parents: 35781
diff changeset
    87
#     current module
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    88
# MAIN_CLASS   The Java main class to launch
45463
d9325138bac6 8180334: Unable to build jaotc launcher on windows
ksrini
parents: 42753
diff changeset
    89
# JAVA_ARGS   Processed into a -DJAVA_ARGS and added to CFLAGS
d9325138bac6 8180334: Unable to build jaotc launcher on windows
ksrini
parents: 42753
diff changeset
    90
# EXTRA_JAVA_ARGS Processed into a -DEXTRA_JAVA_ARGS and is prepended
d9325138bac6 8180334: Unable to build jaotc launcher on windows
ksrini
parents: 42753
diff changeset
    91
#     before JAVA_ARGS to CFLAGS, primarily to allow long string literal
d9325138bac6 8180334: Unable to build jaotc launcher on windows
ksrini
parents: 42753
diff changeset
    92
#     compile time defines exceeding Visual Studio 2013 limitations.
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    93
# CFLAGS   Additional CFLAGS
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    94
# CFLAGS_windows   Additional CFLAGS_windows
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    95
# LIBS_unix   Additional LIBS_unix
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    96
# LIBS_windows   Additional LIBS_windows
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    97
# LDFLAGS_solaris Additional LDFLAGS_solaris
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    98
# RC_FLAGS   Additional RC_FLAGS
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    99
# MACOSX_SIGNED   On macosx, sign this binary
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   100
# WINDOWS_STATIC_LINK   On windows, link statically with C runtime and libjli.
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   101
# OPTIMIZATION   Override default optimization level (LOW)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   102
# OUTPUT_DIR   Override default output directory
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   103
# VERSION_INFO_RESOURCE   Override default Windows resource file
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   104
# NO_JAVA_MS   Do not add -ms8m to JAVA_ARGS.
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   105
SetupBuildLauncher = $(NamedParamsMacroTemplate)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   106
define SetupBuildLauncherBody
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   107
  # Setup default values (unless overridden)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   108
  ifeq ($$($1_OPTIMIZATION), )
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   109
    $1_OPTIMIZATION := LOW
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   110
  endif
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   111
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   112
  ifneq ($$($1_NO_JAVA_MS), true)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   113
    # The norm is to append -ms8m, unless otherwise instructed.
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   114
    $1_JAVA_ARGS += -ms8m
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   115
  endif
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   116
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 35781
diff changeset
   117
  ifeq ($$($1_MAIN_MODULE), )
9d0388c6b336 8142968: Module System implementation
alanb
parents: 35781
diff changeset
   118
    $1_MAIN_MODULE := $(MODULE)
9d0388c6b336 8142968: Module System implementation
alanb
parents: 35781
diff changeset
   119
  endif
9d0388c6b336 8142968: Module System implementation
alanb
parents: 35781
diff changeset
   120
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   121
  ifneq ($$($1_JAVA_ARGS), )
45463
d9325138bac6 8180334: Unable to build jaotc launcher on windows
ksrini
parents: 42753
diff changeset
   122
    ifneq ($$($1_EXTRA_JAVA_ARGS), )
d9325138bac6 8180334: Unable to build jaotc launcher on windows
ksrini
parents: 42753
diff changeset
   123
      $1_EXTRA_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \
d9325138bac6 8180334: Unable to build jaotc launcher on windows
ksrini
parents: 42753
diff changeset
   124
        $$(addprefix -J, $$($1_EXTRA_JAVA_ARGS)), "$$a"$(COMMA) )) }'
d9325138bac6 8180334: Unable to build jaotc launcher on windows
ksrini
parents: 42753
diff changeset
   125
      $1_CFLAGS += -DEXTRA_JAVA_ARGS=$$($1_EXTRA_JAVA_ARGS_STR)
d9325138bac6 8180334: Unable to build jaotc launcher on windows
ksrini
parents: 42753
diff changeset
   126
    endif
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   127
    $1_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 35781
diff changeset
   128
        $$(addprefix -J, $$($1_JAVA_ARGS)) -m $$($1_MAIN_MODULE)/$$($1_MAIN_CLASS), "$$a"$(COMMA) )) }'
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   129
    $1_CFLAGS += -DJAVA_ARGS=$$($1_JAVA_ARGS_STR)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   130
  endif
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   131
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   132
  $1_LIBS :=
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   133
  ifeq ($(OPENJDK_TARGET_OS), macosx)
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   134
    ifeq ($$($1_MACOSX_SIGNED), true)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   135
      $1_PLIST_FILE := Info-privileged.plist
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   136
        $1_CODESIGN := true
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   137
    else
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   138
      $1_PLIST_FILE := Info-cmdline.plist
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   139
    endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   140
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   141
    $1_CFLAGS += -DPACKAGE_PATH='"$(PACKAGE_PATH)"'
33666
amurillo
parents: 33523 33661
diff changeset
   142
    $1_LDFLAGS += -Wl,-all_load \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   143
        -sectcreate __TEXT __info_plist $(MACOSX_PLIST_DIR)/$$($1_PLIST_FILE)
33653
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   144
    ifeq ($(STATIC_BUILD), true)
33666
amurillo
parents: 33523 33661
diff changeset
   145
      $1_LDFLAGS += -exported_symbols_list \
amurillo
parents: 33523 33661
diff changeset
   146
              $(SUPPORT_OUTPUTDIR)/build-static/exported.symbols
amurillo
parents: 33523 33661
diff changeset
   147
      $1_LIBS += \
35241
075bbb8f2423 8146403: Windows build can be faster
erikj
parents: 34695
diff changeset
   148
          $$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/java.base -name "*.a") \
33653
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   149
          $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libdt_socket.a \
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   150
          $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libjdwp.a \
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   151
          $(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) \
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   152
          -framework CoreFoundation \
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   153
          -framework Foundation \
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   154
          -framework SystemConfiguration \
33666
amurillo
parents: 33523 33661
diff changeset
   155
          -lstdc++ -liconv
33653
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   156
    else
33666
amurillo
parents: 33523 33661
diff changeset
   157
      $1_LIBS += $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
33653
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   158
    endif
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   159
    $1_LIBS += -framework Cocoa -framework Security \
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   160
        -framework ApplicationServices
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   161
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   162
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   163
  ifeq ($(OPENJDK_TARGET_OS), aix)
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   164
    $1_LDFLAGS += -L$(SUPPORT_OUTPUTDIR)/native/java.base
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   165
    $1_LIBS += -ljli_static
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   166
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   167
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   168
  ifeq ($(USE_EXTERNAL_LIBZ), true)
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   169
    $1_LIBS += -lz
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   170
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   171
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   172
  ifeq ($$($1_WINDOWS_STATIC_LINK), true)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   173
    $1_CFLAGS += $(filter-out -MD, $(CFLAGS_JDKEXE))
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   174
    $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/jli_static.lib
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   175
  else
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   176
    $1_CFLAGS += $(CFLAGS_JDKEXE)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   177
    $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   178
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   179
49244
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents: 49241
diff changeset
   180
  $$(eval $$(call SetupJdkExecutable, BUILD_LAUNCHER_$1, \
49070
d7859531621b 8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents: 47217
diff changeset
   181
      NAME := $1, \
35241
075bbb8f2423 8146403: Windows build can be faster
erikj
parents: 34695
diff changeset
   182
      EXTRA_FILES := $(LAUNCHER_SRC)/main.c, \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   183
      OPTIMIZATION := $$($1_OPTIMIZATION), \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   184
      CFLAGS := $$($1_CFLAGS) \
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   185
          $(LAUNCHER_CFLAGS) \
33984
2333676816eb 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 29931
diff changeset
   186
          $(VERSION_CFLAGS) \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   187
          -DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   188
          -DPROGNAME='"$1"' \
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   189
          $$($1_CFLAGS), \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   190
      CFLAGS_linux := -fPIC, \
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   191
      CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   192
      CFLAGS_windows := $$($1_CFLAGS_windows), \
34695
7a6cc9982d22 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34389
diff changeset
   193
      LDFLAGS := $$(LDFLAGS_JDKEXE) \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   194
          $$(ORIGIN_ARG) \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   195
          $$($1_LDFLAGS), \
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   196
      LDFLAGS_linux := \
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 36511
diff changeset
   197
          -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jli, \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   198
      LDFLAGS_solaris := $$($1_LDFLAGS_solaris) \
42753
40f61533b93d 8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents: 36511
diff changeset
   199
          -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jli, \
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   200
      LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   201
      LIBS_unix := $$($1_LIBS_unix), \
49241
de4b3a04feae 8199606: Set -lc as global LIBS on solstudio
ihse
parents: 49070
diff changeset
   202
      LIBS_linux := -lpthread -ljli $(LIBDL), \
de4b3a04feae 8199606: Set -lc as global LIBS on solstudio
ihse
parents: 49070
diff changeset
   203
      LIBS_solaris := -ljli -lthread $(LIBDL), \
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   204
      LIBS_windows := $$($1_WINDOWS_JLI_LIB) \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   205
          $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib \
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   206
          $$($1_LIBS_windows), \
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   207
      OUTPUT_DIR := $$($1_OUTPUT_DIR), \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   208
      VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \
49244
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents: 49241
diff changeset
   209
      EXTRA_RC_FLAGS := $$($1_EXTRA_RC_FLAGS), \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   210
      MANIFEST := $(JAVA_MANIFEST), \
33984
2333676816eb 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 29931
diff changeset
   211
      MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
29925
6d47adfc6b47 8077847: Better handling of Windows executable manifest version
ihse
parents: 27953
diff changeset
   212
      CODESIGN := $$($1_CODESIGN), \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   213
  ))
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   214
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   215
  $1 += $$(BUILD_LAUNCHER_$1)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   216
  TARGETS += $$($1)
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   217
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   218
  ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix))
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 25859
diff changeset
   219
    $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   220
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   221
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   222
  ifeq ($(OPENJDK_TARGET_OS), windows)
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 25859
diff changeset
   223
    $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   224
        $$($1_WINDOWS_JLI_LIB)
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   225
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   226
endef