xref: /PHP-8.0/build/Makefile.gcov (revision 4fa3687e)
1#
2# GCOV
3#
4
5LTP = lcov
6LTP_GENHTML = genhtml
7
8LCOV_EXCLUDES = \
9	'$(top_srcdir)/ext/bcmath/libbcmath/*' \
10	'$(top_srcdir)/ext/date/lib/*' \
11	'$(top_srcdir)/ext/fileinfo/libmagic/*' \
12	'$(top_srcdir)/ext/gd/libgd/*' \
13	'$(top_srcdir)/ext/hash/sha3/*' \
14	'$(top_srcdir)/ext/mbstring/libmbfl/*' \
15	'$(top_srcdir)/ext/opcache/jit/libudis86/*' \
16	'$(top_srcdir)/ext/pcre/pcre2lib/*' \
17	'$(top_srcdir)/parse_date.re' \
18	'$(top_srcdir)/parse_iso_intervals.re'
19
20GCOVR_EXCLUDES = \
21	'ext/bcmath/libbcmath/.*' \
22	'ext/date/lib/.*' \
23	'ext/fileinfo/libmagic/.*' \
24	'ext/gd/libgd/.*' \
25	'ext/hash/sha3/.*' \
26	'ext/mbstring/libmbfl/.*' \
27	'ext/opcache/jit/libudis86/.*' \
28	'ext/pcre/pcre2lib/.*'
29
30lcov: lcov-html
31
32php_lcov.info:
33	@echo "Generating lcov data for $@"
34	$(LTP) --capture --no-external --directory . --output-file $@
35	@echo "Stripping bundled libraries from $@"
36	$(LTP) --output-file $@ --remove $@ '*/<stdout>' $(LCOV_EXCLUDES)
37
38lcov-html: php_lcov.info
39	@echo "Generating lcov HTML"
40	$(LTP_GENHTML) --legend --output-directory lcov_html/ --title "PHP Code Coverage" php_lcov.info
41
42lcov-clean:
43	rm -f php_lcov.info
44	rm -rf lcov_html/
45
46lcov-clean-data:
47	@find . -name \*.gcda -o -name \*.da -o -name \*.bbg? | xargs rm -f
48
49gcovr-html:
50	@echo "Generating gcovr HTML"
51	@rm -rf gcovr_html/
52	@mkdir gcovr_html
53	gcovr -sr . -o gcovr_html/index.html --html --html-details \
54		--exclude-directories 'ext/date/lib$$' \
55		$(foreach lib, $(GCOVR_EXCLUDES), -e $(lib))
56
57gcovr-xml:
58	@echo "Generating gcovr XML"
59	@rm -f gcovr.xml
60	gcovr -sr . -o gcovr.xml --xml \
61		--exclude-directories 'ext/date/lib$$' \
62		$(foreach lib, $(GCOVR_EXCLUDES), -e $(lib))
63
64.PHONY: gcovr-html lcov-html php_lcov.info
65