depend-cleanup: Force a clean build when options change

Similar to the build epoch check, cache a list of source options in the
object tree, and force a clean build if the cached list does not match
the current list, after filtering out options which are known not to
affect the build (e.g. CLEAN, TESTS, WARNS).

This also adds a DEPEND_CLEANUP option (which defaults to yes unless
the CLEAN option is set) which can be used to skip depend-cleanup for
faster incremental builds.

MFC after:	1 week
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D52011
This commit is contained in:
Dag-Erling Smørgrav
2025-12-31 14:10:20 +01:00
parent 2c0e9a76c1
commit 1d52d5c537
5 changed files with 79 additions and 12 deletions
+14
View File
@@ -449,6 +449,14 @@ Clean before building world and/or kernel.
Note that recording a new epoch in
.Pa .clean_build_epoch
in the root of the source tree will also force a clean world build.
When set, these options are also in effect:
.Pp
.Bl -inset -compact
.It Va WITHOUT_DEPEND_CLEANUP
(unless
.Va WITH_DEPEND_CLEANUP
is set explicitly)
.El
.It Va WITHOUT_CPP
Do not build
.Xr cpp 1 .
@@ -537,6 +545,12 @@ amd64/amd64, arm64/aarch64, i386/i386, powerpc/powerpc64 and powerpc/powerpc64le
.It Va WITHOUT_DEBUG_FILES
Avoid building or installing standalone debug files for each
executable binary and shared library.
.It Va WITHOUT_DEPEND_CLEANUP
Do not attempt to detect if the object tree needs cleaning in part or in
whole before building.
This speeds up incremental builds, especially when experimenting with
build options, but may cause the build to inexplicably fail or produce
non-functioning binaries.
.It Va WITH_DETECT_TZ_CHANGES
Make the time handling code detect changes to the timezone files.
.It Va WITH_DIALOG
+5
View File
@@ -86,6 +86,7 @@ __DEFAULT_YES_OPTIONS = \
CRYPT \
CUSE \
CXGBETOOL \
DEPEND_CLEANUP \
DICT \
DMAGENT \
DTRACE \
@@ -515,6 +516,10 @@ MK_LLVM_CXXFILT:= yes
MK_LOADER_VERIEXEC_PASS_MANIFEST := no
.endif
.if ${MK_CLEAN} == "yes"
MK_DEPEND_CLEANUP:= no
.endif
#
# MK_* options whose default value depends on another option.
#