Added an option to use a configurable number of cores for make
Signed-off-by: Dimitris Tassopoulos <dimtass@gmail.com>
This commit is contained in:
parent
5b70856a85
commit
9b4b85bb7d
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# author: Maciej Suminski <maciej.suminski@cern.ch>
|
# author: Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
# contributors: madworm, imcinerney
|
# contributors: madworm, imcinerney, dimtass
|
||||||
|
|
||||||
# Set to 1 to pull the tag given by NGSPICE_GIT_TAG
|
# 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
|
# 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"
|
BUILD_DIR="/tmp/libngspice_so"
|
||||||
SRC_DIR="${BUILD_DIR}/ngspice"
|
SRC_DIR="${BUILD_DIR}/ngspice"
|
||||||
|
|
||||||
|
NPROC=1
|
||||||
|
|
||||||
if [ -n "${MINGW_PREFIX}" ]; then
|
if [ -n "${MINGW_PREFIX}" ]; then
|
||||||
OSTYPE="mingw"
|
OSTYPE="mingw"
|
||||||
fi
|
fi
|
||||||
|
@ -43,6 +45,22 @@ case "${OSTYPE}" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
while getopts "c:ah" option; do
|
||||||
|
case "${option}"
|
||||||
|
in
|
||||||
|
c) NPROC=${OPTARG};; # number of cores
|
||||||
|
a) NPROC=$(nproc);; # all threads
|
||||||
|
h) cat <<EOF
|
||||||
|
Usage: ${0} [-c Cores] [-a All Cores]
|
||||||
|
|
||||||
|
-c Cores Number of cores/threads to use for make (default: 1)
|
||||||
|
-a All Cores Use all available cores/threads
|
||||||
|
-h Help This help
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = "install" ]; then
|
if [ "$1" = "install" ]; then
|
||||||
if [ -d ${SRC_DIR} ]; then
|
if [ -d ${SRC_DIR} ]; then
|
||||||
|
@ -79,7 +97,7 @@ cd "${BUILD_DIR}" || exit
|
||||||
echo "libngspice (for KiCad) builder v1.2"
|
echo "libngspice (for KiCad) builder v1.2"
|
||||||
echo "(c) CERN 2016"
|
echo "(c) CERN 2016"
|
||||||
echo "author: Maciej Suminski <maciej.suminski@cern.ch>"
|
echo "author: Maciej Suminski <maciej.suminski@cern.ch>"
|
||||||
echo "contributors: madworm, imcinerney"
|
echo "contributors: madworm, imcinerney, dimtass"
|
||||||
echo
|
echo
|
||||||
echo "PREREQUISITES: autoconf automake bison flex gcc git libtool make"
|
echo "PREREQUISITES: autoconf automake bison flex gcc git libtool make"
|
||||||
echo
|
echo
|
||||||
|
@ -99,7 +117,7 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "*** Building libngspice shared library.. ***"
|
echo "*** Building libngspice shared library using ${NPROC} core(s).. ***"
|
||||||
if [ $USE_GIT_TAG == 1 ]; then
|
if [ $USE_GIT_TAG == 1 ]; then
|
||||||
echo "*** Checking out tag ${NGSPICE_GIT_TAG} ***"
|
echo "*** Checking out tag ${NGSPICE_GIT_TAG} ***"
|
||||||
git checkout tags/${NGSPICE_GIT_TAG}
|
git checkout tags/${NGSPICE_GIT_TAG}
|
||||||
|
@ -110,7 +128,7 @@ fi
|
||||||
|
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
./configure --with-ngshared --enable-xspice --enable-cider ${CFG_OPTIONS}
|
./configure --with-ngshared --enable-xspice --enable-cider ${CFG_OPTIONS}
|
||||||
make
|
make -j${NPROC}
|
||||||
|
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo "*** Build failed ***"
|
echo "*** Build failed ***"
|
||||||
|
|
Loading…
Reference in New Issue