Initial Import
[profile/ivi/json-glib.git] / build / autotools / Makefile.am.gcov
1 if GCOV_ENABLED
2 gcov-report.txt: gcov-clean
3         $(QUIET_GEN)(rm -f $@; \
4         echo -e "Test coverage for json-glib:\n" >> $@; \
5         total_covered=0; total_actual=0; \
6         for file in $(filter %.c,$(gcov_sources)); do \
7                 gcov -o .libs/$${file/.c/.gcda} $$file > /dev/null; \
8                 if test -f $$file.gcov; then \
9                         actual=`grep -v ' -:' $$file.gcov | wc -l`; \
10                         uncovered=`grep '#####:' $$file.gcov | wc -l`; \
11                         covered=$$((actual - uncovered)); \
12                         total_covered=$$((total_covered + covered)); \
13                         total_actual=$$((total_actual + actual)); \
14                         echo -e "$$file:    \t$$covered / $$actual\t($$((($$covered * 100) / $$actual))%)"; \
15                 fi \
16         done >> $@; \
17         cd $(abs_srcdir); \
18         echo -e "\nSource lines: $$total_actual\nCovered statements: $$total_covered\nTotal coverage: $$((($$total_covered * 100) / $$total_actual))%" >> $@)
19
20 gcov: gcov-report.txt
21         @cat gcov-report.txt
22 gcov-clean:
23         @find . -name "*.gcda" -o -name "*.gcov" -delete
24 else
25 gcov-report.txt:
26         @true
27 gcov-clean:
28         @true
29 gcov:
30         @echo "Need to reconfigure with --enable-gcov"
31 endif   # GCOV_ENABLED
32
33 .PHONY: gcov gcov-clean gcov-report.txt
34
35 check-local: gcov