diff options
author | Brooks Davis <brooks@FreeBSD.org> | 2020-11-16 19:15:11 +0000 |
---|---|---|
committer | Brooks Davis <brooks@FreeBSD.org> | 2020-11-16 19:15:11 +0000 |
commit | 02e65672b4071abde68c7163d272b8cd53003eca (patch) | |
tree | 9c3feefdf71c7e81ab5de921621d258fb9ee22b6 | |
parent | a521f2116473fbd8c09db395518f060a27d02334 (diff) | |
download | src-02e65672b4071abde68c7163d272b8cd53003eca.tar.gz src-02e65672b4071abde68c7163d272b8cd53003eca.zip |
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
Notes
Notes:
svn path=/head/; revision=367735
-rw-r--r-- | share/mk/bsd.subdir.mk | 6 |
1 files changed, 6 insertions, 0 deletions
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 \ + <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 \ |