svn commit: r351151 - head/lib/libsysdecode
Bryan Drewery
bdrewery at FreeBSD.org
Fri Aug 16 22:34:11 UTC 2019
Author: bdrewery
Date: Fri Aug 16 22:34:10 2019
New Revision: 351151
URL: https://svnweb.freebsd.org/changeset/base/351151
Log:
Rework r339635 to fix .depend.tables.h handling.
Avoid touching the tables.h file unless it has changed to avoid unneeded
rebuilds.
Also revert r350301's explicit dependencies.
Reviewed by: emaste
MFC after: 2 weeks
X-MFC-With: r339635 (kevans request)
PR: 238828
Sponsored by: DellEMC
Differential Revision: https://reviews.freebsd.org/D21295
Modified:
head/lib/libsysdecode/Makefile
head/lib/libsysdecode/mktables
Modified: head/lib/libsysdecode/Makefile
==============================================================================
--- head/lib/libsysdecode/Makefile Fri Aug 16 21:54:12 2019 (r351150)
+++ head/lib/libsysdecode/Makefile Fri Aug 16 22:34:10 2019 (r351151)
@@ -107,7 +107,7 @@ MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \
sysdecode_mask.3 sysdecode_wait4_options.3 \
sysdecode_mask.3 sysdecode_wait6_options.3
-CLEANFILES= ioctl.c ioctl.c.tmp tables.h tables.h.tmp
+CLEANFILES= ioctl.c ioctl.c.tmp tables.h
.if defined(COMPAT_32BIT)
CPP+= -m32
@@ -123,11 +123,8 @@ CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls
CFLAGS.gcc+= ${CFLAGS.gcc.${.IMPSRC}}
DEPENDOBJS+= tables.h
-incdir=${SYSROOT:U${DESTDIR}}${INCLUDEDIR}
-tables.h: mktables ${incdir}/netinet/in.h ${incdir}/netinet/tcp.h \
- ${incdir}/netinet6/in6.h
- sh ${.CURDIR}/mktables ${incdir} ${.TARGET}.tmp && \
- mv -f ${.TARGET}.tmp ${.TARGET}
+tables.h: mktables
+ sh ${.CURDIR}/mktables ${SYSROOT:U${DESTDIR}}${INCLUDEDIR} ${.TARGET}
# mkioctls runs find(1) for headers so needs to rebuild every time. This used
# to be a hack only done in buildworld.
Modified: head/lib/libsysdecode/mktables
==============================================================================
--- head/lib/libsysdecode/mktables Fri Aug 16 21:54:12 2019 (r351150)
+++ head/lib/libsysdecode/mktables Fri Aug 16 22:34:10 2019 (r351151)
@@ -43,7 +43,8 @@ fi
include_dir=$1
if [ -n "$2" ]; then
output_file="$2"
- exec > "$output_file"
+ output_tmp=$(mktemp -u)
+ exec > "$output_tmp"
fi
all_headers=
@@ -167,9 +168,17 @@ fi
# Generate a .depend file for our output file
if [ -n "$output_file" ]; then
- echo "$output_file: \\" > ".depend.$output_file"
- echo "$all_headers" | tr ' ' '\n' | sort -u |
- sed -e "s,^, $include_dir/," -e 's,$, \\,' >> \
- ".depend.$output_file"
- echo >> ".depend.$output_file"
+ depend_tmp=$(mktemp -u)
+ {
+ echo "$output_file: \\"
+ echo "$all_headers" | tr ' ' '\n' | sort -u |
+ sed -e "s,^, $include_dir/," -e 's,$, \\,'
+ echo
+ } > "$depend_tmp"
+ if cmp -s "$output_tmp" "$output_file"; then
+ rm -f "$output_tmp" "$depend_tmp"
+ else
+ mv -f "$depend_tmp" ".depend.${output_file}"
+ mv -f "$output_tmp" "$output_file"
+ fi
fi
More information about the svn-src-all
mailing list