Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Nov 2020 19:15:11 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r367735 - head/share/mk
Message-ID:  <202011161915.0AGJFBvk093515@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011161915.0AGJFBvk093515>