1 # 2 # Copyright (c) 2006, 2015, 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 # 24 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. 28 29 SLASH_JAVA ?= /java 30 31 define print_info 32 ifneq ($$(LOG_LEVEL), warn) 33 $$(shell echo >&2 "INFO: $1") 34 endif 35 endef 36 37 # Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name 38 ARCH:=$(shell uname -m) 39 PATH_SEP = : 40 ifeq ($(LP64), 1) 41 ARCH_DATA_MODEL ?= 64 42 else 43 ARCH_DATA_MODEL ?= 32 44 endif 45 46 # zero 47 ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) 48 ifeq ($(ARCH_DATA_MODEL), 64) 49 MAKE_ARGS += LP64=1 50 endif 51 PLATFORM = bsd-zero 52 VM_PLATFORM = bsd_$(subst i386,i486,$(ZERO_LIBARCH)) 53 HS_ARCH = zero 54 ARCH = zero 55 endif 56 57 # ia64 58 ifeq ($(ARCH), ia64) 59 ARCH_DATA_MODEL = 64 60 MAKE_ARGS += LP64=1 61 PLATFORM = bsd-ia64 62 VM_PLATFORM = bsd_ia64 63 HS_ARCH = ia64 64 endif 65 66 # sparc 67 ifeq ($(ARCH), sparc64) 68 ifeq ($(ARCH_DATA_MODEL), 64) 69 ARCH_DATA_MODEL = 64 70 MAKE_ARGS += LP64=1 71 PLATFORM = bsd-sparcv9 72 VM_PLATFORM = bsd_sparcv9 73 else 74 ARCH_DATA_MODEL = 32 75 PLATFORM = bsd-sparc 76 VM_PLATFORM = bsd_sparc 77 endif 78 HS_ARCH = sparc 79 endif 80 81 # amd64 82 ifneq (,$(findstring $(ARCH), amd64 x86_64)) 83 ifeq ($(ARCH_DATA_MODEL), 64) 84 ARCH_DATA_MODEL = 64 85 MAKE_ARGS += LP64=1 86 PLATFORM = bsd-amd64 87 VM_PLATFORM = bsd_amd64 88 HS_ARCH = x86 89 else 90 ARCH_DATA_MODEL = 32 91 PLATFORM = bsd-i586 92 VM_PLATFORM = bsd_i486 93 HS_ARCH = x86 94 # We have to reset ARCH to i386 since SRCARCH relies on it 95 ARCH = i386 96 endif 97 endif 98 99 # i386 100 ifeq ($(ARCH), i386) 101 ifeq ($(ARCH_DATA_MODEL), 64) 102 ARCH_DATA_MODEL = 64 103 MAKE_ARGS += LP64=1 104 PLATFORM = bsd-amd64 105 VM_PLATFORM = bsd_amd64 106 HS_ARCH = x86 107 # We have to reset ARCH to amd64 since SRCARCH relies on it 108 ARCH = amd64 109 else 110 ARCH_DATA_MODEL = 32 111 PLATFORM = bsd-i586 112 VM_PLATFORM = bsd_i486 113 HS_ARCH = x86 114 endif 115 endif 116 117 # ARM 118 ifeq ($(ARCH), arm) 119 ARCH_DATA_MODEL = 32 120 PLATFORM = bsd-arm 121 VM_PLATFORM = bsd_arm 122 HS_ARCH = arm 123 endif 124 125 # PPC 126 ifeq ($(ARCH), ppc) 127 ARCH_DATA_MODEL = 32 128 PLATFORM = bsd-ppc 129 VM_PLATFORM = bsd_ppc 130 HS_ARCH = ppc 131 endif 132 133 # On 32 bit bsd we build server and client, on 64 bit just server. 134 ifeq ($(JVM_VARIANTS),) 135 ifeq ($(ARCH_DATA_MODEL), 32) 136 JVM_VARIANTS:=client,server 137 JVM_VARIANT_CLIENT:=true 138 JVM_VARIANT_SERVER:=true 139 else 140 JVM_VARIANTS:=server 141 JVM_VARIANT_SERVER:=true 142 endif 143 endif 144 145 OS_VENDOR:=$(shell uname -s) 146 147 # The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product 148 # builds is enabled with debug info files ZIP'ed to save space. For 149 # BUILD_FLAVOR != product builds, FDS is always enabled, after all a 150 # debug build without debug info isn't very useful. 151 # The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled. 152 # 153 # If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be 154 # disabled for a BUILD_FLAVOR == product build. 155 # 156 # Note: Use of a different variable name for the FDS override option 157 # versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS 158 # versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass 159 # in options via environment variables, use of distinct variables 160 # prevents strange behaviours. For example, in a BUILD_FLAVOR != 161 # product build, the FULL_DEBUG_SYMBOLS environment variable will be 162 # 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If 163 # the same variable name is used, then different values can be picked 164 # up by different parts of the build. Just to be clear, we only need 165 # two variable names because the incoming option value can be 166 # overridden in some situations, e.g., a BUILD_FLAVOR != product 167 # build. 168 169 # Due to the multiple sub-make processes that occur this logic gets 170 # executed multiple times. We reduce the noise by at least checking that 171 # BUILD_FLAVOR has been set. 172 ifneq ($(BUILD_FLAVOR),) 173 ifeq ($(BUILD_FLAVOR), product) 174 FULL_DEBUG_SYMBOLS ?= 1 175 ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) 176 else 177 # debug variants always get Full Debug Symbols (if available) 178 ENABLE_FULL_DEBUG_SYMBOLS = 1 179 endif 180 $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) 181 # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later 182 183 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 184 ifeq ($(OS_VENDOR), Darwin) 185 # MacOS X doesn't use OBJCOPY or STRIP_POLICY 186 OBJCOPY= 187 STRIP_POLICY= 188 ZIP_DEBUGINFO_FILES ?= 1 189 else 190 # Default OBJCOPY comes from GNU Binutils on BSD 191 ifeq ($(CROSS_COMPILE_ARCH),) 192 DEF_OBJCOPY=/usr/bin/objcopy 193 else 194 # Assume objcopy is part of the cross-compilation toolset 195 ifneq ($(ALT_COMPILER_PATH),) 196 DEF_OBJCOPY=$(ALT_COMPILER_PATH)/objcopy 197 endif 198 endif 199 OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) 200 ifneq ($(ALT_OBJCOPY),) 201 $(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)")) 202 OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) 203 endif 204 205 ifeq ($(OBJCOPY),) 206 $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo" \ 207 "files. You may need to set ALT_OBJCOPY.")) 208 ENABLE_FULL_DEBUG_SYMBOLS=0 209 $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) 210 else 211 $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo" \ 212 "files.")) 213 214 # Library stripping policies for .debuginfo configs: 215 # all_strip - strips everything from the library 216 # min_strip - strips most stuff from the library; leaves 217 # minimum symbols 218 # no_strip - does not strip the library at all 219 # 220 # Oracle security policy requires "all_strip". A waiver was 221 # granted on 2011.09.01 that permits using "min_strip" in the 222 # Java JDK and Java JRE. 223 # 224 # Currently, STRIP_POLICY is only used when Full Debug Symbols 225 # is enabled. 226 # 227 STRIP_POLICY ?= min_strip 228 229 $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)")) 230 231 ZIP_DEBUGINFO_FILES ?= 1 232 endif 233 234 $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")) 235 endif 236 endif # ENABLE_FULL_DEBUG_SYMBOLS=1 237 endif # BUILD_FLAVOR 238 239 JDK_INCLUDE_SUBDIR=bsd 240 241 # Library suffix 242 ifeq ($(OS_VENDOR),Darwin) 243 LIBRARY_SUFFIX=dylib 244 else 245 LIBRARY_SUFFIX=so 246 endif 247 248 EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html 249 250 # client and server subdirectories have symbolic links to ../libjsig.so 251 EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX) 252 253 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 254 ifeq ($(ZIP_DEBUGINFO_FILES),1) 255 EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.diz 256 else 257 ifeq ($(OS_VENDOR), Darwin) 258 EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX).dSYM 259 else 260 EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.debuginfo 261 endif 262 endif 263 endif 264 265 EXPORT_SERVER_DIR = $(EXPORT_LIB_ARCH_DIR)/server 266 EXPORT_CLIENT_DIR = $(EXPORT_LIB_ARCH_DIR)/client 267 EXPORT_MINIMAL_DIR = $(EXPORT_LIB_ARCH_DIR)/minimal 268 269 ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) 270 EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt 271 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) 272 273 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 274 ifeq ($(ZIP_DEBUGINFO_FILES),1) 275 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz 276 else 277 ifeq ($(OS_VENDOR), Darwin) 278 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX).dSYM 279 else 280 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo 281 endif 282 endif 283 endif 284 endif 285 286 ifeq ($(JVM_VARIANT_CLIENT),true) 287 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt 288 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) 289 290 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 291 ifeq ($(ZIP_DEBUGINFO_FILES),1) 292 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz 293 else 294 ifeq ($(OS_VENDOR), Darwin) 295 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX).dSYM 296 else 297 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo 298 endif 299 endif 300 endif 301 endif 302 303 ifeq ($(JVM_VARIANT_MINIMAL1),true) 304 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/Xusage.txt 305 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.$(LIBRARY_SUFFIX) 306 endif 307 308 # Serviceability Binaries 309 # No SA Support for PPC, IA64, ARM or zero 310 ADD_SA_BINARIES/x86 = $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ 311 $(EXPORT_LIB_DIR)/sa-jdi.jar 312 313 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 314 ifeq ($(ZIP_DEBUGINFO_FILES),1) 315 ADD_SA_BINARIES/x86 += $(EXPORT_LIB_ARCH_DIR)/libsaproc.diz 316 else 317 ifeq ($(OS_VENDOR), Darwin) 318 ADD_SA_BINARIES/x86 += $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM 319 else 320 ADD_SA_BINARIES/x86 += $(EXPORT_LIB_ARCH_DIR)/libsaproc.debuginfo 321 endif 322 endif 323 endif 324 325 ADD_SA_BINARIES/sparc = $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ 326 $(EXPORT_LIB_DIR)/sa-jdi.jar 327 ADD_SA_BINARIES/universal = $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ 328 $(EXPORT_LIB_DIR)/sa-jdi.jar 329 330 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 331 ifeq ($(ZIP_DEBUGINFO_FILES),1) 332 ADD_SA_BINARIES/universal += $(EXPORT_LIB_ARCH_DIR)/libsaproc.diz 333 else 334 ifeq ($(OS_VENDOR), Darwin) 335 ADD_SA_BINARIES/universal += $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM 336 else 337 ADD_SA_BINARIES/universal += $(EXPORT_LIB_ARCH_DIR)/libsaproc.debuginfo 338 endif 339 endif 340 endif 341 342 ADD_SA_BINARIES/ppc = 343 ADD_SA_BINARIES/ia64 = 344 ADD_SA_BINARIES/arm = 345 ADD_SA_BINARIES/zero = 346 347 EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH)) 348 349 # Universal build settings 350 ifeq ($(OS_VENDOR), Darwin) 351 # Build universal binaries by default on Mac OS X 352 MACOSX_UNIVERSAL = true 353 ifneq ($(ALT_MACOSX_UNIVERSAL),) 354 MACOSX_UNIVERSAL = $(ALT_MACOSX_UNIVERSAL) 355 endif 356 MAKE_ARGS += MACOSX_UNIVERSAL=$(MACOSX_UNIVERSAL) 357 358 # Universal settings 359 ifeq ($(MACOSX_UNIVERSAL), true) 360 361 # Set universal export path but avoid using ARCH or PLATFORM subdirs 362 EXPORT_PATH=$(OUTPUTDIR)/export-universal$(EXPORT_SUBDIR) 363 ifneq ($(ALT_EXPORT_PATH),) 364 EXPORT_PATH=$(ALT_EXPORT_PATH) 365 endif 366 367 # Set universal image dir 368 JDK_IMAGE_DIR=$(OUTPUTDIR)/jdk-universal$(EXPORT_SUBDIR) 369 ifneq ($(ALT_JDK_IMAGE_DIR),) 370 JDK_IMAGE_DIR=$(ALT_JDK_IMAGE_DIR) 371 endif 372 373 # Binaries to 'universalize' if built 374 UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/libjsig.$(LIBRARY_SUFFIX) 375 UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/libsaproc.$(LIBRARY_SUFFIX) 376 UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/server/libjvm.$(LIBRARY_SUFFIX) 377 UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/client/libjvm.$(LIBRARY_SUFFIX) 378 379 # Files to simply copy in place 380 UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/server/Xusage.txt 381 UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/client/Xusage.txt 382 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 383 ifeq ($(ZIP_DEBUGINFO_FILES),1) 384 UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/server/libjvm.diz 385 UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/client/libjvm.diz 386 UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libjsig.diz 387 UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libsaproc.diz 388 else 389 UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/server/libjvm.$(LIBRARY_SUFFIX).dSYM 390 UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/client/libjvm.$(LIBRARY_SUFFIX).dSYM 391 UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libjsig.$(LIBRARY_SUFFIX).dSYM 392 UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM 393 endif 394 endif 395 396 endif 397 endif