old-cross-binutils/sim/common/gentvals.sh
David Edelsohn 58b72d7e20 * run.c: #include ../common/config.h, tconfig.h.
(myname): New static global.
	(main): Recognize new options -a, -c.  Also recognize -h if h8/300.
	Only process -c ifdef SIM_HAVE_SIMCACHE.
	Only process -p/-s ifdef SIM_HAVE_PROFILE.
	Parse program name from argv[0] and use in error messages.
	Pass sim_args to sim_open.  Pass prog_args to sim_create_inferior.
	Add support for incomplete h8/300 termination indicators.
	(usage): Make more verbose.
	* aclocal.m4,config.in,tconfig.in,configure.in,configure: New files.
	* Makefile.in,Make-common.in,callback.c: New files.
	* nltvals.def,gentmap.c,gentvals.sh: New files.
1996-11-20 09:20:55 +00:00

51 lines
1,014 B
Bash

#!/bin/sh
# Usage: gentvals.sh type dir files pattern cpp
type=$1
dir=$2
# FIXME: Would be nice to process #include's in these files.
files=$3
pattern=$4
cpp=$5
# FIXME: need trap to remove tmp files.
rm -f tmpvals.list tmpvals.uniq
for f in $files
do
if test -f $dir/$f ; then
grep "#define[ ]$pattern" $dir/$f | sed -e "s/^.*#define[ ]\($pattern\)[ ]*\([^ ][^ ]*\).*$/\1/" >> tmpvals.list
fi
done
sort <tmpvals.list | uniq >tmpvals.uniq
rm -f tmpvals.h
for f in $files
do
if test -f $dir/$f ; then
echo "#include <$f>" >>tmpvals.h
fi
done
cat tmpvals.uniq |
while read sym
do
echo "#ifdef $sym" >>tmpvals.h
echo 'DEFVAL { "'$sym'", '$sym ' },' >>tmpvals.h
echo "#endif" >>tmpvals.h
done
echo "#ifdef ${type}_defs"
for f in $files
do
if test -f $dir/$f ; then
echo "/* from $f */"
fi
done
echo "/* begin $type target macros */"
$cpp tmpvals.h | grep DEFVAL | sed -e 's/DEFVAL//' -e 's/ / /'
echo "/* end $type target macros */"
echo "#endif"
rm -f tmpvals.list tmpvals.uniq tmpvals.h