Makefile targets for linting

This commit is contained in:
Imbus 2024-11-21 08:45:34 +01:00
parent fe00d47e02
commit 8c8930f5c5

View file

@ -3,6 +3,7 @@ CXXFLAGS = -Wall -Wextra -Wpedantic -Wshadow -Wnon-virtual-dtor -Wold-style-cast
#CXXFLAGS += -Werror
SRC = $(wildcard *.cc)
HDR = $(wildcard *.h)
OBJ = $(SRC:.cc=.o)
all: spell edit $(OBJ)
@ -19,7 +20,18 @@ spell: spell.o word.o dictionary.o
@echo "Building $@"
@$(CXX) -c $(CXXFLAGS) $< -o $@
lint: clang-tidy cppcheck clang-format
clang-tidy:
clang-tidy $(SRC) -- $(CXXFLAGS)
cppcheck:
cppcheck --enable=all --language=c++ --std=c++17 --suppress=missingIncludeSystem -I/usr/include $(SRC) $(HDR)
clang-format:
clang-format -i $(SRC) $(HDR)
clean:
rm -f *.o spell edit
.PHONY: clean
.PHONY: clean all lint clang-tidy cppcheck clang-format