Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / bin / pal
CommitLineData
86530b38
AT
1
2die () {
3 message="$1"
4 echo "$tool -> .local_tool_wrapper: $message Exiting ..."
5 exit 1
6}
7
8############################ main ##############################
9
10tool=`basename $0`
11ARGV="$*"
12TRE_PROJECT=$DV_ROOT
13
14if [ -z "$TRE_PROJECT" ]; then
15 die "TRE_PROJECT not defined"
16fi
17
18TRE_ROOT=$TRE_PROJECT/tools
19TOOL_ROOT=$TRE_PROJECT/tools/perlmod/$tool
20
21### Verify TRE_SEARCH and TRE_ENTRY are defined and non-null
22
23if [ -z "$TRE_SEARCH" ]; then
24 die "TRE_SEARCH not defined"
25fi
26if [ -z "$TRE_ENTRY" ]; then
27 die "TRE_ENTRY not defined"
28fi
29
30### Get version, based on tool invoked, and $TRE_ENTRY
31
32version=`configsrch $tool $TRE_ENTRY`
33if [ $? != 0 ] ; then
34 die "configsrch returned error code!"
35fi
36
37### Verify configsrch delivered a non-null version
38
39if [ -z "$version" ]; then
40 die "No version set by configsrch"
41fi
42
43### Assemble directory-oriented executable ...
44### (eliminate the extra layer of shell redirection...)
45
46 exe=$TOOL_ROOT/$version/bin/$tool
47 if [ -x $exe ]; then
48 exec $exe "$@"
49 fi
50
51
52### Assemble do-file name. If it's there, execute and test status.
53
54 exe=$TRE_ROOT/$tool,$version.do
55 if [ -x $exe ]; then
56 $exe
57 dostat=$?
58 if [ $dostat != 0 ] ; then
59 die "Error return from do file"
60 fi
61 fi
62
63
64 exe=$TRE_ROOT/$tool,$version
65 if [ -x $exe ]; then
66 exec $exe "$@"
67 else
68 die "executable $exe not found!"
69 fi
70
71
72### If none of the above executable patterns hit, then die with errors...
73
74 echo "FATAL: Couldn't find any executable form:"
75 echo "FATAL: $TOOL_ROOT/$version/bin/$tool"
76 echo "FATAL: $TRE_ROOT/$tool,$version.do"
77 echo "FATAL: $TRE_ROOT/$tool,$version"
78 die "FATAL: $tool executable not found!"
79