aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Picus <diana.picus@linaro.org>2016-07-22 11:52:31 +0300
committerDiana Picus <diana.picus@linaro.org>2016-07-22 13:17:00 +0300
commit87d06329821c68b005ec70f04fff04cc9c1de601 (patch)
tree5801d0eb95e86f466464234a24afbad4d7a52660
parentb2a8786e473b94382ffc7611d2859aa1e700093d (diff)
downloadlinaro-scripts-87d06329821c68b005ec70f04fff04cc9c1de601.tar.gz
[llvm-build] Add -j option
Allow the user to override the number of CPUs used for building LLVM. The default remains unchanged, so if you're not going to use the -j flag it won't affect you. Change-Id: I2491274a629a505744a80625381fb2c47bafd4da
-rwxr-xr-xhelpers/llvm-build14
1 files changed, 10 insertions, 4 deletions
diff --git a/helpers/llvm-build b/helpers/llvm-build
index 7e00b2b..5ef0662 100755
--- a/helpers/llvm-build
+++ b/helpers/llvm-build
@@ -11,14 +11,14 @@
safe_run verify_env
## CMD line options and defaults
-CPUs=`grep -c proc /proc/cpuinfo`
+PARALLEL=-j`grep -c proc /proc/cpuinfo`
build_dir=$LLVM_BLD
install_dir=$LLVM_INSTALL
build_type=Release
shared=
targets=
prog=`basename $0`
-syntax="Syntax: $prog [targets]"
+syntax="Syntax: $prog [-jN] [targets]"
update=false
check=false
master=false
@@ -62,14 +62,20 @@ if [ ! -f build.ninja ] && [ ! -f Makefile ]; then
$targets $shared
fi
+## Allow the user to override the number of CPUs used with -jN
+if [[ $1 =~ -j[0-9]+ ]]; then
+ PARALLEL=$1
+ shift
+fi
+
## Build
if [ "$1" == "" ]; then
echo " + Building LLVM"
- safe_run $make -j$CPUs
+ safe_run $make $PARALLEL
else
for target in "$@"; do
echo " + Running $target"
- safe_run $make -j$CPUs $target
+ safe_run $make $PARALLEL $target
done
fi