Skip to content

Instantly share code, notes, and snippets.

@warped-rudi
Created December 13, 2014 17:05
Show Gist options
  • Save warped-rudi/522d717348faec77a00e to your computer and use it in GitHub Desktop.
Save warped-rudi/522d717348faec77a00e to your computer and use it in GitHub Desktop.
Limit number of make job to actuall number of processors, gracefully handle invalid values for CONCURRENCY_MAKE_LEVEL
diff --git a/config/path b/config/path
index 78f53d5..9043ddc 100644
--- a/config/path
+++ b/config/path
@@ -52,6 +52,11 @@ ROOT=`pwd`
# Toolchain Settings #
######################
+NUM_PROCESSORS=`grep -c processor /proc/cpuinfo`
+[ -z "$CONCURRENCY_MAKE_LEVEL" ] && CONCURRENCY_MAKE_LEVEL=0
+[ $CONCURRENCY_MAKE_LEVEL -lt 1 -o $CONCURRENCY_MAKE_LEVEL -gt $NUM_PROCESSORS ] && \
+ CONCURRENCY_MAKE_LEVEL=$NUM_PROCESSORS
+
. config/toolchain
TOOLCHAIN_LANGUAGES=c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment