forked from cpp-exercises/CardWar_B
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (26 loc) · 1.09 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!make -f
CXX=clang++-14
CXXVERSION=c++2a
SOURCE_PATH=sources
OBJECT_PATH=objects
CXXFLAGS=-std=$(CXXVERSION) -Werror -Wsign-conversion -I$(SOURCE_PATH)
TIDY_FLAGS=-extra-arg=-std=$(CXXVERSION) -checks=bugprone-*,clang-analyzer-*,cppcoreguidelines-*,performance-*,portability-*,readability-*,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-owning-memory --warnings-as-errors=*
VALGRIND_FLAGS=-v --leak-check=full --show-leak-kinds=all --error-exitcode=99
SOURCES=$(wildcard $(SOURCE_PATH)/*.cpp)
HEADERS=$(wildcard $(SOURCE_PATH)/*.hpp)
OBJECTS=$(subst sources/,objects/,$(subst .cpp,.o,$(SOURCES)))
run: test1
demo: Demo.o $(OBJECTS)
$(CXX) $(CXXFLAGS) $^ -o $@
test1: TestRunner.o StudentTest1.o $(OBJECTS)
$(CXX) $(CXXFLAGS) $^ -o $@
tidy:
clang-tidy $(HEADERS) $(TIDY_FLAGS) --
valgrind: test1
valgrind --tool=memcheck $(VALGRIND_FLAGS) ./test1 2>&1 | { egrep "lost| at " || true; }
%.o: %.cpp $(HEADERS)
$(CXX) $(CXXFLAGS) --compile $< -o $@
$(OBJECT_PATH)/%.o: $(SOURCE_PATH)/%.cpp $(HEADERS)
$(CXX) $(CXXFLAGS) --compile $< -o $@
clean:
rm -f $(OBJECTS) *.o test* demo*