svn commit: r367735 - head/share/mk

Brooks Davis brooks at FreeBSD.org
Mon Nov 16 19:15:11 UTC 2020


Author: brooks
Date: Mon Nov 16 19:15:11 2020
New Revision: 367735
URL: https://svnweb.freebsd.org/changeset/base/367735

Log:
  Add a guard for broken SUBDIR.${MK_FOO} use
  
  Check for the variable SUBDIR. and error as it usually means someone
  forgot to include src.opts.mk.
  
  This guard from CheriBSD found the bugs in r367655 and r367728.
  
  Reviewed by:	bdrewery, arichardson
  Obtained from:	CheriBSD
  Sponsored by:	DARPA
  Differential Revision:	https://reviews.freebsd.org/D27211

Modified:
  head/share/mk/bsd.subdir.mk

Modified: head/share/mk/bsd.subdir.mk
==============================================================================
--- head/share/mk/bsd.subdir.mk	Mon Nov 16 18:41:49 2020	(r367734)
+++ head/share/mk/bsd.subdir.mk	Mon Nov 16 19:15:11 2020	(r367735)
@@ -127,6 +127,12 @@ SUBDIR:=${SUBDIR} ${SUBDIR.yes} ${SUBDIR.yes.yes}
 SUBDIR:=${SUBDIR:u}
 .endif
 
+.if defined(SUBDIR.)
+.error ${.CURDIR}: Found variable SUBDIR. with value "${SUBDIR.}". This was \
+        probably caused by using SUBDIR.$${MK_FOO} without including \
+        <src.opts.mk> or by using an invalid $${MK_FOO} option.
+.endif
+
 # Subdir code shared among 'make <subdir>', 'make <target>' and SUBDIR_PARALLEL.
 _SUBDIR_SH=	\
 		if test -d ${.CURDIR}/$${dir}.${MACHINE_ARCH}; then \


More information about the svn-src-head mailing list