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