The nlist-test has a special compile rule, make sure it gets the
GCOV flags when configuring with --enable-gcov.

Signed-off-by: Mark Wielaard <m...@klomp.org>
---
 tests/ChangeLog   | 4 ++++
 tests/Makefile.am | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 99f9da9d..e5d9196b 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2020-06-11  Mark Wielaard  <m...@klomp.org>
+
+       * Makefile.am (nlist-test): Add GCOV flags when necessary.
+
 2020-06-06  Mark Wielaard  <m...@klomp.org>
 
        * testfilesyms32.bz2: New test file.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7db7db16..53dd70a7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -80,13 +80,19 @@ backtrace-child-biarch$(EXEEXT): backtrace-child.c
                     $(AM_LDFLAGS) $(LDFLAGS) $(backtrace_child_LDFLAGS) \
                     -o $@ $<
 
+if GCOV
+GCOV_FLAGS=-fprofile-arcs -ftest-coverage
+else
+GCOV_FLAGS=
+endif
+
 # test_nlist checks its own symbol table, and expects various symbols
 # to be in the order as specified in the source file. Explicitly set
 # minimal CFLAGS
 test-nlist$(EXEEXT): test-nlist.c
        $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
          $(AM_CPPFLAGS) $(CPPFLAGS) \
-         $(test_nlist_CFLAGS) $(test_nlist_LDADD) -o $@ $<
+         $(test_nlist_CFLAGS) $(GCOV_FLAGS) -o $@ $< $(test_nlist_LDADD)
 
 TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \
        update1 update2 update3 update4 \
-- 
2.18.4

Reply via email to