Index: head/lib/libsysdecode/Makefile =================================================================== --- head/lib/libsysdecode/Makefile +++ head/lib/libsysdecode/Makefile @@ -107,7 +107,7 @@ 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+= ${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. Index: head/lib/libsysdecode/mktables =================================================================== --- head/lib/libsysdecode/mktables +++ head/lib/libsysdecode/mktables @@ -43,7 +43,8 @@ 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 @@ # 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