make/common/shared/Platform.gmk

Fri, 09 Aug 2013 14:24:17 +0100

author
chegar
date
Fri, 09 Aug 2013 14:24:17 +0100
changeset 518
0717fc6f2960
parent 406
0a5931be9176
permissions
-rw-r--r--

Merge

     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 #
    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 #
    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 #
    38 ifndef PLATFORM_SHARED
    40 PLATFORM_SHARED=done
    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 #     OS_NAME                     solaris, linux, or nt
    55 #     OS_VERSION                  specific version of os, 5.10, 2.4.9-e.3, etc.
    56 #     TEMP_DISK                   /tmp or C:/temp
    57 #     ARCH_DATA_MODEL             32 or 64
    58 #     ARCH                        sparc, sparcv9, i586, amd64, or ia64
    59 #     ARCH_FAMILY                 sparc or i586
    60 #     ARCHPROP                    sparc or x86
    61 #     DEV_NULL                    destination of /dev/null, NUL or /dev/NULL
    62 #     CLASSPATH_SEPARATOR         separator in classpath, ; or :
    63 #     BUNDLE_FILE_SUFFIX          suffix for bundles: .tar or .tar.gz
    64 #     ISA_DIR                     solaris only: /sparcv9 or /amd64
    65 #     REQUIRED_WINDOWS_NAME       windows only: basic name of windows
    66 #     REQUIRED_WINDOWS_VERSION    windows only: specific version of windows
    67 #     USING_CYGWIN                windows only: true or false
    68 #     USING_MSYS                  windows only: true or false
    69 #     USING_MKS                   windows only: true or false
    70 #     WINDOWS_NT_VERSION_STRING   windows only: long version name
    71 #     REQUIRED_OS_VERSION         required OS version, e.g. 5.10, 2.4
    72 #     REQUIRED_FREE_SPACE         minimum disk space needed for outputdir
    73 #     REQUIRED_ZIP_VER            required version of zip
    74 #     REQUIRED_UNZIP_VER          required version of unzip
    75 #     LINUX_VERSION_INFO          linux only: location of linux release file
    76 #     REQUIRED_LINUX_VER          linux only: required version of linux
    77 #     REQUIRED_LINUX_FULLVER      linux only: required full version of linux
    79 ifndef SYSTEM_UNAME
    80   SYSTEM_UNAME := $(shell uname)
    81   export SYSTEM_UNAME
    82 endif
    84 # Normal boot jdk is previous release, but a hard requirement is a 1.5 boot
    85 REQUIRED_BOOT_VER = 1.5
    87 # Don't define this unless it's not defined
    88 ifndef VARIANT
    89   VARIANT=OPT
    90 endif
    92 # Platform settings specific to Solaris
    93 ifeq ($(SYSTEM_UNAME), SunOS)
    94   PLATFORM = solaris
    95   OS_NAME = solaris
    96   OS_VERSION := $(shell uname -r)
    97   # Solaris sparc build can be either 32-bit or 64-bit.
    98   #   Default to 32, but allow explicit setting to 32 or 64.
    99   ifndef ARCH_DATA_MODEL
   100     ARCH_DATA_MODEL=32
   101   endif
   102   ifeq ($(ARCH_DATA_MODEL), 32)
   103     processor := $(shell uname -p)
   104     archExpr = case "$(processor)" in  \
   105                 i[3-9]86) \
   106                     echo i586 \
   107                     ;; \
   108                 sparc*)  \
   109                     echo sparc \
   110                     ;; \
   111                 *) \
   112                     echo $(processor)  \
   113                     ;; \
   114         esac
   115     ARCH        := $(shell $(archExpr))
   116   else
   117     ARCH := $(shell isainfo -n)
   118     # ISA_DIR is used to locate 64-bit specific libraries which are generally
   119     # in the same general place as other libraries under the ./$(ARCH) directory
   120     ISA_DIR = /$(ARCH)
   121   endif
   122   # Need to maintain the jre/lib/i386 location for 32-bit Intel
   123   ifeq ($(ARCH), i586)
   124      ARCH_FAMILY = $(ARCH)
   125      # Value of Java os.arch property
   126      ARCHPROP    = x86
   127   else
   128      ifeq ($(ARCH), amd64)
   129         ARCH_FAMILY = i586
   130      else
   131         ARCH_FAMILY = sparc
   132      endif
   133      # Value of Java os.arch property
   134      ARCHPROP = $(ARCH)
   135   endif
   136   # Suffix for file bundles used in previous release
   137   BUNDLE_FILE_SUFFIX=.tar
   138   # Required Solaris version
   139   REQUIRED_OS_VERSION = 5.10
   140   # Minimum disk space needed as determined by running 'du -sk' on
   141   #    a fully built workspace.
   142   ifeq ($(ARCH_FAMILY), sparc)
   143     REQUIRED_FREE_SPACE=1300000
   144   else
   145     REQUIRED_FREE_SPACE=1040000
   146   endif
   147   # How much RAM does this machine have:
   148   MB_OF_MEMORY:=$(shell /usr/sbin/prtconf 2>/dev/null | fgrep 'Memory size:' | expand | cut -d' ' -f3)
   149 endif
   151 # Platform settings specific to Linux
   152 ifeq ($(SYSTEM_UNAME), Linux)
   153   PLATFORM = linux
   154   OS_NAME = linux
   155   OS_VERSION := $(shell uname -r)
   156   # Arch and OS name/version
   157   mach := $(shell uname -m)
   158   archExpr = case "$(mach)" in \
   159                 i[3-9]86) \
   160                     echo i586 \
   161                     ;; \
   162                 ia64) \
   163                     echo ia64 \
   164                     ;; \
   165                 x86_64) \
   166                     echo amd64 \
   167                     ;; \
   168                 sparc*) \
   169                     echo sparc \
   170                     ;; \
   171                 arm*) \
   172                     echo arm \
   173                     ;; \
   174                 *) \
   175                     echo $(mach) \
   176                     ;; \
   177       esac
   178   ARCH        := $(shell $(archExpr) )
   179   ARCH_FAMILY := $(ARCH)
   181   # Linux builds may be 32-bit or 64-bit data model.
   182   ifeq ($(ARCH), sparc)
   183     # Linux sparc build can be either 32-bit or 64-bit.
   184     #   Default to 32, but allow explicit setting to 32 or 64.
   185     ifndef ARCH_DATA_MODEL
   186       ARCH_DATA_MODEL=32
   187     endif
   188     ifeq ($(ARCH_DATA_MODEL), 32)
   189       ARCH=sparc
   190     else
   191       ARCH=sparcv9
   192     endif
   193   else
   194     # i586 is 32-bit, amd64 is 64-bit
   195     ifndef ARCH_DATA_MODEL
   196       ifeq ($(ARCH), i586)
   197         ARCH_DATA_MODEL=32
   198       else
   199         ARCH_DATA_MODEL=64
   200       endif
   201     endif
   202   endif
   204   ifeq ($(ARCH), i586)
   205     ARCHPROP = i386
   206   else
   207     ARCHPROP = $(ARCH)
   208   endif
   210   # Suffix for file bundles used in previous release
   211   BUNDLE_FILE_SUFFIX=.tar.gz
   212   # Minimum disk space needed as determined by running 'du -sk' on
   213   #    a fully built workspace.
   214   REQUIRED_FREE_SPACE=1460000
   215   LINUX_VERSION_INFO = /etc/redhat-release
   216   ifeq ($(ARCH_DATA_MODEL), 32)
   217     REQUIRED_LINUX_VER = Advanced Server
   218     REQUIRED_LINUX_FULLVER = Advanced Server release 2.1AS
   219     REQUIRED_OS_VERSION = 2.4.9-e.3
   220   else
   221     ifeq ($(ARCH), amd64)
   222       LINUX_VERSION_INFO = /etc/SuSE-release
   223       REQUIRED_LINUX_VER = 8.1
   224       REQUIRED_LINUX_FULLVER = $(REQUIRED_LINUX_VER) SLSE AMD64
   225       REQUIRED_OS_VERSION = 2.4.19-SMP
   226     else
   227       REQUIRED_LINUX_VER = Advanced Server
   228       REQUIRED_LINUX_FULLVER = Advanced Server release 2.1AS 64 bit
   229       REQUIRED_OS_VERSION = 2.4.19-SMP
   230     endif
   231   endif
   232   # How much RAM does this machine have:
   233   MB_OF_MEMORY := $(shell free -m | fgrep Mem: | sed -e 's@\ \ *@ @g' | cut -d' ' -f2)
   234 endif
   236 ifeq ($(SYSTEM_UNAME), FreeBSD)
   237   PLATFORM = bsd
   238   OS_NAME = freebsd
   239   OS_VENDOR = FreeBSD
   240   REQUIRED_OS_VERSION = 6.0
   241 endif
   243 ifeq ($(SYSTEM_UNAME), Darwin)
   244   PLATFORM = bsd
   245   OS_NAME = darwin
   246   OS_VENDOR = Apple
   247   REQUIRED_OS_VERSION = 8.0
   248 endif
   250 ifeq ($(SYSTEM_UNAME), NetBSD)
   251   PLATFORM = bsd
   252   OS_NAME = netbsd
   253   OS_VENDOR = NetBSD
   254   REQUIRED_OS_VERSION = 3.0
   255 endif
   257 ifeq ($(SYSTEM_UNAME), OpenBSD)
   258   PLATFORM = bsd
   259   OS_NAME = openbsd
   260   OS_VENDOR = OpenBSD
   261   REQUIRED_OS_VERSION = 4.9
   262 endif
   264 # Platform settings specific to BSD
   265 ifeq ($(PLATFORM), bsd)
   266   OS_VERSION := $(shell uname -r)
   267   # Arch and OS name/version
   268   mach := $(shell uname -m)
   269   archExpr = case "$(mach)" in \
   270                 i[3-9]86) \
   271                     echo i586 \
   272                     ;; \
   273                 sparc64) \
   274                     echo sparcv9 \
   275                     ;; \
   276                 sparc*) \
   277                     echo sparc \
   278                     ;; \
   279                 x86_64) \
   280                     echo x86_64 \
   281                     ;; \
   282                 "Power Macintosh") \
   283                     echo ppc \
   284                     ;; \
   285                 *) \
   286                     echo $(mach) \
   287                     ;; \
   288       esac
   289   ARCH        := $(shell $(archExpr) )
   290   ARCH_FAMILY := $(ARCH)
   292   # Darwin builds are currently universal but only include 64-bit
   293   # 
   294   # ifeq ($(SYSTEM_UNAME), Darwin)
   295   #  ifneq ($(ARCH), ppc)
   296   #    ARCH=universal
   297   #  endif
   298   # endif
   300   # i586, sparc, and ppc are 32 bit, amd64 and sparc64 are 64
   301   ifneq (,$(findstring $(ARCH), i586 sparc ppc universal))
   302     ARCH_DATA_MODEL=32
   303   else
   304     ARCH_DATA_MODEL=64
   305   endif
   307   ifeq ($(ARCH), i586)
   308     LIBARCH = i386
   309   else
   310     LIBARCH = $(ARCH)
   311   endif
   313   # Value of Java os.arch property
   314   ARCHPROP  = $(LIBARCH)
   316   # Suffix for file bundles used in previous release
   317   BUNDLE_FILE_SUFFIX=.tar.gz
   318   # Minimum disk space needed as determined by running 'du -sk' on
   319   #    a fully built workspace.
   320   REQUIRED_FREE_SPACE=1500000
   321   # How much RAM does this machine have:
   322   ifeq ($(OS_VENDOR), OpenBSD)
   323     MB_OF_MEMORY=$(shell sysctl -n hw.physmem | awk '{print int($$NF / 1048576); }' )
   324   else
   325     MB_OF_MEMORY=$(shell (sysctl -n hw.physmem64 2> /dev/null || sysctl -n hw.physmem) | awk '{print int($$NF / 1048576); }' )
   326   endif
   327 endif
   329 # Windows with and without CYGWIN will be slightly different
   330 ifeq ($(SYSTEM_UNAME), Windows_NT)
   331   PLATFORM = windows
   332   USING_MKS = true
   333   export USING_MKS
   334   OS_VERSION := $(shell uname -r)
   335   WINDOWS_NT_VERSION_STRING=Windows_NT
   336   REQUIRED_MKS_VER=6.1
   337 endif
   338 ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME)))
   339   PLATFORM = windows
   340   OS_VERSION := 5
   341   USING_CYGWIN = true
   342   export USING_CYGWIN
   343   WINDOWS_NT_VERSION_STRING=CYGWIN_NT
   344   REQUIRED_CYGWIN_VER=4.0
   345 endif
   346 ifneq (,$(findstring MINGW,$(SYSTEM_UNAME)))
   347   PLATFORM = windows
   348   USING_MSYS = true
   349   export USING_MSYS
   350 endif
   352 # Platform settings specific to Windows
   353 ifeq ($(PLATFORM), windows)
   354   OS_NAME = nt
   355   REQUIRED_OS_VERSION=5
   356   # Windows builds default to the appropriate for the underlaying
   357   # architecture.
   358   # Temporary disk area
   359   TEMP_DISK=C:/temp
   360   # GNU Make or MKS overrides $(PROCESSOR_ARCHITECTURE) to always
   361   # return "x86". Use the first word of $(PROCESSOR_IDENTIFIER) instead.
   362   PROC_ARCH:=$(word 1, $(PROCESSOR_IDENTIFIER))
   363   PROC_ARCH:=$(subst x86,X86,$(PROC_ARCH))
   364   PROC_ARCH:=$(subst x64,X64,$(PROC_ARCH))
   365   PROC_ARCH:=$(subst intel64,X64,$(PROC_ARCH))
   366   PROC_ARCH:=$(subst Intel64,X64,$(PROC_ARCH))
   367   PROC_ARCH:=$(subst INTEL64,X64,$(PROC_ARCH))
   368   PROC_ARCH:=$(subst em64t,X64,$(PROC_ARCH))
   369   PROC_ARCH:=$(subst EM64T,X64,$(PROC_ARCH))
   370   PROC_ARCH:=$(subst amd64,X64,$(PROC_ARCH))
   371   PROC_ARCH:=$(subst AMD64,X64,$(PROC_ARCH))
   372   PROC_ARCH:=$(subst ia64,IA64,$(PROC_ARCH))
   373   ifndef ARCH_DATA_MODEL
   374     ifeq ($(PROC_ARCH),IA64)
   375       ARCH_DATA_MODEL=64
   376     else
   377       ifeq ($(PROC_ARCH),X64)
   378         ARCH_DATA_MODEL=64
   379       else
   380         ARCH_DATA_MODEL=32
   381       endif
   382     endif
   383   endif
   384   export ARCH_DATA_MODEL
   385   ARCH=i586
   386   # Value of Java os.arch property
   387   ARCHPROP=x86
   388   REQUIRED_WINDOWS_NAME=Windows Professional 2000
   389   REQUIRED_WINDOWS_VERSION=5 0 Service Pack 4
   390   ifeq ($(ARCH_DATA_MODEL), 64)
   391     # If the user wants to perform a cross compile build then they must
   392     # - set ARCH_DATA_MODEL=64 and either
   393     #      + set ARCH to ia64 or amd64, or
   394     REQUIRED_WINDOWS_NAME=Windows Server 2003
   395     REQUIRED_WINDOWS_VERSION=5 2 Service Pack 1
   396     ifeq ($(PROC_ARCH),X64)
   397       ARCH=amd64
   398     else
   399       ifeq ($(PROC_ARCH),IA64)
   400         ARCH=ia64
   401       endif
   402     endif
   403     # Value of Java os.arch property
   404     ARCHPROP=$(ARCH)
   405   endif
   406   ARCH_FAMILY = $(ARCH)
   407   # Where is unwanted output to be delivered?
   408   ifeq ($(USING_CYGWIN),true)
   409     DEV_NULL = /dev/null
   410   else
   411     DEV_NULL = NUL
   412   endif
   413   export DEV_NULL
   414   # Classpath separator
   415   CLASSPATH_SEPARATOR = ;
   416   # User name determination (set _USER)
   417   ifndef USER
   418     ifdef USERNAME
   419       _USER := $(USERNAME)
   420     else
   421       ifdef LOGNAME
   422         _USER := $(LOGNAME)
   423       else
   424         _USER := $(shell id -un)
   425       endif
   426     endif
   427   else
   428     _USER:=$(USER)
   429   endif
   430   # Suffix for file bundles used in previous release
   431   BUNDLE_FILE_SUFFIX=.tar
   432   # Minimum disk space needed as determined by running 'du -sk' on
   433   #    a fully built workspace.
   434   REQUIRED_FREE_SPACE=500000
   435   # How much RAM does this machine have:
   436   ifndef MB_OF_MEMORY
   437     MB_OF_MEMORY := $(shell \
   438       if [ -f "C:/cygwin/bin/free.exe" ] ; then \
   439         ( C:/cygwin/bin/bash.exe -c "C:/cygwin/bin/free.exe -m" ) | \
   440           grep Mem: | \
   441           sed -e 's@\ \ *@ @g' | cut -d' ' -f2 ; \
   442       else \
   443         echo "512"; \
   444       fi)
   445     export MB_OF_MEMORY
   446   endif
   447 endif
   449 # Machines with 512Mb or less of real memory are considered low memory
   450 #    build machines and adjustments will be made to prevent excessing
   451 #    system swapping during the build.
   452 #    If we don't know, assume 512. Subtract 128 from MB for VM MAX.
   453 #    Don't set VM max over 1024-128=896.
   454 ifndef MAX_VM_MEMORY
   455   ifneq ($(MB_OF_MEMORY),)
   456     LOW_MEMORY_MACHINE := $(shell \
   457       if [ $(MB_OF_MEMORY) -le 512 ] ; then \
   458         echo "true"; \
   459       else \
   460         echo "false"; \
   461       fi)
   462     MAX_VM_MEMORY := $(shell \
   463       if [ $(MB_OF_MEMORY) -le 1024 ] ; then \
   464         expr $(MB_OF_MEMORY) '-' 128 ; \
   465       else \
   466         echo "896"; \
   467       fi)
   468     MIN_VM_MEMORY := $(shell \
   469       if [ $(MAX_VM_MEMORY) -le 128 ] ; then \
   470         expr $(MAX_VM_MEMORY) '-' 8 ; \
   471       else \
   472         echo "128"; \
   473       fi)
   474   else
   475     MB_OF_MEMORY       := unknown
   476     LOW_MEMORY_MACHINE := true
   477     MAX_VM_MEMORY      := 384
   478     MIN_VM_MEMORY      := 128
   479   endif
   480   export MAX_VM_MEMORY
   481   export MIN_VM_MEMORY
   482   export LOW_MEMORY_MACHINE
   483   export MAX_VM_MEMORY
   484 endif
   486 REQUIRED_ZIP_VER = 2.2
   487 REQUIRED_UNZIP_VER = 5.12
   488 REQUIRED_MAKE_VER = 3.81
   490 # Unix type settings (same for all unix platforms)
   491 ifneq ($(PLATFORM), windows)
   492   # Temporary disk area
   493   TEMP_DISK=/tmp
   494   # Where is unwanted output to be delivered?
   495   DEV_NULL = /dev/null
   496   export DEV_NULL
   497   # Character used between entries in classpath
   498   CLASSPATH_SEPARATOR = :
   499   # User name determination (set _USER)
   500   ifndef USER
   501     ifdef LOGNAME
   502       _USER := $(LOGNAME)
   503     else
   504       _USER := $(shell logname)
   505     endif
   506   else
   507     _USER:=$(USER)
   508   endif
   509 endif
   511 # If blanks in the username, use the first 4 words and pack them together
   512 _USER1:=$(subst ', ,$(_USER))
   513 _USER2:=$(subst ", ,$(_USER1))
   514 USER:=$(word 1,$(_USER2))$(word 2,$(_USER2))$(word 3,$(_USER2))$(word 4,$(_USER2))
   515 export USER
   517 export PLATFORM
   518 endif

mercurial