4 # $Id: make-reg-dotc,v 1.8 2004/05/03 18:53:16 guy Exp $
8 # The first argument is the output filename.
15 # The second argument is the directory in which the source files live.
21 # All subsequent arguments are the files to scan.
24 echo '/* Do not modify this file. */' >${outfile}-tmp
25 echo '/* It is created automatically by the Makefile. */'>>${outfile}-tmp
26 echo '#include "register.h"' >>${outfile}-tmp
29 # Build code to call all the protocol registration routines.
31 echo 'void register_all_protocols(void) {' >>${outfile}-tmp
40 grep '^proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
41 done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
50 grep '^void proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
51 done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
52 echo '}' >>${outfile}-tmp
55 # Build code to call all the protocol handoff registration routines.
57 echo 'void register_all_protocol_handoffs(void) {' >>${outfile}-tmp
66 grep '^proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
67 done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
76 grep '^void proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
77 done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
78 echo '}' >>${outfile}-tmp
79 mv ${outfile}-tmp ${outfile}