1 # 2 # Copyright (c) 1997, 2012, 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 # 27 # Shared platform (OS/ARCH) variable settings for the JDK builds. 28 # 29 # Includes basic system requirements, versions of utilities required, 30 # suffixes on files, and basic defaults attributed to the build platform. 31 # 32 33 # 34 # Assumes some basic unix system utilities (e.g. uname) are in the search path 35 # in order to figure out the system. 36 # 37 38 ifndef PLATFORM_SHARED 39 40 PLATFORM_SHARED=done 41 42 # Possible Input variables: 43 # ARCH_DATA_MODEL 32 or 64, default to 32 44 # USER, LOGNAME user name (runs logname, or id if not set) 45 # PROCESSOR_IDENTIFIER windows only: needed in environment 46 # 47 # (Also gets input by running the utilities uname, logname, isainfo, or id.) 48 # 49 # Variables set by this file: 50 # SYSTEM_UNAME what 'uname' says this system is 51 # USER login name of user (minus blanks) 52 # PLATFORM windows, solaris, or linux 53 # VARIANT OPT or DBG, OPT is the default 54 # TEMP_DISK /tmp or C:/temp 55 # ARCH_DATA_MODEL 32 or 64 56 # ARCH sparc, sparcv9, i586, amd64, or ia64 57 # ARCH_FAMILY sparc or i586 58 # ARCHPROP sparc or x86 59 # ARCH_VM_SUBDIR jre/bin, jre/lib/sparc, etc. 60 # LIBARCH sparc, sparcv9, i386, amd64, or ia64 61 # DEV_NULL destination of /dev/null, NUL or /dev/NULL 62 # CLASSPATH_SEPARATOR separator in classpath, ; or : 63 # LIB_PREFIX dynamic or static library prefix, lib or empty 64 # LIB_SUFFIX static library file suffix, .lib or .a? 65 # LIBRARY_SUFFIX dynamic library file suffix, .dll or .so 66 # OBJECT_SUFFIX object file suffix, .o or .obj 67 # EXE_SUFFIX executable file suffix, .exe or empty 68 # BUNDLE_FILE_SUFFIX suffix for bundles: .tar or .tar.gz 69 # ISA_DIR solaris only: /sparcv9 or /amd64 70 # LIBARCH32 solaris only: sparc or i386 71 # LIBARCH64 solaris only: sparcv9 or amd64 72 # USING_CYGWIN windows only: true or false 73 # ISHIELD_TEMP_MIN windows only: minimum disk space in temp area 74 75 # Only run uname once in this make session. 76 ifndef SYSTEM_UNAME 77 SYSTEM_UNAME := $(shell uname) 78 export SYSTEM_UNAME 79 endif 80 81 # 82 # Prune out all known SCM (Source Code Management) directories 83 # so they will not be included when copying directory trees 84 # or packaging up .jar files, etc. This applies to all workspaces. 85 # 86 SCM_DIRs = .hg .svn CVS RCS SCCS Codemgr_wsdata deleted_files .hgignore .hgtags 87 # When changing SCM_DIRs also change SCM_DIRS_rexp and SCM_DIRS_prune: 88 SCM_DIRS_rexp = ".hg|.svn|CVS|RCS|SCCS|Codemgr_wsdata|deleted_files|.hgignore|.hgtags" 89 SCM_DIRS_prune = \( -name .hg -o -name .svn -o -name CVS -o -name RCS -o -name SCCS -o -name Codemgr_wsdata -o -name deleted_files -o -name .hgignore -o -name .hgtags \) -prune 90 91 # Don't define this unless it's not defined 92 ifndef VARIANT 93 VARIANT=OPT 94 endif 95 96 # Platform settings specific to Solaris 97 ifeq ($(SYSTEM_UNAME), SunOS) 98 PLATFORM = solaris 99 # Solaris sparc build can be either 32-bit or 64-bit. 100 # Default to 32, but allow explicit setting to 32 or 64. 101 ifndef ARCH_DATA_MODEL 102 ARCH_DATA_MODEL=32 103 endif 104 ifeq ($(ARCH_DATA_MODEL), 32) 105 processor := $(shell uname -p) 106 archExpr = case "$(processor)" in \ 107 i[3-9]86) \ 108 echo i586 \ 109 ;; \ 110 sparc*) \ 111 echo sparc \ 112 ;; \ 113 *) \ 114 echo $(processor) \ 115 ;; \ 116 esac 117 ARCH := $(shell $(archExpr)) 118 else 119 ARCH := $(shell isainfo -n) 120 # ISA_DIR is used to locate 64-bit specific libraries which are generally 121 # in the same general place as other libraries under the ./$(ARCH) directory 122 ISA_DIR = /$(ARCH) 123 endif 124 # Need to maintain the jre/lib/i386 location for 32-bit Intel 125 ifeq ($(ARCH), i586) 126 ARCH_FAMILY = $(ARCH) 127 LIBARCH = i386 128 # Value of Java os.arch property 129 ARCHPROP = x86 130 else 131 ifeq ($(ARCH), amd64) 132 ARCH_FAMILY = i586 133 else 134 ARCH_FAMILY = sparc 135 endif 136 LIBARCH = $(ARCH) 137 # Value of Java os.arch property 138 ARCHPROP = $(LIBARCH) 139 endif 140 # The two LIBARCH names 141 ifeq ($(ARCH_FAMILY), sparc) 142 LIBARCH32 = sparc 143 LIBARCH64 = sparcv9 144 else 145 LIBARCH32 = i386 146 LIBARCH64 = amd64 147 endif 148 # Suffix for file bundles used in previous release 149 BUNDLE_FILE_SUFFIX=.tar 150 # How much RAM does this machine have (zones send an error to stderr): 151 MB_OF_MEMORY:=$(shell /usr/sbin/prtconf 2>/dev/null | fgrep 'Memory size:' | expand | cut -d' ' -f3) 152 endif 153 154 ifeq ($(SYSTEM_UNAME), AIX) 155 PLATFORM = aix 156 ARCH=ppc64 157 ARCH_DATA_MODEL=64 158 ARCH_FAMILY=$(ARCH) 159 LIBARCH=$(ARCH) 160 ARCHPROP = $(LIBARCH) 161 endif 162 163 164 # Platform settings specific to Linux 165 ifeq ($(SYSTEM_UNAME), Linux) 166 PLATFORM = linux 167 # Arch and OS name/version 168 ifdef CROSS_COMPILE_ARCH 169 mach := $(CROSS_COMPILE_ARCH) 170 else 171 mach := $(shell uname -m) 172 endif 173 archExpr = case "$(mach)" in \ 174 i[3-9]86) \ 175 echo i586 \ 176 ;; \ 177 ia64) \ 178 echo ia64 \ 179 ;; \ 180 x86_64) \ 181 echo amd64 \ 182 ;; \ 183 sparc*) \ 184 echo sparc \ 185 ;; \ 186 arm*) \ 187 echo arm \ 188 ;; \ 189 *) \ 190 echo $(mach) \ 191 ;; \ 192 esac 193 ARCH := $(shell $(archExpr) ) 194 ARCH_FAMILY := $(ARCH:ppc64le=ppc64) 195 196 # Linux builds may be 32-bit or 64-bit data model. 197 ifeq ($(ARCH), sparc) 198 # Linux sparc build can be either 32-bit or 64-bit. 199 # Default to 32, but allow explicit setting to 32 or 64. 200 ifndef ARCH_DATA_MODEL 201 ARCH_DATA_MODEL=32 202 endif 203 ifeq ($(ARCH_DATA_MODEL), 32) 204 ARCH=sparc 205 else 206 ARCH=sparcv9 207 endif 208 else ifeq ($(ARCH), ppc64) 209 ARCH_DATA_MODEL=64 210 OPENJDK_TARGET_CPU_ENDIAN=big 211 else ifeq ($(ARCH), ppc64le) 212 ARCH_DATA_MODEL=64 213 OPENJDK_TARGET_CPU_ENDIAN=little 214 ARCH := ppc64 215 else 216 # Most archs are 32-bit 217 ifndef ARCH_DATA_MODEL 218 ARCH_DATA_MODEL=32 219 ifeq ($(ARCH), amd64) 220 ARCH_DATA_MODEL=64 221 endif 222 ifeq ($(ARCH), ia64) 223 ARCH_DATA_MODEL=64 224 endif 225 endif 226 endif 227 228 # Need to maintain the jre/lib/i386 location for 32-bit Intel 229 ifeq ($(ARCH), i586) 230 LIBARCH = i386 231 else 232 LIBARCH = $(ARCH) 233 endif 234 235 # Value of Java os.arch property 236 ARCHPROP = $(LIBARCH) 237 238 # Suffix for file bundles used in previous release 239 BUNDLE_FILE_SUFFIX=.tar.gz 240 # How much RAM does this machine have: 241 MB_OF_MEMORY := $(shell free -m | fgrep Mem: | awk '{print $$2;}' ) 242 endif 243 244 ifeq ($(SYSTEM_UNAME), Darwin) 245 PLATFORM = macosx 246 OS_NAME = darwin 247 OS_VENDOR = Apple 248 GB_OF_MEMORY := $(shell system_profiler SPHardwareDataType | fgrep Memory: | awk '{print $$2}') 249 MB_OF_MEMORY := $(shell expr ${GB_OF_MEMORY} '*' 1024) 250 endif 251 252 # Platform settings specific to BSD/Mac OS X 253 ifeq ($(PLATFORM), macosx) 254 OS_VERSION := $(shell uname -r) 255 256 # Arch and OS name/version 257 # Darwin x86 builds are i386/amd64 universal by default. 258 # Allow arch to be set from the environment to avoid this. 259 ifeq ($(origin ARCH), undefined) 260 ifeq ($(PLATFORM), macosx) 261 # MMM: revisit when hotspot producinging universal libs 262 # mach := universal 263 mach := x86_64 264 else 265 mach := $(shell uname -m) 266 endif 267 else 268 mach := $(ARCH) 269 endif 270 271 archExpr = case "$(mach)" in \ 272 i[3-9]86) \ 273 echo i586 \ 274 ;; \ 275 sparc64) \ 276 echo sparcv9 \ 277 ;; \ 278 sparc*) \ 279 echo sparc \ 280 ;; \ 281 x86_64) \ 282 echo x86_64 \ 283 ;; \ 284 "Power Macintosh") \ 285 echo ppc \ 286 ;; \ 287 *) \ 288 echo $(mach) \ 289 ;; \ 290 esac 291 ARCH := $(shell $(archExpr) ) 292 ARCH_FAMILY := $(ARCH) 293 294 # i586, sparc, and ppc are 32 bit, amd64 and sparc64 are 64 295 # ARCH_DATA_MODEL does not exactly mean anything in universal 296 # but it has to be one or the other, so pick 32 297 ifneq (,$(findstring $(ARCH), i586 sparc ppc universal)) 298 ARCH_DATA_MODEL=32 299 else 300 ARCH_DATA_MODEL=64 301 endif 302 303 # Need to maintain the jre/lib/i386 location for 32-bit Intel 304 ifeq ($(ARCH), i586) 305 LIBARCH = i386 306 else 307 LIBARCH = $(ARCH) 308 endif 309 310 # Value of Java os.arch property 311 ARCHPROP = $(LIBARCH) 312 313 # Suffix for file bundles used in previous release 314 BUNDLE_FILE_SUFFIX=.tar.gz 315 # How much RAM does this machine have: 316 endif 317 318 # Windows with and without CYGWIN will be slightly different 319 ifeq ($(SYSTEM_UNAME), Windows_NT) 320 PLATFORM = windows 321 endif 322 ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME))) 323 PLATFORM = windows 324 USING_CYGWIN = true 325 export USING_CYGWIN 326 CYGPATH_CMD=cygpath -a -s -m 327 # Only run "cygpath /" once in this make session. 328 ifndef CYGWIN_HOME 329 CYGWIN_HOME := $(shell $(CYGPATH_CMD) /) 330 export CYGWIN_HOME 331 endif 332 endif 333 334 # Platform settings specific to Windows 335 ifeq ($(PLATFORM), windows) 336 # Windows builds default to the appropriate for the underlaying 337 # architecture. 338 # Temporary disk area 339 TEMP_DISK=C:/temp 340 # GNU Make or MKS overrides $(PROCESSOR_ARCHITECTURE) to always 341 # return "x86". Use the first word of $(PROCESSOR_IDENTIFIER) instead. 342 # And sometimes PROCESSOR_IDENTIFIER is not defined at all 343 # (in some restricted shells), so we use uname if we have to. 344 ifeq ($(PROCESSOR_IDENTIFIER),) 345 # Only run uname -m once in this make session. 346 ifndef SYSTEM_UNAME_M 347 SYSTEM_UNAME_M := $(shell uname -m) 348 export SYSTEM_UNAME_M 349 endif 350 PROC_ARCH:=$(SYSTEM_UNAME_M) 351 else 352 PROC_ARCH:=$(word 1, $(PROCESSOR_IDENTIFIER)) 353 endif 354 # Cover all the possibilities, MKS uname, CYGWIN uname, PROCESSOR_IDENTIFIER 355 # Get: X86, X64, or IA64 356 PROC_ARCH:=$(patsubst 386,X86,$(PROC_ARCH)) 357 PROC_ARCH:=$(patsubst 486,X86,$(PROC_ARCH)) 358 PROC_ARCH:=$(patsubst 586,X86,$(PROC_ARCH)) 359 PROC_ARCH:=$(patsubst 686,X86,$(PROC_ARCH)) 360 PROC_ARCH:=$(patsubst i386,X86,$(PROC_ARCH)) 361 PROC_ARCH:=$(patsubst i486,X86,$(PROC_ARCH)) 362 PROC_ARCH:=$(patsubst i586,X86,$(PROC_ARCH)) 363 PROC_ARCH:=$(patsubst i686,X86,$(PROC_ARCH)) 364 PROC_ARCH:=$(patsubst x86,X86,$(PROC_ARCH)) 365 PROC_ARCH:=$(patsubst intel64,X64,$(PROC_ARCH)) 366 PROC_ARCH:=$(patsubst Intel64,X64,$(PROC_ARCH)) 367 PROC_ARCH:=$(patsubst INTEL64,X64,$(PROC_ARCH)) 368 PROC_ARCH:=$(patsubst em64t,X64,$(PROC_ARCH)) 369 PROC_ARCH:=$(patsubst EM64T,X64,$(PROC_ARCH)) 370 PROC_ARCH:=$(patsubst amd64,X64,$(PROC_ARCH)) 371 PROC_ARCH:=$(patsubst AMD64,X64,$(PROC_ARCH)) 372 PROC_ARCH:=$(patsubst 8664,X64,$(PROC_ARCH)) 373 PROC_ARCH:=$(patsubst x86_64,X64,$(PROC_ARCH)) 374 PROC_ARCH:=$(patsubst ia64,IA64,$(PROC_ARCH)) 375 ifndef ARCH_DATA_MODEL 376 ifeq ($(PROC_ARCH),IA64) 377 ARCH_DATA_MODEL=64 378 else 379 ifeq ($(PROC_ARCH),X64) 380 ARCH_DATA_MODEL=64 381 else 382 ARCH_DATA_MODEL=32 383 endif 384 endif 385 endif 386 export ARCH_DATA_MODEL 387 ifeq ($(ARCH_DATA_MODEL), 64) 388 # If the user wants to perform a cross compile build then they must 389 # - set ARCH_DATA_MODEL=64 and either 390 # + set ARCH to ia64 or amd64, or 391 ifeq ($(PROC_ARCH),X64) 392 ARCH=amd64 393 else 394 ifeq ($(PROC_ARCH),IA64) 395 ARCH=ia64 396 endif 397 endif 398 LIBARCH=$(ARCH) 399 # Value of Java os.arch property 400 ARCHPROP=$(LIBARCH) 401 else 402 # LIBARCH is used to preserve the jre/lib/i386 directory name for 32-bit intel 403 ARCH=i586 404 LIBARCH=i386 405 # Value of Java os.arch property 406 ARCHPROP=x86 407 endif 408 ARCH_FAMILY = $(ARCH) 409 # Where is unwanted output to be delivered? 410 # MKS uses the special file "NUL", cygwin uses the customary unix file. 411 ifeq ($(USING_CYGWIN),true) 412 DEV_NULL = /dev/null 413 else 414 DEV_NULL = NUL 415 endif 416 export DEV_NULL 417 # Classpath separator 418 CLASSPATH_SEPARATOR = ; 419 # The suffix used for object file (.o for unix .obj for windows) 420 OBJECT_SUFFIX = obj 421 # The suffix applied to executables (.exe for windows, nothing for solaris) 422 EXE_SUFFIX = .exe 423 # The prefix applied to library files (lib for solaris, nothing for windows) 424 LIB_PREFIX= 425 LIBRARY_SUFFIX = dll 426 LIB_SUFFIX = lib 427 # User name determination (set _USER) 428 ifndef USER 429 ifdef USERNAME 430 _USER := $(USERNAME) 431 else 432 ifdef LOGNAME 433 _USER := $(LOGNAME) 434 else 435 _USER := $(shell id -un) 436 endif 437 endif 438 else 439 _USER:=$(USER) 440 endif 441 # Location of client/server directories 442 ARCH_VM_SUBDIR=jre/bin 443 # Suffix for file bundles used in previous release 444 BUNDLE_FILE_SUFFIX=.tar 445 # ISHIELD_TEMP_MIN is the difference of an empty C:\TEMP vs. one after a 446 # bundles build on windows. 447 ISHIELD_TEMP_MIN=250000 448 # How much RAM does this machine have: 449 ifeq ($(JDK_HAS_MEM_INFO),) 450 ifeq ($(USING_CYGWIN),true) 451 # CYGWIN has the 'free' utility 452 _MB_OF_MEMORY := \ 453 $(shell free -m | grep Mem: | awk '{print $$2;}' ) 454 else 455 # Windows 2000 has the mem utility, but two memory areas 456 # extended memory is what is beyond 1024M 457 _B_OF_EXT_MEMORY := \ 458 $(shell mem 2> $(DEV_NULL) | \ 459 grep 'total contiguous extended memory' | awk '{print $$1;}') 460 ifeq ($(_B_OF_EXT_MEMORY),) 461 _B_OF_MEMORY := \ 462 $(shell mem 2> $(DEV_NULL) | \ 463 grep 'total conventional memory' | awk '{print $$1;}') 464 else 465 _B_OF_MEMORY := \ 466 $(shell expr 1048576 '+' $(_B_OF_EXT_MEMORY) 2> $(DEV_NULL)) 467 endif 468 ifeq ($(_B_OF_MEMORY),) 469 # Windows 2003 has the systeminfo utility use it if mem doesn't work 470 _MB_OF_MEMORY := \ 471 $(shell systeminfo 2> $(DEV_NULL) | \ 472 grep 'Total Physical Memory:' | \ 473 awk '{print $$4;}' | sed -e 's@,@@') 474 else 475 _MB_OF_MEMORY := $(shell expr $(_B_OF_MEMORY) '/' 1024 2> $(DEV_NULL)) 476 endif 477 endif 478 ifeq ($(shell expr $(_MB_OF_MEMORY) '+' 0 2> $(DEV_NULL)), $(_MB_OF_MEMORY)) 479 MB_OF_MEMORY := $(_MB_OF_MEMORY) 480 else 481 MB_OF_MEMORY := 512 482 endif 483 endif 484 endif 485 486 # Unix type settings (same for all unix platforms) 487 ifneq ($(PLATFORM), windows) 488 # Temporary disk area 489 TEMP_DISK=/tmp 490 # Where is unwanted output to be delivered? 491 DEV_NULL = /dev/null 492 export DEV_NULL 493 # Character used between entries in classpath 494 CLASSPATH_SEPARATOR = : 495 # suffix used for object file (.o for unix .obj for windows) 496 OBJECT_SUFFIX = o 497 # The suffix applied to runtime libraries 498 LIBRARY_SUFFIX = so 499 # The suffix applied to link libraries 500 LIB_SUFFIX = so 501 # The suffix applied to executables (.exe for windows, nothing for solaris) 502 EXE_SUFFIX = 503 # The prefix applied to library files (lib for solaris, nothing for windows) 504 LIB_PREFIX = lib 505 # User name determination (set _USER) 506 ifndef USER 507 ifdef LOGNAME 508 _USER := $(LOGNAME) 509 else 510 _USER := $(shell logname) 511 endif 512 else 513 _USER:=$(USER) 514 endif 515 # Location of client/server directories 516 ARCH_VM_SUBDIR=jre/lib/$(LIBARCH) 517 endif 518 519 # Darwin-specific Overrides 520 ifeq ($(SYSTEM_UNAME),Darwin) 521 # The suffix applied to runtime libraries 522 LIBRARY_SUFFIX = dylib 523 # The suffix applied to link libraries 524 ifeq ($(ARCH), universal) 525 LIB_SUFFIX = o 526 else 527 LIB_SUFFIX = a 528 endif 529 530 ifeq ($(PLATFORM), macosx) 531 ARCH_VM_SUBDIR=jre/lib 532 endif 533 endif 534 535 # Machines with 512Mb or less of real memory are considered low memory 536 # build machines and adjustments will be made to prevent excessing 537 # system swapping during the build. 538 ifeq ($(JDK_HAS_MEM_INFO),) 539 JDK_HAS_MEM_INFO=true 540 export JDK_HAS_MEM_INFO 541 ifneq ($(MB_OF_MEMORY),) 542 LOW_MEMORY_MACHINE := $(shell \ 543 if [ $(MB_OF_MEMORY) -le 512 ] ; then \ 544 echo "true"; \ 545 else \ 546 echo "false"; \ 547 fi) 548 MAX_VM_MEMORY := 512 549 MIN_VM_MEMORY := $(MAX_VM_MEMORY) 550 else 551 MB_OF_MEMORY := unknown 552 LOW_MEMORY_MACHINE := true 553 MAX_VM_MEMORY := 384 554 MIN_VM_MEMORY := 128 555 endif 556 export MB_OF_MEMORY 557 export LOW_MEMORY_MACHINE 558 export MAX_VM_MEMORY 559 export MIN_VM_MEMORY 560 endif 561 562 # If blanks in the username, use the first 4 words and pack them together 563 _USER1:=$(subst ', ,$(_USER)) 564 _USER2:=$(subst ", ,$(_USER1)) 565 USER:=$(word 1,$(_USER2))$(word 2,$(_USER2))$(word 3,$(_USER2))$(word 4,$(_USER2)) 566 export USER 567 568 export PLATFORM 569 endif 570