META_MODE: Avoid some logic if disabled and allow enabling with make argument.

Sponsored by:	Dell EMC Isilon
This commit is contained in:
Bryan Drewery 2017-11-11 01:10:50 +00:00
parent 58d86ed342
commit d8d24cec9f

View File

@ -247,8 +247,11 @@ SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
_MAKE= PATH=${PATH} MAKE_CMD="${MAKE}" ${SUB_MAKE} -f Makefile.inc1 \ _MAKE= PATH=${PATH} MAKE_CMD="${MAKE}" ${SUB_MAKE} -f Makefile.inc1 \
TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} 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 # 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} .for _tgt in ${META_TGT_WHITELIST}
.if make(${_tgt}) .if make(${_tgt})
_CAN_USE_META_MODE?= yes _CAN_USE_META_MODE?= yes
@ -256,17 +259,22 @@ _CAN_USE_META_MODE?= yes
.endfor .endfor
.if !defined(_CAN_USE_META_MODE) .if !defined(_CAN_USE_META_MODE)
_MAKE+= MK_META_MODE=no _MAKE+= MK_META_MODE=no
MK_META_MODE= no
.if defined(.PARSEDIR) .if defined(.PARSEDIR)
.unexport META_MODE .unexport META_MODE
.endif .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) .if !exists(/dev/filemon) && !defined(NO_FILEMON) && !make(showconfig)
# Require filemon be loaded to provide a working incremental build # Require filemon be loaded to provide a working incremental build
.error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. \ .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: WITH_META_MODE is enabled but requires filemon for an incremental build. \
${.newline}ERROR: 'kldload filemon' or pass -DNO_FILEMON to suppress this error. ${.newline}ERROR: 'kldload filemon' or pass -DNO_FILEMON to suppress this error.
.endif # !exists(/dev/filemon) && !defined(NO_FILEMON) .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 # 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 # above. MK_AUTO_OBJ not checked here for "yes" as it may not yet be enabled