make/launcher/LauncherCommon.gmk
author jwilhelm
Wed, 23 Jan 2019 19:56:28 +0100
changeset 53457 e3ed96060992
parent 53087 f48737b2f428
child 53683 48ff68e2fe5c
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
#
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
52714
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
    27
include Modules.gmk
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
    28
include ProcessMarkdown.gmk
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
    29
include ToolsJdk.gmk
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    30
49534
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    31
# Tell the compiler not to export any functions unless declared so in
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    32
# 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
    33
# On Mac, we have always exported all symbols, probably due to oversight
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    34
# and/or misunderstanding. To emulate this, don't hide any symbols
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    35
# by default.
52812
fc54d27e58d8 8214063: OpenJDK will not build on AIX while using the xlc 13.1 compiler
afarley
parents: 52714
diff changeset
    36
# On AIX/xlc we need at least xlc 13.1 for the symbol hiding (see JDK-8214063)
49534
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    37
# Also provide an override for non-conformant libraries.
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    38
ifeq ($(TOOLCHAIN_TYPE), gcc)
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    39
  LAUNCHER_CFLAGS += -fvisibility=hidden
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    40
  LDFLAGS_JDKEXE += -Wl,--exclude-libs,ALL
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    41
else ifeq ($(TOOLCHAIN_TYPE), clang)
51855
8bbb5cbac92c 8210705: Stop exporting all symbols on macosx
ihse
parents: 51853
diff changeset
    42
  LAUNCHER_CFLAGS += -fvisibility=hidden
49534
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    43
else ifeq ($(TOOLCHAIN_TYPE), solstudio)
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    44
  LAUNCHER_CFLAGS += -xldscope=hidden
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    45
endif
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    46
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    47
LAUNCHER_SRC := $(TOPDIR)/src/java.base/share/native/launcher
49534
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49244
diff changeset
    48
LAUNCHER_CFLAGS += -I$(TOPDIR)/src/java.base/share/native/launcher \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    49
    -I$(TOPDIR)/src/java.base/share/native/libjli \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    50
    -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    51
    -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    52
    #
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    53
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
    54
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
    55
MACOSX_PLIST_DIR := $(TOPDIR)/src/java.base/macosx/native/launcher
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    56
JAVA_MANIFEST := $(TOPDIR)/src/java.base/windows/native/launcher/java.manifest
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
################################################################################
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    59
# Build standard launcher.
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
    60
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    61
# Setup make rules for building a standard launcher.
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    62
#
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    63
# 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
    64
# 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
    65
# used as the name of the executable.
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    66
#
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    67
# Remaining parameters are named arguments. These include:
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 35781
diff changeset
    68
# MAIN_MODULE  The module of the main class to launch if different from the
9d0388c6b336 8142968: Module System implementation
alanb
parents: 35781
diff changeset
    69
#     current module
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    70
# MAIN_CLASS   The Java main class to launch
45463
d9325138bac6 8180334: Unable to build jaotc launcher on windows
ksrini
parents: 42753
diff changeset
    71
# 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
    72
# 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
    73
#     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
    74
#     compile time defines exceeding Visual Studio 2013 limitations.
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    75
# CFLAGS   Additional CFLAGS
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    76
# CFLAGS_windows   Additional CFLAGS_windows
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    77
# LDFLAGS_solaris Additional LDFLAGS_solaris
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    78
# RC_FLAGS   Additional RC_FLAGS
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    79
# MACOSX_SIGNED   On macosx, sign this binary
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    80
# OPTIMIZATION   Override default optimization level (LOW)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    81
# OUTPUT_DIR   Override default output directory
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    82
# VERSION_INFO_RESOURCE   Override default Windows resource file
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    83
SetupBuildLauncher = $(NamedParamsMacroTemplate)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    84
define SetupBuildLauncherBody
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    85
  # Setup default values (unless overridden)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    86
  ifeq ($$($1_OPTIMIZATION), )
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    87
    $1_OPTIMIZATION := LOW
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    88
  endif
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    89
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 35781
diff changeset
    90
  ifeq ($$($1_MAIN_MODULE), )
9d0388c6b336 8142968: Module System implementation
alanb
parents: 35781
diff changeset
    91
    $1_MAIN_MODULE := $(MODULE)
9d0388c6b336 8142968: Module System implementation
alanb
parents: 35781
diff changeset
    92
  endif
9d0388c6b336 8142968: Module System implementation
alanb
parents: 35781
diff changeset
    93
51808
3f32076a43a6 8210919: Remove statically linked libjli on Windows
ihse
parents: 51783
diff changeset
    94
  $1_JAVA_ARGS += -ms8m
3f32076a43a6 8210919: Remove statically linked libjli on Windows
ihse
parents: 51783
diff changeset
    95
  ifneq ($$($1_MAIN_CLASS), )
3f32076a43a6 8210919: Remove statically linked libjli on Windows
ihse
parents: 51783
diff changeset
    96
    $1_LAUNCHER_CLASS := -m $$($1_MAIN_MODULE)/$$($1_MAIN_CLASS)
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    97
  endif
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
    98
51808
3f32076a43a6 8210919: Remove statically linked libjli on Windows
ihse
parents: 51783
diff changeset
    99
  ifneq ($$($1_EXTRA_JAVA_ARGS), )
3f32076a43a6 8210919: Remove statically linked libjli on Windows
ihse
parents: 51783
diff changeset
   100
    $1_EXTRA_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \
3f32076a43a6 8210919: Remove statically linked libjli on Windows
ihse
parents: 51783
diff changeset
   101
      $$(addprefix -J, $$($1_EXTRA_JAVA_ARGS)), "$$a"$(COMMA) )) }'
3f32076a43a6 8210919: Remove statically linked libjli on Windows
ihse
parents: 51783
diff changeset
   102
    $1_CFLAGS += -DEXTRA_JAVA_ARGS=$$($1_EXTRA_JAVA_ARGS_STR)
3f32076a43a6 8210919: Remove statically linked libjli on Windows
ihse
parents: 51783
diff changeset
   103
  endif
3f32076a43a6 8210919: Remove statically linked libjli on Windows
ihse
parents: 51783
diff changeset
   104
  $1_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \
3f32076a43a6 8210919: Remove statically linked libjli on Windows
ihse
parents: 51783
diff changeset
   105
      $$(addprefix -J, $$($1_JAVA_ARGS)) $$($1_LAUNCHER_CLASS), "$$a"$(COMMA) )) }'
3f32076a43a6 8210919: Remove statically linked libjli on Windows
ihse
parents: 51783
diff changeset
   106
  $1_CFLAGS += -DJAVA_ARGS=$$($1_JAVA_ARGS_STR)
3f32076a43a6 8210919: Remove statically linked libjli on Windows
ihse
parents: 51783
diff changeset
   107
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   108
  ifeq ($(OPENJDK_TARGET_OS), macosx)
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   109
    ifeq ($$($1_MACOSX_SIGNED), true)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   110
      $1_PLIST_FILE := Info-privileged.plist
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   111
        $1_CODESIGN := true
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   112
    else
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   113
      $1_PLIST_FILE := Info-cmdline.plist
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   114
    endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   115
51825
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   116
    $1_LDFLAGS += -sectcreate __TEXT __info_plist $(MACOSX_PLIST_DIR)/$$($1_PLIST_FILE)
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   117
33653
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   118
    ifeq ($(STATIC_BUILD), true)
33666
amurillo
parents: 33523 33661
diff changeset
   119
      $1_LDFLAGS += -exported_symbols_list \
amurillo
parents: 33523 33661
diff changeset
   120
              $(SUPPORT_OUTPUTDIR)/build-static/exported.symbols
amurillo
parents: 33523 33661
diff changeset
   121
      $1_LIBS += \
35241
075bbb8f2423 8146403: Windows build can be faster
erikj
parents: 34695
diff changeset
   122
          $$(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
   123
          $(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
   124
          $(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
   125
          $(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
   126
          -framework CoreFoundation \
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   127
          -framework Foundation \
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   128
          -framework SystemConfiguration \
33666
amurillo
parents: 33523 33661
diff changeset
   129
          -lstdc++ -liconv
33653
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32515
diff changeset
   130
    endif
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   131
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   132
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   133
  ifeq ($(USE_EXTERNAL_LIBZ), true)
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   134
    $1_LIBS += -lz
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   135
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   136
52022
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 51855
diff changeset
   137
  $1_WINDOWS_JLI_LIB := $(call FindStaticLib, java.base, jli, /libjli)
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   138
49244
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents: 49241
diff changeset
   139
  $$(eval $$(call SetupJdkExecutable, BUILD_LAUNCHER_$1, \
49070
d7859531621b 8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents: 47217
diff changeset
   140
      NAME := $1, \
35241
075bbb8f2423 8146403: Windows build can be faster
erikj
parents: 34695
diff changeset
   141
      EXTRA_FILES := $(LAUNCHER_SRC)/main.c, \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   142
      OPTIMIZATION := $$($1_OPTIMIZATION), \
51808
3f32076a43a6 8210919: Remove statically linked libjli on Windows
ihse
parents: 51783
diff changeset
   143
      CFLAGS := $$(CFLAGS_JDKEXE) $$($1_CFLAGS) \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   144
          $(LAUNCHER_CFLAGS) \
33984
2333676816eb 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 29931
diff changeset
   145
          $(VERSION_CFLAGS) \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   146
          -DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   147
          -DPROGNAME='"$1"' \
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   148
          $$($1_CFLAGS), \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   149
      CFLAGS_linux := -fPIC, \
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   150
      CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   151
      CFLAGS_windows := $$($1_CFLAGS_windows), \
51853
ec62d6cab037 8211029: Have a common set of enabled warnings for all native libraries
ihse
parents: 51825
diff changeset
   152
      DISABLED_WARNINGS_gcc := unused-function, \
34695
7a6cc9982d22 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34389
diff changeset
   153
      LDFLAGS := $$(LDFLAGS_JDKEXE) \
51825
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   154
          $$(call SET_EXECUTABLE_ORIGIN) \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   155
          $$($1_LDFLAGS), \
51825
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   156
      LDFLAGS_linux := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   157
          -L$(call FindLibDirForModule, java.base), \
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   158
      LDFLAGS_macosx := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   159
          -L$(call FindLibDirForModule, java.base), \
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   160
      LDFLAGS_solaris := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   161
          -L$(call FindLibDirForModule, java.base), \
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   162
      LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   163
      LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \
51825
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   164
      LIBS_linux := -ljli -lpthread $(LIBDL), \
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   165
      LIBS_macosx := -ljli -framework Cocoa -framework Security \
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   166
          -framework ApplicationServices, \
49241
de4b3a04feae 8199606: Set -lc as global LIBS on solstudio
ihse
parents: 49070
diff changeset
   167
      LIBS_solaris := -ljli -lthread $(LIBDL), \
51825
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   168
      LIBS_aix := -ljli_static, \
33406
4680f7495292 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32515
diff changeset
   169
      LIBS_windows := $$($1_WINDOWS_JLI_LIB) \
51825
e3632b4706c4 8210931: JLI and launchers normalization and cleanup
ihse
parents: 51811
diff changeset
   170
          $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib, \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   171
      OUTPUT_DIR := $$($1_OUTPUT_DIR), \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   172
      VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \
49244
995a5556edfa 8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents: 49241
diff changeset
   173
      EXTRA_RC_FLAGS := $$($1_EXTRA_RC_FLAGS), \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   174
      MANIFEST := $(JAVA_MANIFEST), \
33984
2333676816eb 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 29931
diff changeset
   175
      MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
29925
6d47adfc6b47 8077847: Better handling of Windows executable manifest version
ihse
parents: 27953
diff changeset
   176
      CODESIGN := $$($1_CODESIGN), \
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   177
  ))
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   178
33523
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   179
  $1 += $$(BUILD_LAUNCHER_$1)
eb067bcd9414 8141444: Clean up building of JDK launchers
ihse
parents: 33406
diff changeset
   180
  TARGETS += $$($1)
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   181
51783
4482acfef2a5 8210729: Clean up macosx static library handling
ihse
parents: 50126
diff changeset
   182
  ifeq ($(OPENJDK_TARGET_OS), aix)
52022
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 51855
diff changeset
   183
    $$(BUILD_LAUNCHER_$1): $(call FindStaticLib, java.base, jli_static)
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   184
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   185
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   186
  ifeq ($(OPENJDK_TARGET_OS), windows)
52022
804792ce736f 8210459: Add support for generating compile_commands.json
rwestberg
parents: 51855
diff changeset
   187
    $$(BUILD_LAUNCHER_$1): $(call FindStaticLib, java.base, java, /libjava) \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   188
        $$($1_WINDOWS_JLI_LIB)
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   189
  endif
3317bb8137f4 8054834: Modular Source Code
chegar
parents:
diff changeset
   190
endef
52714
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   191
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   192
################################################################################
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   193
# Create man pages for jmod to pick up. There should be a one-to-one
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   194
# relationship between executables and man pages (even if this is not always
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   195
# the case), so piggyback man page generation on the launcher compilation.
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   196
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   197
ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   198
  # Only build manpages on unix systems.
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   199
  # We assume all our man pages should reside in section 1.
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   200
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   201
  MAN_FILES_MD := $(wildcard $(addsuffix /*.md, $(call FindModuleManDirs, $(MODULE))))
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   202
  MAN_FILES_TROFF := $(wildcard $(addsuffix /*.1, $(call FindModuleManDirs, $(MODULE))))
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   203
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   204
  ifneq ($(MAN_FILES_MD), )
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   205
    # If we got markdown files, ignore the troff files
53087
f48737b2f428 8215635: Pandoc check in Docs.gmk does not work on Windows
erikj
parents: 52940
diff changeset
   206
    ifeq ($(ENABLE_PANDOC), false)
52714
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   207
      $(info Warning: pandoc not found. Not generating man pages)
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   208
    else
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   209
      # Create dynamic man pages from markdown using pandoc. We need
52940
26e2cfebcfba 8214720: Add pandoc filter to improve html man page output
ihse
parents: 52812
diff changeset
   210
      # PANDOC_TROFF_MANPAGE_FILTER, a wrapper around
26e2cfebcfba 8214720: Add pandoc filter to improve html man page output
ihse
parents: 52812
diff changeset
   211
      # PANDOC_TROFF_MANPAGE_FILTER_JAVASCRIPT. This is created by buildtools-jdk.
52714
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   212
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   213
      # We should also depend on the source javascript filter
52940
26e2cfebcfba 8214720: Add pandoc filter to improve html man page output
ihse
parents: 52812
diff changeset
   214
      PANDOC_TROFF_MANPAGE_FILTER_JAVASCRIPT := \
26e2cfebcfba 8214720: Add pandoc filter to improve html man page output
ihse
parents: 52812
diff changeset
   215
          $(TOPDIR)/make/scripts/pandoc-troff-manpage-filter.js
52714
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   216
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   217
      # The norm in man pages is to display code literals as bold, but pandoc
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   218
      # "correctly" converts these constructs (encoded in markdown using `...`
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   219
      # or ```...```) to \f[C]. Ideally, we should use the filter to encapsulate
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   220
      # the Code/CodeBlock in Strong. While this works for Code, pandoc cannot
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   221
      # correctly render man page output for CodeBlock wrapped in Strong. So we
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   222
      # take the easy way out, and post-process the troff output, replacing
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   223
      # \f[C] with \f[CB]. This has the added benefit of working correctly on
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   224
      # pandoc prior to version 2.0, which cannot properly produced nested
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   225
      # formatting in man pages (see https://github.com/jgm/pandoc/issues/3568).
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   226
      #
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   227
      # As of pandoc 2.3, the termination of formatting is still broken
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   228
      # (see https://github.com/jgm/pandoc/issues/4973). We need to replace
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   229
      # \f[] with \f[R].
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   230
      MAN_POST_PROCESS := $(SED) -e 's/\\f\[C\]/\\f\[CB\]/g' \
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   231
          -e 's/\\f\[\]/\\f\[R\]/g'
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   232
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   233
      # Now generate the man pages from markdown using pandoc
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   234
      $(eval $(call SetupProcessMarkdown, BUILD_MAN_PAGES, \
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   235
          DEST := $(SUPPORT_OUTPUTDIR)/modules_man/$(MODULE)/man1, \
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   236
          FILES := $(MAN_FILES_MD), \
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   237
          FORMAT := man, \
52940
26e2cfebcfba 8214720: Add pandoc filter to improve html man page output
ihse
parents: 52812
diff changeset
   238
          FILTER := $(PANDOC_TROFF_MANPAGE_FILTER), \
52714
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   239
          POST_PROCESS := $(MAN_POST_PROCESS), \
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   240
          REPLACEMENTS := @@VERSION_SHORT@@ => $(VERSION_SHORT), \
52940
26e2cfebcfba 8214720: Add pandoc filter to improve html man page output
ihse
parents: 52812
diff changeset
   241
          EXTRA_DEPS := $(PANDOC_TROFF_MANPAGE_FILTER) \
26e2cfebcfba 8214720: Add pandoc filter to improve html man page output
ihse
parents: 52812
diff changeset
   242
              $(PANDOC_TROFF_MANPAGE_FILTER_JAVASCRIPT), \
52714
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   243
      ))
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   244
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   245
      TARGETS += $(BUILD_MAN_PAGES)
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   246
    endif
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   247
  else
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   248
    # No markdown man pages present
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   249
    ifeq ($(BUILD_MANPAGES), true)
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   250
      # BUILD_MANPAGES is a mis-nomer. It really means "copy the pre-generated man pages".
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   251
      $(eval $(call SetupCopyFiles, COPY_MAN_PAGES, \
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   252
          DEST := $(SUPPORT_OUTPUTDIR)/modules_man/$(MODULE)/man1, \
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   253
          FILES := $(MAN_FILES_TROFF), \
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   254
      ))
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   255
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   256
      TARGETS += $(COPY_MAN_PAGES)
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   257
    endif
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   258
  endif
2e52aa822c57 8178317: Create man pages using pandoc from markdown sources
ihse
parents: 52022
diff changeset
   259
endif