]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/common/gentvals.sh
* config/sh/tm-sh.h (BELIEVE_PCC_PROMOTION): Define, so that
[thirdparty/binutils-gdb.git] / sim / common / gentvals.sh
CommitLineData
58b72d7e
DE
1#!/bin/sh
2# Usage: gentvals.sh type dir files pattern cpp
3
4type=$1
5dir=$2
6# FIXME: Would be nice to process #include's in these files.
7files=$3
8pattern=$4
9cpp=$5
10
11# FIXME: need trap to remove tmp files.
12
13rm -f tmpvals.list tmpvals.uniq
14for f in $files
15do
16 if test -f $dir/$f ; then
17 grep "#define[ ]$pattern" $dir/$f | sed -e "s/^.*#define[ ]\($pattern\)[ ]*\([^ ][^ ]*\).*$/\1/" >> tmpvals.list
18 fi
19done
20
21sort <tmpvals.list | uniq >tmpvals.uniq
22
23rm -f tmpvals.h
24for f in $files
25do
26 if test -f $dir/$f ; then
27 echo "#include <$f>" >>tmpvals.h
28 fi
29done
30
31cat tmpvals.uniq |
32while read sym
33do
34 echo "#ifdef $sym" >>tmpvals.h
35 echo 'DEFVAL { "'$sym'", '$sym ' },' >>tmpvals.h
36 echo "#endif" >>tmpvals.h
37done
38
39echo "#ifdef ${type}_defs"
40for f in $files
41do
42 if test -f $dir/$f ; then
43 echo "/* from $f */"
44 fi
45done
46echo "/* begin $type target macros */"
47$cpp tmpvals.h | grep DEFVAL | sed -e 's/DEFVAL//' -e 's/ / /'
48echo "/* end $type target macros */"
49echo "#endif"
50
51rm -f tmpvals.list tmpvals.uniq tmpvals.h