git: 6d1d5577ce10 - stable/14 - Makefile.inc1: Require DISTDIR be set for `make distributeworld`

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Mon, 16 Dec 2024 00:39:51 UTC
The branch stable/14 has been updated by emaste:

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

commit 6d1d5577ce1076ea2080bf243611d0f76c646a35
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-12-11 15:53:42 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-12-16 00:39:08 +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
    
    (cherry picked from commit f6575ed0deb08026c5ee261495e000831688e5a2)
---
 Makefile.inc1 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 1927a69ef732..d4ec63091e5a 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -979,6 +979,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