From: Jim Meyering Date: Thu, 28 Feb 2008 17:07:37 +0000 (+0000) Subject: Rewrite test-coverage rules to accommodate multiple .o files per .c. X-Git-Tag: LIBVIRT_0_4_1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba52fcbcdf36f2364c519ce8bd9767901adba5ed;p=thirdparty%2Flibvirt.git 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. --- diff --git a/ChangeLog b/ChangeLog index d52e6a7b0e..9f76d14308 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ Thu Feb 28 18:04:59 CET 2008 Jim Meyering + 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. diff --git a/configure.in b/configure.in index c2030c7c6c..6367990c24 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/src/Makefile.am b/src/Makefile.am index 8821faa455..d7e4a91edc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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