Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / bin / makeinfo
CommitLineData
920dae64
AT
1#! /bin/sh -f
2# ========== Copyright Header Begin ==========================================
3#
4# OpenSPARC T1 Processor File: makeinfo
5# Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
7#
8# The above named program is free software; you can redistribute it and/or
9# modify it under the terms of the GNU General Public
10# License version 2 as published by the Free Software Foundation.
11#
12# The above named program is distributed in the hope that it will be
13# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15# General Public License for more details.
16#
17# You should have received a copy of the GNU General Public
18# License along with this work; if not, write to the Free Software
19# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20#
21# ========== Copyright Header End ============================================
22#
23#####################################################################
24##
25## Description : .gnu_tool_wrapper
26##
27#######################################################################
28
29
30die () {
31 message="$1"
32 echo "$tool-> $message Exiting ..."
33 exit 1
34}
35############################ main ##############################
36
37tool=`basename $0`
38ARGV="$*"
39GNU_ROOT=/freetools/local
40GNU_TOOL2PKG=${GNU_TOOL2PKG:=$GNU_ROOT/.tool2pkg}
41
42### Get GNU package name from the "tool2pkg" file
43
44pkg=`/bin/awk '{if($1 == var)print $2}' var=$tool $GNU_TOOL2PKG`
45if [ -z "$pkg" ] ; then
46 die "gnu package not found!"
47fi
48
49version=`configsrch $tool 2> /dev/null`
50
51if [ $? != 0 ] ; then
52 version=`gnusrch $tool`
53 if [ $? != 0 ] ; then
54 gnusrch_version=$version
55 #die "gnusrch returned error code: $version"
56 version=latest
57 fi
58fi
59
60version=`echo $version |/bin/awk '{print $1}'`
61if [ -z "$version" ] ; then
62 die "No version set for $tool in $pkg."
63fi
64
65### Assemble to exe path
66
67exe=$GNU_ROOT/$pkg/$version/bin/$tool
68
69if [ -x $exe ] ; then
70 exec $exe "$@"
71elif [ $version -eq latest ] ; then
72 die "gnusrch returned error code: $gnusrch_version"
73else
74 die "Executable $exe not found!"
75fi