From 02e65672b4071abde68c7163d272b8cd53003eca Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Mon, 16 Nov 2020 19:15:11 +0000 Subject: [PATCH] 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 --- share/mk/bsd.subdir.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index 40fe454ecacc..91c114f8d361 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -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 \ + or by using an invalid $${MK_FOO} option. +.endif + # Subdir code shared among 'make ', 'make ' and SUBDIR_PARALLEL. _SUBDIR_SH= \ if test -d ${.CURDIR}/$${dir}.${MACHINE_ARCH}; then \