aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/install.c2
-rwxr-xr-xscripts/make.sh28
2 files changed, 28 insertions, 2 deletions
diff --git a/scripts/install.c b/scripts/install.c
index 5564fa50..317b180c 100644
--- a/scripts/install.c
+++ b/scripts/install.c
@@ -14,7 +14,7 @@
// Populate toy_list[].
struct toy_list toy_list[] = {
-#include "toys/toylist.h"
+#include "generated/newtoys.h"
};
#define TOY_LIST_LEN (sizeof(toy_list)/sizeof(struct toy_list))
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