In legion build config, updated path to GNU tools and updated deprecated Sun CC flag...
[OpenSPARC-T2-SAM] / legion / src / support / hasnative.sh
CommitLineData
920dae64
AT
1#!/bin/sh
2# ========== Copyright Header Begin ==========================================
3#
4# OpenSPARC T2 Processor File: hasnative.sh
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
23usage()
24{
25 echo ""
26 echo "`basename $0` [-p <prefix>] <srcname> <destfile>"
27 echo ""
28 echo "\tgenerate a .h file for instruction IMPL types"
29 exit 1
30}
31
32prefix="_"
33if [ $# -gt 1 ]; then
34 if [ $1 = "-p" ] ; then
35 prefix=$2;
36 prefix="_`echo $prefix | sed -e 's/\.h$//g' | tr '[a-z]-/' '[A-Z]__'`_"
37 shift
38 shift
39 fi
40fi
41
42if [ ! "$#" = "2" ] ; then
43 usage
44fi
45
46
47srcname=$1
48name=$2
49
50if [ ! "`echo $name | egrep '\.h$'`" = $name ] ;then
51 echo $name is not a .h filename !
52 exit 1
53fi
54
55#
56# ok dig out the base filename
57#
58
59bname=`basename $name | sed -e 's/\.h$//g' | tr '[a-z] -/' '[A-Z]___' | sed -e 's/__/_/g'`
60
61cat << END > $name
62
63#ifndef ${prefix}${bname}_H_
64#define ${prefix}${bname}_H_
65
66/* This file is autogenerated from $srcname - DO NOT EDIT */
67
68END
69
70list=`egrep '^IMPL\(' $srcname | sed -e 's?IMPL(??' -e 's?).*??'`
71
72for n in $list ; do
73cat <<END >> $name
74#define HAS_NATIVE_${n} 1
75END
76done
77
78cat <<END >> $name
79
80#endif /* #ifndef ${prefix}${bname}_H_ */
81
82END
83
84exit 0
85