From 25a828190b2a08105ad561b5b417bb61a383fc4f Mon Sep 17 00:00:00 2001 From: Francis Rowe Date: Thu, 10 Mar 2016 15:18:49 -0500 Subject: build system: allow arbitrary specification of number of cores used Use NPROC=foo Replace "foo" with a number. By default, the build system uses $(nproc). This patch allows the user to specify any number of cores. This is useful on some systems, or certain chroot environments. --- (limited to 'resources/scripts/helpers/build/module/flashrom') diff --git a/resources/scripts/helpers/build/module/flashrom b/resources/scripts/helpers/build/module/flashrom index 3664f56..54c12ed 100755 --- a/resources/scripts/helpers/build/module/flashrom +++ b/resources/scripts/helpers/build/module/flashrom @@ -24,6 +24,17 @@ [ "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 # Build "flashrom" (utility for flashing/dumping ROMs) # -------------------------------------------------------------------- @@ -34,12 +45,12 @@ cd "flashrom/" make clean if (( $# != 1 )); then - make -j$(nproc) + make -j${cores} else if [ "${1}" = "static" ]; then - make SHARED=0 CC='gcc -static' -j$(nproc) + make SHARED=0 CC='gcc -static' -j${cores} else - make -j$(nproc) + make -j${cores} fi fi @@ -60,12 +71,12 @@ do make clean if (( $# != 1 )); then - make -j$(nproc) + make -j${cores} else if [ "${1}" = "static" ]; then - make SHARED=0 CC='gcc -static' -j$(nproc) + make SHARED=0 CC='gcc -static' -j${cores} else - make -j$(nproc) + make -j${cores} fi fi -- cgit v0.9.1