From d8d24cec9fe17c4341d91cbf65ba276b3385c6dd Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Sat, 11 Nov 2017 01:10:50 +0000 Subject: [PATCH] META_MODE: Avoid some logic if disabled and allow enabling with make argument. Sponsored by: Dell EMC Isilon --- Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index bf6d4c221584..6aece21ecdc8 100644 --- a/Makefile +++ b/Makefile @@ -247,8 +247,11 @@ SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk _MAKE= PATH=${PATH} MAKE_CMD="${MAKE}" ${SUB_MAKE} -f Makefile.inc1 \ TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} +.if defined(MK_META_MODE) && ${MK_META_MODE} == "yes" # Only allow meta mode for the whitelisted targets. See META_TGT_WHITELIST -# above. +# above. If overridden as a make argument then don't bother trying to +# disable it. +.if empty(.MAKEOVERRIDES:MMK_META_MODE) .for _tgt in ${META_TGT_WHITELIST} .if make(${_tgt}) _CAN_USE_META_MODE?= yes @@ -256,17 +259,22 @@ _CAN_USE_META_MODE?= yes .endfor .if !defined(_CAN_USE_META_MODE) _MAKE+= MK_META_MODE=no +MK_META_MODE= no .if defined(.PARSEDIR) .unexport META_MODE .endif -.elif defined(MK_META_MODE) && ${MK_META_MODE} == "yes" +.endif # !defined(_CAN_USE_META_MODE) +.endif # empty(.MAKEOVERRIDES:MMK_META_MODE) + +.if ${MK_META_MODE} == "yes" .if !exists(/dev/filemon) && !defined(NO_FILEMON) && !make(showconfig) # Require filemon be loaded to provide a working incremental build .error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. \ ${.newline}ERROR: WITH_META_MODE is enabled but requires filemon for an incremental build. \ ${.newline}ERROR: 'kldload filemon' or pass -DNO_FILEMON to suppress this error. .endif # !exists(/dev/filemon) && !defined(NO_FILEMON) -.endif # !defined(_CAN_USE_META_MODE) +.endif # ${MK_META_MODE} == yes +.endif # defined(MK_META_MODE) && ${MK_META_MODE} == yes # Only allow AUTO_OBJ for the whitelisted targets. See AUTO_OBJ_TGT_WHITELIST # above. MK_AUTO_OBJ not checked here for "yes" as it may not yet be enabled