Page MenuHomeFreeBSD

D52011.id167657.diff
No OneTemporary

D52011.id167657.diff

diff --git a/Makefile.inc1 b/Makefile.inc1
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1073,7 +1073,7 @@
_cleanobj_fast_depend_hack: .PHONY
@echo ">>> Deleting stale dependencies...";
MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} \
- ALL_libcompats=${_ALL_libcompats:Q} \
+ ALL_libcompats=${_ALL_libcompats:Q} MAKE=${MAKE} \
sh ${.CURDIR}/tools/build/depend-cleanup.sh ${OBJTOP} ${SRCTOP}
_cleanworldtmp: .PHONY
@@ -1168,7 +1168,7 @@
.endfor
.else
${_+_}cd ${.CURDIR}; env CLEANMK="_NO_INCLUDE_COMPILERMK=t ${CLEANDIR}" \
- MAKE=${MAKE} ${WMAKE} _cleanobj_fast_depend_hack
+ ${WMAKE} _cleanobj_fast_depend_hack
.endif # ${MK_CLEAN} == "yes"
_obj:
@echo
diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh
--- a/tools/build/depend-cleanup.sh
+++ b/tools/build/depend-cleanup.sh
@@ -124,10 +124,8 @@
fi
: ${CLEANMK=""}
-if [ -n "$CLEANMK" ]; then
- if [ -z "${MAKE+set}" ]; then
- err "MAKE not set"
- fi
+if [ -z "${MAKE+set}" ]; then
+ err "MAKE not set"
fi
if [ -z "${MACHINE+set}" ]; then
@@ -202,9 +200,40 @@
awk 'int($1) > 0 { epoch = $1 } END { print epoch }' "$1"
}
+# Regular expression matching the names of src.conf(5) options which
+# don't affect the build.
+#
+# This filter is applied to both the current options and the cached
+# options so we don't force a rebuild just because the filter itself
+# changed.
+IGNORED_OPTS="CLEAN|EXAMPLES|MAN|TESTS|WARNS|WERROR|INSTALL.*|STAGING.*"
+# Also ignore TOOLCHAIN and the options it forces if set. It is
+# commonly used to speed up a build and is safe to toggle.
+IGNORED_OPTS="${IGNORED_OPTS}|TOOLCHAIN|CLANG.*|LLDB?|LLVM_(BIN|COV).*"
+
+extract_src_opts()
+{
+ $MAKE -C "$SRCTOP" -f "$SRCTOP"/Makefile.inc1 \
+ -V $'SRC_OPT_LIST:O:ts\n' |
+ egrep -v "^WITH(OUT)?_(${IGNORED_OPTS})="
+}
+
+extract_obj_opts()
+{
+ for fn; do
+ if [ -f "${fn}" ]; then
+ cat "${fn}"
+ else
+ echo "# ${fn}"
+ fi
+ done |
+ egrep -v "^WITH(OUT)?_(${IGNORED_OPTS})="
+}
+
clean_world()
{
local buildepoch="$1"
+ local srcopts="$2"
# The caller may set CLEANMK in the environment to make target(s) that
# should be invoked instead of just destroying everything. This is
@@ -227,34 +256,45 @@
mkdir -p "$OBJTOP"
echo "$buildepoch" > "$OBJTOP"/.clean_build_epoch
+ echo "$srcopts" > "$OBJTOP"/.src_opts
exit 0
}
-check_epoch()
+check_epoch_and_opts()
{
local srcepoch objepoch
+ local srcopts objopts
srcepoch=$(extract_epoch "$SRCTOP"/.clean_build_epoch)
if [ -z "$srcepoch" ]; then
err "Malformed .clean_build_epoch; please validate the last line"
fi
+ srcopts=$(extract_src_opts)
+ if [ -z "$srcopts" ]; then
+ err "Unable to extract source options"
+ fi
+
# We don't discriminate between the varying degrees of difference
# between epochs. If it went backwards we could be bisecting across
# epochs, in which case the original need to clean likely still stands.
objepoch=$(extract_epoch "$OBJTOP"/.clean_build_epoch)
if [ -z "$objepoch" ] || [ "$srcepoch" -ne "$objepoch" ]; then
- if [ "$VERBOSE" ]; then
- echo "Cleaning - src epoch: $srcepoch, objdir epoch: ${objepoch:-unknown}"
- fi
+ echo "Cleaning - src epoch: $srcepoch, objdir epoch: ${objepoch:-unknown}"
+ clean_world "$srcepoch" "$srcopts"
+ # NORETURN
+ fi
- clean_world "$srcepoch"
+ objopts=$(extract_obj_opts "$OBJTOP"/.src_opts)
+ if [ "$srcopts" != "$objopts" ]; then
+ echo "Cleaning - build options have changed"
+ clean_world "$srcepoch" "$srcopts"
# NORETURN
fi
}
-check_epoch
+check_epoch_and_opts
#### Typical dependency cleanup begins here.

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 5, 3:35 AM (17 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30866157
Default Alt Text
D52011.id167657.diff (3 KB)

Event Timeline