]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Rewrite test-coverage rules to accommodate multiple .o files per .c.
authorJim Meyering <meyering@redhat.com>
Thu, 28 Feb 2008 17:07:37 +0000 (17:07 +0000)
committerJim Meyering <meyering@redhat.com>
Thu, 28 Feb 2008 17:07:37 +0000 (17:07 +0000)
* src/Makefile.am (cov): Rewrite rule to merge gcov results corresponding
to two .o files: the libvirt_la- one, and the libvirt_test_la- one.
(tst): Remove unused rule.
* configure.in (LV_LIBTOOL_OBJDIR): Define and AC_SUBST.

ChangeLog
configure.in
src/Makefile.am

index d52e6a7b0e13fa8cb90f9dcc4ba23d24de88568e..9f76d14308ee980e98dfb6cbe459aceee0fc3448 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 Thu Feb 28 18:04:59 CET 2008 Jim Meyering <meyering@redhat.com>
 
+       Rewrite test-coverage rules to accommodate multiple .o files per .c.
+       * src/Makefile.am (cov): Rewrite rule to merge gcov results corresponding
+       to two .o files: the libvirt_la- one, and the libvirt_test_la- one.
+       (tst): Remove unused rule.
+       * configure.in (LV_LIBTOOL_OBJDIR): Define and AC_SUBST.
+
        Avoid link errors with "configure --disable-shared".
        * src/Makefile.am: Create a convenience library, libvirt_test.la,
        and don't restrict access to *its* symbols.
index c2030c7c6c7fd97719a89ffad4337a240ce5f88b..6367990c242878b72ab4ac855bf78bc9483af4a5 100644 (file)
@@ -913,6 +913,13 @@ AC_SUBST(MINGW_EXTRA_LDFLAGS)
 
 AC_SYS_LARGEFILE
 
+# Set LV_LIBTOOL_OBJDIR to "." or $lt_cv_objdir, depending on whether
+# we're building shared libraries.  This is the name of the directory
+# in which .o files will be created.
+test "$enable_shared" = no && lt_cv_objdir=.
+LV_LIBTOOL_OBJDIR=${lt_cv_objdir-.}
+AC_SUBST(LV_LIBTOOL_OBJDIR)
+
 # very annoying
 rm -f COPYING
 cp COPYING.LIB COPYING
index 8821faa45594b866144db5572885423548109ee7..d7e4a91edc74948056d93914c51c0ad668d23880 100644 (file)
@@ -137,20 +137,20 @@ else
 EXTRA_DIST += parthelper.c
 endif
 
-#
-# target to ease building test programs
-#
-tst: tst.c
-       $(CC) $(CFLAGS) $(INCLUDES) -I../include -o tst tst.c .libs/libvirt.a $(LIBXML_LIBS) $(VIRSH_LIBS) $(GNUTLS_LIBS) $(LIBS)
-
-COVERAGE_FILES = $(CLIENT_SOURCES:%.c=libvirt_la-%.cov)
-
-cov: clean-cov $(COVERAGE_FILES)
+cov: clean-cov
+       for i in $(CLIENT_SOURCES); do                  \
+         case $$i in *.c) ;; *) continue;; esac;       \
+         b=$$(basename $$i .c);                        \
+         o_files=;                                     \
+         for i in '' _test; do                         \
+           o="$(LV_LIBTOOL_OBJDIR)/libvirt$${i}_la-$$b.o";     \
+           test -f "$$o"                               \
+             && o_files="$$o_files $$o";               \
+         done;                                         \
+         gcov -b -f $$o_files > $$b.cov;               \
+       done
 
 clean-cov:
        rm -f *.cov *.gcov
 
-%.cov: .libs/%.o
-       gcov -b -f -o .libs $< > $@
-
 CLEANFILES = *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda