##----------------------------------------------------------## ## ## ## Universal Makefile Lcov Function ## ## ## ## Created : Wei Liu 07/04/11 ## ## Revision: [Last]Wei Liu 07/07/09 ## ## ## ##----------------------------------------------------------## ##-------------------------------------- ## ## COVER define ## ##-------------------------------------- ifeq "$(COVER_NEED)" "yes" COVER := /usr/bin/lcov GENHTML := /usr/bin/genhtml GENDESC := /usr/bin/gendesc GENPNG := /usr/bin/genpng ##Depending on the presence of the GD.pm perl module, we can use the ##special option '--frames' for genhtml USE_GENPNG := $(shell $(GENPNG) --help >/dev/null 2>/dev/null; echo $$?) ifeq ($(USE_GENPNG),0) FRAMES := --frames else FRAMES := endif ##COV_SETFLAG := --zerocounters --path . -q --directory . COV_SETFLAG := --zerocounters -q --directory ../obj COV_SET := $(COVER) $(COV_SETFLAG) COVER_REPORT_PATH ?= $(UTDIR)/output INFO_FILE = $(COVER_REPORT_PATH)/$(MODULE).info DSP_FILE = $(MODULE)_test_descriptions.txt COV_OUTSET = --capture --directory ../obj \ --output-file $(INFO_FILE)\ --test-name $(MODULE) -q \ --base-directory ../ COV_HTMLSET= $(INFO_FILE) \ --output-directory $(COVER_REPORT_PATH)\ --title $(MODULE) \ --show-details $(FRAMES) \ --legend -q --num-spaces 4 COV_OUTPUT = $(COVER) $(COV_OUTSET) COV_DOC_PATH := /usr/local/include/cov endif ##-------------------------------------- ## ## Make Test ## ##-------------------------------------- test: @echo -e "\n================================Test start======================================\n" ifeq "$(BUILD)" "exef" ifeq "$(COVER_NEED)" "yes" @$(MKDIR) -p $(COVER_REPORT_PATH) --mode=0777 @cp -rf $(COV_DOC_PATH)/lcovrc $(COV_DOC_PATH)/lcov_html_header\ $(COV_DOC_PATH)/lcov_html_foot /etc/ @cp -rf /usr/local/include/cgprof/cgprof /usr/local/bin/cgprof @$(COV_SET) $(OUTFILE) gprof $(OUTFILE) gmon.out -p | cgprof -Tps @$(COV_OUTPUT) @LANG=C $(GENHTML) $(COV_HTMLSET) @echo @echo -e "||---------------------------------------------------------------" @echo -e "|| Test cover report generated on the paht $(COVER_REPORT_PATH). " @echo -e "|| Point a web browser at index.html to see results. " @echo -e "||---------------------------------------------------------------" else @echo "COVER_NEED: $(COVER_NEED)BUILD: $(BUILD) " $(OUTFILE) endif @echo -e "\n================================Test End========================================\n" else @echo -e "||---------------------------------------------------------------" @echo -e "|| This is not exef project! " @echo -e "||---------------------------------------------------------------" @echo "This is not exef project!" endif cleanlcov: @$(COV_SET) --reset retest: cleanlcov test