jdk/make/common/shared/Platform.gmk
changeset 2 90ce3da70b43
child 26 eb94dff5238c
equal deleted inserted replaced
0:fd16c54261b3 2:90ce3da70b43
       
     1 #
       
     2 # Copyright 1997-2007 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 #     OS_NAME                     solaris, linux, or nt
       
    55 #     OS_VERSION                  specific version of os, 5.10, 2.4.9-e.3, etc.
       
    56 #     OS_VENDOR                   company name
       
    57 #     TEMP_DISK                   /tmp or C:/temp
       
    58 #     ARCH_DATA_MODEL             32 or 64
       
    59 #     ARCH                        sparc, sparcv9, i586, amd64, or ia64
       
    60 #     ARCH_FAMILY                 sparc or i586
       
    61 #     ARCHPROP                    sparc or x86
       
    62 #     ARCH_VM_SUBDIR              jre/bin, jre/lib/sparc, etc.
       
    63 #     LIBARCH                     sparc, sparcv9, i386, amd64, or ia64
       
    64 #     DEV_NULL                    destination of /dev/null, NUL or /dev/NULL
       
    65 #     CLASSPATH_SEPARATOR         separator in classpath, ; or :
       
    66 #     LIB_PREFIX                  dynamic or static library prefix, lib or empty
       
    67 #     LIB_SUFFIX                  static library file suffix, .lib or .a?
       
    68 #     LIBRARY_SUFFIX              dynamic library file suffix, .dll or .so
       
    69 #     OBJECT_SUFFIX               object file suffix, .o or .obj
       
    70 #     EXE_SUFFIX                  executable file suffix, .exe or empty
       
    71 #     BUNDLE_FILE_SUFFIX          suffix for bundles: .tar or .tar.gz
       
    72 #     ISA_DIR                     solaris only: /sparcv9 or /amd64
       
    73 #     LIBARCH32                   solaris only: sparc or i386
       
    74 #     LIBARCH64                   solaris only: sparcv9 or amd64
       
    75 #     REQUIRED_WINDOWS_NAME       windows only: basic name of windows 
       
    76 #     REQUIRED_WINDOWS_VERSION    windows only: specific version of windows 
       
    77 #     USING_CYGWIN                windows only: true or false
       
    78 #     WINDOWS_NT_VERSION_STRING   windows only: long version name
       
    79 #     REQUIRED_OS_VERSION         required OS version, e.g. 5.10, 2.4
       
    80 #     REQUIRED_FREE_SPACE         minimum disk space needed for outputdir
       
    81 #     ISHIELD_TEMP_MIN            windows only: minimum disk space in temp area
       
    82 #     REQUIRED_ZIP_VER            required version of zip
       
    83 #     REQUIRED_UNZIP_VER          required version of unzip
       
    84 #     REQUIRED_DXSDK_VER          windows only: required version of DirectX
       
    85 #     LINUX_VERSION_INFO          linux only: location of linux release file
       
    86 #     REQUIRED_LINUX_VER          linux only: required version of linux
       
    87 #     REQUIRED_LINUX_FULLVER      linux only: required full version of linux
       
    88 #     REQUIRED_ALSA_VERSION       linux only: required version of ALSA
       
    89 #     REQUIRED_FREETYPE_VERSION   openjdk only: required version of freetype 
       
    90 
       
    91 SYSTEM_UNAME := $(shell uname)
       
    92 
       
    93 # Normal boot jdk is previous release, but a hard requirement is a 1.5 boot
       
    94 REQUIRED_BOOT_VER = 1.5
       
    95 
       
    96 #This is specific to OpenJDK build
       
    97 ifdef OPENJDK
       
    98   REQUIRED_FREETYPE_VERSION=2.3.0
       
    99 endif
       
   100 
       
   101 #
       
   102 # Prune out all known SCM (Source Code Management) directories
       
   103 # so they will not be included when copying directory trees
       
   104 # or packaging up .jar files, etc.  This applies to all workspaces.
       
   105 #
       
   106 SCM_DIRs = .hg .svn CVS RCS SCCS Codemgr_wsdata deleted_files
       
   107 # When changing SCM_DIRs also change SCM_DIRS_rexp and SCM_DIRS_prune:
       
   108 SCM_DIRS_rexp = ".hg|.svn|CVS|RCS|SCCS|Codemgr_wsdata|deleted_files"
       
   109 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 \) -prune
       
   110 
       
   111 # Don't define this unless it's not defined
       
   112 ifndef VARIANT
       
   113   VARIANT=OPT
       
   114 endif
       
   115 
       
   116 # Platform settings specific to Solaris
       
   117 ifeq ($(SYSTEM_UNAME), SunOS)
       
   118   PLATFORM = solaris
       
   119   OS_NAME = solaris
       
   120   OS_VERSION := $(shell uname -r)
       
   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     processor := $(shell uname -p)
       
   128     archExpr = case "$(processor)" in  \
       
   129                 i[3-9]86) \
       
   130                     echo i586 \
       
   131                     ;; \
       
   132                 sparc*)  \
       
   133                     echo sparc \
       
   134                     ;; \
       
   135                 *) \
       
   136                     echo $(processor)  \
       
   137                     ;; \
       
   138         esac
       
   139     ARCH        := $(shell $(archExpr))
       
   140   else
       
   141     ARCH := $(shell isainfo -n)
       
   142     # ISA_DIR is used to locate 64-bit specific libraries which are generally
       
   143     # in the same general place as other libraries under the ./$(ARCH) directory
       
   144     ISA_DIR = /$(ARCH)
       
   145   endif
       
   146   # Need to maintain the jre/lib/i386 location for 32-bit Intel
       
   147   ifeq ($(ARCH), i586)
       
   148      ARCH_FAMILY = $(ARCH)
       
   149      LIBARCH     = i386
       
   150      # Value of Java os.arch property
       
   151      ARCHPROP    = x86
       
   152   else
       
   153      ifeq ($(ARCH), amd64)
       
   154         ARCH_FAMILY = i586
       
   155      else
       
   156         ARCH_FAMILY = sparc
       
   157      endif
       
   158      LIBARCH  = $(ARCH)
       
   159      # Value of Java os.arch property
       
   160      ARCHPROP = $(LIBARCH)
       
   161   endif
       
   162   # The two LIBARCH names
       
   163   ifeq ($(ARCH_FAMILY), sparc)
       
   164     LIBARCH32 = sparc
       
   165     LIBARCH64 = sparcv9
       
   166   else
       
   167     LIBARCH32 = i386
       
   168     LIBARCH64 = amd64
       
   169   endif
       
   170   # Suffix for file bundles used in previous release
       
   171   BUNDLE_FILE_SUFFIX=.tar
       
   172   OS_VENDOR = Sun Microsystems
       
   173   # Required Solaris version
       
   174   REQUIRED_OS_VERSION = 5.10
       
   175   # Minimum disk space needed as determined by running 'du -sk' on 
       
   176   #    a fully built workspace.
       
   177   ifeq ($(ARCH_FAMILY), sparc)
       
   178     REQUIRED_FREE_SPACE=1300000
       
   179   else
       
   180     REQUIRED_FREE_SPACE=1040000
       
   181   endif
       
   182   # How much RAM does this machine have:
       
   183   MB_OF_MEMORY=$(shell /etc/prtconf | fgrep 'Memory size:' | expand | cut -d' ' -f3)
       
   184 endif
       
   185 
       
   186 # Platform settings specific to Linux
       
   187 ifeq ($(SYSTEM_UNAME), Linux)
       
   188   PLATFORM = linux
       
   189   OS_NAME = linux
       
   190   OS_VERSION := $(shell uname -r)
       
   191   # Arch and OS name/version
       
   192   mach := $(shell uname -m)
       
   193   archExpr = case "$(mach)" in \
       
   194                 i[3-9]86) \
       
   195                     echo i586 \
       
   196                     ;; \
       
   197                 ia64) \
       
   198                     echo ia64 \
       
   199                     ;; \
       
   200                 x86_64) \
       
   201                     echo amd64 \
       
   202                     ;; \
       
   203                 sparc*) \
       
   204                     echo sparc \
       
   205                     ;; \
       
   206                 *) \
       
   207                     echo $(mach) \
       
   208                     ;; \
       
   209       esac
       
   210   ARCH        := $(shell $(archExpr) )
       
   211   ARCH_FAMILY := $(ARCH)
       
   212 
       
   213   # Linux builds may be 32-bit or 64-bit data model.
       
   214   ifeq ($(ARCH), sparc)
       
   215     # Linux sparc build can be either 32-bit or 64-bit.
       
   216     #   Default to 32, but allow explicit setting to 32 or 64.
       
   217     ifndef ARCH_DATA_MODEL
       
   218       ARCH_DATA_MODEL=32
       
   219     endif
       
   220     ifeq ($(ARCH_DATA_MODEL), 32)
       
   221       ARCH=sparc
       
   222     else
       
   223       ARCH=sparcv9
       
   224     endif
       
   225   else
       
   226     # i586 is 32-bit, amd64 is 64-bit
       
   227     ifndef ARCH_DATA_MODEL
       
   228       ifeq ($(ARCH), i586)
       
   229         ARCH_DATA_MODEL=32
       
   230       else
       
   231         ARCH_DATA_MODEL=64
       
   232       endif
       
   233     endif
       
   234   endif
       
   235 
       
   236   # Need to maintain the jre/lib/i386 location for 32-bit Intel
       
   237   ifeq ($(ARCH), i586)
       
   238     LIBARCH = i386
       
   239   else
       
   240     LIBARCH = $(ARCH)
       
   241   endif
       
   242 
       
   243   # Value of Java os.arch property
       
   244   ARCHPROP  = $(LIBARCH)
       
   245 
       
   246   # Suffix for file bundles used in previous release
       
   247   BUNDLE_FILE_SUFFIX=.tar.gz
       
   248   # Minimum disk space needed as determined by running 'du -sk' on 
       
   249   #    a fully built workspace.
       
   250   REQUIRED_FREE_SPACE=1460000
       
   251   LINUX_VERSION_INFO = /etc/redhat-release
       
   252   OS_VENDOR = Red Hat
       
   253   ifeq ($(ARCH_DATA_MODEL), 32)
       
   254     REQUIRED_LINUX_VER = Advanced Server
       
   255     REQUIRED_LINUX_FULLVER = Advanced Server release 2.1AS
       
   256     REQUIRED_OS_VERSION = 2.4.9-e.3
       
   257   else
       
   258     ifeq ($(ARCH), amd64)
       
   259       LINUX_VERSION_INFO = /etc/SuSE-release
       
   260       OS_VENDOR = SuSE Enterprise
       
   261       REQUIRED_LINUX_VER = 8.1
       
   262       REQUIRED_LINUX_FULLVER = $(REQUIRED_LINUX_VER) SLSE AMD64
       
   263       REQUIRED_OS_VERSION = 2.4.19-SMP
       
   264     else
       
   265       REQUIRED_LINUX_VER = Advanced Server
       
   266       REQUIRED_LINUX_FULLVER = Advanced Server release 2.1AS 64 bit
       
   267       REQUIRED_OS_VERSION = 2.4.19-SMP
       
   268     endif
       
   269   endif
       
   270   ifneq ($(ARCH), ia64)
       
   271     # ALSA 0.9.1 and above
       
   272     REQUIRED_ALSA_VERSION = ^((0[.]9[.][1-9])|(1[.]0[.][0-9]))[0-9]*
       
   273   endif
       
   274   # How much RAM does this machine have:
       
   275   MB_OF_MEMORY := $(shell free -m | fgrep Mem: | sed -e 's@\ \ *@ @g' | cut -d' ' -f2)
       
   276 endif
       
   277 
       
   278 # Windows with and without CYGWIN will be slightly different
       
   279 ifeq ($(SYSTEM_UNAME), Windows_NT)
       
   280   PLATFORM = windows
       
   281   OS_VERSION := $(shell uname -r)
       
   282   WINDOWS_NT_VERSION_STRING=Windows_NT
       
   283   REQUIRED_MKS_VER=6.1
       
   284 endif
       
   285 ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME)))
       
   286   PLATFORM = windows
       
   287   OS_VERSION := 5
       
   288   USING_CYGWIN = true
       
   289   export USING_CYGWIN
       
   290   WINDOWS_NT_VERSION_STRING=CYGWIN_NT
       
   291   REQUIRED_CYGWIN_VER=4.0
       
   292 endif
       
   293 
       
   294 # Platform settings specific to Windows
       
   295 ifeq ($(PLATFORM), windows)
       
   296   OS_NAME = nt
       
   297   REQUIRED_OS_VERSION=5
       
   298   # Windows builds default to the appropriate for the underlaying
       
   299   # architecture.
       
   300   # Temporary disk area
       
   301   TEMP_DISK=C:/temp
       
   302   # GNU Make or MKS overrides $(PROCESSOR_ARCHITECTURE) to always
       
   303   # return "x86". Use the first word of $(PROCESSOR_IDENTIFIER) instead.
       
   304   ifndef ARCH_DATA_MODEL
       
   305     ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
       
   306       ARCH_DATA_MODEL=64
       
   307     else
       
   308       ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64)
       
   309         ARCH_DATA_MODEL=64
       
   310       else
       
   311         ARCH_DATA_MODEL=32
       
   312       endif
       
   313     endif
       
   314   endif
       
   315   export ARCH_DATA_MODEL
       
   316   # LIBARCH is used to preserve the jre/lib/i386 directory name for 32-bit intel
       
   317   ARCH=i586
       
   318   LIBARCH=i386
       
   319   # Value of Java os.arch property
       
   320   ARCHPROP=x86
       
   321   REQUIRED_WINDOWS_NAME=Windows Professional 2000
       
   322   REQUIRED_WINDOWS_VERSION=5 0 Service Pack 4
       
   323   ifeq ($(ARCH_DATA_MODEL), 64)
       
   324     # If the user wants to perform a cross compile build then they must
       
   325     # - set ARCH_DATA_MODEL=64 and either
       
   326     #      + set ARCH to ia64 or amd64, or
       
   327     REQUIRED_WINDOWS_NAME=Windows Server 2003
       
   328     REQUIRED_WINDOWS_VERSION=5 2 Service Pack 1
       
   329     ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)), AMD64)
       
   330       ARCH=amd64
       
   331     else
       
   332       ARCH=ia64
       
   333     endif
       
   334     LIBARCH=$(ARCH)
       
   335     # Value of Java os.arch property
       
   336     ARCHPROP=$(LIBARCH)
       
   337   endif
       
   338   ARCH_FAMILY = $(ARCH)
       
   339   # Where is unwanted output to be delivered?
       
   340   DEV_NULL = NUL
       
   341   export DEV_NULL
       
   342   # Classpath separator
       
   343   CLASSPATH_SEPARATOR = ;
       
   344   # The suffix used for object file (.o for unix .obj for windows)
       
   345   OBJECT_SUFFIX = obj
       
   346   # The suffix applied to executables (.exe for windows, nothing for solaris)
       
   347   EXE_SUFFIX = .exe
       
   348   # The prefix applied to library files (lib for solaris, nothing for windows)
       
   349   LIB_PREFIX=
       
   350   LIBRARY_SUFFIX = dll
       
   351   LIB_SUFFIX     = lib
       
   352   # User name determination (set _USER)
       
   353   ifndef USER
       
   354     ifdef USERNAME
       
   355       _USER := $(USERNAME)
       
   356     else
       
   357       ifdef LOGNAME
       
   358         _USER := $(LOGNAME)
       
   359       else
       
   360         _USER := $(shell id -un)
       
   361       endif
       
   362     endif
       
   363   else
       
   364     _USER:=$(USER)
       
   365   endif
       
   366   # Location of client/server directories
       
   367   ARCH_VM_SUBDIR=jre/bin
       
   368   # Suffix for file bundles used in previous release
       
   369   BUNDLE_FILE_SUFFIX=.tar
       
   370   # Minimum disk space needed as determined by running 'du -sk' on 
       
   371   #    a fully built workspace.
       
   372   REQUIRED_FREE_SPACE=500000
       
   373   # ISHIELD_TEMP_MIN is the difference of an empty C:\TEMP vs. one after a
       
   374   #     bundles build on windows.
       
   375   ISHIELD_TEMP_MIN=250000
       
   376   REQUIRED_DXSDK_VER = 0x0700
       
   377   OS_VENDOR = Microsoft
       
   378   # How much RAM does this machine have:
       
   379   MB_OF_MEMORY := $(shell \
       
   380     if [ -f "C:/cygwin/bin/free.exe" ] ; then \
       
   381       ( C:/cygwin/bin/bash.exe -c "C:/cygwin/bin/free.exe -m" ) | \
       
   382 	grep Mem: | \
       
   383 	sed -e 's@\ \ *@ @g' | cut -d' ' -f2 ; \
       
   384     else \
       
   385       echo "512"; \
       
   386     fi)
       
   387 endif
       
   388 
       
   389 # Machines with 512Mb or less of real memory are considered low memory
       
   390 #    build machines and adjustments will be made to prevent excessing
       
   391 #    system swapping during the build.
       
   392 #    If we don't know, assume 512. Subtract 128 from MB for VM MAX.
       
   393 #    Don't set VM max over 1024-128=896.
       
   394 ifneq ($(MB_OF_MEMORY),)
       
   395   LOW_MEMORY_MACHINE := $(shell \
       
   396     if [ $(MB_OF_MEMORY) -le 512 ] ; then \
       
   397       echo "true"; \
       
   398     else \
       
   399       echo "false"; \
       
   400     fi)
       
   401   MAX_VM_MEMORY := $(shell \
       
   402     if [ $(MB_OF_MEMORY) -le 1024 ] ; then \
       
   403       expr $(MB_OF_MEMORY) '-' 128 ; \
       
   404     else \
       
   405       echo "896"; \
       
   406     fi)
       
   407   MIN_VM_MEMORY := $(shell \
       
   408     if [ $(MAX_VM_MEMORY) -le 128 ] ; then \
       
   409       expr $(MAX_VM_MEMORY) '-' 8 ; \
       
   410     else \
       
   411       echo "128"; \
       
   412     fi)
       
   413 else
       
   414   MB_OF_MEMORY       := unknown
       
   415   LOW_MEMORY_MACHINE := true
       
   416   MAX_VM_MEMORY      := 384
       
   417   MIN_VM_MEMORY      := 128
       
   418 endif
       
   419 
       
   420 REQUIRED_ZIP_VER = 2.2
       
   421 REQUIRED_UNZIP_VER = 5.12
       
   422 REQUIRED_MAKE_VER = 3.78
       
   423 
       
   424 # Unix type settings (same for all unix platforms)
       
   425 ifneq ($(PLATFORM), windows)
       
   426   # Temporary disk area
       
   427   TEMP_DISK=/tmp
       
   428   # Where is unwanted output to be delivered?
       
   429   DEV_NULL = /dev/null
       
   430   export DEV_NULL
       
   431   # Character used between entries in classpath 
       
   432   CLASSPATH_SEPARATOR = :
       
   433   # suffix used for object file (.o for unix .obj for windows)
       
   434   OBJECT_SUFFIX = o
       
   435   # The suffix applied to runtime libraries
       
   436   LIBRARY_SUFFIX = so
       
   437   # The suffix applied to link libraries
       
   438   LIB_SUFFIX = so
       
   439   # The suffix applied to executables (.exe for windows, nothing for solaris)
       
   440   EXE_SUFFIX =
       
   441   # The prefix applied to library files (lib for solaris, nothing for windows)
       
   442   LIB_PREFIX = lib
       
   443   # User name determination (set _USER)
       
   444   ifndef USER
       
   445     ifdef LOGNAME
       
   446       _USER := $(LOGNAME)
       
   447     else
       
   448       _USER := $(shell logname)
       
   449     endif
       
   450   else
       
   451     _USER:=$(USER)
       
   452   endif
       
   453   # Location of client/server directories
       
   454   ARCH_VM_SUBDIR=jre/lib/$(LIBARCH)
       
   455 endif
       
   456 
       
   457 # If blanks in the username, use the first 4 words and pack them together
       
   458 _USER1:=$(subst ', ,$(_USER))
       
   459 _USER2:=$(subst ", ,$(_USER1))
       
   460 USER:=$(word 1,$(_USER2))$(word 2,$(_USER2))$(word 3,$(_USER2))$(word 4,$(_USER2))
       
   461 export USER
       
   462 
       
   463 export PLATFORM
       
   464 endif
       
   465