labs-edaf30/lab2/Makefile

38 lines
944 B
Makefile
Raw Normal View History

2024-11-20 17:46:21 +01:00
CXX = g++
2024-11-21 07:48:56 +01:00
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
2024-11-20 17:46:21 +01:00
SRC = $(wildcard *.cc)
2024-11-21 08:45:34 +01:00
HDR = $(wildcard *.h)
2024-11-20 17:46:21 +01:00
OBJ = $(SRC:.cc=.o)
all: spell edit $(OBJ)
edit: test_edit_distance.o edit_distance.o
@echo "Building & linking $@"
@$(CXX) $(CXXFLAGS) $^ -o $@
spell: spell.o word.o dictionary.o
@echo "Building & linking $@"
@$(CXX) $(CXXFLAGS) $^ -o $@
%.o:%.cc
@echo "Building $@"
@$(CXX) -c $(CXXFLAGS) $< -o $@
2024-11-21 08:45:34 +01:00
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)
2024-11-20 17:46:21 +01:00
clean:
rm -f *.o spell edit
2024-11-21 08:45:34 +01:00
.PHONY: clean all lint clang-tidy cppcheck clang-format