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