svn commit: r363216 - head/lib/libpmc

Alex Richardson arichardson at FreeBSD.org
Wed Jul 15 12:07:50 UTC 2020


Author: arichardson
Date: Wed Jul 15 12:07:47 2020
New Revision: 363216
URL: https://svnweb.freebsd.org/changeset/base/363216

Log:
  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

Modified:
  head/lib/libpmc/Makefile

Modified: head/lib/libpmc/Makefile
==============================================================================
--- head/lib/libpmc/Makefile	Wed Jul 15 10:24:39 2020	(r363215)
+++ head/lib/libpmc/Makefile	Wed Jul 15 12:07:47 2020	(r363216)
@@ -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


More information about the svn-src-head mailing list