]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Makefile.am: Avoid code duplication
authorAaron Merey <amerey@redhat.com>
Thu, 9 May 2024 23:17:20 +0000 (19:17 -0400)
committerAaron Merey <amerey@redhat.com>
Thu, 9 May 2024 23:17:20 +0000 (19:17 -0400)
Parameterize lcov/genhtml option ignore-errors in order to avoid code
duplication.

Signed-off-by: Aaron Merey <amerey@redhat.com>
Makefile.am

index a1f0b0c36432ae320fbcfcfa5faf4195fd51eb78..69af63ac992bed7a47fb56e890cdf918a64fbf1e 100644 (file)
@@ -78,24 +78,16 @@ coverage: $(COVERAGE_OUTPUT_INDEX_HTML)
        @echo 'file://$(abs_builddir)/$(COVERAGE_OUTPUT_INDEX_HTML)'
 
 if LCOV_OLD
-$(COVERAGE_OUTPUT_INDEX_HTML): $(COVERAGE_OUTPUT_FILE)
-       LC_ALL=C $(GENHTML) \
-               --legend \
-               --show-details \
-               --rc=genhtml_branch_coverage=1 \
-               --title='$(COVERAGE_TITLE)' \
-               --prefix='$(abspath $(abs_srcdir))' \
-               --prefix='$(realpath $(abs_srcdir))' \
-               --prefix='$(abspath $(abs_builddir)/..)' \
-               --prefix='$(realpath $(abs_builddir)/..)' \
-               --output-directory='$(COVERAGE_OUTPUT_DIRECTORY)' \
-               $<
+ignore_errors =
 else
+ignore_errors = --ignore-errors empty,negative
+endif
+
 $(COVERAGE_OUTPUT_INDEX_HTML): $(COVERAGE_OUTPUT_FILE)
        LC_ALL=C $(GENHTML) \
                --legend \
                --show-details \
-               --ignore-errors empty,negative \
+               $(ignore_errors) \
                --rc=genhtml_branch_coverage=1 \
                --title='$(COVERAGE_TITLE)' \
                --prefix='$(abspath $(abs_srcdir))' \
@@ -104,30 +96,17 @@ $(COVERAGE_OUTPUT_INDEX_HTML): $(COVERAGE_OUTPUT_FILE)
                --prefix='$(realpath $(abs_builddir)/..)' \
                --output-directory='$(COVERAGE_OUTPUT_DIRECTORY)' \
                $<
-endif
 
-if LCOV_OLD
 $(COVERAGE_OUTPUT_FILE):
        $(LCOV) \
                --capture \
                --no-external \
                --no-checksum \
+               $(ignore_errors) \
                --rc=lcov_branch_coverage=1 \
                --gcov-tool='$(GCOV)' \
                --output-file='$@' \
                $(LCOV_DIRS_ARGS)
-else
-$(COVERAGE_OUTPUT_FILE):
-       $(LCOV) \
-               --capture \
-               --no-external \
-               --no-checksum \
-               --ignore-errors empty,negative \
-               --rc=lcov_branch_coverage=1 \
-               --gcov-tool='$(GCOV)' \
-               --output-file='$@' \
-               $(LCOV_DIRS_ARGS)
-endif
 endif
 
 # Tell version 3.79 and up of GNU make to not build goals in this