Makefile.gcov 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #
  2. # LCOV
  3. #
  4. LCOV_INCLUDE="."
  5. lcov: lcov-html
  6. lcov-test: lcov-clean-data test
  7. php_lcov.info: lcov-test
  8. @echo "Generating data for $@"
  9. @rm -rf lcov_data/
  10. @$(mkinstalldirs) lcov_data/
  11. @echo
  12. -@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` ;\
  13. for x in $$files; do \
  14. echo -n . ;\
  15. y=`echo $$x | sed -e 's!\.libs/!!'`; \
  16. dir=lcov_data/`dirname $$x`; \
  17. test -d "$$dir" || $(mkinstalldirs) "$$dir"; \
  18. if test -f "$(top_srcdir)/$$y.c"; then \
  19. ln -f -s $(top_srcdir)/$$y.c lcov_data/$$y.c; \
  20. fi; \
  21. if test -f "$(top_srcdir)/$$y.h"; then \
  22. ln -f -s $(top_srcdir)/$$y.h lcov_data/$$y.h; \
  23. fi; \
  24. if test -f "$(top_srcdir)/$$y.re"; then \
  25. ln -f -s $(top_srcdir)/$$y.re lcov_data/$$y.re; \
  26. fi; \
  27. if test -f "$(top_srcdir)/$$y.y"; then \
  28. ln -f -s $(top_srcdir)/$$y.y lcov_data/$$y.y; \
  29. fi; \
  30. if test -f "$(top_srcdir)/$$y.l"; then \
  31. ln -f -s $(top_srcdir)/$$y.l lcov_data/$$y.l; \
  32. fi; \
  33. if test -f "$(top_srcdir)/$$y"; then \
  34. ln -f -s $(top_srcdir)/$$y lcov_data/$$y; \
  35. fi; \
  36. if test -f "$(top_builddir)/$$y.c"; then \
  37. ln -f -s $(top_builddir)/$$y.c lcov_data/$$y.c; \
  38. fi; \
  39. if test -f "$$x.gcno"; then \
  40. cp $$x.gcno lcov_data/$$y.gcno ; \
  41. fi; \
  42. if test -f "$$x.gcda"; then \
  43. cp $$x.gcda lcov_data/$$y.gcda ; \
  44. fi; \
  45. if test -f "$$x.da"; then \
  46. cp $$x.da lcov_data/$$y.da ; \
  47. fi; \
  48. if test -f "$$x.bb"; then \
  49. cp $$x.bb lcov_data/$$y.bb ; \
  50. fi; \
  51. if test -f "$$x.bbg"; then \
  52. cp $$x.bbg lcov_data/$$y.bbg ; \
  53. fi; \
  54. done; \
  55. 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 \
  56. if test -d lcov_data/$$dir; then \
  57. rm -rf lcov_data/$$dir ; \
  58. fi; \
  59. done
  60. @echo
  61. @echo "Generating $@"
  62. @$(LTP) --directory lcov_data/ --capture --base-directory=lcov_data --output-file $@
  63. lcov-html: php_lcov.info
  64. @echo "Generating lcov HTML"
  65. @$(LTP_GENHTML) --legend --output-directory lcov_html/ --title "PHP Code Coverage" php_lcov.info
  66. lcov-clean:
  67. rm -f php_lcov.info
  68. rm -rf lcov_data/
  69. rm -rf lcov_html/
  70. lcov-clean-data:
  71. @find . -name \*.gcda -o -name \*.da -o -name \*.bbg? | xargs rm -f