git: f83ec40fca52 - main - Makefile.inc1: Let the buildetc target run outside of etc

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 24 Apr 2025 14:35:07 UTC
The branch main has been updated by markj:

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

commit f83ec40fca52e1e2319b5d4f770f8263378265d6
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-04-24 14:32:41 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-04-24 14:32:41 +0000

    Makefile.inc1: Let the buildetc target run outside of etc
    
    Commit 49bc071f4088 ("nsswitch.conf: Avoid modification after
    installation") changes handling of nsswitch.conf such that we make a
    copy in the objdir during a build.  Historically, the in-tree
    nsswitch.conf lived under etc.
    
    The buildetc target and its copy set SUBDIR_OVERRIDE=etc when building
    the object tree, but I think this isn't right when conf files are
    scattered around the src tree.  If any of them require non-trivial
    processing, they'll get skipped during buildetc, and then some
    build-time commands may run during installetc.  In the linked PR, this
    fails because the src tree is mounted read-only and no objdir was
    created during buildetc.
    
    Remove the SUBDIR_OVERRIDE for the _obj target, and build the
    buildconfig target across the tree.
    
    PR:             286072
    Fixes:          49bc071f4088 ("nsswitch.conf: Avoid modification after installation")
    Reviewed by:    brooks, dim
    Tested by:      dim, Alastair Hogge <agh@riseup.net>
    Differential Revision:  https://reviews.freebsd.org/D49960
---
 Makefile.inc1 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 4a0e4a884532..ebba0ccd9f5e 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1674,8 +1674,8 @@ buildetc: .MAKE .PHONY
 	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 _legacy
 	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 _bootstrap-tools \
 	    MK_CROSS_COMPILER=no MK_TOOLCHAIN=no
-	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 _obj \
-	    SUBDIR_OVERRIDE=etc
+	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 _obj
+	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 buildconfig
 	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 everything \
 	    SUBDIR_OVERRIDE=etc