Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Jul 2020 12:07:48 +0000 (UTC)
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363216 - head/lib/libpmc
Message-ID:  <202007151207.06FC7mKs068615@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007151207.06FC7mKs068615>