OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [sim/] [common/] [gentvals.sh] - Blame information for rev 1775

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
#!/bin/sh
2
# Usage: gentvals.sh target type dir files pattern cpp
3
 
4
target=$1
5
type=$2
6
dir=$3
7
# FIXME: Would be nice to process #include's in these files.
8
files=$4
9
pattern=$5
10
cpp=$6
11
 
12
# FIXME: need trap to remove tmp files.
13
 
14
rm -f tmpvals.list tmpvals.uniq
15
for f in $files
16
do
17
        if test -f $dir/$f ; then
18
                grep "#define[  ]$pattern" $dir/$f | sed -e "s/^.*#define[      ]\($pattern\)[  ]*\([^  ][^     ]*\).*$/\1/" >> tmpvals.list
19
        fi
20
done
21
 
22
sort <tmpvals.list | uniq >tmpvals.uniq
23
 
24
rm -f tmpvals.h
25
for f in $files
26
do
27
        if test -f $dir/$f ; then
28
                echo "#include <$f>" >>tmpvals.h
29
        fi
30
done
31
 
32
cat tmpvals.uniq |
33
while read sym
34
do
35
        echo "#ifdef $sym" >>tmpvals.h
36
        echo 'DEFVAL { "'$sym'", '$sym ' },' >>tmpvals.h
37
        echo "#endif" >>tmpvals.h
38
done
39
 
40
if test -z "$target"
41
then
42
        echo "#ifdef ${type}_defs"
43
else
44
        echo "#ifdef NL_TARGET_$target"
45
        echo "#ifdef ${type}_defs"
46
fi
47
 
48
for f in $files
49
do
50
        if test -f $dir/$f ; then
51
                echo "/* from $f */"
52
        fi
53
done
54
 
55
if test -z "$target"
56
then
57
        echo "/* begin $type target macros */"
58
else
59
        echo "/* begin $target $type target macros */"
60
fi
61
 
62
$cpp -I$dir tmpvals.h | grep DEFVAL | sed -e 's/DEFVAL//' -e 's/  / /'
63
 
64
if test -z "$target"
65
then
66
        echo "/* end $type target macros */"
67
        echo "#endif"
68
else
69
        echo "/* end $target $type target macros */"
70
        echo "#endif"
71
        echo "#endif"
72
fi
73
 
74
rm -f tmpvals.list tmpvals.uniq tmpvals.h

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.