1# 2# This is a project Makefile. It is assumed the directory this Makefile resides in is a 3# project subdirectory. 4# 5 6PROJECT_NAME := gcov_example 7 8include $(IDF_PATH)/make/project.mk 9 10GCOV := $(call dequote,$(CONFIG_SDK_TOOLPREFIX))gcov 11REPORT_DIR := $(BUILD_DIR_BASE)/coverage_report 12 13pre-cov-report: 14 echo "Generating coverage report in: $(REPORT_DIR)" 15 echo "Using gcov: $(GCOV)" 16 mkdir -p $(REPORT_DIR)/html 17 18lcov-report: | pre-cov-report 19 echo "WARNING: lcov-report is deprecated. Please use gcovr-report instead." 20 lcov --gcov-tool $(GCOV) -c -d $(BUILD_DIR_BASE) -o $(REPORT_DIR)/$(PROJECT_NAME).info 21 genhtml -o $(REPORT_DIR)/html $(REPORT_DIR)/$(PROJECT_NAME).info 22 23gcovr-report: | check_python_dependencies pre-cov-report 24 cd $(BUILD_DIR_BASE) 25 gcovr -r $(PROJECT_PATH) --gcov-executable $(GCOV) -s --html-details $(REPORT_DIR)/html/index.html 26 27cov-data-clean: 28 echo "Remove coverage data files..." 29 find $(BUILD_DIR_BASE) -name "*.gcda" -exec rm {} + 30 rm -rf $(REPORT_DIR) 31 32.PHONY: lcov-report gcovr-report cov-data-clean 33