hush: propagate (output,n) parameters into expand_one_var()
[oweals/busybox.git] / make_single_applets.sh
index 03a5c324f4bd170cce4cf9200153fdcb45165a92..aa1ace265ae50d5194f4a051f42cfdb7e87d16fe 100755 (executable)
@@ -12,8 +12,9 @@ makeopts="-j9"
 test -f include/applets.h || { echo "No include/applets.h file"; exit 1; }
 apps="`
 grep ^IF_ include/applets.h \
-| grep -v ^IF_FEATURE_ \
+| grep -v '^IF_FEATURE_' \
 | sed 's/IF_\([A-Z0-9._-]*\)(.*/\1/' \
+| grep -v '^BUSYBOX$' \
 | sort | uniq
 `"
 
@@ -30,9 +31,12 @@ done
 
 trap 'test -f .config.SV && mv .config.SV .config && touch .config' EXIT
 
+
 # Turn on each applet individually and build single-applet executable
+# (give config names on command line to build only those)
+test $# = 0 && set -- $apps
 fail=0
-for app in $apps; do
+for app; do
        # Only if it was indeed originally enabled...
        { echo "$cfg" | grep -q "^CONFIG_${app}=y\$"; } || continue
 
@@ -51,18 +55,18 @@ for app in $apps; do
        fi
 
        if ! yes '' | make oldconfig >busybox_make_${app}.log 2>&1; then
-               : $((fail++))
+               fail=$((fail+1))
                echo "Config error for ${app}"
                mv .config busybox_config_${app}
        elif ! make $makeopts >>busybox_make_${app}.log 2>&1; then
-               : $((fail++))
+               fail=$((fail+1))
                grep -i -e error: -e warning: busybox_make_${app}.log
                echo "Build error for ${app}"
                mv .config busybox_config_${app}
        elif ! grep -q '^#define NUM_APPLETS 1$' include/NUM_APPLETS.h; then
                grep -i -e error: -e warning: busybox_make_${app}.log
                mv busybox busybox_${app}
-               : $((fail++))
+               fail=$((fail+1))
                echo "NUM_APPLETS != 1 for ${app}: `cat include/NUM_APPLETS.h`"
                mv .config busybox_config_${app}
        else