2020-03-30 20:20:15 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Our current make(1)-based approach to dependency tracking cannot cope with
|
|
|
|
# certain source tree changes, including:
|
|
|
|
# - removing source files
|
|
|
|
# - replacing generated files with files committed to the tree
|
|
|
|
# - changing file extensions (e.g. a C source file rewritten in C++)
|
|
|
|
#
|
|
|
|
# We handle those cases here in an ad-hoc fashion by looking for the known-
|
|
|
|
# bad case in the main .depend file, and if found deleting all of the related
|
|
|
|
# .depend files (including for example the lib32 version).
|
2020-08-26 03:41:29 +00:00
|
|
|
#
|
|
|
|
# These tests increase the build time (albeit by a small amount), so they
|
|
|
|
# should be removed once enough time has passed and it is extremely unlikely
|
|
|
|
# anyone would try a NO_CLEAN build against an object tree from before the
|
|
|
|
# related change. One year should be sufficient.
|
2020-03-30 20:20:15 +00:00
|
|
|
|
2023-07-11 00:53:04 +00:00
|
|
|
set -e
|
|
|
|
set -u
|
|
|
|
|
|
|
|
warn()
|
|
|
|
{
|
|
|
|
echo "$(basename "$0"):" "$@" >&2
|
|
|
|
}
|
|
|
|
|
|
|
|
err()
|
|
|
|
{
|
|
|
|
warn "$@"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
echo "usage: $(basename $0) [-v] [-n] objtop" >&2
|
|
|
|
}
|
|
|
|
|
|
|
|
VERBOSE=
|
|
|
|
PRETEND=
|
|
|
|
while getopts vn o; do
|
|
|
|
case "$o" in
|
|
|
|
v)
|
|
|
|
VERBOSE=1
|
|
|
|
;;
|
|
|
|
n)
|
|
|
|
PRETEND=1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $((OPTIND-1))
|
|
|
|
|
|
|
|
if [ $# -ne 1 ]; then
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-03-30 20:20:15 +00:00
|
|
|
OBJTOP=$1
|
2023-07-11 00:53:04 +00:00
|
|
|
shift
|
2020-03-30 20:20:15 +00:00
|
|
|
if [ ! -d "$OBJTOP" ]; then
|
2023-07-11 00:53:04 +00:00
|
|
|
err "$OBJTOP: Not a directory"
|
2020-03-30 20:20:15 +00:00
|
|
|
fi
|
|
|
|
|
2023-07-11 00:53:04 +00:00
|
|
|
if [ -z "${MACHINE+set}" ]; then
|
2023-07-11 00:53:04 +00:00
|
|
|
err "MACHINE not set"
|
2023-07-11 00:53:04 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${MACHINE_ARCH+set}" ]; then
|
2023-07-11 00:53:04 +00:00
|
|
|
err "MACHINE_ARCH not set"
|
2023-07-11 00:53:04 +00:00
|
|
|
fi
|
|
|
|
|
2023-07-27 04:10:47 +00:00
|
|
|
if [ -z "${ALL_libcompats+set}" ]; then
|
|
|
|
err "ALL_libcompats not set"
|
|
|
|
fi
|
|
|
|
|
2023-07-11 00:53:04 +00:00
|
|
|
run()
|
|
|
|
{
|
|
|
|
if [ "$VERBOSE" ]; then
|
|
|
|
echo "$@"
|
|
|
|
fi
|
|
|
|
if ! [ "$PRETEND" ]; then
|
|
|
|
"$@"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-03-30 20:20:15 +00:00
|
|
|
# $1 directory
|
|
|
|
# $2 source filename w/o extension
|
|
|
|
# $3 source extension
|
|
|
|
clean_dep()
|
|
|
|
{
|
2023-07-27 04:10:47 +00:00
|
|
|
for libcompat in "" $ALL_libcompats; do
|
|
|
|
dirprfx=${libcompat:+obj-lib${libcompat}/}
|
|
|
|
if egrep -qw "$2\.$3" "$OBJTOP"/$dirprfx$1/.depend.$2.*o 2>/dev/null; then
|
|
|
|
echo "Removing stale ${libcompat:+lib${libcompat} }dependencies and objects for $2.$3"
|
|
|
|
run rm -f \
|
|
|
|
"$OBJTOP"/$dirprfx$1/.depend.$2.* \
|
|
|
|
"$OBJTOP"/$dirprfx$1/$2.*o
|
|
|
|
fi
|
|
|
|
done
|
2020-03-30 20:20:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Date Rev Description
|
|
|
|
# 20200310 r358851 rename of openmp's ittnotify_static.c to .cpp
|
|
|
|
clean_dep lib/libomp ittnotify_static c
|
2020-04-14 18:07:42 +00:00
|
|
|
# 20200414 r359930 closefrom
|
|
|
|
clean_dep lib/libc closefrom S
|
2020-08-26 04:01:06 +00:00
|
|
|
|
|
|
|
# 20200826 r364746 OpenZFS merge, apply a big hammer (remove whole tree)
|
|
|
|
if [ -e "$OBJTOP"/cddl/lib/libzfs/.depend.libzfs_changelist.o ] && \
|
|
|
|
egrep -qw "cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c" \
|
|
|
|
"$OBJTOP"/cddl/lib/libzfs/.depend.libzfs_changelist.o; then
|
|
|
|
echo "Removing old ZFS tree"
|
2023-07-27 04:10:47 +00:00
|
|
|
for libcompat in "" $ALL_libcompats; do
|
|
|
|
dirprfx=${libcompat:+obj-lib${libcompat}/}
|
|
|
|
run rm -rf "$OBJTOP"/${dirprfx}cddl
|
|
|
|
done
|
2020-08-26 04:01:06 +00:00
|
|
|
fi
|
2020-09-18 17:17:46 +00:00
|
|
|
|
|
|
|
# 20200916 WARNS bumped, need bootstrapped crunchgen stubs
|
|
|
|
if [ -e "$OBJTOP"/rescue/rescue/rescue.c ] && \
|
|
|
|
! grep -q 'crunched_stub_t' "$OBJTOP"/rescue/rescue/rescue.c; then
|
|
|
|
echo "Removing old rescue(8) tree"
|
2023-07-11 00:53:04 +00:00
|
|
|
run rm -rf "$OBJTOP"/rescue/rescue
|
2020-09-18 17:17:46 +00:00
|
|
|
fi
|
2021-01-06 21:07:25 +00:00
|
|
|
|
|
|
|
# 20210105 fda7daf06301 pfctl gained its own version of pf_ruleset.c
|
|
|
|
if [ -e "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o ] && \
|
|
|
|
egrep -qw "sys/netpfil/pf/pf_ruleset.c" \
|
|
|
|
"$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o; then
|
|
|
|
echo "Removing old pf_ruleset dependecy file"
|
2023-07-11 00:53:04 +00:00
|
|
|
run rm -rf "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o
|
2021-01-06 21:07:25 +00:00
|
|
|
fi
|
2021-01-08 15:18:46 +00:00
|
|
|
|
|
|
|
# 20210108 821aa63a0940 non-widechar version of ncurses removed
|
|
|
|
if [ -e "$OBJTOP"/lib/ncurses/ncursesw ]; then
|
|
|
|
echo "Removing stale ncurses objects"
|
2023-07-27 04:10:47 +00:00
|
|
|
for libcompat in "" $ALL_libcompats; do
|
|
|
|
dirprfx=${libcompat:+obj-lib${libcompat}/}
|
|
|
|
run rm -rf "$OBJTOP"/${dirprfx}lib/ncurses
|
|
|
|
done
|
2021-01-08 15:18:46 +00:00
|
|
|
fi
|
2021-06-08 23:56:15 +00:00
|
|
|
|
|
|
|
# 20210608 f20893853e8e move from atomic.S to atomic.c
|
2021-12-07 16:18:45 +00:00
|
|
|
clean_dep cddl/lib/libspl atomic S
|
|
|
|
# 20211207 cbdec8db18b5 switch to libthr-friendly pdfork
|
|
|
|
clean_dep lib/libc pdfork S
|
2021-12-30 22:10:05 +00:00
|
|
|
|
|
|
|
# 20211230 5e6a2d6eb220 libc++.so.1 path changed in ldscript
|
|
|
|
if [ -e "$OBJTOP"/lib/libc++/libc++.ld ] && \
|
|
|
|
fgrep -q "/usr/lib/libc++.so" "$OBJTOP"/lib/libc++/libc++.ld; then
|
|
|
|
echo "Removing old libc++ linker script"
|
2023-07-11 00:53:04 +00:00
|
|
|
run rm -f "$OBJTOP"/lib/libc++/libc++.ld
|
2021-12-30 22:10:05 +00:00
|
|
|
fi
|
2022-03-25 18:03:18 +00:00
|
|
|
|
2022-03-26 09:11:31 +00:00
|
|
|
# 20220326 fbc002cb72d2 move from bcmp.c to bcmp.S
|
2022-03-25 18:03:18 +00:00
|
|
|
if [ "$MACHINE_ARCH" = "amd64" ]; then
|
2023-07-10 23:18:15 +00:00
|
|
|
clean_dep lib/libc bcmp c
|
2022-03-25 18:03:18 +00:00
|
|
|
fi
|
2022-07-14 20:03:59 +00:00
|
|
|
|
|
|
|
# 20220524 68fe988a40ca kqueue_test binary replaced shell script
|
|
|
|
if stat "$OBJTOP"/tests/sys/kqueue/libkqueue/*kqtest* \
|
|
|
|
"$OBJTOP"/tests/sys/kqueue/libkqueue/.depend.kqtest* >/dev/null 2>&1; then
|
|
|
|
echo "Removing old kqtest"
|
2023-07-11 00:53:04 +00:00
|
|
|
run rm -f "$OBJTOP"/tests/sys/kqueue/libkqueue/.depend.* \
|
2022-07-14 20:03:59 +00:00
|
|
|
"$OBJTOP"/tests/sys/kqueue/libkqueue/*
|
|
|
|
fi
|
2022-11-16 05:17:28 +00:00
|
|
|
|
|
|
|
# 20221115 42d10b1b56f2 move from rs.c to rs.cc
|
|
|
|
clean_dep usr.bin/rs rs c
|
2023-01-13 18:09:51 +00:00
|
|
|
|
|
|
|
# 20230110 bc42155199b5 usr.sbin/zic/zic -> usr.sbin/zic
|
|
|
|
if [ -d "$OBJTOP"/usr.sbin/zic/zic ] ; then
|
|
|
|
echo "Removing old zic directory"
|
2023-07-11 00:53:04 +00:00
|
|
|
run rm -rf "$OBJTOP"/usr.sbin/zic/zic
|
2023-01-13 18:09:51 +00:00
|
|
|
fi
|
2023-02-08 06:05:58 +00:00
|
|
|
|
|
|
|
# 20230208 29c5f8bf9a01 move from mkmakefile.c to mkmakefile.cc
|
|
|
|
clean_dep usr.sbin/config mkmakefile c
|
2023-02-09 04:56:11 +00:00
|
|
|
# 20230209 83d7ed8af3d9 convert to main.cc and mkoptions.cc
|
|
|
|
clean_dep usr.sbin/config main c
|
|
|
|
clean_dep usr.sbin/config mkoptions c
|
2023-04-24 21:05:18 +00:00
|
|
|
|
|
|
|
# 20230401 54579376c05e kqueue1 from syscall to C wrapper
|
|
|
|
clean_dep lib/libc kqueue1 S
|
2023-06-24 18:12:06 +00:00
|
|
|
|
|
|
|
# 20230623 b077aed33b7b OpenSSL 3.0 update
|
|
|
|
if [ -f "$OBJTOP"/secure/lib/libcrypto/aria.o ]; then
|
|
|
|
echo "Removing old OpenSSL 1.1.1 tree"
|
2023-07-27 04:10:47 +00:00
|
|
|
for libcompat in "" $ALL_libcompats; do
|
|
|
|
dirprfx=${libcompat:+obj-lib${libcompat}/}
|
|
|
|
run rm -rf "$OBJTOP"/${dirprfx}secure/lib/libcrypto \
|
|
|
|
"$OBJTOP"/${dirprfx}secure/lib/libssl
|
|
|
|
done
|
2023-06-24 18:12:06 +00:00
|
|
|
fi
|
2023-07-10 22:50:31 +00:00
|
|
|
|
2023-07-07 18:59:26 +00:00
|
|
|
# 20230714 ee8b0c436d72 replace ffs/fls implementations with clang builtins
|
|
|
|
clean_dep lib/libc ffs S
|
|
|
|
clean_dep lib/libc ffsl S
|
|
|
|
clean_dep lib/libc ffsll S
|
|
|
|
clean_dep lib/libc fls S
|
|
|
|
clean_dep lib/libc flsl S
|
|
|
|
clean_dep lib/libc flsll S
|
2023-08-15 21:14:26 +00:00
|
|
|
|
|
|
|
# 20230815 28f6c2f29280 GoogleTest update
|
|
|
|
if [ -e "$OBJTOP"/tests/sys/fs/fusefs/mockfs.o ] && \
|
|
|
|
grep -q '_ZN7testing8internal18g_linked_ptr_mutexE' "$OBJTOP"/tests/sys/fs/fusefs/mockfs.o; then
|
|
|
|
echo "Removing stale fusefs GoogleTest objects"
|
|
|
|
run rm -rf "$OBJTOP"/tests/sys/fs/fusefs
|
|
|
|
fi
|