Page MenuHomeFreeBSD

D52011.id160589.diff
No OneTemporary

D52011.id160589.diff

diff --git a/Makefile.inc1 b/Makefile.inc1
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1082,7 +1082,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
@@ -1177,7 +1177,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
@@ -176,9 +174,37 @@
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.*'
+
+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
@@ -201,19 +227,26 @@
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.
@@ -223,12 +256,22 @@
echo "Cleaning - src epoch: $srcepoch, objdir epoch: ${objepoch:-unknown}"
fi
- clean_world "$srcepoch"
+ clean_world "$srcepoch" "$srcopts"
+ # NORETURN
+ fi
+
+ objopts=$(extract_obj_opts "$OBJTOP"/.src_opts)
+ if [ "$srcopts" != "$objopts" ]; then
+ if [ "$VERBOSE" ]; then
+ echo "Cleaning - build options have changed"
+ fi
+
+ clean_world "$srcepoch" "$srcopts"
# NORETURN
fi
}
-check_epoch
+check_epoch_and_opts
#### Typical dependency cleanup begins here.

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 2, 4:56 AM (19 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30705199
Default Alt Text
D52011.id160589.diff (3 KB)

Event Timeline