aboutsummaryrefslogtreecommitdiff
path: root/scripts/make.sh
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-11-28 17:30:46 -0600
committerRob Landley <rob@landley.net>2014-11-28 17:30:46 -0600
commit42a36d6314e6ad7af6ab732ddc6d4e7577bb2c7b (patch)
tree273bcdbefe2522523c790574ade2e0d7a4365c37 /scripts/make.sh
parent6d28370f22aa6b7c97a57a434339fa57ce322c8b (diff)
downloadtoybox-42a36d6314e6ad7af6ab732ddc6d4e7577bb2c7b.tar.gz
Improve error reporting in parallel build. (On error, wait for all children to finish before exiting.)
Diffstat (limited to 'scripts/make.sh')
-rwxr-xr-xscripts/make.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/make.sh b/scripts/make.sh
index 2274d68b..167c3d51 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -230,6 +230,7 @@ else
fi
PENDING=
LFILES=
+DONE=0
for i in $FILES
do
# build each generated/obj/*.o file in parallel
@@ -248,18 +249,23 @@ do
PENDING="$(echo $PENDING $(jobs -rp) | tr ' ' '\n' | sort -u)"
[ $(echo -n "$PENDING" | wc -l) -lt "$CPUS" ] && break;
- wait $(echo "$PENDING" | head -n 1) || exit 1
+ wait $(echo "$PENDING" | head -n 1)
+ DONE=$(($DONE+$?))
PENDING="$(echo "$PENDING" | tail -n +2)"
done
+ [ $DONE -ne 0 ] && break
done
# wait for all background jobs, detecting errors
for i in $PENDING
do
- wait $i || exit 1
+ wait $i
+ DONE=$(($DONE+$?))
done
+[ $DONE -ne 0 ] && exit 1
+
do_loudly $BUILD $LFILES $LINK || exit 1
do_loudly ${CROSS_COMPILE}${STRIP} toybox_unstripped -o toybox || exit 1
# gcc 4.4's strip command is buggy, and doesn't set the executable bit on