From 23ff19c6275b10ba8f17dd389630ce4a6585941e Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Mon, 20 Aug 2018 10:59:49 +0000 Subject: [PATCH] Don't rebuild ioctl.c and relink libsysdecode if there are no changes Instead generate a temporary file and only overwrite ioctl.c if the files are actually different. Approved By: jhb (mentor) --- lib/libsysdecode/Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/libsysdecode/Makefile b/lib/libsysdecode/Makefile index a37d05de20c..97af7dc7cad 100644 --- a/lib/libsysdecode/Makefile +++ b/lib/libsysdecode/Makefile @@ -129,12 +129,17 @@ tables.h: mktables # mkioctls runs find(1) for headers so needs to rebuild every time. This used # to be a hack only done in buildworld. .if !defined(_SKIP_BUILD) -ioctl.c: .PHONY +ioctl.c.tmp: .PHONY .endif -ioctl.c: mkioctls .META +ioctl.c.tmp: mkioctls .META env CPP="${CPP}" MK_PF="${MK_PF}" \ /bin/sh ${.CURDIR}/mkioctls ${SYSROOT:U${DESTDIR}}${INCLUDEDIR} > ${.TARGET} +ioctl.c: ioctl.c.tmp + if [ ! -e ${.TARGET} ] || ! cmp -s ${.TARGET} ${.TARGET}.tmp; then \ + mv -f ${.TARGET}.tmp ${.TARGET}; \ + fi + beforedepend: ioctl.c tables.h .include