git: 02ef0b6d76e9 - main - universe: allow moving build logs to UNIVERSE_LOGDIR

From: Siva Mahadevan <siva_at_FreeBSD.org>
Date: Thu, 21 May 2026 14:22:56 UTC
The branch main has been updated by siva:

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

commit 02ef0b6d76e9717b8e3182dd706e23fd2702701d
Author:     Siva Mahadevan <siva@FreeBSD.org>
AuthorDate: 2026-05-20 20:05:53 +0000
Commit:     Siva Mahadevan <siva@FreeBSD.org>
CommitDate: 2026-05-21 14:16:48 +0000

    universe: allow moving build logs to UNIVERSE_LOGDIR
    
    This allows `make universe` or `make tinderbox`
    to build from a read-only src tree.
    
    Reviewed by:    ziaee, imp, delphij
    Approved by:    lwhsu (mentor), emaste (mentor)
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D55566
---
 Makefile               | 17 ++++++++---------
 share/man/man7/build.7 |  7 ++++++-
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 9308883b8500..e7a565cff05e 100644
--- a/Makefile
+++ b/Makefile
@@ -599,8 +599,9 @@ targets:	.PHONY
 .endfor
 .endfor
 
+UNIVERSE_LOGDIR?=${.CURDIR}
 .if defined(DOING_TINDERBOX)
-FAILFILE=${.CURDIR}/_.tinderbox.failed
+FAILFILE=${UNIVERSE_LOGDIR}/_.tinderbox.failed
 MAKEFAIL=tee -a ${FAILFILE}
 .else
 MAKEFAIL=cat
@@ -612,9 +613,7 @@ universe_prologue: .PHONY
 	@echo "--------------------------------------------------------------"
 	@echo ">>> make universe started on ${STARTTIME}"
 	@echo "--------------------------------------------------------------"
-.if defined(DOING_TINDERBOX)
 	@rm -f ${FAILFILE}
-.endif
 
 universe-toolchain: .PHONY universe_prologue
 	@echo "--------------------------------------------------------------"
@@ -630,9 +629,9 @@ universe-toolchain: .PHONY universe_prologue
 	    TOOLS_PREFIX_UNDEF= \
 	    kernel-toolchain \
 	    MK_LLVM_TARGET_ALL=yes \
-	    > _.${.TARGET} 2>&1 || \
+	    > ${UNIVERSE_LOGDIR}/_.${.TARGET} 2>&1 || \
 	    (echo "${.TARGET} failed," \
-	    "check _.${.TARGET} for details" | \
+	    "check ${UNIVERSE_LOGDIR}/_.${.TARGET} for details" | \
 	    ${MAKEFAIL}; false)
 	@if [ ! -e "${HOST_OBJTOP}/tmp/usr/bin/cc" ]; then \
 	    echo "Missing host compiler at ${HOST_OBJTOP}/tmp/usr/bin/cc?" >&2; \
@@ -716,9 +715,9 @@ universe_${target}_${target_arch}: universe_${target}_prologue .MAKE .PHONY
 	    TARGET=${target} \
 	    TARGET_ARCH=${target_arch} \
 	    ${MAKE_PARAMS_${target_arch}} \
-	    > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
+	    > ${UNIVERSE_LOGDIR}/_.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
 	    (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
-	    "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
+	    "check ${UNIVERSE_LOGDIR}/_.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
 	    ${MAKEFAIL}))
 	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
 .endfor
@@ -775,9 +774,9 @@ universe_kernconf_${TARGET}_${kernel}: .MAKE
 	    TARGET_ARCH=${TARGET_ARCH_${kernel}} \
 	    ${MAKE_PARAMS_${TARGET_ARCH_${kernel}}} \
 	    KERNCONF=${kernel} \
-	    > _.${TARGET}.${kernel} 2>&1 || \
+	    > ${UNIVERSE_LOGDIR}/_.${TARGET}.${kernel} 2>&1 || \
 	    (echo "${TARGET} ${kernel} kernel failed," \
-	    "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
+	    "check ${UNIVERSE_LOGDIR}/_.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
 	@echo ">> ${TARGET}.${TARGET_ARCH_${kernel}} ${kernel} kernel completed on `LC_ALL=C date`"
 .endfor
 .for target_arch in ${TARGET_ARCHES_${TARGET}}
diff --git a/share/man/man7/build.7 b/share/man/man7/build.7
index b9a781a9b5ab..23980875eaaa 100644
--- a/share/man/man7/build.7
+++ b/share/man/man7/build.7
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 28, 2026
+.Dd May 20, 2026
 .Dt BUILD 7
 .Os
 .Sh NAME
@@ -958,6 +958,11 @@ Only build worlds for each supported architecture.
 Only build kernels for each supported architecture.
 .It Va WITHOUT_KERNELS
 Only build worlds for each supported architecture.
+.It Va UNIVERSE_LOGDIR
+Write all build logs to this directory for each supported architecture.
+When invoking
+.Cm tinderbox ,
+also write the summary of all failed targets to this directory.
 .It Va UNIVERSE_TARGET
 Execute the specified
 .Xr make 1