Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / bin / makeinfo
#! /bin/sh -f
# ========== Copyright Header Begin ==========================================
#
# OpenSPARC T1 Processor File: makeinfo
# Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
#
# The above named program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License version 2 as published by the Free Software Foundation.
#
# The above named program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this work; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ========== Copyright Header End ============================================
#
#####################################################################
##
## Description : .gnu_tool_wrapper
##
#######################################################################
die () {
message="$1"
echo "$tool-> $message Exiting ..."
exit 1
}
############################ main ##############################
tool=`basename $0`
ARGV="$*"
GNU_ROOT=/freetools/local
GNU_TOOL2PKG=${GNU_TOOL2PKG:=$GNU_ROOT/.tool2pkg}
### Get GNU package name from the "tool2pkg" file
pkg=`/bin/awk '{if($1 == var)print $2}' var=$tool $GNU_TOOL2PKG`
if [ -z "$pkg" ] ; then
die "gnu package not found!"
fi
version=`configsrch $tool 2> /dev/null`
if [ $? != 0 ] ; then
version=`gnusrch $tool`
if [ $? != 0 ] ; then
gnusrch_version=$version
#die "gnusrch returned error code: $version"
version=latest
fi
fi
version=`echo $version |/bin/awk '{print $1}'`
if [ -z "$version" ] ; then
die "No version set for $tool in $pkg."
fi
### Assemble to exe path
exe=$GNU_ROOT/$pkg/$version/bin/$tool
if [ -x $exe ] ; then
exec $exe "$@"
elif [ $version -eq latest ] ; then
die "gnusrch returned error code: $gnusrch_version"
else
die "Executable $exe not found!"
fi