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 \