From 9b4b85bb7dd320da04f94f1f53aafaf5ba4e696d Mon Sep 17 00:00:00 2001 From: Dimitris Tassopoulos Date: Mon, 6 Apr 2020 14:24:38 +0200 Subject: [PATCH] Added an option to use a configurable number of cores for make Signed-off-by: Dimitris Tassopoulos --- scripting/build_tools/get_libngspice_so.sh | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/scripting/build_tools/get_libngspice_so.sh b/scripting/build_tools/get_libngspice_so.sh index fedb6e3e0a..8a3783f16c 100755 --- a/scripting/build_tools/get_libngspice_so.sh +++ b/scripting/build_tools/get_libngspice_so.sh @@ -1,7 +1,7 @@ #!/bin/bash # author: Maciej Suminski -# contributors: madworm, imcinerney +# contributors: madworm, imcinerney, dimtass # Set to 1 to pull the tag given by NGSPICE_GIT_TAG # Set to 0 to pull the commit with the has given by NGSPICE_GIT_HASH @@ -15,6 +15,8 @@ NGSPICE_GIT="git://git.code.sf.net/p/ngspice/ngspice" BUILD_DIR="/tmp/libngspice_so" SRC_DIR="${BUILD_DIR}/ngspice" +NPROC=1 + if [ -n "${MINGW_PREFIX}" ]; then OSTYPE="mingw" fi @@ -43,6 +45,22 @@ case "${OSTYPE}" in ;; esac +while getopts "c:ah" option; do + case "${option}" + in + c) NPROC=${OPTARG};; # number of cores + a) NPROC=$(nproc);; # all threads + h) cat <" -echo "contributors: madworm, imcinerney" +echo "contributors: madworm, imcinerney, dimtass" echo echo "PREREQUISITES: autoconf automake bison flex gcc git libtool make" echo @@ -99,7 +117,7 @@ else exit 1 fi -echo "*** Building libngspice shared library.. ***" +echo "*** Building libngspice shared library using ${NPROC} core(s).. ***" if [ $USE_GIT_TAG == 1 ]; then echo "*** Checking out tag ${NGSPICE_GIT_TAG} ***" git checkout tags/${NGSPICE_GIT_TAG} @@ -110,7 +128,7 @@ fi ./autogen.sh ./configure --with-ngshared --enable-xspice --enable-cider ${CFG_OPTIONS} -make +make -j${NPROC} if [ $? != 0 ]; then echo "*** Build failed ***"