From 13e441d60edef32c5660f952c5b25e6087ea6bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 24 Mar 2020 23:45:59 +0200 Subject: [PATCH] build-llvm: Only pass -j to ninja if CORES was set originally If CORES was unset, let ninja pick the core count (which normally is set higher than the number of cores). --- build-llvm.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build-llvm.sh b/build-llvm.sh index d2e21ed..c437fe5 100755 --- a/build-llvm.sh +++ b/build-llvm.sh @@ -53,10 +53,6 @@ if [ -z "$CHECKOUT_ONLY" ]; then PREFIX="$(cd "$PREFIX" && pwd)" fi -: ${CORES:=$(nproc 2>/dev/null)} -: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)} -: ${CORES:=4} - if [ ! -d llvm-project ]; then # When cloning master and checking out a pinned old hash, we can't use --depth=1. git clone https://github.com/llvm/llvm-project.git @@ -76,6 +72,10 @@ if [ -n "$(which ninja)" ]; then CMAKE_GENERATOR="Ninja" NINJA=1 else + : ${CORES:=$(nproc 2>/dev/null)} + : ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)} + : ${CORES:=4} + case $(uname) in MINGW*) CMAKE_GENERATOR="MSYS Makefiles" @@ -180,7 +180,7 @@ cmake \ .. if [ -n "$NINJA" ]; then - ninja -j$CORES install/strip + ninja ${CORES+-j$CORES} install/strip else make -j$CORES install/strip fi