Commit | Line | Data |
---|---|---|
dd3b648e RP |
1 | #!/bin/sh |
2 | ||
3 | # create an initialization procedure from a list of .o files | |
4 | ||
5 | echo '/* Do not modify this file. It is created automatically by "munch". */' | |
6 | echo 'void initialize_all_files () {' | |
7 | ||
8 | # make it easy to use a different nm, e.g. for cross-developing | |
9 | MUNCH_NM=${MUNCH_NM-nm} | |
10 | if test "`$MUNCH_NM main.o | egrep 'T _?main$'`" = "" ; then | |
11 | # System V style nm | |
12 | shift; | |
13 | $MUNCH_NM $* | egrep '^(.*[^a-zA-Z_]_|_)_?initialize_.*\.text' | \ | |
14 | sed -e 's/^.*\(_initialize_[a-zA-Z0-9_]*\)[^a-zA-Z0-9_].*$/ {extern void \1 (); \1 ();}/' | |
15 | else | |
16 | # BSD style nm | |
17 | $MUNCH_NM -p $* | egrep 'T *_?_initialize_' | \ | |
18 | sed -e 's/^.*T *_*\(.*\)/ {extern void _\1 (); _\1 ();}/' | |
19 | fi | |
20 | ||
21 | echo '}' |