File: Makefile.gcov

package info (click to toggle)
libpeas 1.20.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 5,748 kB
  • ctags: 2,099
  • sloc: ansic: 14,108; sh: 11,443; makefile: 1,071; python: 187; xml: 44
file content (37 lines) | stat: -rw-r--r-- 1,242 bytes parent folder | download | duplicates (4)
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