Makefile.inc1: Let the buildetc target run outside of etc

Commit 49bc071f40 ("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:		49bc071f40 ("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
This commit is contained in:
Mark Johnston 2025-04-24 14:32:41 +00:00
parent ca4b046105
commit f83ec40fca

View file

@ -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