From d4d2f8cb6142531b180dc4d7e40709c35cfbd60a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 17 Mar 2016 17:41:01 -0500 Subject: helpers/build/crossgcc: Honor NPROC environment variable --- resources/scripts/helpers/build/module/crossgcc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'resources/scripts/helpers/build/module/crossgcc') diff --git a/resources/scripts/helpers/build/module/crossgcc b/resources/scripts/helpers/build/module/crossgcc index 801cd5e0..7a23e392 100755 --- a/resources/scripts/helpers/build/module/crossgcc +++ b/resources/scripts/helpers/build/module/crossgcc @@ -24,14 +24,26 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e +if [ -z ${NPROC+x} ]; then + cores="$(nproc)" +else + case ${NPROC} in + ''|*[!0-9]*) + printf "value '%s' for NPROC is invalid. non-numeric. Exiting.\n" "${NPROC}" + exit 1 + ;; + esac + cores="${NPROC}" +fi + ( cd "crossgcc/" if [ $# -lt 1 ]; then - make crossgcc-i386 - make crossgcc-arm + make crossgcc-i386 CPUS=${cores} + make crossgcc-arm CPUS=${cores} else for architecture in "${@}"; do - make crossgcc-${architecture} + make crossgcc-${architecture} CPUS=${cores} done fi ) -- cgit v1.2.3-70-g09d2