From 09961851544a5cf03e28cb928a3e3c40841df69a Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Tue, 4 Aug 2015 10:04:42 +0200 Subject: [PATCH] Buildscript: Support --debug, calc # of threads dynamically --- build.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index ce42b91..2ffc8f7 100755 --- a/build.sh +++ b/build.sh @@ -35,9 +35,9 @@ extract_local_version() { echo "${local_version_tmp%~testing}" } -if [ "$#" != 1 ]; then +if [ "$#" = 0 ]; then cat < +Usage: $(basename $0) [--debug] This script takes the intended branch, "testing" or "stable", as the single parameter. It then tries to autodetermine the correct release name, builds @@ -48,6 +48,12 @@ USAGE exit 1 fi +debug= +if [ "$1" = "--debug" ]; then + debug=1 + shift +fi + branch="$1" case "$branch" in testing|stable) @@ -84,11 +90,18 @@ case "$branch" in ;; esac +# calculate number of threads +if [ -z "$debug" ]; then + proc_num="$(($(grep -c '^processor\s' /proc/cpuinfo) + 1))" +else + proc_num=1 +fi + cd "$GLUON_DIR" -make update +make update ${debug:+V=s} for target in ar71xx-generic ar71xx-nand mpc85xx-generic; do - make clean GLUON_TARGET="$target" - make -j5 GLUON_TARGET="$target" + make clean GLUON_TARGET="$target" ${debug:+V=s} + make -j${proc_num} GLUON_TARGET="$target" ${debug:+V=s} done make manifest cd ..