]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libucl/Makefile.am
Add two missing eventhandler.h headers
[FreeBSD/FreeBSD.git] / contrib / libucl / Makefile.am
1 ACLOCAL_AMFLAGS = -I m4
2 EXTRA_DIST = uthash klib README.md
3
4 pkgconfigdir = $(libdir)/pkgconfig
5 pkgconfig_DATA = libucl.pc
6
7 if LUA_SUB
8   LUA_SUBDIR = lua
9 endif
10
11 COVERAGE_INFO_FILE = $(top_builddir)/coverage.info
12 COVERAGE_REPORT_DIR = $(top_builddir)/coverage
13
14 .PHONY = coverage-requirement-check clean-coverage-report
15
16 coverage-requirement-check:
17         @if test ! -e $(GCOV); then \
18                 echo "Cannot find $(GCOV). Please install gcov."; \
19                 exit 1; \
20         fi
21
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."
24
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."; \
30         fi
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."
38
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."
47
48 coverage-lcov: coverage-check coverage-requirement-check
49         $(LCOV) --capture \
50                 --directory "$(top_builddir)/" \
51                 --output-file $(COVERAGE_INFO_FILE) \
52                 --gcov-tool $(GCOV) \
53                 --compat-libtool --checksum
54         $(LCOV) --extract $(COVERAGE_INFO_FILE) `pwd`/src/ucl_\* \
55                 --output-file $(COVERAGE_INFO_FILE)
56
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 \
63                 $(GENHTML_OPTIONS) \
64                 $(COVERAGE_INFO_FILE)
65         @echo "Successfully created coverage reports into $(COVERAGE_REPORT_DIR) directory."
66
67 clean-coverage-report:
68         -rm -rf $(COVERAGE_INFO_FILE)
69         -rm -rf $(COVERAGE_REPORT_DIR)
70
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; \
75         else \
76                 find $(top_builddir) -name "*.gcno" | xargs rm; \
77         fi
78
79 clean-local: clean-coverage
80
81 SUBDIRS = src tests utils doc $(LUA_SUBDIR)