Allow parallel make when the -j option is passed to build.sh.

Based on a patch to the UQM Mega-Mod by Ala-lala.
This commit is contained in:
Michael Martin
2019-10-27 14:36:33 -07:00
parent 8b1dab9ec0
commit 252fffb993
2 changed files with 26 additions and 6 deletions
+18 -2
View File
@@ -58,6 +58,22 @@ fi
# Load the configuration functions
. build/unix/build.config
BUILD_THREADS=""
for i in "$@"; do
shift
if [ "`printf "%s" "$i" | cut -c1-2`" = "-j" ]; then
num="`printf "%s" "$i" | cut -c3-`"
if [ -z "$num" ] || [ "$num" -gt 0 ] 2>/dev/null; then
BUILD_THREADS="-j$num"
else
usage 1>&2
exit 1
fi
else
set -- "$@" "$i"
fi
done
case "$1" in
cleanall)
build_cleanall
@@ -93,7 +109,7 @@ export "${BUILD_PROJECT}_OBJS"
if [ $# -lt 2 ]; then
build_check_config
build_check_dependencies
build_compile
build_compile $BUILD_THREADS
exit $?
fi
@@ -115,7 +131,7 @@ case "$2" in
install)
build_check_config
build_check_dependencies
build_check_compile
build_check_compile $BUILD_THREADS
build_install
;;
*)