Skip to content

Commit

Permalink
Makefile - add option to run cppcheck
Browse files Browse the repository at this point in the history
Run `make cppcheck`
  • Loading branch information
SiskaPavel committed Oct 3, 2024
1 parent c46361c commit 5155f68
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,25 @@ 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"

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
Expand Down Expand Up @@ -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 ..
Expand Down

0 comments on commit 5155f68

Please sign in to comment.