aboutsummaryrefslogtreecommitdiff
path: root/scripts/make.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/make.sh')
-rwxr-xr-xscripts/make.sh36
1 files changed, 12 insertions, 24 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