-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
125 lines (112 loc) · 5.26 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
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# .PHONY == defines that it's a command and not creating any files
# $@ == the name of the command and the file that I create. (The stuff before : )
# $< == first dependence
# $^ == all dependencies
# @ before command silences it in the terminal
CXX = g++
CXXFLAGS = -std=c++14 -Wall -pedantic -g -O3
LDLIBS = -lSDL2 -lSDL2_image -lSDL2_ttf
DEST_DIR = obj
PROGRAM = gorgomat
.PHONY: all
all: $(PROGRAM) doc
.PHONY: run
run: $(PROGRAM)
@./$(PROGRAM)
.PHONY: valgrind
valgrind: $(PROGRAM)
@valgrind --gen-suppressions=all --suppressions=./ValgrindSuppression.sup --leak-check=full --show-leak-kinds=all ./$(PROGRAM) -g
.PHONY: compile
compile: $(PROGRAM)
@echo "Compiled"
doc: doc src/*.hpp
@mkdir -p doc
doxygen Doxyfile
$(PROGRAM): $(DEST_DIR)/Application.o\
$(DEST_DIR)/Ball.o\
$(DEST_DIR)/Block.o\
$(DEST_DIR)/Bonus.o\
$(DEST_DIR)/ExitState.o\
$(DEST_DIR)/GameObject.o\
$(DEST_DIR)/GameState.o\
$(DEST_DIR)/HighScoreManager.o\
$(DEST_DIR)/LoadState.o\
$(DEST_DIR)/main.o\
$(DEST_DIR)/MainMenu.o\
$(DEST_DIR)/MapLoader.o\
$(DEST_DIR)/MenuState.o\
$(DEST_DIR)/MenuText.o\
$(DEST_DIR)/Platform.o\
$(DEST_DIR)/ResultState.o\
$(DEST_DIR)/ScoreManager.o\
$(DEST_DIR)/StartupState.o\
$(DEST_DIR)/TextPrinter.o
$(CXX) $(CXXFLAGS) $^ -g -o $@ $(LDLIBS)
$(DEST_DIR)/%.o: src/%.cpp $(DEST_DIR)
@echo "Compiling..."
$(CXX) $(CXXFLAGS) -c -g $< -o $@ $(LDLIBS)
$(DEST_DIR):
@mkdir -p $(DEST_DIR)
.PHONY: clean
clean:
@rm -rf $(PROGRAM) doc 2>/dev/null
@rm -rf $(DEST_DIR)/ 2>/dev/null
@rm -rf doc 2>/dev/null
@echo "Files deleted"
#Dependencies
$(DEST_DIR)/Application.o: src/Application.cpp src/Application.hpp src/State.hpp \
src/TextPrinter.hpp src/ScoreManager.hpp src/GameObject.hpp \
src/Platform.hpp src/Ball.hpp src/Bonus.hpp
$(DEST_DIR)/Ball.o: src/Ball.cpp src/Ball.hpp src/GameObject.hpp src/ScoreManager.hpp \
src/State.hpp src/Application.hpp src/TextPrinter.hpp src/Platform.hpp \
src/Bonus.hpp
$(DEST_DIR)/Block.o: src/Block.cpp src/Block.hpp src/GameObject.hpp
$(DEST_DIR)/Bonus.o: src/Bonus.cpp src/Bonus.hpp src/GameObject.hpp \
src/ScoreManager.hpp src/State.hpp src/Application.hpp \
src/TextPrinter.hpp src/Platform.hpp src/Ball.hpp
$(DEST_DIR)/ExitState.o: src/ExitState.cpp src/ExitState.hpp src/State.hpp \
src/Application.hpp src/TextPrinter.hpp src/ScoreManager.hpp \
src/GameObject.hpp src/Platform.hpp src/Ball.hpp src/Bonus.hpp
$(DEST_DIR)/GameObject.o: src/GameObject.cpp src/GameObject.hpp
$(DEST_DIR)/GameState.o: src/GameState.cpp src/GameState.hpp src/State.hpp \
src/Application.hpp src/TextPrinter.hpp src/ScoreManager.hpp \
src/GameObject.hpp src/Platform.hpp src/Ball.hpp src/Bonus.hpp
$(DEST_DIR)/HighScoreManager.o: src/HighScoreManager.cpp src/HighScoreManager.hpp
$(DEST_DIR)/LoadState.o: src/LoadState.cpp src/LoadState.hpp src/State.hpp \
src/Application.hpp src/TextPrinter.hpp src/ScoreManager.hpp \
src/GameObject.hpp src/Platform.hpp src/Ball.hpp src/Bonus.hpp \
src/MapLoader.hpp src/Block.hpp
$(DEST_DIR)/main.o: src/main.cpp src/Application.hpp src/State.hpp \
src/TextPrinter.hpp src/ScoreManager.hpp src/GameObject.hpp \
src/Platform.hpp src/Ball.hpp src/Bonus.hpp src/StartupState.hpp \
src/MainMenu.hpp src/MenuState.hpp src/MenuText.hpp src/LoadState.hpp \
src/MapLoader.hpp src/Block.hpp src/GameState.hpp src/ResultState.hpp \
src/HighScoreManager.hpp src/ExitState.hpp
$(DEST_DIR)/MainMenu.o: src/MainMenu.cpp src/MainMenu.hpp src/MenuState.hpp \
src/State.hpp src/Application.hpp src/TextPrinter.hpp \
src/ScoreManager.hpp src/GameObject.hpp src/Platform.hpp src/Ball.hpp \
src/Bonus.hpp src/MenuText.hpp
$(DEST_DIR)/MapLoader.o: src/MapLoader.cpp src/MapLoader.hpp src/Block.hpp \
src/GameObject.hpp src/State.hpp src/Application.hpp src/TextPrinter.hpp \
src/ScoreManager.hpp src/Platform.hpp src/Ball.hpp src/Bonus.hpp
$(DEST_DIR)/MenuState.o: src/MenuState.cpp src/MenuState.hpp src/State.hpp \
src/Application.hpp src/TextPrinter.hpp src/ScoreManager.hpp \
src/GameObject.hpp src/Platform.hpp src/Ball.hpp src/Bonus.hpp \
src/MenuText.hpp
$(DEST_DIR)/MenuText.o: src/MenuText.cpp src/MenuText.hpp src/Application.hpp \
src/State.hpp src/TextPrinter.hpp src/ScoreManager.hpp \
src/GameObject.hpp src/Platform.hpp src/Ball.hpp src/Bonus.hpp
$(DEST_DIR)/Platform.o: src/Platform.cpp src/Platform.hpp src/GameObject.hpp \
src/State.hpp src/Application.hpp src/TextPrinter.hpp \
src/ScoreManager.hpp src/Ball.hpp src/Bonus.hpp
$(DEST_DIR)/ResultState.o: src/ResultState.cpp src/ResultState.hpp src/MenuState.hpp \
src/State.hpp src/Application.hpp src/TextPrinter.hpp \
src/ScoreManager.hpp src/GameObject.hpp src/Platform.hpp src/Ball.hpp \
src/Bonus.hpp src/MenuText.hpp src/HighScoreManager.hpp
$(DEST_DIR)/ScoreManager.o: src/ScoreManager.cpp src/ScoreManager.hpp \
src/GameObject.hpp src/State.hpp src/Application.hpp src/TextPrinter.hpp \
src/Platform.hpp src/Ball.hpp src/Bonus.hpp
$(DEST_DIR)/StartupState.o: src/StartupState.cpp src/StartupState.hpp src/State.hpp \
src/Application.hpp src/TextPrinter.hpp src/ScoreManager.hpp \
src/GameObject.hpp src/Platform.hpp src/Ball.hpp src/Bonus.hpp
$(DEST_DIR)/TextPrinter.o: src/TextPrinter.cpp src/TextPrinter.hpp