Makefile.am 1.69 KB
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = subdir-objects

if IS_AMD
else
TESTS_ENVIRONMENT = valgrind \
		    --error-exitcode=123 \
		    --leak-check=full \
		    --suppressions=./suppress/external.supp \
		    --quiet
endif
TESTS = classTest
check_PROGRAMS = classTest

COMMON = runtest.c
CLASS  = $(COMMON) \
	 ../src/interface.c \
	 ../src/i_class.c \
	 ../src/memory.c \
	 mock/mock_class.c

AM_CFLAGS += -O0 -Wall -Werror -ggdb -I ../include -I .. -I . $(MEM_OPT_FLAGS)
AM_LDFLAGS = 

if HAVE_GCOV
AM_CFLAGS += $(COVERAGE_CFLAGS)
AM_LDFLAGS += $(COVERAGE_LDFLAGS)
endif

classTest_SOURCES = $(CLASS) classTest.c
classTest_CFLAGS  = $(AM_CFLAGS) -pg
classTest_LDFLAGS = $(AM_LDFLAGS) -pg

EXTRA_DIST = runtest.h mock suppress

if HAVE_GCOV

.PHONY: clean-gcda clean-gcno coverage-html clean-coverage

cov_dir = $(top_srcdir)/tests/coverage/$(PACKAGE_VERSION)

coverage-html: clean clean-coverage check
	@echo Collecting coverage data
	$(LCOV) -d $(top_srcdir) -c -i -o coverage.base
	$(LCOV) -d $(top_srcdir) -c -o coverage.run --gcov-tool /usr/bin/gcov
	$(LCOV) -d $(top_srcdir) \
		-a ./coverage.base -a ./coverage.run \
		-o coverage.info
	LANG=C $(GENHTML) --prefix $(PWD) \
	     --output-directory $(cov_dir) \
	     --title "$(PACKAGE_NAME) $(PACKAGE_VERSION)" \
	     --legend --branch-coverage --show-details coverage.run

clean-coverage: clean-gcda clean-gcno
	$(LCOV) -d $(top_srcdir) -z
	-rm -rf coverage.info coverage.base coverage.run $(cov_dir)

clean-gcda:
	@echo Removing old coverage results
	-find $(top_srcdir) -name '*.gcda' -print | xargs -r rm

clean-gcno:
	@echo Removing old coverage results
	-find $(top_srcdir) -name '*.gcno' -print | xargs -r rm

clean-local: clean-coverage

endif # HAVE_GCOV