forked from freifunk-franken/firmware
buildscript: provide option to set number of threads during build
This allows to specify the number of threads used in './buildscript build' manually by adding them as third option, e.g. ./buildscript build fast 20 ./buildscript build debug 4 ./buildscript build default 10 Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Reviewed-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
parent
20d12f943e
commit
0dfa1140ff
18
buildscript
18
buildscript
|
@ -208,13 +208,19 @@ build() {
|
|||
|
||||
case "$1" in
|
||||
"debug")
|
||||
make V=99
|
||||
if [ -n "$2" ]; then
|
||||
make V=99 -j $2
|
||||
else
|
||||
make V=99
|
||||
fi
|
||||
;;
|
||||
"fast")
|
||||
ionice -c 2 -- nice -n 1 -- make -j $((cpus*2))
|
||||
[ -n "$2" ] && threads=$2 || threads=$((cpus*2))
|
||||
ionice -c 2 -- nice -n 1 -- make -j $threads
|
||||
;;
|
||||
*)
|
||||
ionice -c 3 -- nice -n 10 -- make -j $((cpus+1))
|
||||
[ -n "$2" ] && threads=$2 || threads=$((cpus+1))
|
||||
ionice -c 3 -- nice -n 10 -- make -j $threads
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -444,13 +450,13 @@ case "$1" in
|
|||
"build")
|
||||
if [ "$2" = "help" ] || [ "$2" = "x" ]; then
|
||||
echo "This option compiles the firmware"
|
||||
echo "Normaly the build uses lower IO and System priorities, "
|
||||
echo "Normally the build uses lower IO and System priorities, "
|
||||
echo "you can append \"fast\" option, to use normal user priorities"
|
||||
echo
|
||||
echo "Usage: $0 $1 [fast|debug]"
|
||||
echo "Usage: $0 $1 [fast|debug] [numthreads]"
|
||||
echo
|
||||
else
|
||||
build "$2"
|
||||
build "$2" "$3"
|
||||
fi
|
||||
;;
|
||||
"config")
|
||||
|
|
Loading…
Reference in New Issue