From 1c0488792d245101ceb4efca2223574c44fd0e67 Mon Sep 17 00:00:00 2001 From: Michael Hope Date: Thu, 29 Sep 2011 12:40:42 +1300 Subject: config: add a 'auto' value for the number of parallel jobs When CT_PARALLEL_JOBS is -1, set the number of parallel jobs to the number of online CPUs + 1. Update documentation to match. I find this useful when building in the cloud. You can use the same .config file and have the build adapt to the number of processors available. Limited testing shows that NCPUS+1 is faster than NCPUS+0 or NCPUS+2. Signed-off-by: Michael Hope --- scripts/crosstool-NG.sh.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index c2f35f6b..6b6aa0e3 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -488,7 +488,11 @@ if [ -z "${CT_RESTART}" ]; then # And help make go faster JOBSFLAGS= - [ ${CT_PARALLEL_JOBS} -ne 0 ] && JOBSFLAGS="${JOBSFLAGS} -j${CT_PARALLEL_JOBS}" + # Use the number of processors+1 when automatically setting the number of + # parallel jobs. Fall back to 1 if the host doesn't use GLIBC. + AUTO_JOBS=$((`getconf _NPROCESSORS_ONLN 2> /dev/null || echo 0` + 1)) + [ ${CT_PARALLEL_JOBS} -eq -1 ] && JOBSFLAGS="${JOBSFLAGS} -j${AUTO_JOBS}" + [ ${CT_PARALLEL_JOBS} -gt 0 ] && JOBSFLAGS="${JOBSFLAGS} -j${CT_PARALLEL_JOBS}" [ ${CT_LOAD} -ne 0 ] && JOBSFLAGS="${JOBSFLAGS} -l${CT_LOAD}" # We need to save the real .config with kconfig's value, -- cgit v1.2.3