git: 6eae413a2545 - main - build: Check NO_ROOT and METALOG for more targets

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Sat, 11 Jan 2025 13:45:53 UTC
The branch main has been updated by emaste:

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

commit 6eae413a25450c99a5d91d443569c3c1a51b4a4d
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-12-31 14:47:33 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-01-11 13:44:53 +0000

    build: Check NO_ROOT and METALOG for more targets
    
    In f6575ed0deb08 I added a check that DISTDIR is set and is not / for
    `make distributeworld`.  Extend the check to `distributekernel` and the
    two package* targets as the same argument applies.
    
    Reviewed by:    brooks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D48339
---
 Makefile.inc1 | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index fe799218ab0a..c8e6e63d2e39 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1000,13 +1000,18 @@ INSTALLFLAGS+=	-h sha256
 IMAKE_INSTALL=	INSTALL="${INSTALL_CMD} ${INSTALLFLAGS}"
 IMAKE_MTREE=	MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}"
 .endif
-.if make(distributeworld)
+
+.if make(distributeworld) || make(packageworld) || make(distributekernel) || \
+    make(packagekernel)
 .if ${DISTDIR:U/} == /
-.error DISTDIR must be set for make distributeworld and may not be the root directory.
+.error DISTDIR must be set for make distribute* and make package*, and may not be the root directory.
 .endif
 .if !defined(NO_ROOT) || !defined(METALOG)
-.error NO_ROOT and METALOG must be set for make distributeworld.
+.error NO_ROOT and METALOG must be set for make distribute* and make package*.
+.endif
 .endif
+
+.if make(distributeworld)
 CERTCTLDESTDIR=	${DESTDIR}/${DISTDIR}
 CERTCTLFLAGS+=	-d /base
 .else