@@ -37,6 +37,7 @@ abs_builddir= @abs_builddir@
37
37
CC= @CC@
38
38
CXX= @CXX@
39
39
LINKCC= @LINKCC@
40
+ CC_NAME=@CC_NAME@
40
41
AR= @AR@
41
42
READELF= @READELF@
42
43
SOABI= @SOABI@
@@ -646,9 +647,20 @@ profile-opt: profile-run-stamp
646
647
-rm -f profile-clean-stamp
647
648
$(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS_NODIST) $(PGO_PROF_USE_FLAG)" LDFLAGS_NODIST="$(LDFLAGS_NODIST)"
648
649
650
+ .PHONY=coverage-report
651
+ coverage-report:
652
+ @if [ $(CC_NAME) = "gcc" ]; then \
653
+ $(MAKE) coverage-report-lcov; \
654
+ elif [ $(CC_NAME) = "clang" ]; then \
655
+ $(MAKE) coverage-report-llvm; \
656
+ else \
657
+ echo "Coverage is not supported with the $(CC_NAME) compiler"; \
658
+ exit 1; \
659
+ fi
660
+
649
661
# Compile and run with gcov
650
- .PHONY=coverage coverage-lcov coverage-report
651
- coverage:
662
+ .PHONY=coverage-gcc coverage-lcov coverage-report-lcov
663
+ coverage-gcc :
652
664
@echo "Building with support for coverage checking:"
653
665
$(MAKE) clean
654
666
$(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg --coverage" LDFLAGS="$(LDFLAGS) --coverage"
@@ -684,7 +696,7 @@ coverage-lcov:
684
696
@echo
685
697
686
698
# Force regeneration of parser and frozen modules
687
- coverage-report: regen-token regen-frozen
699
+ coverage-report-lcov : regen-token regen-frozen
688
700
@ # build with coverage info
689
701
$(MAKE) coverage
690
702
@ # run tests, ignore failures
@@ -693,14 +705,9 @@ coverage-report: regen-token regen-frozen
693
705
$(MAKE) coverage-lcov
694
706
695
707
# Compile and calculate coverage with llvm-cov
696
- .PHONY=check-clang coverage-llvm coverage-profdata coverage-report-llvm
697
-
698
- # Check whether the compiler is clang, and if not, error out.
699
- check-clang:
700
- ($(CC) --version | grep clang) || \
701
- (echo "LLVM coverage only works with clang. Set CC=clang and CXX=clang++ and re-run ./configure"; exit 1)
708
+ .PHONY=coverage-clang coverage-profdata coverage-report-llvm
702
709
703
- coverage-llvm: check-clang
710
+ coverage-clang:
704
711
@echo "Building with support for coverage checking:"
705
712
$(MAKE) clean
706
713
@ # Override CC rather than CFLAGS since these flags must come first
@@ -724,7 +731,7 @@ coverage-profdata:
724
731
# into temporary directories created by tests.
725
732
coverage-report-llvm: regen-token regen-importlib
726
733
@ # build with coverage info
727
- $(MAKE) coverage-llvm
734
+ $(MAKE) coverage-clang
728
735
@ # run tests, ignore failures
729
736
LLVM_PROFILE_FILE=${PWD}/python%m.profraw $(TESTRUNNER) $(TESTOPTS) || true
730
737
@ # build llvm-cov report
0 commit comments