35 lines
820 B
Makefile
35 lines
820 B
Makefile
# Perform static code checks
|
|
|
|
TIDY ?= clang-tidy
|
|
CPPLINT ?= /usr/bin/env python "$(CURRENT_DIR)/cpplint.py"
|
|
|
|
|
|
# Check sources with Clang Tidy
|
|
tidy::
|
|
ifeq (,$(CC_SOURCES))
|
|
@echo "(nothing to tidy)"
|
|
else
|
|
$(VERBOSE) $(TIDY) $(filter-out utils/png.cc,$(CC_SOURCES)) -- $(CXXFLAGS_ARCH) $(CXXFLAGS_DEFAULT) $(CXXFLAGS_OPT)
|
|
endif
|
|
|
|
|
|
# Check sources with cpplint
|
|
lint::
|
|
@if $(CPPLINT) --quiet --recursive . ; then \
|
|
echo "Congratuations, coding style obeyed!" ; \
|
|
else \
|
|
echo "Coding style violated -- see CPPLINT.cfg for details" ; \
|
|
exit 1 ; \
|
|
fi
|
|
|
|
|
|
# Documentation
|
|
help::
|
|
@$(echo) "Static Analysis and Linter\n" \
|
|
" \e[3mlint\e[0m Checks the coding style using \e[4mCPPLINT\e[0m\n\n" \
|
|
" \e[3mtidy\e[0m Uses \e[4mClang Tidy\e[0m for a static code analysis\n\n"
|
|
|
|
|
|
# Phony targets
|
|
.PHONY: tidy lint help
|