aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Richardson <arichardson@FreeBSD.org>2020-07-15 12:07:47 +0000
committerAlex Richardson <arichardson@FreeBSD.org>2020-07-15 12:07:47 +0000
commita9ea00474518545efea1b428eaeb5a1ed67eeba2 (patch)
treee0ff7ae5491b5fcbce5fa0414e75f953e1be3ab8
parentb1607c8727a5fd031d08fc09be5474fffb18be3e (diff)
downloadsrc-a9ea00474518545efea1b428eaeb5a1ed67eeba2.tar.gz
src-a9ea00474518545efea1b428eaeb5a1ed67eeba2.zip
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
Notes
Notes: svn path=/head/; revision=363216
-rw-r--r--lib/libpmc/Makefile10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile
index 194578803587..0097d5454bcd 100644
--- a/lib/libpmc/Makefile
+++ b/lib/libpmc/Makefile
@@ -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