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