summaryrefslogtreecommitdiffstats
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile46
1 files changed, 40 insertions, 6 deletions
diff --git a/makefile b/makefile
index 16217fd5d..b1ab6e467 100644
--- a/makefile
+++ b/makefile
@@ -45,6 +45,16 @@ IMAGE_PASS_POST += cscope ctags
endif
IMAGE_PASS_POST += check_istep_modules
+# Variables used when running cppcheck tool.
+# The actual commands are stored in CXX_CHECK and C_CHECK, which are created as
+# dummy variables here, but will be set to the actual tool in the "cppcheck" rule
+BUILDCPPCHECK := $(PROJECT_ROOT)/src/build/tools/build-cppcheck
+CPPCHECKTOOL := $(PROJECT_ROOT)/src/build/tools/cpptools/cppcheck/cppcheck
+CPPCHECKFLAGS := --inline-suppr --error-exitcode=1 --template='Error CPPCHECK {file}: line {line}\nSyntax error string: {id}\n{message}'
+CPPCHECK := $(CPPCHECKTOOL) $(CPPCHECKFLAGS)
+export CXX_CHECK ?= true
+export C_CHECK ?= true
+
include ./config.mk
.PHONY: docs
@@ -56,14 +66,38 @@ docs: src/build/doxygen/doxygen.conf
citest:
src/build/citest/cxxtest-start.sh
+gcov: HOSTBOOT_PROFILE := 1
+
+export HOSTBOOT_PROFILE
+
.PHONY: gcov
gcov:
- rm -rf obj/gcov/*
- $(MAKE) gcov_pass
- find obj/gcov/ -size 0c | xargs rm # Delete empty files.
- genhtml obj/gcov/*.lcov -o obj/gcov/html --prefix `pwd` \
- --title `git describe --dirty`
- @echo "View GCOV results with: firefox obj/gcov/html/index.html"
+ @echo Building Hostboot with profiling enabled.
+ $(MAKE)
+ @echo Run simics and execute the hb-Gcov command at the end of the simulation to extract gcov data.
+ @echo Then you can "make lcov" to generate the coverage report.
+
+.PHONY: lcov
+lcov:
+ rm -f obj/lcov_data
+ lcov -c --dir . -o obj/lcov_data --gcov-tool $(GCOV)
+ rm -rf obj/gcov_report
+ genhtml obj/lcov_data -o obj/gcov_report --ignore-errors source
+ @echo Coverage report now available in obj/gcov_report
+
+.PHONY: cppcheck
+cppcheck:
+ @echo Building with CPPCHECK tool
+# TODO RTC: 215692
+ ${BUILDCPPCHECK}
+ export CXX_CHECK="$(CPPCHECK) $(filter -D%, $(CXXFLAGS)) $(INCFLAGS)" && \
+ export C_CHECK="$(CPPCHECK) $(filter -D%, $(CFLAGS)) $(INCFLAGS)" && \
+ export DOCPPCHECK=1 && \
+ ${MAKE}
+
+.PHONY: gcda_clean
+gcda_clean:
+ find -name '*.gcda' -exec rm -f {} \;
$(GENDIR)/hwp_id.html :
$(ROOTPATH)/src/build/tools/hwp_id.pl -i -l > $@
OpenPOWER on IntegriCloud