Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Sep 2017 03:08:00 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r323661 - projects/runtime-coverage/share/mk
Message-ID:  <201709170308.v8H380Nt009878@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sun Sep 17 03:08:00 2017
New Revision: 323661
URL: https://svnweb.freebsd.org/changeset/base/323661

Log:
  Fix logic errors and simplify installation process
  
  .gcda files should be installed, not .gcno files. It's easier to
  formulate which .gcda's to install based on the SRCS and their
  extension in bsd.{lib,prog}.mk .

Modified:
  projects/runtime-coverage/share/mk/bsd.cov.mk
  projects/runtime-coverage/share/mk/bsd.lib.mk
  projects/runtime-coverage/share/mk/bsd.prog.mk

Modified: projects/runtime-coverage/share/mk/bsd.cov.mk
==============================================================================
--- projects/runtime-coverage/share/mk/bsd.cov.mk	Sun Sep 17 01:32:45 2017	(r323660)
+++ projects/runtime-coverage/share/mk/bsd.cov.mk	Sun Sep 17 03:08:00 2017	(r323661)
@@ -1,32 +1,24 @@
 # $FreeBSD$
+#
+# Snippet for dealing with runtime coverage logic.
+#
+# .gcda files are generated from files that are compiled from source, e.g.,
+# foo.gcda is foo.c or foo.cpp's file. In order for the libraries and programs
+# to be properly instrumented, the .gcda files must be installed to a prefix
+# common to the object files.
+#
+# See gcov(1) for more details.
 
 .include <bsd.own.mk>
 
-.if make(*clean) || make(*install)
-
 FILESGROUPS?=	FILES
 
-cov_objs_no_suffixes=	${COV_OBJS:R}
-.for src in ${COV_SRCS:R}
-.if ${cov_objs_no_suffixes:M${src}}
-GCNOS+=	${src}.gcno
-.endif
-.endfor
+.if !empty(GCDAS)
+GCDAS:=		${GCDAS:O:u}
+FILESGROUPS+=	GCDAS
+CLEANFILES+=	${GCDAS}
 
-.if !empty(GCNOS)
-GCNOS:=		${GCNOS:O:u}
-FILESGROUPS+=	GCNOS
-CLEANFILES+=	${GCNOS}
-
-.for _gcno in ${GCNOS}
-_gcno_dir=	${COVERAGEDIR}${_gcno:H:tA}
-GCNOSDIR_${_gcno:T}=	${_gcno_dir}
-.if !target(${DESTDIR}${_gcno_dir})
-beforeinstall: ${DESTDIR}${_gcno_dir}
-${DESTDIR}${_gcno_dir}:
-	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},coverage} -d ${.TARGET}
-.endif
+.for _gcda in ${GCDAS}
+GCDASDIR_${_gcda:T}=	${COVERAGEDIR}${_gcda:H:tA}
 .endfor
-.endif
-
 .endif

Modified: projects/runtime-coverage/share/mk/bsd.lib.mk
==============================================================================
--- projects/runtime-coverage/share/mk/bsd.lib.mk	Sun Sep 17 01:32:45 2017	(r323660)
+++ projects/runtime-coverage/share/mk/bsd.lib.mk	Sun Sep 17 03:08:00 2017	(r323661)
@@ -453,8 +453,7 @@ _libinstall:
 .if !defined(LIBRARIES_ONLY)
 .include <bsd.nls.mk>
 .if defined(_COV_FLAG)
-COV_OBJS=	${SOBJS:.pico=.o}
-COV_SRCS=	${SRCS:M*.[c|cc|cpp|cxx|C]}
+GCDAS=		${SRCS:M*.[c|cc|cpp|cxx|C]:R:S/$/.gcda/g}
 .include <bsd.cov.mk>
 .endif
 .include <bsd.files.mk>

Modified: projects/runtime-coverage/share/mk/bsd.prog.mk
==============================================================================
--- projects/runtime-coverage/share/mk/bsd.prog.mk	Sun Sep 17 01:32:45 2017	(r323660)
+++ projects/runtime-coverage/share/mk/bsd.prog.mk	Sun Sep 17 03:08:00 2017	(r323661)
@@ -302,8 +302,7 @@ NLSNAME?=	${PROG}
 
 .include <bsd.confs.mk>
 .if defined(_COV_FLAG)
-COV_OBJS=	${OBJS}
-COV_SRCS=	${SRCS:M*.[c|cc|cpp|cxx|C]}
+GCDAS=		${SRCS:M*.[c|cc|cpp|cxx|C]:R:S/$/.gcda/g}
 .include <bsd.cov.mk>
 .endif
 .include <bsd.files.mk>



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