scripts: Scale number of make jobs by hardware thread count
If the hardware thread/core count cannot be determined successfully, avoid setting the '-j' option for make.
This commit is contained in:
@@ -110,7 +110,18 @@ else
|
|||||||
mkdir -p "$RISCV"
|
mkdir -p "$RISCV"
|
||||||
git -C "${CHIPYARD_DIR}" submodule update --init --recursive "toolchains/${TOOLCHAIN}" #--jobs 8
|
git -C "${CHIPYARD_DIR}" submodule update --init --recursive "toolchains/${TOOLCHAIN}" #--jobs 8
|
||||||
cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN"
|
cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN"
|
||||||
export MAKEFLAGS="-j16"
|
|
||||||
|
# Scale number of parallel make jobs by hardware thread count
|
||||||
|
ncpu="$(getconf _NPROCESSORS_ONLN || # GNU
|
||||||
|
getconf NPROCESSORS_ONLN || # *BSD, Solaris
|
||||||
|
nproc --all || # Linux
|
||||||
|
sysctl -n hw.ncpu || # *BSD, OS X
|
||||||
|
:)" 2>/dev/null
|
||||||
|
case ${ncpu} in
|
||||||
|
''|*[^0-9]*) ;; # Ignore non-integer values
|
||||||
|
*) export MAKEFLAGS="-j ${ncpu}" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
#build the actual toolchain
|
#build the actual toolchain
|
||||||
#./build.sh
|
#./build.sh
|
||||||
source build.common
|
source build.common
|
||||||
@@ -128,7 +139,7 @@ else
|
|||||||
cd "$RDIR"
|
cd "$RDIR"
|
||||||
# build linux toolchain
|
# build linux toolchain
|
||||||
cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN/riscv-gnu-toolchain/build"
|
cd "$CHIPYARD_DIR/toolchains/$TOOLCHAIN/riscv-gnu-toolchain/build"
|
||||||
make -j16 linux
|
make linux
|
||||||
echo -e "\\nRISC-V Linux GNU Toolchain installation completed!"
|
echo -e "\\nRISC-V Linux GNU Toolchain installation completed!"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user