Preparation for tests

This commit is contained in:
Imbus 2024-12-26 16:00:26 +01:00
parent 89348119a6
commit c469e978c4

View file

@ -3,6 +3,8 @@ CXXFLAGS = -Wall -Wextra -Wpedantic -Wshadow -Wnon-virtual-dtor \
-Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wconversion \ -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wconversion \
-Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -std=c++17 -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -std=c++17
CXXFLAGS += -I.
ifeq ($(RELEASE),) ifeq ($(RELEASE),)
CFLAGS += -g -O0 CFLAGS += -g -O0
BUILD_TYPE = Debug BUILD_TYPE = Debug
@ -16,12 +18,17 @@ SRC = $(wildcard *.cc)
HDR = $(wildcard *.h) HDR = $(wildcard *.h)
OBJ = $(SRC:.cc=.o) OBJ = $(SRC:.cc=.o)
all: main.elf all: main.elf test.elf
test: test.elf
./test.elf
main.elf: $(OBJ) main.elf: $(OBJ) | words.txt
@echo "Building & linking $@" @echo "Building & linking $@"
@$(CXX) $(CXXFLAGS) $^ -o $@ @$(CXX) $(CXXFLAGS) $^ -o $@
test.elf: ordle.cc test/test.cc
@$(CXX) $(CXXFLAGS) $^ -o $@
words.txt: words.txt:
cat /usr/share/dict/words > words.txt cat /usr/share/dict/words > words.txt
@ -38,9 +45,9 @@ cppcheck:
cppcheck --enable=all --language=c++ --std=c++17 --suppress=missingIncludeSystem -I/usr/include $(SRC) $(HDR) cppcheck --enable=all --language=c++ --std=c++17 --suppress=missingIncludeSystem -I/usr/include $(SRC) $(HDR)
format: format:
clang-format -i $(SRC) $(HDR) clang-format -i $(SRC) $(HDR) **/*.cc
clean: clean:
rm -f *.o *.elf words.txt rm -f *.o *.elf words.txt
.PHONY: clean all lint clang-tidy cppcheck format .PHONY: clean all lint clang-tidy cppcheck format words.txt