diff options
author | Rob Landley <rob@landley.net> | 2008-01-20 17:25:44 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2008-01-20 17:25:44 -0600 |
commit | b1aaba1fc8176ac0b7c202a664d2554aa0967116 (patch) | |
tree | 7bbd14f5dd2413a6b913ea04b0bdf746a2d5b1fb /scripts/make.sh | |
parent | eb9b8da0698aacd14f5aa0879d2a8e390c0c6c13 (diff) | |
download | toybox-b1aaba1fc8176ac0b7c202a664d2554aa0967116.tar.gz |
Zap toylist.h, moving contents of global structures into DEFINE_GLOBALS()
macros in each C file, and making generated/globals.h from that. Rename
"toy" to "this" along the way to avoid toy/toys confusion.
Diffstat (limited to 'scripts/make.sh')
-rwxr-xr-x | scripts/make.sh | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/scripts/make.sh b/scripts/make.sh index b5300d38..08333959 100755 --- a/scripts/make.sh +++ b/scripts/make.sh @@ -4,9 +4,11 @@ source ./configure -echo "Extract configuration information from toys/*.c files." +echo "Extract configuration information from toys/*.c files..." scripts/genconfig.sh +echo "Generate headers from toys/*.h..." + # Create a list of all the applets toybox can provide. Note that the first # entry is out of order on purpose (the toybox multiplexer applet must be the # first element of the array). The rest must be sorted in alphabetical order @@ -22,6 +24,30 @@ function newtoys() echo "NEWTOY(toybox, NULL, 0)" > generated/newtoys.h newtoys | sort >> generated/newtoys.h +# Extract global structure definitions from toys/*.c + +function getglobals() +{ + for i in toys/*.c + do + NAME="$(echo $i | sed 's@toys/\(.*\)\.c@\1@')" + + echo -e "// $i\n" + sed -n -e '/^DEFINE_GLOBALS(/,/^)/b got;b;:got' \ + -e 's/^DEFINE_GLOBALS(/struct '"$NAME"'_data {/' \ + -e 's/^)/};/' -e 'p' $i + done +} + +GLOBSTRUCT="$(getglobals)" +( + echo "$GLOBSTRUCT" + echo + echo "extern union global_union {" + echo "$GLOBSTRUCT" | sed -n 's/struct \(.*\)_data {/ struct \1_data \1;/p' + echo "} this;" +) > generated/globals.h + # Only recreate generated/help.h if python is installed if [ ! -z "$(which python)" ] && [ ! -z "$(grep 'CONFIG_HELP=y' .config)" ] then |