xref: /PHP-7.3/Makefile.gcov (revision 1c850bfc)
1#
2# LCOV
3#
4
5LCOV_INCLUDE="."
6
7lcov: lcov-html
8
9lcov-test: lcov-clean-data test
10
11php_lcov.info: lcov-test
12	@echo "Generating data for $@"
13	@rm -rf lcov_data/
14	@$(mkinstalldirs) lcov_data/
15	@echo
16	-@files=`find . -name \*.gcda -o -name \*.gcno -o -name \*.da -o -name \*.c -o -name \*.h | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | $(EGREP) $(LCOV_INCLUDE) | sed -e 's/.libs/zzzz/g' | sort | sed -e 's/zzzz/.libs/g' | uniq` ;\
17	for x in $$files; do \
18		echo -n . ;\
19		y=`echo $$x | sed -e 's!\.libs/!!'`; \
20		dir=lcov_data/`dirname $$x`; \
21		test -d "$$dir" || $(mkinstalldirs) "$$dir"; \
22		if test -f "$(top_srcdir)/$$y.c"; then \
23			ln -f -s $(top_srcdir)/$$y.c lcov_data/$$y.c; \
24		fi; \
25		if test -f "$(top_srcdir)/$$y.h"; then \
26			ln -f -s $(top_srcdir)/$$y.h lcov_data/$$y.h; \
27		fi; \
28		if test -f "$(top_srcdir)/$$y.re"; then \
29			ln -f -s $(top_srcdir)/$$y.re lcov_data/$$y.re; \
30		fi; \
31		if test -f "$(top_srcdir)/$$y.y"; then \
32		        ln -f -s $(top_srcdir)/$$y.y lcov_data/$$y.y; \
33		fi; \
34		if test -f "$(top_srcdir)/$$y.l"; then \
35		        ln -f -s $(top_srcdir)/$$y.l lcov_data/$$y.l; \
36		fi; \
37		if test -f "$(top_srcdir)/$$y"; then \
38		        ln -f -s $(top_srcdir)/$$y lcov_data/$$y; \
39		fi; \
40		if test -f "$(top_builddir)/$$y.c"; then \
41			ln -f -s $(top_builddir)/$$y.c lcov_data/$$y.c; \
42		fi; \
43		if test -f "$$x.gcno"; then \
44			cp $$x.gcno lcov_data/$$y.gcno ; \
45		fi; \
46		if test -f "$$x.gcda"; then \
47			cp $$x.gcda lcov_data/$$y.gcda ; \
48		fi; \
49		if test -f "$$x.da"; then \
50			cp $$x.da   lcov_data/$$y.da ; \
51		fi; \
52		if test -f "$$x.bb"; then \
53			cp $$x.bb   lcov_data/$$y.bb ; \
54		fi; \
55		if test -f "$$x.bbg"; then \
56			cp $$x.bbg  lcov_data/$$y.bbg ; \
57		fi; \
58	done; \
59	for dir in ext/bcmath/libbcmath ext/date/lib ext/fileinfo/libmagic ext/gd/libgd ext/mbstring/libmbfl ext/mbstring/oniguruma ext/pcre/pcrelib ext/pdo_sqlite/libsqlite ext/sqlite3/libsqlite ext/xmlrpc/libxmlrpc ext/zip/lib; do \
60		if test -d lcov_data/$$dir; then \
61			rm -rf lcov_data/$$dir ; \
62		fi; \
63	done
64	@echo
65	@echo "Generating $@"
66	@$(LTP) --directory lcov_data/ --capture --base-directory=lcov_data --output-file $@
67
68lcov-html: php_lcov.info
69	@echo "Generating lcov HTML"
70	@$(LTP_GENHTML) --legend --output-directory lcov_html/ --title "PHP Code Coverage" php_lcov.info
71
72lcov-clean:
73	rm -f php_lcov.info
74	rm -rf lcov_data/
75	rm -rf lcov_html/
76
77lcov-clean-data:
78	@find . -name \*.gcda -o -name \*.da -o -name \*.bbg? | xargs rm -f
79