From cc34c036485daa6acdecc7d2c8a6c6de83120b1b Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Wed, 27 Nov 2024 17:14:34 +0100 Subject: [PATCH] Makefile lab3 --- lab3/Makefile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lab3/Makefile diff --git a/lab3/Makefile b/lab3/Makefile new file mode 100644 index 0000000..e6d004c --- /dev/null +++ b/lab3/Makefile @@ -0,0 +1,33 @@ +CXX = g++ +CXXFLAGS = -Wall -Wextra -Wpedantic -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -std=c++17 +#CXXFLAGS += -Werror + +SRC = $(wildcard *.cc) +HDR = $(wildcard *.h) +OBJ = $(SRC:.cc=.o) + +all: tabletest $(OBJ) + +tabletest: $(OBJ) + @echo "Building & linking $@" + @$(CXX) $(CXXFLAGS) $^ -o $@ + +%.o:%.cc + @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 all lint clang-tidy cppcheck clang-format