aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-08-24 22:42:47 -0500
committerRob Landley <rob@landley.net>2014-08-24 22:42:47 -0500
commit5d16faa426b641aefe2d019cbbf76a3d49c4549f (patch)
tree7bd116008f332480c5d4bd718e2003f0b803eea1 /scripts
parent8f5ad7ef175851a18b35a10707742ff3b3382c7d (diff)
downloadtoybox-5d16faa426b641aefe2d019cbbf76a3d49c4549f.tar.gz
Fix parallel make not always catching errors before link time.
jobs -p removes finished jobs from the list after reporting them once, so we need to record the output and remove duplicates ourselves.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/make.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/make.sh b/scripts/make.sh
index 502c8cd1..38b8f071 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -7,11 +7,7 @@ source ./configure
[ -z "$KCONFIG_CONFIG" ] && KCONFIG_CONFIG=".config"
-if [ -z "$CPUS" ]
-then
- CPUS=$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w)
- CPUS=$(($CPUS+1))
-fi
+[ -z "$CPUS" ] && CPUS=$(($(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w)+1))
# Respond to V= by echoing command lines as well as running them
do_loudly()
@@ -188,6 +184,7 @@ LINK="-o toybox_unstripped -Wl,--as-needed $(cat generated/optlibs.dat)"
# This is a parallel version of: do_loudly $BUILD $FILES $LINK || exit 1
rm -f generated/*.o
+PENDING=
for i in $FILES
do
# build each generated/*.o file in parallel
@@ -200,14 +197,17 @@ do
while true
do
- [ $(jobs -rp | wc -w) -lt "$CPUS" ] && break;
- wait $(jobs -p | head -n 1) || exit 1
+ PENDING="$(echo $PENDING $(jobs -rp) | tr ' ' '\n' | sort -u)"
+ [ $(echo $PENDING | wc -l) -lt "$CPUS" ] && break;
+
+ wait $(echo $PENDING | head -n 1) || exit 1
+ PENDING="$(echo "$PENDING" | tail -n +2)"
done
done
# wait for all background jobs, detecting errors
-for i in $(jobs -p)
+for i in $PENDING
do
wait $i || exit 1
done