aboutsummaryrefslogtreecommitdiff
path: root/util/abuild
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2013-12-05 19:53:04 +0100
committerPatrick Georgi <patrick@georgi-clan.de>2013-12-05 20:46:00 +0100
commit589555109c95914d5162978c83ae93ba8c9f5a0e (patch)
treecc1c0d060d08f1d6ecc42492639309f22200638f /util/abuild
parentd935f039382a32cd49722235d4186db652f1b56b (diff)
abuild: fix and enable USE_XARGS configuration
USE_XARGS mode builds n boards in parallel (with 1 CPU each) instead of building 1 board with n CPUs. This requires the main build system to work under such circumstances. Change-Id: Ib4571a78dfe78fd61ae5b26c18be9745bd8b3d52 Reviewed-on: http://review.coreboot.org/4485 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'util/abuild')
-rwxr-xr-xutil/abuild/abuild20
1 files changed, 12 insertions, 8 deletions
diff --git a/util/abuild/abuild b/util/abuild/abuild
index 6148757d1e..706bb2a7e3 100755
--- a/util/abuild/abuild
+++ b/util/abuild/abuild
@@ -47,6 +47,9 @@ configureonly=0
# Did any board fail to build?
failed=0
+# default: single CPU build
+cpus=1
+
# One might want to adjust these in case of cross compiling
for i in make gmake gnumake nonexistant_make; do
$i --version 2>/dev/null |grep "GNU Make" >/dev/null && break
@@ -587,6 +590,7 @@ while true ; do
-T|--test) shift; hwtest=true;;
-c|--cpus) shift
export MAKEFLAGS="-j $1"
+ cpus=$1
test "$MAKEFLAGS" == "-j max" && export MAKEFLAGS="-j" && cpuconfig="in parallel"
test "$1" == "1" && cpuconfig="on 1 cpu"
expr "$1" : '-\?[0-9]\+$' > /dev/null && test 0$1 -gt 1 && cpuconfig="on $1 cpus in parallel"
@@ -633,10 +637,16 @@ fi
USE_XARGS=0
if [ "$cpus" != "1" ]; then
+ # Limit to 32 parallel builds for now.
+ # Thrashing all caches because we run
+ # 160 abuilds in parallel is no fun.
+ if [ "$cpus" = "max" ]; then
+ cpus=32
+ fi
if [ "$target" = "" ]; then
# Test if xargs supports the non-standard -P flag
# FIXME: disabled until we managed to eliminate all the make(1) quirks
- echo | xargs -P 0$cpus -n 1 echo 2>/dev/null >/dev/null # && USE_XARGS=1
+ echo | xargs -P ${cpus:-0} -n 1 echo 2>/dev/null >/dev/null && USE_XARGS=1
fi
fi
@@ -653,12 +663,6 @@ build_all_targets()
done
}
else
-# Limit to 32 parallel builds for now.
-# Thrashing all caches because we run
-# 160 abuilds in parallel is no fun.
-if [ "$cpus" = "" ]; then
- cpus=32
-fi
build_all_targets()
{
# seed shared utils
@@ -672,7 +676,7 @@ build_all_targets()
for MAINBOARD in $( mainboards $VENDOR ); do
echo $VENDOR/$MAINBOARD
done
- done | xargs -P 0$cpus -n 1 $0 $cmdline -t
+ done | xargs -P ${cpus:-0} -n 1 $0 $cmdline -t
}
fi