forked from contiki-os/contiki
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts for auto-generating symbols.[c,h]
may for example be called from a platform makefile
- Loading branch information
fros4943
committed
Dec 18, 2006
1 parent
71940f2
commit 2978147
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
|
||
SYMBOLS=`nm -P $* | grep -v " . _ " | grep " [A-Z] " | cut -f 1 -d \ | grep -v symbols | wc -l` | ||
SYMBOLS=`expr $SYMBOLS + 1` | ||
|
||
echo \#ifndef __SYMBOLS_H__ > symbols.h | ||
echo \#define __SYMBOLS_H__ >> symbols.h | ||
echo \#include '"loader/symbols-def.h"' >> symbols.h | ||
echo "extern const struct symbols symbols[$SYMBOLS];" >> symbols.h | ||
echo \#endif >> symbols.h | ||
|
||
echo \#include '"symbols.h"' > symbols.c | ||
|
||
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 | ||
|
||
echo "const struct symbols symbols[$SYMBOLS] = {" >> symbols.c | ||
|
||
if [ -f $* ] ; then | ||
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 | ||
fi | ||
|
||
echo "{(void *)0, 0} };" >> symbols.c |