Wed, 14 Oct 2020 17:44:48 +0800
Merge
1 #
2 # Copyright (c) 2006, 2013, 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.
8 #
9 # This code is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # version 2 for more details (a copy is included in the LICENSE file that
13 # accompanied this code).
14 #
15 # You should have received a copy of the GNU General Public License version
16 # 2 along with this work; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 #
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 # or visit www.oracle.com if you need additional information or have any
21 # questions.
22 #
23 #
25 # The common definitions for hotspot bsd builds.
26 # Include the top level defs.make under make directory instead of this one.
27 # This file is included into make/defs.make.
29 SLASH_JAVA ?= /java
31 # Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name
32 ARCH:=$(shell uname -m)
33 PATH_SEP = :
34 ifeq ($(LP64), 1)
35 ARCH_DATA_MODEL ?= 64
36 else
37 ARCH_DATA_MODEL ?= 32
38 endif
40 # zero
41 ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
42 ifeq ($(ARCH_DATA_MODEL), 64)
43 MAKE_ARGS += LP64=1
44 endif
45 PLATFORM = bsd-zero
46 VM_PLATFORM = bsd_$(subst i386,i486,$(ZERO_LIBARCH))
47 HS_ARCH = zero
48 ARCH = zero
49 endif
51 # ia64
52 ifeq ($(ARCH), ia64)
53 ARCH_DATA_MODEL = 64
54 MAKE_ARGS += LP64=1
55 PLATFORM = bsd-ia64
56 VM_PLATFORM = bsd_ia64
57 HS_ARCH = ia64
58 endif
60 # sparc
61 ifeq ($(ARCH), sparc64)
62 ifeq ($(ARCH_DATA_MODEL), 64)
63 ARCH_DATA_MODEL = 64
64 MAKE_ARGS += LP64=1
65 PLATFORM = bsd-sparcv9
66 VM_PLATFORM = bsd_sparcv9
67 else
68 ARCH_DATA_MODEL = 32
69 PLATFORM = bsd-sparc
70 VM_PLATFORM = bsd_sparc
71 endif
72 HS_ARCH = sparc
73 endif
75 # amd64
76 ifneq (,$(findstring $(ARCH), amd64 x86_64))
77 ifeq ($(ARCH_DATA_MODEL), 64)
78 ARCH_DATA_MODEL = 64
79 MAKE_ARGS += LP64=1
80 PLATFORM = bsd-amd64
81 VM_PLATFORM = bsd_amd64
82 HS_ARCH = x86
83 else
84 ARCH_DATA_MODEL = 32
85 PLATFORM = bsd-i586
86 VM_PLATFORM = bsd_i486
87 HS_ARCH = x86
88 # We have to reset ARCH to i386 since SRCARCH relies on it
89 ARCH = i386
90 endif
91 endif
93 # i386
94 ifeq ($(ARCH), i386)
95 ifeq ($(ARCH_DATA_MODEL), 64)
96 ARCH_DATA_MODEL = 64
97 MAKE_ARGS += LP64=1
98 PLATFORM = bsd-amd64
99 VM_PLATFORM = bsd_amd64
100 HS_ARCH = x86
101 # We have to reset ARCH to amd64 since SRCARCH relies on it
102 ARCH = amd64
103 else
104 ARCH_DATA_MODEL = 32
105 PLATFORM = bsd-i586
106 VM_PLATFORM = bsd_i486
107 HS_ARCH = x86
108 endif
109 endif
111 # ARM
112 ifeq ($(ARCH), arm)
113 ARCH_DATA_MODEL = 32
114 PLATFORM = bsd-arm
115 VM_PLATFORM = bsd_arm
116 HS_ARCH = arm
117 endif
119 # PPC
120 ifeq ($(ARCH), ppc)
121 ARCH_DATA_MODEL = 32
122 PLATFORM = bsd-ppc
123 VM_PLATFORM = bsd_ppc
124 HS_ARCH = ppc
125 endif
127 # On 32 bit bsd we build server and client, on 64 bit just server.
128 ifeq ($(JVM_VARIANTS),)
129 ifeq ($(ARCH_DATA_MODEL), 32)
130 JVM_VARIANTS:=client,server
131 JVM_VARIANT_CLIENT:=true
132 JVM_VARIANT_SERVER:=true
133 else
134 JVM_VARIANTS:=server
135 JVM_VARIANT_SERVER:=true
136 endif
137 endif
139 OS_VENDOR:=$(shell uname -s)
141 # determine if HotSpot is being built in JDK6 or earlier version
142 JDK6_OR_EARLIER=0
143 ifeq "$(shell expr \( '$(JDK_MAJOR_VERSION)' != '' \& '$(JDK_MINOR_VERSION)' != '' \& '$(JDK_MICRO_VERSION)' != '' \))" "1"
144 # if the longer variable names (newer build style) are set, then check those
145 ifeq "$(shell expr \( $(JDK_MAJOR_VERSION) = 1 \& $(JDK_MINOR_VERSION) \< 7 \))" "1"
146 JDK6_OR_EARLIER=1
147 endif
148 else
149 # the longer variables aren't set so check the shorter variable names
150 ifeq "$(shell expr \( '$(JDK_MAJOR_VER)' = 1 \& '$(JDK_MINOR_VER)' \< 7 \))" "1"
151 JDK6_OR_EARLIER=1
152 endif
153 endif
155 ifeq ($(JDK6_OR_EARLIER),0)
156 # Full Debug Symbols is supported on JDK7 or newer.
157 # The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product
158 # builds is enabled with debug info files ZIP'ed to save space. For
159 # BUILD_FLAVOR != product builds, FDS is always enabled, after all a
160 # debug build without debug info isn't very useful.
161 # The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled.
162 #
163 # If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be
164 # disabled for a BUILD_FLAVOR == product build.
165 #
166 # Note: Use of a different variable name for the FDS override option
167 # versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS
168 # versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass
169 # in options via environment variables, use of distinct variables
170 # prevents strange behaviours. For example, in a BUILD_FLAVOR !=
171 # product build, the FULL_DEBUG_SYMBOLS environment variable will be
172 # 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If
173 # the same variable name is used, then different values can be picked
174 # up by different parts of the build. Just to be clear, we only need
175 # two variable names because the incoming option value can be
176 # overridden in some situations, e.g., a BUILD_FLAVOR != product
177 # build.
179 # Due to the multiple sub-make processes that occur this logic gets
180 # executed multiple times. We reduce the noise by at least checking that
181 # BUILD_FLAVOR has been set.
182 ifneq ($(BUILD_FLAVOR),)
183 ifeq ($(BUILD_FLAVOR), product)
184 FULL_DEBUG_SYMBOLS ?= 1
185 ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS)
186 else
187 # debug variants always get Full Debug Symbols (if available)
188 ENABLE_FULL_DEBUG_SYMBOLS = 1
189 endif
190 _JUNK_ := $(shell \
191 echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
192 # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
194 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
195 ifeq ($(OS_VENDOR), Darwin)
196 # MacOS X doesn't use OBJCOPY or STRIP_POLICY
197 OBJCOPY=
198 STRIP_POLICY=
199 ZIP_DEBUGINFO_FILES ?= 1
200 else
201 # Default OBJCOPY comes from GNU Binutils on BSD
202 ifeq ($(CROSS_COMPILE_ARCH),)
203 DEF_OBJCOPY=/usr/bin/objcopy
204 else
205 # Assume objcopy is part of the cross-compilation toolset
206 ifneq ($(ALT_COMPILER_PATH),)
207 DEF_OBJCOPY=$(ALT_COMPILER_PATH)/objcopy
208 endif
209 endif
210 OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
211 ifneq ($(ALT_OBJCOPY),)
212 _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
213 OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
214 endif
216 ifeq ($(OBJCOPY),)
217 _JUNK_ := $(shell \
218 echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo" \
219 "files. You may need to set ALT_OBJCOPY.")
220 ENABLE_FULL_DEBUG_SYMBOLS=0
221 _JUNK_ := $(shell \
222 echo >&2 "INFO:" \
223 "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
224 else
225 _JUNK_ := $(shell \
226 echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo" \
227 "files.")
229 # Library stripping policies for .debuginfo configs:
230 # all_strip - strips everything from the library
231 # min_strip - strips most stuff from the library; leaves
232 # minimum symbols
233 # no_strip - does not strip the library at all
234 #
235 # Oracle security policy requires "all_strip". A waiver was
236 # granted on 2011.09.01 that permits using "min_strip" in the
237 # Java JDK and Java JRE.
238 #
239 # Currently, STRIP_POLICY is only used when Full Debug Symbols
240 # is enabled.
241 #
242 STRIP_POLICY ?= min_strip
244 _JUNK_ := $(shell \
245 echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
247 ZIP_DEBUGINFO_FILES ?= 1
248 endif
250 _JUNK_ := $(shell \
251 echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
252 endif
253 endif # ENABLE_FULL_DEBUG_SYMBOLS=1
254 endif # BUILD_FLAVOR
255 endif # JDK_6_OR_EARLIER
257 JDK_INCLUDE_SUBDIR=bsd
259 # Library suffix
260 ifeq ($(OS_VENDOR),Darwin)
261 LIBRARY_SUFFIX=dylib
262 else
263 LIBRARY_SUFFIX=so
264 endif
266 EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html
268 # client and server subdirectories have symbolic links to ../libjsig.so
269 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
271 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
272 ifeq ($(ZIP_DEBUGINFO_FILES),1)
273 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.diz
274 else
275 ifeq ($(OS_VENDOR), Darwin)
276 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX).dSYM
277 else
278 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo
279 endif
280 endif
281 endif
283 EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
284 EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
285 EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal
287 ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
288 EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
289 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
291 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
292 ifeq ($(ZIP_DEBUGINFO_FILES),1)
293 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz
294 else
295 ifeq ($(OS_VENDOR), Darwin)
296 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX).dSYM
297 else
298 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo
299 endif
300 endif
301 endif
302 endif
304 ifeq ($(JVM_VARIANT_CLIENT),true)
305 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
306 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX)
308 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
309 ifeq ($(ZIP_DEBUGINFO_FILES),1)
310 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz
311 else
312 ifeq ($(OS_VENDOR), Darwin)
313 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX).dSYM
314 else
315 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo
316 endif
317 endif
318 endif
319 endif
321 ifeq ($(JVM_VARIANT_MINIMAL1),true)
322 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/Xusage.txt
323 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.$(LIBRARY_SUFFIX)
324 endif
326 # Serviceability Binaries
327 # No SA Support for PPC, IA64, ARM or zero
328 ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
329 $(EXPORT_LIB_DIR)/sa-jdi.jar
331 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
332 ifeq ($(ZIP_DEBUGINFO_FILES),1)
333 ADD_SA_BINARIES/x86 += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz
334 else
335 ifeq ($(OS_VENDOR), Darwin)
336 ADD_SA_BINARIES/x86 += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM
337 else
338 ADD_SA_BINARIES/x86 += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo
339 endif
340 endif
341 endif
343 ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
344 $(EXPORT_LIB_DIR)/sa-jdi.jar
345 ADD_SA_BINARIES/universal = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
346 $(EXPORT_LIB_DIR)/sa-jdi.jar
348 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
349 ifeq ($(ZIP_DEBUGINFO_FILES),1)
350 ADD_SA_BINARIES/universal += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz
351 else
352 ifeq ($(OS_VENDOR), Darwin)
353 ADD_SA_BINARIES/universal += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM
354 else
355 ADD_SA_BINARIES/universal += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo
356 endif
357 endif
358 endif
360 ADD_SA_BINARIES/ppc =
361 ADD_SA_BINARIES/ia64 =
362 ADD_SA_BINARIES/arm =
363 ADD_SA_BINARIES/zero =
365 EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))
367 # Universal build settings
368 ifeq ($(OS_VENDOR), Darwin)
369 # Build universal binaries by default on Mac OS X
370 MACOSX_UNIVERSAL = true
371 ifneq ($(ALT_MACOSX_UNIVERSAL),)
372 MACOSX_UNIVERSAL = $(ALT_MACOSX_UNIVERSAL)
373 endif
374 MAKE_ARGS += MACOSX_UNIVERSAL=$(MACOSX_UNIVERSAL)
376 # Universal settings
377 ifeq ($(MACOSX_UNIVERSAL), true)
379 # Set universal export path but avoid using ARCH or PLATFORM subdirs
380 EXPORT_PATH=$(OUTPUTDIR)/export-universal$(EXPORT_SUBDIR)
381 ifneq ($(ALT_EXPORT_PATH),)
382 EXPORT_PATH=$(ALT_EXPORT_PATH)
383 endif
385 # Set universal image dir
386 JDK_IMAGE_DIR=$(OUTPUTDIR)/jdk-universal$(EXPORT_SUBDIR)
387 ifneq ($(ALT_JDK_IMAGE_DIR),)
388 JDK_IMAGE_DIR=$(ALT_JDK_IMAGE_DIR)
389 endif
391 # Binaries to 'universalize' if built
392 UNIVERSAL_LIPO_LIST += $(EXPORT_JRE_LIB_DIR)/libjsig.$(LIBRARY_SUFFIX)
393 UNIVERSAL_LIPO_LIST += $(EXPORT_JRE_LIB_DIR)/libsaproc.$(LIBRARY_SUFFIX)
394 UNIVERSAL_LIPO_LIST += $(EXPORT_JRE_LIB_DIR)/server/libjvm.$(LIBRARY_SUFFIX)
395 UNIVERSAL_LIPO_LIST += $(EXPORT_JRE_LIB_DIR)/client/libjvm.$(LIBRARY_SUFFIX)
397 # Files to simply copy in place
398 UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/server/Xusage.txt
399 UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/client/Xusage.txt
400 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
401 ifeq ($(ZIP_DEBUGINFO_FILES),1)
402 UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/server/libjvm.diz
403 UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/client/libjvm.diz
404 UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/libjsig.diz
405 UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/libsaproc.diz
406 else
407 UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/server/libjvm.$(LIBRARY_SUFFIX).dSYM
408 UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/client/libjvm.$(LIBRARY_SUFFIX).dSYM
409 UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/libjsig.$(LIBRARY_SUFFIX).dSYM
410 UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM
411 endif
412 endif
414 endif
415 endif