3 SYMBOLS
=`nm -P $* | grep -v " . _ " | grep " [A-Z] " | cut -f 1 -d \ | grep -v symbols | wc -l`
4 SYMBOLS
=`expr $SYMBOLS + 1`
6 echo \
#ifndef __SYMBOLS_H__ > symbols.h
7 echo \
#define __SYMBOLS_H__ >> symbols.h
8 echo \
#include '"loader/symbols-def.h"' >> symbols.h
9 echo "extern const struct symbols symbols[$SYMBOLS];" >> symbols.h
10 echo \
#endif >> symbols.h
12 echo \
#include '"symbols.h"' > symbols.c
14 nm
-P $
* |
grep -v " . _ " |
grep " [A-Z] " | cut
-f 1 -d \ |
grep -v symbols | perl
-ne 'print "extern int $1();\n" if(/(\w+)/)' |
sort >> symbols.c
16 echo "const struct symbols symbols[$SYMBOLS] = {" >> symbols.c
19 nm
-P $
* |
grep -v " . _ " |
grep " [A-Z] " | cut
-f 1 -d \ |
grep -v symbols | perl
-ne 'print "{\"$1\", (char *)$1},\n" if(/(\w+)/)' |
sort >> symbols.c
22 echo "{(void *)0, 0} };" >> symbols.c