1 # 2 # Copyright 1997-2008 Sun Microsystems, Inc. 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. Sun designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 22 # CA 95054 USA or visit www.sun.com if you need additional information or 23 # have any 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 # Set and Export a variable definition 76 # MAKELEVEL==0: export $1:=$2 77 # MAKELEVEL!=0: export $1 78 # Usage: $(call SetAndExport, NAME, ONE_TIME_EVALUATION_VALUE) 79 # Checks to make sure NAME is not empty, and User environment not using NAME 80 define _SetAndExport 81 $(if $(strip $1),,$(error ERROR: SetAndExport failed, name is empty)) 82 $(if $(filter 0,$(MAKELEVEL)),$(if $($(strip $1)),$(warning WARNING: User environment has $1=$($(strip $1))),),) 83 $(if $(filter 0,$(MAKELEVEL)),export $1:=$2,export $1) 84 endef 85 define SetAndExport 86 $(eval $(call _SetAndExport,$1,$2)) 87 endef 88 89 # Turn system arch name into standard one these makefiles understand. 90 define ArchFilter 91 $(strip \ 92 $(if $(filter x86 X86 i%86,$1),i586,\ 93 $(if $(filter arm%,$1),arm,\ 94 $(if $(filter sparc%,$1),sparc,\ 95 $(if $(filter ia64 IA64,$1),ia64,\ 96 $(if $(filter x64 X64 intel64 Intel64 INTEL64 x86_64 X86_64 amd64 AMD64 em64t EM64T,$1),amd64,$1)\ 97 ))))) 98 endef 99 100 # Get and save the uname return 101 $(call SetAndExport, SYSTEM_UNAME, $(shell uname)) 102 103 # 104 # Prune out all known SCM (Source Code Management) directories 105 # so they will not be included when copying directory trees 106 # or packaging up .jar files, etc. This applies to all workspaces. 107 # 108 SCM_DIRs = .hg .hgignore .hgtags 109 # When changing SCM_DIRs also change SCM_DIRS_rexp and SCM_DIRS_prune: 110 SCM_DIRS_rexp = ".hg|.hgignore|.hgtags" 111 SCM_DIRS_prune = \( -name .hg -o -name .hgignore -o -name .hgtags \) -prune 112 113 # Don't define this unless it's not defined 114 ifndef VARIANT 115 VARIANT=OPT 116 endif 117 118 # Platform settings specific to Solaris 119 ifeq ($(SYSTEM_UNAME), SunOS) 120 PLATFORM = solaris 121 # Solaris sparc build can be either 32-bit or 64-bit. 122 # Default to 32, but allow explicit setting to 32 or 64. 123 ifndef ARCH_DATA_MODEL 124 ARCH_DATA_MODEL=32 125 endif 126 ifeq ($(ARCH_DATA_MODEL), 32) 127 $(call SetAndExport, _UNAME_PROCESSOR, $(shell uname -p)) 128 ARCH:=$(call ArchFilter, $(_UNAME_PROCESSOR)) 129 else 130 $(call SetAndExport, _ISAINFO_ARCH, $(shell isainfo -n)) 131 ARCH:=$(_ISAINFO_ARCH) 132 # ISA_DIR is used to locate 64-bit specific libraries which are generally 133 # in the same general place as other libraries under the ./$(ARCH) directory 134 ISA_DIR = /$(ARCH) 135 endif 136 # Need to maintain the jre/lib/i386 location for 32-bit Intel 137 ifeq ($(ARCH), i586) 138 ARCH_FAMILY = $(ARCH) 139 LIBARCH = i386 140 # Value of Java os.arch property 141 ARCHPROP = x86 142 else 143 ifeq ($(ARCH), amd64) 144 ARCH_FAMILY = i586 145 else 146 ARCH_FAMILY = sparc 147 endif 148 LIBARCH = $(ARCH) 149 # Value of Java os.arch property 150 ARCHPROP = $(LIBARCH) 151 endif 152 # The two LIBARCH names 153 ifeq ($(ARCH_FAMILY), sparc) 154 LIBARCH32 = sparc 155 LIBARCH64 = sparcv9 156 else 157 LIBARCH32 = i386 158 LIBARCH64 = amd64 159 endif 160 # Suffix for file bundles used in previous release 161 BUNDLE_FILE_SUFFIX=.tar 162 # How much RAM does this machine have: 163 $(call SetAndExport, MB_OF_MEMORY, \ 164 $(shell /etc/prtconf | fgrep 'Memory size:' | expand | cut -d' ' -f3)) 165 endif 166 167 # Platform settings specific to Linux 168 ifeq ($(SYSTEM_UNAME), Linux) 169 PLATFORM = linux 170 # Arch and OS name/version 171 $(call SetAndExport, _UNAME_MACH, $(shell uname -m)) 172 ARCH:=$(call ArchFilter, $(_UNAME_MACH)) 173 ARCH_FAMILY:=$(ARCH) 174 175 # Linux builds may be 32-bit or 64-bit data model. 176 ifeq ($(ARCH), sparc) 177 # Linux sparc build can be either 32-bit or 64-bit. 178 # Default to 32, but allow explicit setting to 32 or 64. 179 ifndef ARCH_DATA_MODEL 180 ARCH_DATA_MODEL=32 181 endif 182 ifeq ($(ARCH_DATA_MODEL), 32) 183 ARCH=sparc 184 else 185 ARCH=sparcv9 186 endif 187 else 188 # i586 is 32-bit, amd64 is 64-bit 189 ifndef ARCH_DATA_MODEL 190 ifeq ($(ARCH), i586) 191 ARCH_DATA_MODEL=32 192 else 193 ARCH_DATA_MODEL=64 194 endif 195 endif 196 endif 197 198 # Need to maintain the jre/lib/i386 location for 32-bit Intel 199 ifeq ($(ARCH), i586) 200 LIBARCH = i386 201 else 202 LIBARCH = $(ARCH) 203 endif 204 205 # Value of Java os.arch property 206 ARCHPROP = $(LIBARCH) 207 208 # Suffix for file bundles used in previous release 209 BUNDLE_FILE_SUFFIX=.tar.gz 210 # How much RAM does this machine have: 211 $(call SetAndExport, MB_OF_MEMORY, \ 212 $(shell free -m | fgrep Mem: | awk '{print $$2;}' )) 213 endif 214 215 # Windows with and without CYGWIN will be slightly different 216 ifeq ($(SYSTEM_UNAME), Windows_NT) 217 PLATFORM = windows 218 endif 219 ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME))) 220 PLATFORM = windows 221 USING_CYGWIN = true 222 endif 223 224 # Platform settings specific to Windows 225 ifeq ($(PLATFORM), windows) 226 # Windows builds default to the appropriate for the underlaying 227 # architecture. 228 # Temporary disk area 229 TEMP_DISK=C:/temp 230 # GNU Make or MKS overrides $(PROCESSOR_ARCHITECTURE) to always 231 # return "x86". Use the first word of $(PROCESSOR_IDENTIFIER) instead. 232 PROC_ARCH:=$(word 1, $(PROCESSOR_IDENTIFIER)) 233 ARCH:=$(call ArchFilter, $(PROC_ARCH)) 234 ifndef ARCH_DATA_MODEL 235 ifeq ($(ARCH),ia64) 236 ARCH_DATA_MODEL=64 237 else 238 ifeq ($(ARCH),amd64) 239 ARCH_DATA_MODEL=64 240 else 241 ARCH_DATA_MODEL=32 242 endif 243 endif 244 endif 245 export ARCH_DATA_MODEL 246 ifeq ($(ARCH_DATA_MODEL), 64) 247 # If the user wants to perform a cross compile build then they must 248 # - set ARCH_DATA_MODEL=64 and either 249 # + set ARCH to ia64 or amd64, or 250 LIBARCH=$(ARCH) 251 # Value of Java os.arch property 252 ARCHPROP=$(LIBARCH) 253 else 254 # LIBARCH is used to preserve the jre/lib/i386 directory name for 32-bit intel 255 LIBARCH=i386 256 # Value of Java os.arch property 257 ARCHPROP=x86 258 endif 259 ARCH_FAMILY = $(ARCH) 260 # Where is unwanted output to be delivered? 261 DEV_NULL = NUL 262 export DEV_NULL 263 # Classpath separator 264 CLASSPATH_SEPARATOR = ; 265 # The suffix used for object file (.o for unix .obj for windows) 266 OBJECT_SUFFIX = obj 267 # The suffix applied to executables (.exe for windows, nothing for solaris) 268 EXE_SUFFIX = .exe 269 # The prefix applied to library files (lib for solaris, nothing for windows) 270 LIB_PREFIX= 271 LIBRARY_SUFFIX = dll 272 LIB_SUFFIX = lib 273 # User name determination (set _USER) 274 $(call SetAndExport, _USER, \ 275 $(or $(USER), $(USERNAME), $(LOGNAME), $(shell id -un))) 276 # Location of client/server directories 277 ARCH_VM_SUBDIR=jre/bin 278 # Suffix for file bundles used in previous release 279 BUNDLE_FILE_SUFFIX=.tar 280 # ISHIELD_TEMP_MIN is the difference of an empty C:\TEMP vs. one after a 281 # bundles build on windows. 282 ISHIELD_TEMP_MIN=250000 283 # How much RAM does this machine have: 284 ifeq ($(MB_OF_MEMORY),) 285 # This shell commands should only be executed once 286 ifeq ($(USING_CYGWIN),true) 287 # CYGWIN has the 'free' utility 288 _MB_OF_MEMORY := $(shell free -m | grep Mem: | awk '{print $$2;}' ) 289 else 290 # Windows 2000 has the mem utility, but two memory areas 291 # extended memory is what is beyond 1024M 292 _B_OF_EXT_MEMORY := $(shell mem 2> $(DEV_NULL) | \ 293 grep 'total contiguous extended memory' | awk '{print $$1;}') 294 ifeq ($(_B_OF_EXT_MEMORY),) 295 _B_OF_MEMORY := $(shell mem 2> $(DEV_NULL) | \ 296 grep 'total conventional memory' | awk '{print $$1;}') 297 else 298 _B_OF_MEMORY := $(shell expr 1048576 '+' $(_B_OF_EXT_MEMORY) 2> $(DEV_NULL)) 299 endif 300 ifeq ($(_B_OF_MEMORY),) 301 # Windows 2003 has the systeminfo utility use it if mem doesn't work 302 _MB_OF_MEMORY := $(shell systeminfo 2> $(DEV_NULL) | \ 303 grep 'Total Physical Memory:' | awk '{print $$4;}' | sed -e 's@,@@') 304 else 305 _MB_OF_MEMORY := $(shell expr $(_B_OF_MEMORY) '/' 1024 2> $(DEV_NULL)) 306 endif 307 endif 308 ifeq ($(shell expr $(_MB_OF_MEMORY) '+' 0 2> $(DEV_NULL)), $(_MB_OF_MEMORY)) 309 $(call SetAndExport, MB_OF_MEMORY, $(_MB_OF_MEMORY)) 310 else 311 $(call SetAndExport, MB_OF_MEMORY, 512) 312 endif 313 endif 314 endif 315 316 # Unix type settings (same for all unix platforms) 317 ifneq ($(PLATFORM), windows) 318 # Temporary disk area 319 TEMP_DISK=/tmp 320 # Where is unwanted output to be delivered? 321 DEV_NULL = /dev/null 322 export DEV_NULL 323 # Character used between entries in classpath 324 CLASSPATH_SEPARATOR = : 325 # suffix used for object file (.o for unix .obj for windows) 326 OBJECT_SUFFIX = o 327 # The suffix applied to runtime libraries 328 LIBRARY_SUFFIX = so 329 # The suffix applied to link libraries 330 LIB_SUFFIX = so 331 # The suffix applied to executables (.exe for windows, nothing for solaris) 332 EXE_SUFFIX = 333 # The prefix applied to library files (lib for solaris, nothing for windows) 334 LIB_PREFIX = lib 335 # User name determination (set _USER) 336 $(call SetAndExport, _USER, $(or $(USER), $(LOGNAME), $(shell logname))) 337 # Location of client/server directories 338 ARCH_VM_SUBDIR=jre/lib/$(LIBARCH) 339 endif 340 341 # Machines with 512Mb or less of real memory are considered low memory 342 # build machines and adjustments will be made to prevent excessing 343 # system swapping during the build. 344 # If we don't know, assume 512. Subtract 128 from MB for VM MAX. 345 # Don't set VM max over 1024-128=896. 346 ifneq ($(MB_OF_MEMORY),) 347 $(call SetAndExport, LOW_MEMORY_MACHINE, $(shell \ 348 if [ $(MB_OF_MEMORY) -le 512 ] ; then \ 349 echo "true"; \ 350 else \ 351 echo "false"; \ 352 fi)) 353 $(call SetAndExport, MAX_VM_MEMORY, $(shell \ 354 if [ $(MB_OF_MEMORY) -le 1024 ] ; then \ 355 expr $(MB_OF_MEMORY) '-' 128 2> $(DEV_NULL) ; \ 356 else \ 357 echo "896"; \ 358 fi)) 359 $(call SetAndExport, MIN_VM_MEMORY, $(shell \ 360 if [ $(MAX_VM_MEMORY) -le 128 ] ; then \ 361 expr $(MAX_VM_MEMORY) '-' 8 2> $(DEV_NULL) ; \ 362 else \ 363 echo "128"; \ 364 fi)) 365 else 366 MB_OF_MEMORY := unknown 367 LOW_MEMORY_MACHINE := true 368 MAX_VM_MEMORY := 384 369 MIN_VM_MEMORY := 128 370 endif 371 372 # If blanks in the username, use the first 4 words and pack them together 373 _USER1:=$(subst ', ,$(_USER)) 374 _USER2:=$(subst ", ,$(_USER1)) 375 USER:=$(word 1,$(_USER2))$(word 2,$(_USER2))$(word 3,$(_USER2))$(word 4,$(_USER2)) 376 export USER 377 378 endif 379