functions: build targets in parallel

When we call m outside of a docker-% target, the paralleization isn't calculated
by the build system.

Change-Id: I5f4f6d5fd3c60b5b2c7f825f1d7887c17c001b2c
diff --git a/vars/functions.groovy b/vars/functions.groovy
index f33b963..4e4b333 100644
--- a/vars/functions.groovy
+++ b/vars/functions.groovy
@@ -37,7 +37,8 @@
 }
 
 def buildTarget(targetName) {
-    sh "bash -c 'source build/setup.sh; m prereqs ${targetName}; exit \$?'"
+    def nprocs = sh(returnStdout: true, script: 'nproc')
+    sh "bash -c 'source build/setup.sh; m -j${nprocs} prereqs ${targetName}; exit \$?'"
 }
 
 def nameFromRepoType(repoType, boardName) {