diff options
author | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-10-04 08:10:54 +0000 |
---|---|---|
committer | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-10-04 08:10:54 +0000 |
commit | 1b2498d074bd96c89829b360c73c817a058c873c (patch) | |
tree | 456316785e58d97e2c7a92d4215a0062a84c41c9 /tools/make-tapreg-dotc | |
parent | c0e3180e9be9d16d2cd8c098c1915c8b1c210919 (diff) |
Move make-tapreg-dotc to tools/make-tapreg-dotc
svn path=/trunk/; revision=30284
Diffstat (limited to 'tools/make-tapreg-dotc')
-rwxr-xr-x | tools/make-tapreg-dotc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/make-tapreg-dotc b/tools/make-tapreg-dotc new file mode 100755 index 0000000000..686f308011 --- /dev/null +++ b/tools/make-tapreg-dotc @@ -0,0 +1,47 @@ +#! /bin/sh + +# +# $Id$ +# + +# +# 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 +echo '/* It is created automatically by the Makefile. */' >>${outfile}-tmp +echo '#include "register.h"' >>${outfile}-tmp + +# +# Build code to call all the tap listener registration routines. +# +echo 'void register_all_tap_listeners(void) {' >>${outfile}-tmp +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 + echo " { extern void $func (void);" >>${outfile}-tmp + echo " $func ();}" >>${outfile}-tmp +done +echo '}' >>${outfile}-tmp + +mv ${outfile}-tmp ${outfile} |