1 #! /bin/sh
   2 #
   3 # Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
   4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5 #
   6 # This code is free software; you can redistribute it and/or modify it
   7 # under the terms of the GNU General Public License version 2 only, as
   8 # published by the Free Software Foundation.
   9 #
  10 # This code is distributed in the hope that it will be useful, but WITHOUT
  11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13 # version 2 for more details (a copy is included in the LICENSE file that
  14 # accompanied this code).
  15 #
  16 # You should have received a copy of the GNU General Public License version
  17 # 2 along with this work; if not, write to the Free Software Foundation,
  18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19 #
  20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21 # or visit www.oracle.com if you need additional information or have any
  22 # questions.
  23 #  
  24 #
  25 
  26 # Make sure the variable JAVA_HOME is set before running this script.
  27 
  28 set -u
  29 
  30 
  31 if [ $# -lt 1 ]; then 
  32     echo "Usage : $0 BuildTarget [LP64=1] [BuildOptions]"
  33     echo "               Server VM | Client VM"
  34     echo "BuildTarget :  debug     | debug1"
  35     echo "               fastdebug | fastdebug1"
  36     echo "               jvmg      | jvmg1"
  37     echo "               optimized | optimized1"
  38     echo "               profiled  | profiled1"
  39     echo "               product   | product1"
  40     exit 1
  41 fi
  42 
  43 if [ "${JAVA_HOME-}" = ""  -o  ! -d "${JAVA_HOME-}" ]; then
  44     echo "JAVA_HOME needs to be set to a valid JDK path"
  45     echo "JAVA_HOME: ${JAVA_HOME-}"
  46     exit 1
  47 fi
  48 
  49 # Just in case:
  50 JAVA_HOME=`( cd $JAVA_HOME; pwd )`
  51 
  52 if [ "${ALT_BOOTDIR-}" = ""  -o  ! -d "${ALT_BOOTDIR-}" -o ! -d ${ALT_BOOTDIR-}/lib/ ]; then
  53     ALT_BOOTDIR=${JAVA_HOME}
  54 fi
  55 
  56 # build in current directory by default
  57 if [ "${ALT_OUTPUTDIR-}" = ""  -o  ! -d "${ALT_OUTPUTDIR-}" ]; then
  58     ALT_OUTPUTDIR=`(pwd)`
  59 fi
  60 
  61 HOTSPOT_SRC=`(dirname $0)`/..
  62 HOTSPOT_SRC=`(cd ${HOTSPOT_SRC}; pwd)`
  63 
  64 for gm in gmake gnumake
  65 do
  66   if [ "${GNUMAKE-}" != "" ]; then break; fi
  67   ($gm --version >/dev/null) 2>/dev/null && GNUMAKE=$gm
  68 done
  69 : ${GNUMAKE:?'Cannot locate the gnumake program.  Stop.'}
  70 
  71 # quiet build by default
  72 Quiet="MAKE_VERBOSE="
  73 
  74 # no debug info by default
  75 NoDebugInfo="ENABLE_FULL_DEBUG_SYMBOLS="
  76 
  77 LANG=C
  78 
  79 echo "### ENVIRONMENT SETTINGS:"
  80 export HOTSPOT_SRC              ; echo "HOTSPOT_SRC=$HOTSPOT_SRC"
  81 export JAVA_HOME                ; echo "JAVA_HOME=$JAVA_HOME"
  82 export ALT_BOOTDIR              ; echo "ALT_BOOTDIR=$ALT_BOOTDIR"
  83 export ALT_OUTPUTDIR            ; echo "ALT_OUTPUTDIR=$ALT_OUTPUTDIR"
  84 export GNUMAKE                  ; echo "GNUMAKE=$GNUMAKE"
  85 export LANG                     ; echo "LANG=$LANG"
  86 echo "###"
  87 
  88 BuildOptions="$Quiet $NoDebugInfo $*"
  89 
  90 echo \
  91 ${GNUMAKE} -f ${HOTSPOT_SRC}/make/Makefile $BuildOptions GAMMADIR=${HOTSPOT_SRC}
  92 ${GNUMAKE} -f ${HOTSPOT_SRC}/make/Makefile $BuildOptions GAMMADIR=${HOTSPOT_SRC}