-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.withAllCommands
65 lines (45 loc) · 1.66 KB
/
Makefile.withAllCommands
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Source for base file: https://gitlab.fit.cvut.cz/husekrad/pa2-cvika-2022/tree/master/cv10/semestralka
LOGIN = horanvoj
CXX = g++
BASIC_FLAGS = -std=c++17 -O2 -g -Wall -pedantic
FLAGS = $(shell pkg-config --cflags --libs sdl2) -lSDL2_ttf -DRESOURCES_PATH=\"assets/\" -DMEM
ZIP = Makefile Doxyfile DOCUMENTATION.md zadani.txt prohlaseni.txt \
.gitignore $(wildcard examples/*) $(wildcard src/*) $(wildcard assets/*)
SOURCES = $(wildcard src/*.cpp src/entity/*.cpp src/menu/*.cpp src/parser/*.cpp src/render/*.cpp src/utils/*.cpp src/test/*.cpp)
OBJECTS = $(patsubst src/%.cpp, build/%.o, ${SOURCES})
DEPS = $(patsubst src/%.cpp, build/%.dep, ${SOURCES})
.PHONY: all compile run valgrind doc clean count zip
all: compile doc
test: FLAGS += -DTEST
test: compile run
compile: ${LOGIN}
${LOGIN}: ${OBJECTS}
@mkdir -p build/
${CXX} ${BASIC_FLAGS} ${FLAGS} $^ -o $@
build/%.o: src/%.cpp
@mkdir -p build/
${CXX} ${BASIC_FLAGS} ${FLAGS} -c $< -o $@
run: compile
./${LOGIN}
valgrind: compile
valgrind ./${LOGIN}
doc: doc/index.html
doc/index.html: DOCUMENTATION.md Doxyfile $(wildcard src/* src/entity/* src/menu/*.cpp src/parser/*.cpp src/render/*.cpp src/utils/*.cpp src/test/*.cpp)
doxygen Doxyfile
count:
wc -l src/**/*.h src/**/*.cpp src/*.h src/*.cpp
clean:
rm -rf build doc
rm -f ${LOGIN} ${LOGIN}.zip
zip: ${LOGIN}.zip
${LOGIN}.zip: ${ZIP}
rm -rf tmp/
rm -f $@
mkdir -p tmp/${LOGIN}/
cp --parents -r $^ tmp/${LOGIN}/
cd tmp/ && zip -r ../$@ ${LOGIN}/
rm -rf tmp/
build/%.dep: src/%.cpp src/*
@mkdir -p build/ build/entity build/menu build/render build/parser build/utils build/test
${CXX} -MM -MT $(patsubst src/%.cpp, build/%.o, $<) $< > $@
include ${DEPS}