jdk/make/launcher/LauncherCommon.gmk
author iris
Thu, 19 Nov 2015 14:00:49 -0800
changeset 34014 1ffce305d533
parent 33666 7908508d9e1c
parent 34013 79c21cd6fcfc
child 34389 63708161c21b
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
     1
#
29925
6d47adfc6b47 8077847: Better handling of Windows executable manifest version
ihse
parents: 27953
diff changeset
     2
# Copyright (c) 2011, 2015, 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
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    26
include NativeCompilation.gmk
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    27
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    28
# Prepare the find cache.
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    29
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher))
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    30
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    31
ifeq ($(OPENJDK_TARGET_OS), macosx)
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    32
  ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN)
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    33
else
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    34
  ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,/../lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli)
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    35
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    36
  # Applications expect to be able to link against libjawt without invoking
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    37
  # System.loadLibrary("jawt") first. This was the behaviour described in the
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    38
  # devloper documentation of JAWT and what worked with OpenJDK6.
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    39
  ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    40
    ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,/../lib$(OPENJDK_TARGET_CPU_LIBDIR))
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    41
  endif
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    42
endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    43
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    44
LAUNCHER_SRC := $(JDK_TOPDIR)/src/java.base/share/native/launcher
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    45
LAUNCHER_CFLAGS := -I$(JDK_TOPDIR)/src/java.base/share/native/launcher \
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    46
    -I$(JDK_TOPDIR)/src/java.base/share/native/libjli \
27736
8c9bd4be4a86 8058631: Rename posix to unix in build system to match file name changes
ihse
parents: 25859
diff changeset
    47
    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    48
    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    49
    #
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    50
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    51
JAVA_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.rc
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    52
MACOSX_PLIST_DIR := $(JDK_TOPDIR)/src/java.base/macosx/native/launcher
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    53
JAVA_MANIFEST := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.manifest
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    54
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    55
################################################################################
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    56
# Build standard launcher.
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    57
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    58
# Setup make rules for building a standard launcher.
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    59
#
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    60
# 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
    61
# 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
    62
# used as the name of the executable.
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    63
#
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    64
# Remaining parameters are named arguments. These include:
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    65
# MAIN_CLASS   The Java main class to launch
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    66
# JAVA_ARGS   Processed into a -DJAVA_ARGS C flag
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    67
# APP_CLASSPATH   Processed into a -DAPP_CLASSPATH C flag
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    68
# CFLAGS   Additional CFLAGS
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    69
# CFLAGS_windows   Additional CFLAGS_windows
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    70
# LIBS_unix   Additional LIBS_unix
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    71
# LIBS_windows   Additional LIBS_windows
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    72
# LDFLAGS_solaris Additional LDFLAGS_solaris
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    73
# RC_FLAGS   Additional RC_FLAGS
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    74
# MACOSX_SIGNED   On macosx, sign this binary
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    75
# 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
    76
# OPTIMIZATION   Override default optimization level (LOW)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    77
# OUTPUT_DIR   Override default output directory
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    78
# VERSION_INFO_RESOURCE   Override default Windows resource file
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    79
# NO_JAVA_MS   Do not add -ms8m to JAVA_ARGS.
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    80
SetupBuildLauncher = $(NamedParamsMacroTemplate)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    81
define SetupBuildLauncherBody
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    82
  # Setup default values (unless overridden)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    83
  ifeq ($$($1_VERSION_INFO_RESOURCE), )
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    84
    $1_VERSION_INFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE)
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    85
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    86
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    87
  ifeq ($$($1_OUTPUT_DIR), )
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    88
    $1_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    89
  endif
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    90
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    91
  ifeq ($$($1_OPTIMIZATION), )
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    92
    $1_OPTIMIZATION := LOW
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    93
  endif
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    94
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    95
  ifneq ($$($1_NO_JAVA_MS), true)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    96
    # The norm is to append -ms8m, unless otherwise instructed.
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    97
    $1_JAVA_ARGS += -ms8m
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    98
  endif
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    99
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   100
  ifneq ($$($1_JAVA_ARGS), )
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   101
    $1_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   102
        $$(addprefix -J, $$($1_JAVA_ARGS)) $$($1_MAIN_CLASS), "$$a"$(COMMA) )) }'
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   103
    $1_CFLAGS += -DJAVA_ARGS=$$($1_JAVA_ARGS_STR)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   104
  endif
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   105
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   106
  ifneq ($$($1_APP_CLASSPATH), )
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   107
    $1_APP_CLASSPATH_STR := '{ $$(strip $$(foreach a, \
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   108
        $$($1_APP_CLASSPATH), "$$a"$(COMMA) )) }'
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   109
    # Remove the trailing comma
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   110
    $1_APP_CLASSPATH_STR := $$(strip $$(subst $$(COMMA) }', }', \
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   111
        $$($1_APP_CLASSPATH_STR)))
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   112
    $1_CFLAGS += -DAPP_CLASSPATH=$$($1_APP_CLASSPATH_STR)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   113
  endif
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   114
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   115
  $1_LIBS :=
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   116
  ifeq ($(OPENJDK_TARGET_OS), macosx)
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   117
    ifeq ($$($1_MACOSX_SIGNED), true)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   118
      $1_PLIST_FILE := Info-privileged.plist
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   119
        $1_CODESIGN := true
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   120
    else
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   121
      $1_PLIST_FILE := Info-cmdline.plist
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   122
    endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   123
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   124
    $1_CFLAGS += -DPACKAGE_PATH='"$(PACKAGE_PATH)"'
33666
amurillo
parents: 33523 33661
diff changeset
   125
    $1_LDFLAGS += -Wl,-all_load \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   126
        -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
   127
    ifeq ($(STATIC_BUILD), true)
33666
amurillo
parents: 33523 33661
diff changeset
   128
      $1_LDFLAGS += -exported_symbols_list \
amurillo
parents: 33523 33661
diff changeset
   129
              $(SUPPORT_OUTPUTDIR)/build-static/exported.symbols
amurillo
parents: 33523 33661
diff changeset
   130
      $1_LIBS += \
33653
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   131
          $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/java.base -name "*.a") \
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   132
          $(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
   133
          $(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
   134
          $(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
   135
          -framework CoreFoundation \
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   136
          -framework Foundation \
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   137
          -framework SystemConfiguration \
33666
amurillo
parents: 33523 33661
diff changeset
   138
          -lstdc++ -liconv
33653
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   139
    else
33666
amurillo
parents: 33523 33661
diff changeset
   140
      $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
   141
    endif
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   142
    $1_LIBS += -framework Cocoa -framework Security \
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   143
        -framework ApplicationServices
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   144
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   145
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   146
  ifeq ($(OPENJDK_TARGET_OS), aix)
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   147
    $1_LDFLAGS += -L$(SUPPORT_OUTPUTDIR)/native/java.base
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   148
    $1_LIBS += -ljli_static
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   149
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   150
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   151
  ifeq ($(USE_EXTERNAL_LIBZ), true)
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   152
    $1_LIBS += -lz
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   153
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   154
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   155
  ifeq ($$($1_WINDOWS_STATIC_LINK), true)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   156
    $1_CFLAGS += $(filter-out -MD, $(CFLAGS_JDKEXE))
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   157
    $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/jli_static.lib
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   158
  else
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   159
    $1_CFLAGS += $(CFLAGS_JDKEXE)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   160
    $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib
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
  # The linker on older SuSE distros (e.g. on SLES 10) complains with:
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   164
  # "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   165
  # if feeded with a version script which contains named tags.
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   166
  ifeq ($(USING_BROKEN_SUSE_LD),yes)
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   167
    ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous), )
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   168
      $1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   169
    else
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   170
      $1_MAPFILE :=
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   171
    endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   172
  else
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   173
    ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)), )
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   174
      $1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   175
    else
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   176
      $1_MAPFILE :=
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   177
    endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   178
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   179
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   180
  $$(eval $$(call SetupNativeCompilation, BUILD_LAUNCHER_$1, \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   181
      SRC := $(LAUNCHER_SRC), \
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   182
      INCLUDE_FILES := 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), \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
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 := \
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   197
          $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)) \
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   198
          -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli, \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   199
      LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_NAME,$1), \
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   200
      LDFLAGS_solaris := $$($1_LDFLAGS_solaris) \
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   201
          $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)) \
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   202
          -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli, \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   203
      MAPFILE := $$($1_MAPFILE), \
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   204
      LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   205
      LIBS_unix := $$($1_LIBS_unix), \
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   206
      LIBS_linux := -lpthread -ljli $(LIBDL) -lc, \
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   207
      LIBS_solaris := -ljli -lthread $(LIBDL) -lc, \
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   208
      LIBS_windows := $$($1_WINDOWS_JLI_LIB) \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   209
          $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib \
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   210
          $$($1_LIBS_windows), \
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   211
      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs, \
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   212
      OUTPUT_DIR := $$($1_OUTPUT_DIR), \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   213
      PROGRAM := $1, \
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   214
      DEBUG_SYMBOLS := true, \
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   215
      VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   216
      RC_FLAGS := $$(RC_FLAGS) \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   217
          -D "JDK_FNAME=$1$(EXE_SUFFIX)" \
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   218
          -D "JDK_INTERNAL_NAME=$1" \
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   219
          -D "JDK_FTYPE=0x1L" \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   220
          $$($1_RC_FLAGS), \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   221
      MANIFEST := $(JAVA_MANIFEST), \
33984
2333676816eb 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 29931
diff changeset
   222
      MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
29925
6d47adfc6b47 8077847: Better handling of Windows executable manifest version
ihse
parents: 27953
diff changeset
   223
      CODESIGN := $$($1_CODESIGN), \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   224
  ))
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   225
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   226
  $1 += $$(BUILD_LAUNCHER_$1)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   227
  TARGETS += $$($1)
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   228
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   229
  ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix))
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 25859
diff changeset
   230
    $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   231
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   232
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   233
  ifeq ($(OPENJDK_TARGET_OS), windows)
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 25859
diff changeset
   234
    $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   235
        $$($1_WINDOWS_JLI_LIB)
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   236
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   237
endef