git: f6575ed0deb0 - main - Makefile.inc1: Require DISTDIR be set for `make distributeworld`

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 13 Dec 2024 15:23:50 UTC
The branch main has been updated by emaste:

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

commit f6575ed0deb08026c5ee261495e000831688e5a2
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-12-11 15:53:42 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-12-13 15:22:01 +0000

    Makefile.inc1: Require DISTDIR be set for `make distributeworld`
    
    distributeworld is the target used to stage world for building dist sets
    for release targets, and is not really intended for end-user use.  If
    DISTDIR is not set we would attempt to write to the root directory.
    Error out in this case, serving as an assertion that an internal target
    is not being used incorrectly.
    
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D48030
---
 Makefile.inc1 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 5cf431733f8e..bd0ed3ebfba8 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1001,6 +1001,9 @@ IMAKE_INSTALL=	INSTALL="${INSTALL_CMD} ${INSTALLFLAGS}"
 IMAKE_MTREE=	MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}"
 .endif
 .if make(distributeworld)
+.if ${DISTDIR:U/} == /
+.error DISTDIR must be set for make distributeworld and may not be the root directory.
+.endif
 CERTCTLDESTDIR=	${DESTDIR}/${DISTDIR}
 CERTCTLFLAGS+=	-d /base
 .else