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