-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
232 lines (172 loc) · 6.57 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# makefile
ifndef config
config = debug
endif
TARGETDIR = bin
GAMEPLAYDIR = src/gameplay
AIDIR = src/ai
ANIMATIONDIR = src/animation
INPUTDIR = src/input
PHYSICSDIR = src/physics
GRAPHICSDIR = src/graphics
AUDIODIR = src/audio
HUDDIR = src/hud
NETWORKINGDIR = src/networking
PARTICLEDIR = src/particle
SYSTEMDIR = src/system
SCRIPTINGDIR = src/scripting
# Note: -fcolor-diagnostics, for some reason, is defaulted to false in Clang 3.4
CXX = g++
ifeq ($(config),debug)
OBJDIR = obj
TARGET = $(TARGETDIR)/chimera.debug
DEFINES = -DDEBUG
INCLUDES := -I/opt/local/include -I/usr/include/ImageMagick
STDLIB := -lc++ -lsupc++
COMPILER := -pthread # -stdlib=libc++
MAGICK = `Magick++-config --cppflags --cxxflags`
CPPFLAGS := -g -Wall -MMD -std=c++11 # -MP $(DEFINES) $(INCLUDES)
CXXFLAGS := $(CPPFLAGS) # -fcolor-diagnostics -ferror-limit=5
LDFLAGS =
LIBS := -lc++ -lsupc++ -lGL -lglfw -lGLEW -lassimp `Magick++-config --ldflags --libs`
endif
# ifeq ($(config),release)
# OBJDIR = obj
# TARGET = $(TARGETDIR)/chimera.release
# DEFINES = -DNDEBUG
# INCLUDES := -Ithirdparty/stb_image -I/opt/local/include
# COMPILER := -std=c++11 -stdlib=libc++ -lc++ -lsupc++ -lpthread
# CPPFLAGS := -MMD -MP $(DEFINES) -02 -Wall $(COMPILER)
# CXXFLAGS := $(CPPFLAGS) -fcolor-diagnostics -ferror-limit=5
# LDFLAGS = -s
# MAGICK = `Magick++-config --cppflags --cxxflags --ldflags --libs`
# LIBS += -lGL -lglfw -lGLEW -lassimp -lMagick++
# endif
SOURCES = \
$(SYSTEMDIR)/main.cpp \
$(SYSTEMDIR)/Engine.cpp \
$(SYSTEMDIR)/PlatformManager.cpp \
$(GRAPHICSDIR)/Program.cpp \
$(GRAPHICSDIR)/Shader.cpp \
$(GRAPHICSDIR)/Texture.cpp \
$(GRAPHICSDIR)/Mesh.cpp \
$(GRAPHICSDIR)/GraphicsSystem.cpp \
$(INPUTDIR)/InputSystem.cpp \
OBJECTS = \
$(OBJDIR)/main.o \
$(OBJDIR)/Engine.o \
$(OBJDIR)/Program.o \
$(OBJDIR)/Shader.o \
$(OBJDIR)/Texture.o \
$(OBJDIR)/Mesh.o \
$(OBJDIR)/GraphicsSystem.o \
$(OBJDIR)/InputSystem.o \
$(OBJDIR)/PlatformManager.o \
DEPENDS = \
$(OBJDIR)/main.d \
$(OBJDIR)/Engine.d \
$(OBJDIR)/Program.d \
$(OBJDIR)/Shader.d \
$(OBJDIR)/Texture.d \
$(OBJDIR)/Mesh.d \
$(OBJDIR)/GraphicsSystem.d \
$(OBJDIR)/InputSystem.d \
$(OBJDIR)/PlatformManager.d \
.PHONY: clean
all: $(TARGETDIR) $(OBJDIR) ${TARGET}
# depend: $(DEPENDS)
$(TARGET): $(TARGETDIR) $(OBJDIR) $(OBJECTS)
$(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(LIBS)
$(OBJDIR):
@echo "Creating $(OBJDIR)"
@ mkdir -p $(OBJDIR)
$(TARGETDIR):
@echo "Creating $(TARGETDIR)"
@ mkdir -p $(TARGETDIR)
clean:
@echo "Cleaning program"
@ rm -f $(TARGET)
@ rm -rf $(OBJDIR)
run: ${TARGET}
./${TARGET}
$(OBJDIR)/%.o: $(SYSTEMDIR)/%.cpp
@echo $(notdir $<)
@ $(CXX) $(MAGICK) -o $@ -MF $(@:%.o=%.d) -c $(CXXFLAGS) $(COMPILER) $<
$(OBJDIR)/%.o: $(INPUTDIR)/%.cpp
@echo $(notdir $<)
@ $(CXX) $(MAGICK) -o $@ -MF $(@:%.o=%.d) -c $(CXXFLAGS) $(COMPILER) $<
$(OBJDIR)/%.o: $(GRAPHICSDIR)/%.cpp
@echo $(notdir $<)
@ $(CXX) $(MAGICK) -o $@ -MF $(@:%.o=%.d) -c $(CXXFLAGS) $(COMPILER) $<
# $(OBJDIR)/%.d: $(SYSTEMDIR)/%.cpp
# set -e; $(CC) -M $(MAGICK) $(CPPFLAGS) $< \
# | sed 's/\(obj\/$*\)\.o[ :]*/\1.o $@ : /g' > $@; \
# [ -s $@ ] || rm -f $@
# $(OBJDIR)/%.d: $(INPUTDIR)/%.cpp
# set -e; $(CC) -M $(MAGICK) $(CPPFLAGS) $< \
# | sed 's/\(obj\/$*\)\.o[ :]*/\1.o $@ : /g' > $@; \
# [ -s $@ ] || rm -f $@
# $(OBJDIR)/%.d: $(GRAPHICSDIR)/%.cpp
# set -e; $(CC) -M $(MAGICK) $(CPPFLAGS) $< \
# | sed 's/\(obj\/$*\)\.o[ :]*/\1.o $@ : /g' > $@; \
# [ -s $@ ] || rm -f $@
# include $(DEPENDS)
# # ----------------------- Compile AI Folder --------------------------------- #
# # ----------------------- Compile Audio Folder ------------------------------ #
# # ----------------------- Compile Game Folder ------------------------------ #
# # ----------------------- Compile Graphics Folder ------------------------------ #
# $(OBJDIR)/GraphicsSystem.o: $(GRAPHICSDIR)/GraphicsSystem.cpp
# @echo $(notdir $<)
# @ $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
# $(OBJDIR)/Program.o: $(GRAPHICSDIR)/Program.cpp
# @echo $(notdir $<)
# @ $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
# $(OBJDIR)/Shader.o: $(GRAPHICSDIR)/Shader.cpp
# @echo $(notdir $<)
# @ $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
# $(OBJDIR)/Mesh.o: $(GRAPHICSDIR)/Mesh.cpp
# @echo $(notdir $<)
# @ $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
# $(OBJDIR)/Texture.o: $(GRAPHICSDIR)/Texture.cpp
# @echo $(notdir $<)
# @ $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
# # $(OBJDIR)/%.o: $(GRAPHICSDIR)/%.cpp
# # $(CXX) $(MAGICK) -o $@ -c $(CXXFLAGS)$<
# # $(OBJDIR)/%.d: $(GRAPHICSDIR)/%.cpp
# # set -e; $(CC) -M $(MAGICK) $(CXXFLAGS) $< \
# # | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
# # [ -s $@ ] || rm -f $@
# # ----------------------- Compile HUD Folder ------------------------------ #
# # ----------------------- Compile Input Folder ------------------------------ #
# $(OBJDIR)/InputSystem.o: $(INPUTDIR)/InputSystem.cpp
# @echo $(notdir $<)
# @ $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
# # $(OBJDIR)/%.o: $(INPUTDIR)/%.cpp
# # $(CXX) $(MAGICK) -o $@ -c $(CXXFLAGS)$<
# # $(OBJDIR)/%.d: $(INPUTDIR)/%.cpp
# # set -e; $(CC) -M $(MAGICK) $(CXXFLAGS) $< \
# # | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
# # [ -s $@ ] || rm -f $@
# # ----------------------- Compile Networking Folder ------------------------------ #
# # ----------------------- Compile Particle Folder ------------------------------ #
# # ----------------------- Compile Physics Folder ------------------------------ #
# # ----------------------- Compile Resource Folder ------------------------------ #
# # ----------------------- Compile Scripting Folder ------------------------------ #
# # ----------------------- Compile System Folder ------------------------------- #
# $(OBJDIR)/main.o: $(SYSTEMDIR)/main.cpp
# @echo $(notdir $<)
# @ $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
# $(OBJDIR)/Engine.o: $(SYSTEMDIR)/Engine.cpp
# @echo $(notdir $<)
# @ $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
# $(OBJDIR)/PlatformManager.o: $(SYSTEMDIR)/PlatformManager.cpp
# @echo $(notdir $<)
# @ $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
# # $(OBJDIR)/%.o: $(SYSTEMDIR)/%.cpp
# # $(CXX) $(MAGICK) -o $@ -c $(CXXFLAGS)$<
# # $(OBJDIR)/%.d: $(SYSTEMDIR)/%.cpp
# # set -e; $(CC) -M $(MAGICK) $(CXXFLAGS) $< \
# # | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
# # [ -s $@ ] || rm -f $@
# # ----------------------- End of stuff -------------------------------------- #
# -include $(OBJECTS:%.o=%.d)