From f6575ed0deb08026c5ee261495e000831688e5a2 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Wed, 11 Dec 2024 10:53:42 -0500 Subject: [PATCH] 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 5cf431733f8..bd0ed3ebfba 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