From d5a9a275a19296748def6da385f956172cb65d30 Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Fri, 15 Oct 2010 12:46:31 -0500 Subject: [PATCH] script/makeworld: autotune make jobs to 2x hardware contexts (CPUs * cores * threads) --- script/makeworld | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/script/makeworld b/script/makeworld index 36eab41..21029b2 100755 --- a/script/makeworld +++ b/script/makeworld @@ -27,10 +27,15 @@ ROOT="$(realpath "$(dirname "${0}")/../worlds")" # src.conf # CONFIG (Matches config name: GENERIC, SABA, SS4200, etc) +# Compute number of simultaneous make jobs (usually 2x cpu/thread count) to set make -j +make_cpus="$(sysctl -n hw.ncpu)" +make_jobs="$(( ${make_cpus} * 2 ))" + # Going to build this config: TARGET="${TARGET:-i386}" CONFIG="${CONFIG:-GENERIC}" -MAKEOPTS="${MAKEOPTS:-"-j4"}" +MAKEOPTS="-j${make_jobs} ${MAKEOPTS}" + # Check if it exists [ -d "${ROOT}/${TARGET}/${CONFIG}" ] || wtf "${TARGET}/${CONFIG} doesn't exist" -- 2.42.0