diff --git a/Makefile b/Makefile index 5e2f951aa579..b829916916dc 100644 --- a/Makefile +++ b/Makefile @@ -219,6 +219,13 @@ _CAN_USE_META_MODE?= yes .if !defined(_CAN_USE_META_MODE) _MAKE+= MK_META_MODE=no .unexport META_MODE +.elif ${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) # Guess machine architecture from machine type, and vice versa. diff --git a/share/mk/bsd.init.mk b/share/mk/bsd.init.mk index d00b9e5b3a7d..01d5c47e914d 100644 --- a/share/mk/bsd.init.mk +++ b/share/mk/bsd.init.mk @@ -28,4 +28,14 @@ _SKIP_BUILD = not building at level 0 .warning ${_SKIP_BUILD} .endif +.if ${MK_META_MODE} == "yes" +.if !exists(/dev/filemon) && \ + ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !defined(NO_FILEMON) && \ + !make(showconfig) +.warning The filemon module (/dev/filemon) is not loaded. +.warning META_MODE is less useful for incremental builds without filemon. +.warning 'kldload filemon' or pass -DNO_FILEMON to suppress this warning. +.endif +.endif # ${MK_META_MODE} == "yes" + .endif # !target(____) diff --git a/share/mk/sys.mk b/share/mk/sys.mk index e103fddddbfa..cccc5437ba0a 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -60,10 +60,6 @@ META_MODE+= missing-meta=yes META_MODE+= silent=yes .endif .if !exists(/dev/filemon) -.if ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !defined(NO_FILEMON) && \ - !make(showconfig) -.error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. -.endif META_MODE+= nofilemon .endif # Require filemon data with bmake diff --git a/tools/build/options/WITH_META_MODE b/tools/build/options/WITH_META_MODE index 775ab0197f83..65595ac1c4d8 100644 --- a/tools/build/options/WITH_META_MODE +++ b/tools/build/options/WITH_META_MODE @@ -7,9 +7,13 @@ using The meta file is created in the OBJDIR as .Pa target.meta . These meta files track the command ran, its output, and the current directory. -When the +The .Xr filemon 4 -module is loaded, any files used by the commands executed will be tracked as +module is required unless +.Va NO_FILEMON +is defined. +When the module is loaded, any files used by the commands executed will be +tracked as dependencies for the target in its meta file. The target will be considered out-of-date and rebuilt if any of the following are true compared to the last build: