db4d383614
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282 Co-authored-by: Alex Buckley <alex.buckley@oracle.com> Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com> Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com> Co-authored-by: Mandy Chung <mandy.chung@oracle.com> Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com> Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com> Co-authored-by: Alexandr Scherbatiy <alexandr.scherbatiy@oracle.com> Co-authored-by: Amy Lu <amy.lu@oracle.com> Co-authored-by: Calvin Cheung <calvin.cheung@oracle.com> Co-authored-by: Daniel Fuchs <daniel.fuchs@oracle.com> Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com> Co-authored-by: Harold Seigel <harold.seigel@oracle.com> Co-authored-by: Jaroslav Bachorik <jaroslav.bachorik@oracle.com> Co-authored-by: Jean-Francois Denise <jean-francois.denise@oracle.com> Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com> Co-authored-by: James Laskey <james.laskey@oracle.com> Co-authored-by: Lois Foltan <lois.foltan@oracle.com> Co-authored-by: Miroslav Kos <miroslav.kos@oracle.com> Co-authored-by: Huaming Li <huaming.li@oracle.com> Co-authored-by: Sean Mullan <sean.mullan@oracle.com> Co-authored-by: Naoto Sato <naoto.sato@oracle.com> Co-authored-by: Masayoshi Okutsu <masayoshi.okutsu@oracle.com> Co-authored-by: Peter Levart <peter.levart@gmail.com> Co-authored-by: Philip Race <philip.race@oracle.com> Co-authored-by: Claes Redestad <claes.redestad@oracle.com> Co-authored-by: Sergey Bylokhov <sergey.bylokhov@oracle.com> Co-authored-by: Alexandre Iline <alexandre.iline@oracle.com> Co-authored-by: Volker Simonis <volker.simonis@gmail.com> Co-authored-by: Staffan Larsen <staffan.larsen@oracle.com> Co-authored-by: Stuart Marks <stuart.marks@oracle.com> Co-authored-by: Semyon Sadetsky <semyon.sadetsky@oracle.com> Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com> Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com> Co-authored-by: Valerie Peng <valerie.peng@oracle.com> Co-authored-by: Vincent Ryan <vincent.x.ryan@oracle.com> Co-authored-by: Weijun Wang <weijun.wang@oracle.com> Co-authored-by: Yuri Nesterenko <yuri.nesterenko@oracle.com> Co-authored-by: Yekaterina Kantserova <yekaterina.kantserova@oracle.com> Co-authored-by: Alexander Kulyakthin <alexander.kulyakhtin@oracle.com> Co-authored-by: Felix Yang <felix.yang@oracle.com> Co-authored-by: Andrei Eremeev <andrei.eremeev@oracle.com> Co-authored-by: Frank Yuan <frank.yuan@oracle.com> Co-authored-by: Sergei Pikalev <sergei.pikalev@oracle.com> Co-authored-by: Sibabrata Sahoo <sibabrata.sahoo@oracle.com> Co-authored-by: Tiantian Du <tiantian.du@oracle.com> Co-authored-by: Sha Jiang <sha.jiang@oracle.com> Reviewed-by: alanb, mchung, naoto, rriggs, psandoz, plevart, mullan, ascarpino, vinnie, prr, sherman, dfuchs, mhaupt
230 lines
8.9 KiB
Plaintext
230 lines
8.9 KiB
Plaintext
#
|
|
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
#
|
|
# This code is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License version 2 only, as
|
|
# published by the Free Software Foundation. Oracle designates this
|
|
# particular file as subject to the "Classpath" exception as provided
|
|
# by Oracle in the LICENSE file that accompanied this code.
|
|
#
|
|
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
# version 2 for more details (a copy is included in the LICENSE file that
|
|
# accompanied this code).
|
|
#
|
|
# You should have received a copy of the GNU General Public License version
|
|
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
#
|
|
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
# or visit www.oracle.com if you need additional information or have any
|
|
# questions.
|
|
#
|
|
|
|
include NativeCompilation.gmk
|
|
|
|
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
|
DISABLE_MAPFILES := true
|
|
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN)
|
|
else
|
|
ifeq ($(OPENJDK_TARGET_OS), windows)
|
|
DISABLE_MAPFILES := true
|
|
endif
|
|
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,/../lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli)
|
|
|
|
# Applications expect to be able to link against libjawt without invoking
|
|
# System.loadLibrary("jawt") first. This was the behaviour described in the
|
|
# devloper documentation of JAWT and what worked with OpenJDK6.
|
|
ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
|
|
ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,/../lib$(OPENJDK_TARGET_CPU_LIBDIR))
|
|
endif
|
|
endif
|
|
|
|
LAUNCHER_SRC := $(JDK_TOPDIR)/src/java.base/share/native/launcher
|
|
LAUNCHER_CFLAGS := -I$(JDK_TOPDIR)/src/java.base/share/native/launcher \
|
|
-I$(JDK_TOPDIR)/src/java.base/share/native/libjli \
|
|
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \
|
|
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \
|
|
#
|
|
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
|
|
JAVA_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.rc
|
|
MACOSX_PLIST_DIR := $(JDK_TOPDIR)/src/java.base/macosx/native/launcher
|
|
JAVA_MANIFEST := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.manifest
|
|
|
|
################################################################################
|
|
# Build standard launcher.
|
|
|
|
# Setup make rules for building a standard launcher.
|
|
#
|
|
# Parameter 1 is the name of the rule. This name is used as variable prefix,
|
|
# and the targets generated are listed in a variable by that name. It is also
|
|
# used as the name of the executable.
|
|
#
|
|
# Remaining parameters are named arguments. These include:
|
|
# MAIN_MODULE The module of the main class to launch if different from the
|
|
# current module
|
|
# MAIN_CLASS The Java main class to launch
|
|
# JAVA_ARGS Processed into a -DJAVA_ARGS C flag
|
|
# CFLAGS Additional CFLAGS
|
|
# CFLAGS_windows Additional CFLAGS_windows
|
|
# LIBS_unix Additional LIBS_unix
|
|
# LIBS_windows Additional LIBS_windows
|
|
# LDFLAGS_solaris Additional LDFLAGS_solaris
|
|
# RC_FLAGS Additional RC_FLAGS
|
|
# MACOSX_SIGNED On macosx, sign this binary
|
|
# WINDOWS_STATIC_LINK On windows, link statically with C runtime and libjli.
|
|
# OPTIMIZATION Override default optimization level (LOW)
|
|
# OUTPUT_DIR Override default output directory
|
|
# VERSION_INFO_RESOURCE Override default Windows resource file
|
|
# NO_JAVA_MS Do not add -ms8m to JAVA_ARGS.
|
|
SetupBuildLauncher = $(NamedParamsMacroTemplate)
|
|
define SetupBuildLauncherBody
|
|
# Setup default values (unless overridden)
|
|
ifeq ($$($1_VERSION_INFO_RESOURCE), )
|
|
$1_VERSION_INFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE)
|
|
endif
|
|
|
|
ifeq ($$($1_OUTPUT_DIR), )
|
|
$1_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)
|
|
endif
|
|
|
|
ifeq ($$($1_OPTIMIZATION), )
|
|
$1_OPTIMIZATION := LOW
|
|
endif
|
|
|
|
ifneq ($$($1_NO_JAVA_MS), true)
|
|
# The norm is to append -ms8m, unless otherwise instructed.
|
|
$1_JAVA_ARGS += -ms8m
|
|
endif
|
|
|
|
ifeq ($$($1_MAIN_MODULE), )
|
|
$1_MAIN_MODULE := $(MODULE)
|
|
endif
|
|
|
|
ifneq ($$($1_JAVA_ARGS), )
|
|
$1_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \
|
|
$$(addprefix -J, $$($1_JAVA_ARGS)) -m $$($1_MAIN_MODULE)/$$($1_MAIN_CLASS), "$$a"$(COMMA) )) }'
|
|
$1_CFLAGS += -DJAVA_ARGS=$$($1_JAVA_ARGS_STR)
|
|
endif
|
|
|
|
$1_LIBS :=
|
|
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
|
ifeq ($$($1_MACOSX_SIGNED), true)
|
|
$1_PLIST_FILE := Info-privileged.plist
|
|
$1_CODESIGN := true
|
|
else
|
|
$1_PLIST_FILE := Info-cmdline.plist
|
|
endif
|
|
|
|
$1_CFLAGS += -DPACKAGE_PATH='"$(PACKAGE_PATH)"'
|
|
$1_LDFLAGS += -Wl,-all_load \
|
|
-sectcreate __TEXT __info_plist $(MACOSX_PLIST_DIR)/$$($1_PLIST_FILE)
|
|
ifeq ($(STATIC_BUILD), true)
|
|
$1_LDFLAGS += -exported_symbols_list \
|
|
$(SUPPORT_OUTPUTDIR)/build-static/exported.symbols
|
|
$1_LIBS += \
|
|
$$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/java.base -name "*.a") \
|
|
$(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libdt_socket.a \
|
|
$(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libjdwp.a \
|
|
$(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) \
|
|
-framework CoreFoundation \
|
|
-framework Foundation \
|
|
-framework SystemConfiguration \
|
|
-lstdc++ -liconv
|
|
else
|
|
$1_LIBS += $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
|
|
endif
|
|
$1_LIBS += -framework Cocoa -framework Security \
|
|
-framework ApplicationServices
|
|
endif
|
|
|
|
ifeq ($(OPENJDK_TARGET_OS), aix)
|
|
$1_LDFLAGS += -L$(SUPPORT_OUTPUTDIR)/native/java.base
|
|
$1_LIBS += -ljli_static
|
|
endif
|
|
|
|
ifeq ($(USE_EXTERNAL_LIBZ), true)
|
|
$1_LIBS += -lz
|
|
endif
|
|
|
|
ifeq ($$($1_WINDOWS_STATIC_LINK), true)
|
|
$1_CFLAGS += $(filter-out -MD, $(CFLAGS_JDKEXE))
|
|
$1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/jli_static.lib
|
|
else
|
|
$1_CFLAGS += $(CFLAGS_JDKEXE)
|
|
$1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib
|
|
endif
|
|
|
|
# The linker on older SuSE distros (e.g. on SLES 10) complains with:
|
|
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
|
|
# if feeded with a version script which contains named tags.
|
|
ifeq ($(USING_BROKEN_SUSE_LD),yes)
|
|
ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous), )
|
|
$1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous
|
|
else
|
|
$1_MAPFILE :=
|
|
endif
|
|
else
|
|
ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)), )
|
|
$1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)
|
|
else
|
|
$1_MAPFILE :=
|
|
endif
|
|
endif
|
|
|
|
$$(eval $$(call SetupNativeCompilation, BUILD_LAUNCHER_$1, \
|
|
EXTRA_FILES := $(LAUNCHER_SRC)/main.c, \
|
|
OPTIMIZATION := $$($1_OPTIMIZATION), \
|
|
CFLAGS := $$($1_CFLAGS) \
|
|
$(LAUNCHER_CFLAGS) \
|
|
$(VERSION_CFLAGS) \
|
|
-DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
|
|
-DPROGNAME='"$1"' \
|
|
$$($1_CFLAGS), \
|
|
CFLAGS_linux := -fPIC, \
|
|
CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \
|
|
CFLAGS_windows := $$($1_CFLAGS_windows), \
|
|
LDFLAGS := $$(LDFLAGS_JDKEXE) \
|
|
$$(ORIGIN_ARG) \
|
|
$$($1_LDFLAGS), \
|
|
LDFLAGS_linux := \
|
|
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli, \
|
|
LDFLAGS_solaris := $$($1_LDFLAGS_solaris) \
|
|
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli, \
|
|
MAPFILE := $$($1_MAPFILE), \
|
|
LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \
|
|
LIBS_unix := $$($1_LIBS_unix), \
|
|
LIBS_linux := -lpthread -ljli $(LIBDL) -lc, \
|
|
LIBS_solaris := -ljli -lthread $(LIBDL) -lc, \
|
|
LIBS_windows := $$($1_WINDOWS_JLI_LIB) \
|
|
$(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib \
|
|
$$($1_LIBS_windows), \
|
|
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs, \
|
|
OUTPUT_DIR := $$($1_OUTPUT_DIR), \
|
|
PROGRAM := $1, \
|
|
VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \
|
|
RC_FLAGS := $$(RC_FLAGS) \
|
|
-D "JDK_FNAME=$1$(EXE_SUFFIX)" \
|
|
-D "JDK_INTERNAL_NAME=$1" \
|
|
-D "JDK_FTYPE=0x1L" \
|
|
$$($1_RC_FLAGS), \
|
|
MANIFEST := $(JAVA_MANIFEST), \
|
|
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
|
|
CODESIGN := $$($1_CODESIGN), \
|
|
))
|
|
|
|
$1 += $$(BUILD_LAUNCHER_$1)
|
|
TARGETS += $$($1)
|
|
|
|
ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix))
|
|
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
|
|
endif
|
|
|
|
ifeq ($(OPENJDK_TARGET_OS), windows)
|
|
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \
|
|
$$($1_WINDOWS_JLI_LIB)
|
|
endif
|
|
endef
|