From ebae797c82a74cfbdc6acbb1a6bf977f7369e51b Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Mon, 24 Aug 2020 09:20:38 +0000 Subject: [PATCH] Also print number of available CPUs on Linux Without this change the buildworld/buildkernel epilogue looks like this: >>> World built in 249 seconds, sysctl: cannot stat /proc/sys/hw/ncpu: No such file or directory ncpu: , make -j72. Reviewed By: emaste, bdrewery Differential Revision: https://reviews.freebsd.org/D26056 --- Makefile.inc1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index d50bfd772d27..3a6e19e733df 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1136,6 +1136,8 @@ _BUILDWORLD_START!= date '+%s' buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue .PHONY .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue +_ncpu_cmd=sysctl -n hw.ncpu 2>/dev/null || nproc 2>/dev/null || echo unknown + buildworld_prologue: .PHONY @echo "--------------------------------------------------------------" @echo ">>> World build started on `LC_ALL=C date`" @@ -1147,7 +1149,7 @@ buildworld_epilogue: .PHONY @echo ">>> World build completed on `LC_ALL=C date`" @seconds=$$(($$(date '+%s') - ${_BUILDWORLD_START})); \ echo -n ">>> World built in $$seconds seconds, "; \ - echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}" + echo "ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}" @echo "--------------------------------------------------------------" # @@ -1656,7 +1658,7 @@ buildkernel: .MAKE .PHONY .endfor @seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \ echo -n ">>> Kernel(s) ${BUILDKERNELS} built in $$seconds seconds, "; \ - echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}" + echo "ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}" @echo "--------------------------------------------------------------" NO_INSTALLEXTRAKERNELS?= yes