Platform.gmk 16.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526
#
# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

#
# Shared platform (OS/ARCH) variable settings for the JDK builds.
#
# Includes basic system requirements, versions of utilities required,
#   suffixes on files, and basic defaults attributed to the build platform.
#

#
# Assumes some basic unix system utilities (e.g. uname) are in the search path
#   in order to figure out the system.
#

ifndef PLATFORM_SHARED

PLATFORM_SHARED=done

# Possible Input variables:
#     ARCH_DATA_MODEL             32 or 64, default to 32
#     USER, LOGNAME               user name (runs logname, or id if not set)
#     PROCESSOR_IDENTIFIER        windows only: needed in environment
#
# (Also gets input by running the utilities uname, logname, isainfo, or id.)
#
# Variables set by this file:
#     SYSTEM_UNAME                what 'uname' says this system is
#     USER                        login name of user (minus blanks)
#     PLATFORM                    windows, solaris, or linux
#     VARIANT                     OPT or DBG, OPT is the default
#     TEMP_DISK                   /tmp or C:/temp
#     ARCH_DATA_MODEL             32 or 64
#     ARCH                        sparc, sparcv9, i586, amd64, or ia64
#     ARCH_FAMILY                 sparc or i586
#     ARCHPROP                    sparc or x86
#     ARCH_VM_SUBDIR              jre/bin, jre/lib/sparc, etc.
#     LIBARCH                     sparc, sparcv9, i386, amd64, or ia64
#     DEV_NULL                    destination of /dev/null, NUL or /dev/NULL
#     CLASSPATH_SEPARATOR         separator in classpath, ; or :
#     LIB_PREFIX                  dynamic or static library prefix, lib or empty
#     LIB_SUFFIX                  static library file suffix, .lib or .a?
#     LIBRARY_SUFFIX              dynamic library file suffix, .dll or .so
#     OBJECT_SUFFIX               object file suffix, .o or .obj
#     EXE_SUFFIX                  executable file suffix, .exe or empty
#     BUNDLE_FILE_SUFFIX          suffix for bundles: .tar or .tar.gz
#     ISA_DIR                     solaris only: /sparcv9 or /amd64
#     LIBARCH32                   solaris only: sparc or i386
#     LIBARCH64                   solaris only: sparcv9 or amd64
#     USING_CYGWIN                windows only: true or false
#     ISHIELD_TEMP_MIN            windows only: minimum disk space in temp area

# Only run uname once in this make session.
ifndef SYSTEM_UNAME
  SYSTEM_UNAME := $(shell uname)
  export SYSTEM_UNAME
endif

#
# Prune out all known SCM (Source Code Management) directories
# so they will not be included when copying directory trees
# or packaging up .jar files, etc.  This applies to all workspaces.
#
SCM_DIRs = .hg .svn CVS RCS SCCS Codemgr_wsdata deleted_files .hgignore .hgtags
# When changing SCM_DIRs also change SCM_DIRS_rexp and SCM_DIRS_prune:
SCM_DIRS_rexp = ".hg|.svn|CVS|RCS|SCCS|Codemgr_wsdata|deleted_files|.hgignore|.hgtags"
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

# Don't define this unless it's not defined
ifndef VARIANT
  VARIANT=OPT
endif

# Platform settings specific to Solaris
ifeq ($(SYSTEM_UNAME), SunOS)
  PLATFORM = solaris
  # Solaris sparc build can be either 32-bit or 64-bit.
  #   Default to 32, but allow explicit setting to 32 or 64.
  ifndef ARCH_DATA_MODEL
    ARCH_DATA_MODEL=32
  endif
  ifeq ($(ARCH_DATA_MODEL), 32)
    processor := $(shell uname -p)
    archExpr = case "$(processor)" in  \
                i[3-9]86) \
                    echo i586 \
                    ;; \
                sparc*)  \
                    echo sparc \
                    ;; \
                *) \
                    echo $(processor)  \
                    ;; \
        esac
    ARCH        := $(shell $(archExpr))
  else
    ARCH := $(shell isainfo -n)
    # ISA_DIR is used to locate 64-bit specific libraries which are generally
    # in the same general place as other libraries under the ./$(ARCH) directory
    ISA_DIR = /$(ARCH)
  endif
  # Need to maintain the jre/lib/i386 location for 32-bit Intel
  ifeq ($(ARCH), i586)
     ARCH_FAMILY = $(ARCH)
     LIBARCH     = i386
     # Value of Java os.arch property
     ARCHPROP    = x86
  else
     ifeq ($(ARCH), amd64)
        ARCH_FAMILY = i586
     else
        ARCH_FAMILY = sparc
     endif
     LIBARCH  = $(ARCH)
     # Value of Java os.arch property
     ARCHPROP = $(LIBARCH)
  endif
  # The two LIBARCH names
  ifeq ($(ARCH_FAMILY), sparc)
    LIBARCH32 = sparc
    LIBARCH64 = sparcv9
  else
    LIBARCH32 = i386
    LIBARCH64 = amd64
  endif
  # Suffix for file bundles used in previous release
  BUNDLE_FILE_SUFFIX=.tar
  # How much RAM does this machine have (zones send an error to stderr):
  MB_OF_MEMORY:=$(shell /usr/sbin/prtconf 2>/dev/null | fgrep 'Memory size:' | expand | cut -d' ' -f3)
endif

# Platform settings specific to Linux
ifeq ($(SYSTEM_UNAME), Linux)
  PLATFORM = linux
  # Arch and OS name/version
  ifdef CROSS_COMPILE_ARCH
    mach := $(CROSS_COMPILE_ARCH)
  else
    mach := $(shell uname -m)
  endif
  archExpr = case "$(mach)" in \
                i[3-9]86) \
                    echo i586 \
                    ;; \
                ia64) \
                    echo ia64 \
                    ;; \
                x86_64) \
                    echo amd64 \
                    ;; \
                sparc*) \
                    echo sparc \
                    ;; \
                arm*) \
                    echo arm \
                    ;; \
                *) \
                    echo $(mach) \
                    ;; \
      esac
  ARCH        := $(shell $(archExpr) )
  ARCH_FAMILY := $(ARCH)

  # Linux builds may be 32-bit or 64-bit data model.
  ifeq ($(ARCH), sparc)
    # Linux sparc build can be either 32-bit or 64-bit.
    #   Default to 32, but allow explicit setting to 32 or 64.
    ifndef ARCH_DATA_MODEL
      ARCH_DATA_MODEL=32
    endif
    ifeq ($(ARCH_DATA_MODEL), 32)
      ARCH=sparc
    else
      ARCH=sparcv9
    endif
  else
    # Most archs are 32-bit
    ifndef ARCH_DATA_MODEL
      ARCH_DATA_MODEL=32
      ifeq ($(ARCH), amd64)
        ARCH_DATA_MODEL=64
      endif
      ifeq ($(ARCH), ia64)
        ARCH_DATA_MODEL=64
      endif
    endif
  endif

  # Need to maintain the jre/lib/i386 location for 32-bit Intel
  ifeq ($(ARCH), i586)
    LIBARCH = i386
  else
    LIBARCH = $(ARCH)
  endif

  # Value of Java os.arch property
  ARCHPROP  = $(LIBARCH)

  # Suffix for file bundles used in previous release
  BUNDLE_FILE_SUFFIX=.tar.gz
  # How much RAM does this machine have:
  MB_OF_MEMORY := $(shell free -m | fgrep Mem: | awk '{print $$2;}' )
endif

ifeq ($(SYSTEM_UNAME), Darwin)
  PLATFORM = macosx
  OS_NAME = darwin
  OS_VENDOR = Apple
  GB_OF_MEMORY := $(shell system_profiler SPHardwareDataType | fgrep Memory: | awk '{print $$2}')
  MB_OF_MEMORY := $(shell expr ${GB_OF_MEMORY} '*' 1024)
endif

# Platform settings specific to BSD/Mac OS X
ifeq ($(PLATFORM), macosx)
  OS_VERSION := $(shell uname -r)

  # Arch and OS name/version
  # Darwin x86 builds are i386/amd64 universal by default.
  # Allow arch to be set from the environment to avoid this.
  ifeq ($(origin ARCH), undefined)
   ifeq ($(PLATFORM), macosx)
#     ifdef OPENJDK -- when universal 32/64 binaries available in Hotspot
#        mach := universal
#     else
        mach := x86_64
#     endif
   else
    mach := $(shell uname -m)
   endif
  else
   mach := $(ARCH)
  endif

  archExpr = case "$(mach)" in \
                i[3-9]86) \
                    echo i586 \
                    ;; \
                sparc64) \
                    echo sparcv9 \
                    ;; \
                sparc*) \
                    echo sparc \
                    ;; \
                x86_64) \
                    echo amd64 \
                    ;; \
                universal) \
                    echo universal \
                    ;; \
                "Power Macintosh") \
                    echo ppc \
                    ;; \
                *) \
                    echo $(mach) \
                    ;; \
      esac
  ARCH        := $(shell $(archExpr) )
  ARCH_FAMILY := $(ARCH)

  # i586, sparc, and ppc are 32 bit, amd64 and sparc64 are 64
  # ARCH_DATA_MODEL does not exactly mean anything in universal
  # but it has to be one or the other, so pick 32
  ifneq (,$(findstring $(ARCH), i586 sparc ppc universal))
    ARCH_DATA_MODEL=32
  else
    ARCH_DATA_MODEL=64
  endif

  # Need to maintain the jre/lib/i386 location for 32-bit Intel
  ifeq ($(ARCH), i586)
    LIBARCH = i386
  else
    LIBARCH = $(ARCH)
  endif

  # Value of Java os.arch property
  ARCHPROP  = $(LIBARCH)

  # Suffix for file bundles used in previous release
  BUNDLE_FILE_SUFFIX=.tar.gz
  # How much RAM does this machine have:
endif

# Windows with and without CYGWIN will be slightly different
ifeq ($(SYSTEM_UNAME), Windows_NT)
  PLATFORM = windows
endif
ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME)))
  PLATFORM = windows
  USING_CYGWIN = true
  export USING_CYGWIN
  CYGPATH_CMD=cygpath -a -s -m
  # Only run "cygpath /" once in this make session.
  ifndef CYGWIN_HOME
    CYGWIN_HOME := $(shell $(CYGPATH_CMD) /)
    export CYGWIN_HOME
  endif
endif

# Platform settings specific to Windows
ifeq ($(PLATFORM), windows)
  # Windows builds default to the appropriate for the underlaying
  # architecture.
  # Temporary disk area
  TEMP_DISK=C:/temp
  # GNU Make or MKS overrides $(PROCESSOR_ARCHITECTURE) to always
  #  return "x86". Use the first word of $(PROCESSOR_IDENTIFIER) instead.
  #  And sometimes PROCESSOR_IDENTIFIER is not defined at all
  #  (in some restricted shells), so we use uname if we have to.
  ifeq ($(PROCESSOR_IDENTIFIER),)
    # Only run uname -m once in this make session.
    ifndef SYSTEM_UNAME_M
      SYSTEM_UNAME_M := $(shell uname -m)
      export SYSTEM_UNAME_M
    endif
    PROC_ARCH:=$(SYSTEM_UNAME_M)
  else
    PROC_ARCH:=$(word 1, $(PROCESSOR_IDENTIFIER))
  endif
  # Cover all the possibilities, MKS uname, CYGWIN uname, PROCESSOR_IDENTIFIER
  #    Get: X86, X64, or IA64
  PROC_ARCH:=$(patsubst 386,X86,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst 486,X86,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst 586,X86,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst 686,X86,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst i386,X86,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst i486,X86,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst i586,X86,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst i686,X86,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst x86,X86,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst intel64,X64,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst Intel64,X64,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst INTEL64,X64,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst em64t,X64,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst EM64T,X64,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst amd64,X64,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst AMD64,X64,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst 8664,X64,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst x86_64,X64,$(PROC_ARCH))
  PROC_ARCH:=$(patsubst ia64,IA64,$(PROC_ARCH))
  ifndef ARCH_DATA_MODEL
    ifeq ($(PROC_ARCH),IA64)
      ARCH_DATA_MODEL=64
    else
      ifeq ($(PROC_ARCH),X64)
        ARCH_DATA_MODEL=64
      else
        ARCH_DATA_MODEL=32
      endif
    endif
  endif
  export ARCH_DATA_MODEL
  ifeq ($(ARCH_DATA_MODEL), 64)
    # If the user wants to perform a cross compile build then they must
    # - set ARCH_DATA_MODEL=64 and either
    #      + set ARCH to ia64 or amd64, or
    ifeq ($(PROC_ARCH),X64)
      ARCH=amd64
    else
      ifeq ($(PROC_ARCH),IA64)
        ARCH=ia64
      endif
    endif
    LIBARCH=$(ARCH)
    # Value of Java os.arch property
    ARCHPROP=$(LIBARCH)
  else
    # LIBARCH is used to preserve the jre/lib/i386 directory name for 32-bit intel
    ARCH=i586
    LIBARCH=i386
    # Value of Java os.arch property
    ARCHPROP=x86
  endif
  ARCH_FAMILY = $(ARCH)
  # Where is unwanted output to be delivered?
  # MKS uses the special file "NUL", cygwin uses the customary unix file.
  ifeq ($(USING_CYGWIN),true)
    DEV_NULL = /dev/null
  else
    DEV_NULL = NUL
  endif
  export DEV_NULL
  # Classpath separator
  CLASSPATH_SEPARATOR = ;
  # The suffix used for object file (.o for unix .obj for windows)
  OBJECT_SUFFIX = obj
  # The suffix applied to executables (.exe for windows, nothing for solaris)
  EXE_SUFFIX = .exe
  # The prefix applied to library files (lib for solaris, nothing for windows)
  LIB_PREFIX=
  LIBRARY_SUFFIX = dll
  LIB_SUFFIX     = lib
  # User name determination (set _USER)
  ifndef USER
    ifdef USERNAME
      _USER := $(USERNAME)
    else
      ifdef LOGNAME
        _USER := $(LOGNAME)
      else
        _USER := $(shell id -un)
      endif
    endif
  else
    _USER:=$(USER)
  endif
  # Location of client/server directories
  ARCH_VM_SUBDIR=jre/bin
  # Suffix for file bundles used in previous release
  BUNDLE_FILE_SUFFIX=.tar
  # ISHIELD_TEMP_MIN is the difference of an empty C:\TEMP vs. one after a
  #     bundles build on windows.
  ISHIELD_TEMP_MIN=250000
  # How much RAM does this machine have:
  ifeq ($(JDK_HAS_MEM_INFO),)
    MB_OF_MEMORY := 1024
  endif
endif

# Unix type settings (same for all unix platforms)
ifneq ($(PLATFORM), windows)
  # Temporary disk area
  TEMP_DISK=/tmp
  # Where is unwanted output to be delivered?
  DEV_NULL = /dev/null
  export DEV_NULL
  # Character used between entries in classpath 
  CLASSPATH_SEPARATOR = :
  # suffix used for object file (.o for unix .obj for windows)
  OBJECT_SUFFIX = o
  # The suffix applied to runtime libraries
  LIBRARY_SUFFIX = so
  # The suffix applied to link libraries
  LIB_SUFFIX = so
  # The suffix applied to executables (.exe for windows, nothing for solaris)
  EXE_SUFFIX =
  # The prefix applied to library files (lib for solaris, nothing for windows)
  LIB_PREFIX = lib
  # User name determination (set _USER)
  ifndef USER
    ifdef LOGNAME
      _USER := $(LOGNAME)
    else
      _USER := $(shell logname)
    endif
  else
    _USER:=$(USER)
  endif
  # Location of client/server directories
  ARCH_VM_SUBDIR=jre/lib/$(LIBARCH)
endif

# Darwin-specific Overrides
ifeq ($(SYSTEM_UNAME),Darwin)
  # The suffix applied to runtime libraries
  LIBRARY_SUFFIX = dylib
  # The suffix applied to link libraries
  ifeq ($(ARCH), universal)
    LIB_SUFFIX = o
  else
    LIB_SUFFIX = a
  endif

  ifeq ($(PLATFORM), macosx)
  	ARCH_VM_SUBDIR=jre/lib/$(LIBARCH)
  endif
endif

# Machines with 512Mb or less of real memory are considered low memory
#    build machines and adjustments will be made to prevent excessing
#    system swapping during the build.
ifeq ($(JDK_HAS_MEM_INFO),)
  JDK_HAS_MEM_INFO=true
  export JDK_HAS_MEM_INFO
  ifneq ($(MB_OF_MEMORY),)
    LOW_MEMORY_MACHINE := $(shell \
      if [ $(MB_OF_MEMORY) -le 512 ] ; then \
        echo "true"; \
      else \
        echo "false"; \
      fi)
    MAX_VM_MEMORY := 512
    MIN_VM_MEMORY := $(MAX_VM_MEMORY)
  else
    MB_OF_MEMORY       := unknown
    LOW_MEMORY_MACHINE := true
    MAX_VM_MEMORY      := 384
    MIN_VM_MEMORY      := 128
  endif
  export MB_OF_MEMORY
  export LOW_MEMORY_MACHINE
  export MAX_VM_MEMORY
  export MIN_VM_MEMORY
endif

# If blanks in the username, use the first 4 words and pack them together
_USER1:=$(subst ', ,$(_USER))
_USER2:=$(subst ", ,$(_USER1))
USER:=$(word 1,$(_USER2))$(word 2,$(_USER2))$(word 3,$(_USER2))$(word 4,$(_USER2))
export USER

export PLATFORM
endif