Avoid rebuilding libpmc in every incremental rebuild

Generate libpmc_events.c in a temporary file first and only overwrite it
if the files are actually different.
This avoids compiling and relinking the different variants of libpmc on
every incremental build.

Reviewed By:	jhb
Differential Revision: https://reviews.freebsd.org/D24784
This commit is contained in:
Alex Richardson 2020-07-15 12:07:47 +00:00
parent b1607c8727
commit a9ea004745
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363216

View File

@ -32,9 +32,13 @@ SUBDIR+= pmu-events
.endif
.endif
libpmc_events.c: ${JEVENTS}
${JEVENTS} ${EVENT_ARCH} ${.CURDIR}/pmu-events/arch libpmc_events.c
SRCS+= libpmc_events.c
libpmc_events.c: ${JEVENTS} .META
${JEVENTS} ${EVENT_ARCH} ${.CURDIR}/pmu-events/arch ${.TARGET}.tmp
if [ ! -e ${.TARGET} ] || ! cmp -s ${.TARGET} ${.TARGET}.tmp; then \
mv -f ${.TARGET}.tmp ${.TARGET}; \
fi
CLEANFILES+= libpmc_events.c libpmc_events.c.tmp
SRCS+= libpmc_events.c
.endif
WARNS?= 3