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 usage() {
  32     (
  33         echo "Usage : $0 [-sb | -sbfast] config ws_path"
  34         echo ""
  35         echo "Where:"
  36         echo "    -sb     ::= enable source browser info generation for"
  37         echo "                all configs during compilation"
  38         echo ""
  39         echo "    -sbfast ::= enable source browser info generation for"
  40         echo "                all configs without compilation"
  41         echo ""
  42         echo "    config  ::= fastdebug | fastdebug1 | fastdebugcore"
  43         echo "                debug     | debug1     | debugcore"
  44         echo "                optimized | optimized1 | optimizedcore"
  45         echo "                product   | product1   | productcore"
  46         echo ""
  47         echo "    ws_path ::= path to HotSpot workspace"
  48     ) >&2
  49     exit 1
  50 }
  51 
  52 # extract possible options
  53 options=""
  54 if [ $# -gt 2 ]; then
  55     case "$1" in
  56     -sb)
  57         options="CFLAGS_BROWSE=-xsb"
  58         shift
  59         ;;
  60     -sbfast)
  61         options="CFLAGS_BROWSE=-xsbfast"
  62         shift
  63         ;;
  64     *)
  65         echo "Unknown option: '$1'" >&2
  66         usage
  67         ;;
  68     esac
  69 fi
  70 
  71 # should be just two args left at this point
  72 if [ $# != 2 ]; then
  73     usage
  74 fi
  75 
  76 # Just in case:
  77 case ${JAVA_HOME} in
  78 /*) true;;
  79 ?*) JAVA_HOME=`( cd $JAVA_HOME; pwd )`;;
  80 esac
  81 
  82 if [ "${JAVA_HOME}" = ""  -o  ! -d "${JAVA_HOME}" -o ! -d ${JAVA_HOME}/jre/lib/`uname -p` ]; then
  83     echo "JAVA_HOME needs to be set to a valid JDK path"
  84     echo "ksh : export JAVA_HOME=/net/tetrasparc/export/gobi/JDK1.2_fcs_V/solaris"
  85     echo "csh : setenv JAVA_HOME /net/tetrasparc/export/gobi/JDK1.2_fcs_V/solaris"
  86     exit 1
  87 fi
  88 
  89 
  90 LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/`uname -p`:\
  91 ${JAVA_HOME}/jre/lib/`uname -p`/native_threads:${LD_LIBRARY_PATH-.}
  92 
  93 # This is necessary as long as we are using the old launcher
  94 # with the new distribution format:
  95 CLASSPATH=${JAVA_HOME}/jre/lib/rt.jar:${CLASSPATH-.}
  96 
  97 
  98 for gm in gmake gnumake
  99 do
 100   if [ "${GNUMAKE-}" != "" ]; then break; fi
 101   ($gm --version >/dev/null) 2>/dev/null && GNUMAKE=$gm
 102 done
 103 : ${GNUMAKE:?'Cannot locate the gnumake program.  Stop.'}
 104 
 105 
 106 echo "### ENVIRONMENT SETTINGS:"
 107 export JAVA_HOME                ; echo "JAVA_HOME=$JAVA_HOME"
 108 export LD_LIBRARY_PATH          ; echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
 109 export CLASSPATH                ; echo "CLASSPATH=$CLASSPATH"
 110 export GNUMAKE                  ; echo "GNUMAKE=$GNUMAKE"
 111 echo "###"
 112 
 113 config=$1
 114 ws_path=$2
 115 
 116 case ${ws_path} in
 117 /*) true;;
 118 ?*) ws_path=`(cd ${ws_path}; pwd)`;;
 119 esac
 120 
 121 echo \
 122 ${GNUMAKE} -f ${ws_path}/make/solaris/Makefile \
 123     $config GAMMADIR=${ws_path} $options
 124 ${GNUMAKE} -f ${ws_path}/make/solaris/Makefile \
 125     $config GAMMADIR=${ws_path} $options