aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/make.sh36
-rwxr-xr-xscripts/single.sh3
2 files changed, 14 insertions, 25 deletions
diff --git a/scripts/make.sh b/scripts/make.sh
index d659e739..3a5d0826 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -154,7 +154,7 @@ fi
# Rebuild config.h from .config
$SED -En $KCONFIG_CONFIG > "$GENDIR"/config.h \
-e 's/^# CONFIG_(.*) is not set.*/#define CFG_\1 0\n#define USE_\1(...)/p' \
- -e 's/^CONFIG_(.*)=y.*/#define CFG_\1 1\n#define USE_\1(...) __VA_ARGS__\n/p'\
+ -e 's/^CONFIG_(.*)=y.*/#define CFG_\1 1\n#define USE_\1(...) __VA_ARGS__/p'\
|| exit 1
# Process config.h and newtoys.h to generate FLAG_x macros. Note we must
@@ -204,30 +204,18 @@ fi
# Extract global structure definitions and flag definitions from toys/*/*.c
-function getglobals()
{
- for i in toys/*/*.c
- do
- NAME=${i##*/} NAME=${NAME%\.c}
- DATA="$($SED -n -e '/^GLOBALS(/,/^)/b got;b;:got' \
- -e 's/^GLOBALS(/_data {/' \
- -e 's/^)/};/' -e 'p' $i)"
- [ -n "$DATA" ] && echo -e "// $i\n\nstruct $NAME$DATA\n"
- done
-}
-
-if isnewer globals.h toys
-then
- GLOBSTRUCT="$(getglobals)"
- (
- echo "$GLOBSTRUCT"
- echo
- echo "extern union global_union {"
- echo "$GLOBSTRUCT" | \
- $SED -n 's/struct \(.*\)_data {/ struct \1_data \1;/p'
- echo "} this;"
- ) > "$GENDIR"/globals.h
-fi
+ STRUX="$($SED -ne 's/^#define[ \t]*FOR_\([^ \t]*\).*/\1/;T s1;h;:s1' \
+ -e '/^GLOBALS(/,/^)/{s/^GLOBALS(//;T s2;g;s/.*/struct &_data {/;:s2;s/^)/};\n/;p}' \
+ $TOYFILES)"
+ echo "$STRUX" &&
+ echo "extern union global_union {" &&
+ $SED -n 's/^struct \(.*\)_data .*/\1/;T;s/.*/\tstruct &_data &;/p' \
+ <<<"$STRUX" &&
+ echo "} this;"
+} > "$GENDIR"/globals.h || exit 1
+# -e 'h;y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/;H;g;s/\n/ /'\
+# -e 's/\([^ ]*\) \(.*\)/\tUSE_\2(struct \1_data \1;)/p')"
hostcomp mktags
if isnewer tags.h toys
diff --git a/scripts/single.sh b/scripts/single.sh
index f4f28be9..e2ed9880 100755
--- a/scripts/single.sh
+++ b/scripts/single.sh
@@ -35,10 +35,11 @@ do
make allnoconfig > /dev/null || exit 1
+ # For the shell pull in MAYFORK commands from other source files as builtins.
unset DEPENDS MPDEL
if [ "$i" == sh ]
then
- DEPENDS="$($SED -n 's/USE_\([^(]*\)(NEWTOY([^,]*,.*TOYFLAG_MAYFORK.*/\1/p' toys/*/*.c)"
+ DEPENDS="$($SED -n 's/USE_\([^(]*\)(...TOY([^,]*,.*TOYFLAG_MAYFORK.*/\1/p' toys/*/*.c)"
else
MPDEL='s/CONFIG_TOYBOX=y/# CONFIG_TOYBOX is not set/;t'
fi