diff options
author | Guy Harris <guy@alum.mit.edu> | 1999-10-27 01:46:14 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 1999-10-27 01:46:14 +0000 |
commit | 7568df46e6be7dbfb3e17908d3b6c269c032d30d (patch) | |
tree | a10794e95f23e2539baa1772ae3a751e07b3cf2a /make-reg-dotc | |
parent | 454a982d3b99cb00ad3c70973adda497ffc17691 (diff) |
For some unknown reason, having a big "for" loop in the Makefile to scan
all the "packet-XXX.c" files doesn't work with some "make"s; they seem
to pass only the first few names in the list to the shell, for some
reason.
Therefore, we use a script to generate the "register.c" file, and run
that script from the Makefile.
svn path=/trunk/; revision=930
Diffstat (limited to 'make-reg-dotc')
-rwxr-xr-x | make-reg-dotc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/make-reg-dotc b/make-reg-dotc new file mode 100755 index 0000000000..40730eaa33 --- /dev/null +++ b/make-reg-dotc @@ -0,0 +1,26 @@ +#! /bin/sh + +# +# The first argument is the directory in which the source files live. +# +srcdir="$1" +shift + +# +# All subsequent arguments are the files to scan. +# +rm -f register.c-tmp +echo '/* Do not modify this file. */' >register.c-tmp +echo '/* It is created automatically by the Makefile. */'>>register.c-tmp +echo '#include "register.h"' >>register.c-tmp +echo 'void register_all_protocols(void) {' >>register.c-tmp +for f in "$@" +do + grep '^proto_register_[a-z_0-9A-Z]* *(' $srcdir/$f 2>/dev/null +done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>register.c-tmp +for f in "$@" +do + grep '^void proto_register_[a-z_0-9A-Z]* *(' $srcdir/$f 2>/dev/null +done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>register.c-tmp +echo '}' >>register.c-tmp +mv register.c-tmp register.c |