diff --git a/Makefile b/Makefile index 48b41db..1ee3987 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,10 @@ ifeq ($(RUN_CLANG_TIDY),) RUN_CLANG_TIDY := run-clang-tidy endif +ifeq ($(CPPCHECK),) +CPPCHECK := cppcheck +endif + SRC_DIR = "$(shell pwd)/src" INC_DIR = "$(shell pwd)/include" @@ -21,6 +25,14 @@ HEADE_FILTER = "$(SRC_DIR)|$(INC_DIR)" SOURCE_DIR = "$(SRC_DIR)" "$(INC_DIR)" SOURCE_REGEX = '.*\.\(cpp\|hpp\)' +CPPCHECK_FLAGS = \ + --std=c++17 \ + --error-exitcode=1 \ + --inline-suppr \ + --suppress=missingIncludeSystem \ + --library=googletest +CPPCHECK_CHECKS = warning,performance,portability,style,information + .PHONY: all all: build/Makefile @$(MAKE) --no-print-directory -C build @@ -50,6 +62,10 @@ tidy: all tidy-fix: all $(RUN_CLANG_TIDY) -p build -quiet -fix -j $(shell nproc) -header-filter=$(HEADE_FILTER) $(SOURCE_DIR) +.PHONY: cppcheck +cppcheck: build/Makefile + @$(CPPCHECK) $(CPPCHECK_FLAGS) --enable=$(CPPCHECK_CHECKS) $(SOURCE_DIR) + .PHONY: test test: build @cd build && $(CMAKE) $(CMAKE_ARGS) -DTELEMETRY_ENABLE_TESTS=ON ..