hvk: fix MAKEJOBS arguments to KMAKE
[hvutilities.git] / scripts / hvk-common.sh
index 7f332da..fb03814 100644 (file)
@@ -1,5 +1,8 @@
 #!/bin/bash
 
+# Abort on errors
+set -e
+
 if [ -f include/linux/linux_logo.h ]; then
     mode=linux
 elif [ -f include/asm-generic/u-boot.h ]; then
@@ -17,9 +20,13 @@ else
     source ${SCRIPTPATH}/hvk-x86.sh
 fi
 
-: ${MAKEJOBS:="-j$(nproc)"}
+: ${MAKEJOBS:="$(nproc)"}
+
+if [ x"${MAKEJOBS}" != x"" ]; then
+    MAKEJOBS_ARG="-j ${MAKEJOBS}"
+fi
 
-KMAKE="make ${MAKEJOBS}"
+KMAKE="make ${MAKEJOBS_ARG}"
 
 # Needed to compile sample userspace programs (rtc-test):
 export CROSS_COMPILE_KCFLAGS=${KCFLAGS}