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