Use sysctl instead of nproc to get number of processors on FreeBSD

On FreeBSD `nproc` is not available in a standard installation, so the
equivalent `sysctl -n hw.ncpu` is used.
This commit is contained in:
Johann Rudloff 2021-05-13 09:27:11 +02:00 committed by G. Allais
parent b9e95d5d8d
commit 2477d060a8
2 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,10 @@
INTERACTIVE ?= --interactive
threads ?= `nproc`
ifeq ($(shell uname), FreeBSD)
NPROC = sysctl -n hw.ncpu
else
NPROC = nproc
endif
threads ?= `$(NPROC)`
.PHONY: testbin test

View File

@ -1,5 +1,9 @@
rm -f expected
echo "$(nproc) processors" > expected
if [ "FreeBSD" = "$(uname)" ]; then
echo "$(sysctl -n hw.ncpu) processors" > expected
else
echo "$(nproc) processors" > expected
fi
$1 --no-banner --no-color --console-width 0 NumProcessors.idr --exec main