2002-10-31 22:16:01 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
2004-05-03 18:53:57 +00:00
|
|
|
#
|
2004-07-18 00:24:25 +00:00
|
|
|
# $Id$
|
2004-05-03 18:53:57 +00:00
|
|
|
#
|
|
|
|
|
2002-10-31 22:16:01 +00:00
|
|
|
#
|
|
|
|
# The first argument is the output filename.
|
|
|
|
#
|
|
|
|
|
|
|
|
outfile="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
#
|
|
|
|
# The second argument is the directory in which the source files live.
|
|
|
|
#
|
|
|
|
srcdir="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
#
|
|
|
|
# All subsequent arguments are the files to scan.
|
|
|
|
#
|
|
|
|
rm -f ${outfile}-tmp
|
|
|
|
echo '/* Do not modify this file. */' >${outfile}-tmp
|
2005-10-10 18:16:21 +00:00
|
|
|
echo '/* It is created automatically by the Makefile. */' >>${outfile}-tmp
|
|
|
|
echo '#include "register.h"' >>${outfile}-tmp
|
2002-10-31 22:16:01 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Build code to call all the tap listener registration routines.
|
|
|
|
#
|
2009-10-04 08:26:59 +00:00
|
|
|
echo -e 'void register_all_tap_listeners(void)\n{' >>${outfile}-tmp
|
2002-10-31 22:16:01 +00:00
|
|
|
for f in "$@"
|
|
|
|
do
|
|
|
|
if [ -f $f ]
|
|
|
|
then
|
|
|
|
srcfile=$f
|
|
|
|
else
|
|
|
|
srcfile=$srcdir/$f
|
|
|
|
fi
|
|
|
|
grep '^register_tap_listener_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';' | sed -e 's/(.*//'
|
|
|
|
done | while read func; do
|
2009-10-04 08:26:59 +00:00
|
|
|
echo " { extern void $func(void);" >>${outfile}-tmp
|
|
|
|
echo " $func();}" >>${outfile}-tmp
|
2002-10-31 22:16:01 +00:00
|
|
|
done
|
2009-10-04 08:26:59 +00:00
|
|
|
echo -e '}\n' >>${outfile}-tmp
|
2002-10-31 22:16:01 +00:00
|
|
|
|
|
|
|
mv ${outfile}-tmp ${outfile}
|