Move guts of "make change" to scripts/change.sh, don't try to build sh or help standa...
authorRob Landley <rob@landley.net>
Sat, 14 Feb 2015 07:08:15 +0000 (01:08 -0600)
committerRob Landley <rob@landley.net>
Sat, 14 Feb 2015 07:08:15 +0000 (01:08 -0600)
sh builtin commands need multiplexer, help describes other enabled commands.

Makefile
scripts/change.sh [new file with mode: 0755]

index 2c9a857..d2919e7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ toybox toybox_unstripped: toybox_stuff
        scripts/make.sh
 
 .PHONY: clean distclean baseline bloatcheck install install_flat \
-       uinstall uninstall_flat test tests help toybox_stuff
+       uinstall uninstall_flat test tests help toybox_stuff change
 
 include kconfig/Makefile
 
@@ -46,14 +46,7 @@ uninstall:
        scripts/install.sh --long --uninstall
 
 change:
-       @NOBUILD=1 scripts/make.sh > /dev/null&& \
-       $(HOSTCC) -I . scripts/install.c -o generated/instlist && \
-       export PREFIX=$${PREFIX:-change/} && \
-       mkdir -p "$$PREFIX" && \
-       for i in $$(generated/instlist); \
-               do echo -n "$$i " && \
-               scripts/single.sh $$i > /dev/null || touch $$PREFIX/$${i}.bad; \
-       done
+       scripts/change.sh
 
 clean::
        rm -rf toybox toybox_unstripped generated change .singleconfig*
diff --git a/scripts/change.sh b/scripts/change.sh
new file mode 100755 (executable)
index 0000000..8b8ab92
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# build each command as a standalone executable
+
+NOBUILD=1 scripts/make.sh > /dev/null &&
+${HOSTCC:-cc} -I . scripts/install.c -o generated/instlist &&
+export PREFIX=${PREFIX:-change/} &&
+mkdir -p "$PREFIX" || exit 1
+
+# Build all the commands standalone except:
+
+# sh - shell builtins like "cd" and "exit" need the multiplexer
+# help - needs to know what other commands are enabled (use command --help)
+
+for i in $(generated/instlist | egrep -vw "sh|help")
+do
+  echo -n "$i " &&
+  scripts/single.sh $i > /dev/null || touch $PREFIX/${i}.bad
+done