~ubuntu-branches/ubuntu/trusty/libpeas/trusty

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
if GCOV_ENABLED

gcov: all
	@echo ""; \
	 project=`basename $(abs_srcdir)`; \
	 total_covered=0; \
	 total_actual=0; \
	 stats_length=`expr length "   9999 / 9999   100% "`; \
	 filename_width=`expr 80 - 2 - $$stats_length`; \
	 echo -e "Test coverage for $$project:\n"; \
	 for file in $(filter %.c,$(gcov_sources)); do \
		 gcov -o .libs/$${file/.c/.gcda} $$file > /dev/null; \
		 if test -f $$file.gcov; then \
		   actual=`grep -v ' -:' $$file.gcov | wc -l`; \
		   uncovered=`grep '#####:' $$file.gcov | wc -l`; \
		   covered=$$((actual - uncovered)); \
		   percent=$$((($$covered * 100) / $$actual)); \
		   total_covered=$$((total_covered + covered)); \
		   total_actual=$$((total_actual + actual)); \
		   filename=`echo $$file: | sed "s/^\.\///g"`; \
	     printf "  %-*s   %4i / %4i   %3i%%\n" $$filename_width $$filename \
	                                           $$covered $$actual $$percent; \
		 fi \
	 done; \
	 printf "\nSource statements:  %4i" $$total_actual; \
	 printf "\nCovered statements: %4i" $$total_covered; \
	 printf "\nTotal coverage:     %3i%%\n" \
	        $$((($$total_covered * 100) / $$total_actual))

else

gcov:
	@echo "You need to reconfigure with --enable-gcov"

endif	# GCOV_ENABLED

.PHONY: gcov