Buildscript: Support --debug, calc # of threads dynamically

This commit is contained in:
Jan-Philipp Litza 2015-08-04 10:04:42 +02:00
parent 01c91c8cc2
commit 4a6bffedfc
1 changed files with 18 additions and 5 deletions

View File

@ -35,9 +35,9 @@ extract_local_version() {
echo "${local_version_tmp%~testing}"
}
if [ "$#" != 1 ]; then
if [ "$#" = 0 ]; then
cat <<USAGE
Usage: $(basename $0) <branch>
Usage: $(basename $0) [--debug] <branch>
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 ..