summaryrefslogtreecommitdiffstats
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile19
1 files changed, 19 insertions, 0 deletions
diff --git a/makefile b/makefile
index fc344b76c..2863a0ef4 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
@@ -75,6 +85,15 @@ lcov:
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)" && \
+ ${MAKE}
+
.PHONY: gcda_clean
gcda_clean:
find -name '*.gcda' -exec rm -f {} \;
OpenPOWER on IntegriCloud