author | erikj |
Tue, 02 Oct 2018 17:16:01 -0700 | |
branch | ihse-runtestprebuilt-branch |
changeset 56917 | e3334aaef781 |
parent 51855 | 8bbb5cbac92c |
child 52022 | 804792ce736f |
permissions | -rw-r--r-- |
25859 | 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 | 3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
# |
|
5 |
# This code is free software; you can redistribute it and/or modify it |
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
|
7 |
# published by the Free Software Foundation. Oracle designates this |
|
8 |
# particular file as subject to the "Classpath" exception as provided |
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
|
10 |
# |
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
# accompanied this code). |
|
16 |
# |
|
17 |
# You should have received a copy of the GNU General Public License version |
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
# |
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
# or visit www.oracle.com if you need additional information or have any |
|
23 |
# questions. |
|
24 |
# |
|
25 |
||
49244
995a5556edfa
8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
49241
diff
changeset
|
26 |
include JdkNativeCompilation.gmk |
25859 | 27 |
|
49534 | 28 |
# Tell the compiler not to export any functions unless declared so in |
29 |
# the source code. On Windows, this is the default and cannot be changed. |
|
30 |
# On Mac, we have always exported all symbols, probably due to oversight |
|
31 |
# and/or misunderstanding. To emulate this, don't hide any symbols |
|
32 |
# by default. |
|
50126
98f57dff16f3
8202322: AIX: symbol visibility flags not support on xlc 12.1
mbaesken
parents:
49534
diff
changeset
|
33 |
# On AIX/xlc we need at least xlc 13.1 for the symbol hiding |
49534 | 34 |
# Also provide an override for non-conformant libraries. |
35 |
ifeq ($(TOOLCHAIN_TYPE), gcc) |
|
36 |
LAUNCHER_CFLAGS += -fvisibility=hidden |
|
37 |
LDFLAGS_JDKEXE += -Wl,--exclude-libs,ALL |
|
38 |
else ifeq ($(TOOLCHAIN_TYPE), clang) |
|
51855 | 39 |
LAUNCHER_CFLAGS += -fvisibility=hidden |
49534 | 40 |
else ifeq ($(TOOLCHAIN_TYPE), solstudio) |
41 |
LAUNCHER_CFLAGS += -xldscope=hidden |
|
42 |
else ifeq ($(TOOLCHAIN_TYPE), xlc) |
|
50126
98f57dff16f3
8202322: AIX: symbol visibility flags not support on xlc 12.1
mbaesken
parents:
49534
diff
changeset
|
43 |
ifneq ($(CC_VERSION_NUMBER), 12.1) |
98f57dff16f3
8202322: AIX: symbol visibility flags not support on xlc 12.1
mbaesken
parents:
49534
diff
changeset
|
44 |
CXXFLAGS_JDKEXE += -qvisibility=hidden |
98f57dff16f3
8202322: AIX: symbol visibility flags not support on xlc 12.1
mbaesken
parents:
49534
diff
changeset
|
45 |
endif |
49534 | 46 |
endif |
47 |
||
47217 | 48 |
LAUNCHER_SRC := $(TOPDIR)/src/java.base/share/native/launcher |
49534 | 49 |
LAUNCHER_CFLAGS += -I$(TOPDIR)/src/java.base/share/native/launcher \ |
47217 | 50 |
-I$(TOPDIR)/src/java.base/share/native/libjli \ |
51 |
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \ |
|
52 |
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \ |
|
25859 | 53 |
# |
47217 | 54 |
GLOBAL_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/common/version.rc |
55 |
JAVA_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/launcher/java.rc |
|
56 |
MACOSX_PLIST_DIR := $(TOPDIR)/src/java.base/macosx/native/launcher |
|
57 |
JAVA_MANIFEST := $(TOPDIR)/src/java.base/windows/native/launcher/java.manifest |
|
25859 | 58 |
|
33523 | 59 |
################################################################################ |
60 |
# Build standard launcher. |
|
25859 | 61 |
|
33523 | 62 |
# Setup make rules for building a standard launcher. |
63 |
# |
|
64 |
# Parameter 1 is the name of the rule. This name is used as variable prefix, |
|
65 |
# and the targets generated are listed in a variable by that name. It is also |
|
66 |
# used as the name of the executable. |
|
67 |
# |
|
68 |
# Remaining parameters are named arguments. These include: |
|
36511 | 69 |
# MAIN_MODULE The module of the main class to launch if different from the |
70 |
# current module |
|
33523 | 71 |
# MAIN_CLASS The Java main class to launch |
45463
d9325138bac6
8180334: Unable to build jaotc launcher on windows
ksrini
parents:
42753
diff
changeset
|
72 |
# 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
|
73 |
# 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
|
74 |
# 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
|
75 |
# compile time defines exceeding Visual Studio 2013 limitations. |
33523 | 76 |
# CFLAGS Additional CFLAGS |
77 |
# CFLAGS_windows Additional CFLAGS_windows |
|
78 |
# LDFLAGS_solaris Additional LDFLAGS_solaris |
|
79 |
# RC_FLAGS Additional RC_FLAGS |
|
80 |
# MACOSX_SIGNED On macosx, sign this binary |
|
81 |
# OPTIMIZATION Override default optimization level (LOW) |
|
82 |
# OUTPUT_DIR Override default output directory |
|
83 |
# VERSION_INFO_RESOURCE Override default Windows resource file |
|
84 |
SetupBuildLauncher = $(NamedParamsMacroTemplate) |
|
85 |
define SetupBuildLauncherBody |
|
86 |
# Setup default values (unless overridden) |
|
87 |
ifeq ($$($1_OPTIMIZATION), ) |
|
88 |
$1_OPTIMIZATION := LOW |
|
89 |
endif |
|
90 |
||
36511 | 91 |
ifeq ($$($1_MAIN_MODULE), ) |
92 |
$1_MAIN_MODULE := $(MODULE) |
|
93 |
endif |
|
94 |
||
51808 | 95 |
$1_JAVA_ARGS += -ms8m |
96 |
ifneq ($$($1_MAIN_CLASS), ) |
|
97 |
$1_LAUNCHER_CLASS := -m $$($1_MAIN_MODULE)/$$($1_MAIN_CLASS) |
|
33523 | 98 |
endif |
99 |
||
51808 | 100 |
ifneq ($$($1_EXTRA_JAVA_ARGS), ) |
101 |
$1_EXTRA_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \ |
|
102 |
$$(addprefix -J, $$($1_EXTRA_JAVA_ARGS)), "$$a"$(COMMA) )) }' |
|
103 |
$1_CFLAGS += -DEXTRA_JAVA_ARGS=$$($1_EXTRA_JAVA_ARGS_STR) |
|
104 |
endif |
|
105 |
$1_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \ |
|
106 |
$$(addprefix -J, $$($1_JAVA_ARGS)) $$($1_LAUNCHER_CLASS), "$$a"$(COMMA) )) }' |
|
107 |
$1_CFLAGS += -DJAVA_ARGS=$$($1_JAVA_ARGS_STR) |
|
108 |
||
25859 | 109 |
ifeq ($(OPENJDK_TARGET_OS), macosx) |
33523 | 110 |
ifeq ($$($1_MACOSX_SIGNED), true) |
111 |
$1_PLIST_FILE := Info-privileged.plist |
|
25859 | 112 |
$1_CODESIGN := true |
33523 | 113 |
else |
114 |
$1_PLIST_FILE := Info-cmdline.plist |
|
25859 | 115 |
endif |
116 |
||
51825
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
117 |
$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
|
118 |
|
33653
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
32515
diff
changeset
|
119 |
ifeq ($(STATIC_BUILD), true) |
33666 | 120 |
$1_LDFLAGS += -exported_symbols_list \ |
121 |
$(SUPPORT_OUTPUTDIR)/build-static/exported.symbols |
|
122 |
$1_LIBS += \ |
|
35241 | 123 |
$$(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
|
124 |
$(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
|
125 |
$(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
|
126 |
$(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
|
127 |
-framework CoreFoundation \ |
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
32515
diff
changeset
|
128 |
-framework Foundation \ |
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
32515
diff
changeset
|
129 |
-framework SystemConfiguration \ |
33666 | 130 |
-lstdc++ -liconv |
33653
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
32515
diff
changeset
|
131 |
endif |
25859 | 132 |
endif |
133 |
||
134 |
ifeq ($(USE_EXTERNAL_LIBZ), true) |
|
33406 | 135 |
$1_LIBS += -lz |
25859 | 136 |
endif |
137 |
||
51808 | 138 |
$1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib |
25859 | 139 |
|
49244
995a5556edfa
8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
49241
diff
changeset
|
140 |
$$(eval $$(call SetupJdkExecutable, BUILD_LAUNCHER_$1, \ |
49070
d7859531621b
8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents:
47217
diff
changeset
|
141 |
NAME := $1, \ |
35241 | 142 |
EXTRA_FILES := $(LAUNCHER_SRC)/main.c, \ |
33523 | 143 |
OPTIMIZATION := $$($1_OPTIMIZATION), \ |
51808 | 144 |
CFLAGS := $$(CFLAGS_JDKEXE) $$($1_CFLAGS) \ |
25859 | 145 |
$(LAUNCHER_CFLAGS) \ |
33984
2333676816eb
8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents:
29931
diff
changeset
|
146 |
$(VERSION_CFLAGS) \ |
25859 | 147 |
-DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \ |
33523 | 148 |
-DPROGNAME='"$1"' \ |
149 |
$$($1_CFLAGS), \ |
|
25859 | 150 |
CFLAGS_linux := -fPIC, \ |
151 |
CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \ |
|
33523 | 152 |
CFLAGS_windows := $$($1_CFLAGS_windows), \ |
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51825
diff
changeset
|
153 |
DISABLED_WARNINGS_gcc := unused-function, \ |
34695
7a6cc9982d22
8142907: Integration of minor fixes from the build-infra project
ihse
parents:
34389
diff
changeset
|
154 |
LDFLAGS := $$(LDFLAGS_JDKEXE) \ |
51825
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
155 |
$$(call SET_EXECUTABLE_ORIGIN) \ |
25859 | 156 |
$$($1_LDFLAGS), \ |
51825
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
157 |
LDFLAGS_linux := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
158 |
-L$(call FindLibDirForModule, java.base), \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
159 |
LDFLAGS_macosx := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
160 |
-L$(call FindLibDirForModule, java.base), \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
161 |
LDFLAGS_solaris := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
162 |
-L$(call FindLibDirForModule, java.base), \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
163 |
LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \ |
33406 | 164 |
LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \ |
51825
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
165 |
LIBS_linux := -ljli -lpthread $(LIBDL), \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
166 |
LIBS_macosx := -ljli -framework Cocoa -framework Security \ |
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
167 |
-framework ApplicationServices, \ |
49241 | 168 |
LIBS_solaris := -ljli -lthread $(LIBDL), \ |
51825
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
169 |
LIBS_aix := -ljli_static, \ |
33406 | 170 |
LIBS_windows := $$($1_WINDOWS_JLI_LIB) \ |
51825
e3632b4706c4
8210931: JLI and launchers normalization and cleanup
ihse
parents:
51811
diff
changeset
|
171 |
$(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib, \ |
33523 | 172 |
OUTPUT_DIR := $$($1_OUTPUT_DIR), \ |
25859 | 173 |
VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \ |
49244
995a5556edfa
8199639: Introduce SetupJdkLibrary and SetupJdkExecutable
ihse
parents:
49241
diff
changeset
|
174 |
EXTRA_RC_FLAGS := $$($1_EXTRA_RC_FLAGS), \ |
25859 | 175 |
MANIFEST := $(JAVA_MANIFEST), \ |
33984
2333676816eb
8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents:
29931
diff
changeset
|
176 |
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \ |
29925
6d47adfc6b47
8077847: Better handling of Windows executable manifest version
ihse
parents:
27953
diff
changeset
|
177 |
CODESIGN := $$($1_CODESIGN), \ |
33523 | 178 |
)) |
25859 | 179 |
|
33523 | 180 |
$1 += $$(BUILD_LAUNCHER_$1) |
181 |
TARGETS += $$($1) |
|
25859 | 182 |
|
51783 | 183 |
ifeq ($(OPENJDK_TARGET_OS), aix) |
27565 | 184 |
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a |
25859 | 185 |
endif |
186 |
||
187 |
ifeq ($(OPENJDK_TARGET_OS), windows) |
|
27565 | 188 |
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \ |
25859 | 189 |
$$($1_WINDOWS_JLI_LIB) |
190 |
endif |
|
191 |
endef |