git: 3c5d19a40de7 - main - nanobsd: Fix parallel make

From: Jose Luis Duran <jlduran_at_FreeBSD.org>
Date: Sat, 16 Nov 2024 07:23:44 UTC
The branch main has been updated by jlduran:

URL: https://cgit.FreeBSD.org/src/commit/?id=3c5d19a40de7273bb478163639dd8532af425595

commit 3c5d19a40de7273bb478163639dd8532af425595
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2024-11-07 14:32:01 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2024-11-16 06:55:25 +0000

    nanobsd: Fix parallel make
    
    The NANO_NCPU (number of CPUs) value gets ignored by the build script
    when setting the NANO_PMAKE (parallel make) value.
    
    Fix it by setting the NANO_PMAKE later in the process.
    
    PR:             277269
    Reviewed by:    imp, emaste
    Approved by:    emaste (mentor)
    MFC after:      1 month
    Differential Revision:  https://reviews.freebsd.org/D47476
---
 tools/tools/nanobsd/defaults.sh | 5 ++++-
 tools/tools/nanobsd/nanobsd.sh  | 4 ----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index 54e10ba74550..910ec69865df 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -67,7 +67,6 @@ NANO_PKG_META_BASE=/var/db
 # Make & parallel Make
 NANO_MAKE="make"
 NANO_NCPU=$(sysctl -n hw.ncpu)
-NANO_PMAKE="make -j $NANO_NCPU"
 
 # The default name for any image we create.
 NANO_IMGNAME="_.disk.full"
@@ -892,6 +891,10 @@ set_defaults_and_export ( ) {
 	: ${NANO_DISKIMGDIR:=${NANO_OBJ}}
 	: ${NANO_WORLDDIR:=${NANO_OBJ}/_.w}
 	: ${NANO_LOG:=${NANO_OBJ}}
+	: ${NANO_PMAKE:="${NANO_MAKE} -j ${NANO_NCPU}"}
+	if ! $do_clean; then
+		NANO_PMAKE="${NANO_PMAKE} -DNO_CLEAN"
+	fi
 	NANO_MAKE_CONF_BUILD=${MAKEOBJDIRPREFIX}/make.conf.build
 	NANO_MAKE_CONF_INSTALL=${NANO_OBJ}/make.conf.install
 
diff --git a/tools/tools/nanobsd/nanobsd.sh b/tools/tools/nanobsd/nanobsd.sh
index af03d89acece..4c390d8ca371 100755
--- a/tools/tools/nanobsd/nanobsd.sh
+++ b/tools/tools/nanobsd/nanobsd.sh
@@ -156,10 +156,6 @@ if [ ! -d "${NANO_TOOLS}" ]; then
 	exit 1
 fi
 
-if ! $do_clean; then
-	NANO_PMAKE="${NANO_PMAKE} -DNO_CLEAN"
-fi
-
 pprint 1 "NanoBSD image ${NANO_NAME} build starting"
 
 run_early_customize