author | sla |
Thu, 30 Apr 2015 09:50:10 +0200 | |
changeset 30661 | 0685e2924fc6 |
parent 27953 | 03e0e3891572 |
child 29925 | 6d47adfc6b47 |
permissions | -rw-r--r-- |
25859 | 1 |
# |
2 |
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. |
|
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 |
||
26 |
include NativeCompilation.gmk |
|
27 |
||
28 |
# Prepare the find cache. |
|
29 |
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher)) |
|
30 |
||
31 |
# Build tools |
|
32 |
include Tools.gmk |
|
33 |
||
34 |
# When building a legacy overlay image (on solaris 64 bit), the launchers |
|
35 |
# need to be built with a different rpath and a different output dir. |
|
36 |
ifeq ($(OVERLAY_IMAGES), true) |
|
37 |
ORIGIN_ROOT := /../.. |
|
38 |
OUTPUT_SUBDIR := $(OPENJDK_TARGET_CPU_ISADIR) |
|
39 |
else |
|
40 |
ORIGIN_ROOT := /.. |
|
41 |
endif |
|
42 |
||
43 |
ifeq ($(OPENJDK_TARGET_OS), macosx) |
|
44 |
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN) |
|
45 |
else |
|
46 |
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli) |
|
47 |
endif |
|
48 |
||
49 |
# |
|
50 |
# Applications expect to be able to link against libjawt without invoking |
|
51 |
# System.loadLibrary("jawt") first. This was the behaviour described in the |
|
52 |
# devloper documentation of JAWT and what worked with OpenJDK6. |
|
53 |
# |
|
54 |
ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), ) |
|
55 |
ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)) |
|
56 |
endif |
|
57 |
||
58 |
LAUNCHER_SRC := $(JDK_TOPDIR)/src/java.base/share/native/launcher |
|
59 |
LAUNCHER_CFLAGS := -I$(JDK_TOPDIR)/src/java.base/share/native/launcher \ |
|
60 |
-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
|
61 |
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \ |
25859 | 62 |
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \ |
63 |
# |
|
64 |
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc |
|
65 |
JAVA_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.rc |
|
66 |
MACOSX_PLIST_DIR := $(JDK_TOPDIR)/src/java.base/macosx/native/launcher |
|
67 |
# Until the shuffle is permanent, we can't add this in configure |
|
68 |
CFLAGS_JDKEXE := $(filter-out %javavm/export, $(CFLAGS_JDKEXE)) |
|
69 |
CFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \ |
|
27736
8c9bd4be4a86
8058631: Rename posix to unix in build system to match file name changes
ihse
parents:
25859
diff
changeset
|
70 |
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include |
25859 | 71 |
CXXFLAGS_JDKEXE := $(filter-out %javavm/export, $(CXXFLAGS_JDKEXE)) |
72 |
CXXFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \ |
|
27736
8c9bd4be4a86
8058631: Rename posix to unix in build system to match file name changes
ihse
parents:
25859
diff
changeset
|
73 |
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include |
25859 | 74 |
JAVA_MANIFEST := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.manifest |
75 |
||
76 |
define SetupLauncher |
|
77 |
# TODO: Fix mapfile on solaris. Won't work with ld as linker. |
|
78 |
# Parameter 1 is the name of the launcher (java, javac, jar...) |
|
79 |
# Parameter 2 is extra CFLAGS |
|
80 |
# Parameter 3 is extra LDFLAGS |
|
27736
8c9bd4be4a86
8058631: Rename posix to unix in build system to match file name changes
ihse
parents:
25859
diff
changeset
|
81 |
# Parameter 4 is extra LDFLAGS_SUFFIX_unix |
25859 | 82 |
# Parameter 5 is extra LDFLAGS_SUFFIX_windows |
83 |
# Parameter 6 is optional Windows JLI library (full path) |
|
84 |
# Parameter 7 is optional Windows resource (RC) flags |
|
85 |
# Parameter 8 is optional Windows version resource file (.rc) |
|
86 |
# Parameter 9 is different output dir |
|
87 |
# Parameter 10 if set, link statically with c runtime on windows. |
|
88 |
# Parameter 11 if set, override plist file on macosx. |
|
89 |
$(call LogSetupMacroEntry,SetupLauncher($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11)) |
|
90 |
$(if $(13),$(error Internal makefile error: Too many arguments to SetupLauncher, please update CompileLaunchers.gmk)) |
|
91 |
||
27565 | 92 |
$1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib |
25859 | 93 |
ifneq ($6, ) |
94 |
$1_WINDOWS_JLI_LIB := $6 |
|
95 |
endif |
|
96 |
$1_VERSION_INFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE) |
|
97 |
ifneq ($8, ) |
|
98 |
$1_VERSION_INFO_RESOURCE := $8 |
|
99 |
endif |
|
100 |
||
101 |
$1_LDFLAGS := $3 |
|
102 |
$1_LDFLAGS_SUFFIX := |
|
103 |
ifeq ($(OPENJDK_TARGET_OS), macosx) |
|
104 |
$1_PLIST_FILE := Info-cmdline.plist |
|
105 |
ifneq ($(11), ) |
|
106 |
$1_PLIST_FILE := $(11) |
|
107 |
ifneq ($$(findstring privileged, $$($1_PLIST_FILE)), ) |
|
108 |
$1_CODESIGN := true |
|
109 |
endif |
|
110 |
endif |
|
111 |
||
27565 | 112 |
$1_LDFLAGS += -Wl,-all_load $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a \ |
25859 | 113 |
-framework Cocoa -framework Security -framework ApplicationServices \ |
114 |
-sectcreate __TEXT __info_plist $(MACOSX_PLIST_DIR)/$$($1_PLIST_FILE) |
|
115 |
$1_LDFLAGS_SUFFIX += -pthread |
|
116 |
endif |
|
117 |
||
118 |
ifeq ($(OPENJDK_TARGET_OS), aix) |
|
27953
03e0e3891572
8066589: Make importing sa-jdi.jar optional on its existance
simonis
parents:
27799
diff
changeset
|
119 |
$1_LDFLAGS_SUFFIX += -L$(SUPPORT_OUTPUTDIR)/native/java.base -ljli_static |
25859 | 120 |
endif |
121 |
||
122 |
ifeq ($(USE_EXTERNAL_LIBZ), true) |
|
123 |
$1_LDFLAGS_SUFFIX += -lz |
|
124 |
endif |
|
125 |
||
126 |
$1_OUTPUT_DIR_ARG := $9 |
|
127 |
ifeq (, $$($1_OUTPUT_DIR_ARG)) |
|
27565 | 128 |
$1_OUTPUT_DIR_ARG := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE) |
25859 | 129 |
endif |
130 |
||
131 |
# TODO: maybe it's better to move this if-statement out of this function |
|
132 |
ifeq ($1, java) |
|
133 |
$1_OPTIMIZATION_ARG := HIGH |
|
134 |
$1_LDFLAGS_solaris := -R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR) |
|
135 |
else |
|
136 |
$1_OPTIMIZATION_ARG := LOW |
|
137 |
endif |
|
138 |
||
139 |
$1_CFLAGS := $(CFLAGS_JDKEXE) |
|
140 |
ifeq ($(10), true) |
|
141 |
$1_CFLAGS := $(filter-out -MD, $(CFLAGS_JDKEXE)) |
|
142 |
endif |
|
143 |
||
144 |
# The linker on older SuSE distros (e.g. on SLES 10) complains with: |
|
145 |
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable." |
|
146 |
# if feeded with a version script which contains named tags. |
|
147 |
ifeq ($(USING_BROKEN_SUSE_LD),yes) |
|
148 |
ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous), ) |
|
149 |
$1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous |
|
150 |
else |
|
151 |
$1_MAPFILE := |
|
152 |
endif |
|
153 |
else |
|
154 |
ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)), ) |
|
155 |
$1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU) |
|
156 |
else |
|
157 |
$1_MAPFILE := |
|
158 |
endif |
|
159 |
endif |
|
160 |
||
161 |
$(call SetupNativeCompilation,BUILD_LAUNCHER_$1, \ |
|
162 |
SRC := $(LAUNCHER_SRC), \ |
|
163 |
INCLUDE_FILES := main.c, \ |
|
164 |
LANG := C, \ |
|
165 |
OPTIMIZATION := $$($1_OPTIMIZATION_ARG), \ |
|
166 |
CFLAGS := $$($1_CFLAGS) \ |
|
167 |
$(LAUNCHER_CFLAGS) \ |
|
168 |
-DFULL_VERSION='"$(FULL_VERSION)"' \ |
|
169 |
-DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \ |
|
170 |
-DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \ |
|
171 |
-DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \ |
|
172 |
-DPROGNAME='"$1"' $(DPACKAGEPATH) \ |
|
173 |
$2, \ |
|
174 |
CFLAGS_linux := -fPIC, \ |
|
175 |
CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \ |
|
176 |
LDFLAGS := $(LDFLAGS_JDKEXE) \ |
|
177 |
$(ORIGIN_ARG) \ |
|
178 |
$$($1_LDFLAGS), \ |
|
179 |
LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_NAME,$1), \ |
|
180 |
LDFLAGS_linux := -lpthread \ |
|
181 |
$(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \ |
|
182 |
LDFLAGS_solaris := $$($1_LDFLAGS_solaris) \ |
|
183 |
$(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \ |
|
184 |
MAPFILE := $$($1_MAPFILE), \ |
|
185 |
LDFLAGS_SUFFIX := $(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX), \ |
|
27736
8c9bd4be4a86
8058631: Rename posix to unix in build system to match file name changes
ihse
parents:
25859
diff
changeset
|
186 |
LDFLAGS_SUFFIX_unix := $4, \ |
25859 | 187 |
LDFLAGS_SUFFIX_windows := $$($1_WINDOWS_JLI_LIB) \ |
27565 | 188 |
$(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib $5, \ |
189 |
LDFLAGS_SUFFIX_linux := -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \ |
|
190 |
LDFLAGS_SUFFIX_solaris := -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli -lthread $(LIBDL) -lc, \ |
|
191 |
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs$(OUTPUT_SUBDIR), \ |
|
25859 | 192 |
OUTPUT_DIR := $$($1_OUTPUT_DIR_ARG)$(OUTPUT_SUBDIR), \ |
193 |
PROGRAM := $1, \ |
|
194 |
DEBUG_SYMBOLS := true, \ |
|
195 |
VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \ |
|
196 |
RC_FLAGS := $(RC_FLAGS) \ |
|
197 |
-D "JDK_FNAME=$1$(EXE_SUFFIX)" \ |
|
198 |
-D "JDK_INTERNAL_NAME=$1" \ |
|
199 |
-D "JDK_FTYPE=0x1L" \ |
|
200 |
$7, \ |
|
201 |
MANIFEST := $(JAVA_MANIFEST), \ |
|
202 |
CODESIGN := $$($1_CODESIGN)) |
|
203 |
||
27565 | 204 |
TARGETS += $$(BUILD_LAUNCHER_$1) |
25859 | 205 |
|
206 |
ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix)) |
|
27565 | 207 |
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a |
25859 | 208 |
endif |
209 |
||
210 |
ifeq ($(OPENJDK_TARGET_OS), windows) |
|
27565 | 211 |
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \ |
25859 | 212 |
$$($1_WINDOWS_JLI_LIB) |
213 |
endif |
|
214 |
endef |
|
215 |
||
216 |
########################################################################################## |
|
217 |
||
218 |
XLIBS := $(X_LIBS) -lX11 |
|
219 |
ifeq ($(OPENJDK_TARGET_OS), macosx) |
|
220 |
DPACKAGEPATH := -DPACKAGE_PATH='"$(PACKAGE_PATH)"' |
|
221 |
XLIBS := |
|
222 |
endif |
|
223 |
||
224 |
JAVA_RC_FLAGS += -i $(JDK_TOPDIR)/src/java.base/windows/native/common |
|
225 |
ifdef OPENJDK |
|
226 |
JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/java.base/windows/native/launcher/icons" |
|
227 |
else |
|
228 |
JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons" |
|
229 |
endif |