1 ACLOCAL_AMFLAGS = -I m4
2 EXTRA_DIST = uthash klib README.md
4 pkgconfigdir = $(libdir)/pkgconfig
5 pkgconfig_DATA = libucl.pc
11 COVERAGE_INFO_FILE = $(top_builddir)/coverage.info
12 COVERAGE_REPORT_DIR = $(top_builddir)/coverage
14 .PHONY = coverage-requirement-check clean-coverage-report
16 coverage-requirement-check:
17 @if test ! -e $(GCOV); then \
18 echo "Cannot find $(GCOV). Please install gcov."; \
22 coverage: coverage-requirement-check clean-coverage coverage-build coverage-check coverage-report
23 @echo "Please execute 'make clean' before 'make' or 'make check' to remove instrumented object files(compiled with -O0 etc.). Note that 'make clean' also remove coverage data."
25 coverage-build: coverage-requirement-check
26 @if test `find $(top_builddir) -name "*.gcno" | wc -l` -eq 0; then \
27 echo "Start to remove old non-instrumented object files..."; \
28 $(MAKE) $(AM_MAKEFLAGS) clean; \
29 echo "Successfully removed old non-instrumented object files."; \
31 @echo "Start to build libraries with coverage options..."
32 $(MAKE) $(AM_MAKEFLAGS) \
33 CFLAGS="$(CFLAGS) $(COVERAGE_CFLAGS) $(COVERAGE_OPTFLAGS)" \
34 CXXFLAGS="$(CXXFLAGS) $(COVERAGE_CXXFLAGS) $(COVERAGE_OPTFLAGS)" \
35 LDFLAGS="$(LDFLAGS) $(COVERAGE_LDFLAGS)" \
36 LIBS="$(LIBS) $(COVERAGE_LIBS)"
37 @echo "Successfully built libraries with coverage options."
39 coverage-check: coverage-requirement-check
40 @echo "Start to run tests with instrumented libraries..."
41 $(MAKE) $(AM_MAKEFLAGS) check \
42 CFLAGS="$(CFLAGS) $(COVERAGE_CFLAGS) $(COVERAGE_OPTFLAGS)" \
43 CXXFLAGS="$(CXXFLAGS) $(COVERAGE_CXXFLAGS) $(COVERAGE_OPTFLAGS)" \
44 LDFLAGS="$(LDFLAGS) $(COVERAGE_LDFLAGS)" \
45 LIBS="$(LIBS) $(COVERAGE_LIBS)"
46 @echo "Successfully run tests with instrumented libraries."
48 coverage-lcov: coverage-check coverage-requirement-check
50 --directory "$(top_builddir)/" \
51 --output-file $(COVERAGE_INFO_FILE) \
53 --compat-libtool --checksum
54 $(LCOV) --extract $(COVERAGE_INFO_FILE) `pwd`/src/ucl_\* \
55 --output-file $(COVERAGE_INFO_FILE)
57 coverage-report: coverage-lcov
58 @echo "Start to create coverage reports..."
59 $(GENHTML) --prefix "$(top_srcdir)" \
60 --output-directory $(COVERAGE_REPORT_DIR) \
61 --title $(PACKAGE_NAME) \
62 --legend --show-details \
65 @echo "Successfully created coverage reports into $(COVERAGE_REPORT_DIR) directory."
67 clean-coverage-report:
68 -rm -rf $(COVERAGE_INFO_FILE)
69 -rm -rf $(COVERAGE_REPORT_DIR)
71 clean-coverage: clean-coverage-report
72 -$(LCOV) --gcov-tool $(GCOV) --zerocounters --directory $(top_builddir)
73 @if xargs --version 2>/dev/null; then \
74 find $(top_builddir) -name "*.gcno" | xargs --no-run-if-empty rm; \
76 find $(top_builddir) -name "*.gcno" | xargs rm; \
79 clean-local: clean-coverage
81 SUBDIRS = src tests utils doc $(LUA_SUBDIR)