aboutsummaryrefslogtreecommitdiff
path: root/scripts/make.sh
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-03-23 03:25:37 -0500
committerRob Landley <rob@landley.net>2016-03-23 03:25:37 -0500
commita8d0d13376251e1ff35a557dddea1d2e3c81a149 (patch)
tree91ac62baa71572bbd900222ad99338778557e167 /scripts/make.sh
parentc23186d3ee6001b78c843fc3609575306c687ba2 (diff)
downloadtoybox-a8d0d13376251e1ff35a557dddea1d2e3c81a149.tar.gz
Redo build stuff in response to Andy Chu's suggestions.
Toybox single binaries are now made directly with the new name instead of stomping toybox and getting renamed. Unstripped files now live in generated/unstripped. Target to run all tests is now "make tests" to avoid conflict with "make test". .singleconfig now has .PHONY: entries for all test_$NAME targets. Default install location changed to /usr/toybox, code.html now says how to change it (set $PREFIX). scripts/install.sh --uninstall works now. (And you get to keep the pieces!)
Diffstat (limited to 'scripts/make.sh')
-rwxr-xr-xscripts/make.sh15
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/make.sh b/scripts/make.sh
index 8be4c3be..d3dc8eb9 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -7,7 +7,9 @@ export LC_ALL=C
set -o pipefail
source ./configure
-[ -z "$KCONFIG_CONFIG" ] && KCONFIG_CONFIG=".config"
+[ -z "$KCONFIG_CONFIG" ] && KCONFIG_CONFIG=.config
+[ -z "$OUTNAME" ] && OUTNAME=toybox
+UNSTRIPPED="generated/unstripped/$(basename "$OUTNAME")"
# Since each cc invocation is short, launch half again as many processes
# as we have processors so they don't exit faster than we can start them.
@@ -30,7 +32,7 @@ isnewer()
echo "Generate headers from toys/*/*.c..."
-mkdir -p generated
+mkdir -p generated/unstripped
if isnewer generated/Config.in toys
then
@@ -111,7 +113,7 @@ fi
# LINK needs optlibs.dat, above
-LINK="$(echo $LDOPTIMIZE $LDFLAGS -o toybox_unstripped -Wl,--as-needed $(cat generated/optlibs.dat))"
+LINK="$(echo $LDOPTIMIZE $LDFLAGS -o "$UNSTRIPPED" -Wl,--as-needed $(cat generated/optlibs.dat))"
genbuildsh > generated/build.sh && chmod +x generated/build.sh || exit 1
echo "Make generated/config.h from $KCONFIG_CONFIG."
@@ -293,9 +295,10 @@ done
[ $DONE -ne 0 ] && exit 1
do_loudly $BUILD $LFILES $LINK || exit 1
-if [ ! -z "$NOSTRIP" ] || ! do_loudly ${CROSS_COMPILE}strip toybox_unstripped -o toybox
+if [ ! -z "$NOSTRIP" ] ||
+ ! do_loudly ${CROSS_COMPILE}strip "$UNSTRIPPED" -o "$OUTNAME"
then
- echo "strip failed, using unstripped" && cp toybox_unstripped toybox ||
+ echo "strip failed, using unstripped" && cp "$UNSTRIPPED" "$OUTNAME" ||
exit 1
fi
@@ -303,6 +306,6 @@ fi
# its output the way SUSv4 suggests it do so. While we're at it, make sure
# we don't have the "w" bit set so things like bzip2's "cp -f" install don't
# overwrite our binary through the symlink.
-do_loudly chmod 555 toybox || exit 1
+do_loudly chmod 555 "$OUTNAME" || exit 1
echo