-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (32 loc) · 1.05 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
CXX = g++
CXXFLAGS = -std=c++11 -Wall -Wextra
INCLUDES = -I./include -I/usr/include/freetype2
LIBS = -lGL -lglut -lGLU -lfreetype
SRC_DIR = src
OBJ_DIR = obj
BIN_DIR = bin
SOURCES = $(wildcard $(SRC_DIR)/*.cpp) \
$(wildcard $(SRC_DIR)/engine/*.cpp) \
$(wildcard $(SRC_DIR)/states/*.cpp) \
$(wildcard $(SRC_DIR)/gameName/*.cpp) \
$(wildcard $(SRC_DIR)/gameName/states/*.cpp) \
$(wildcard $(SRC_DIR)/gameName/substates/*.cpp)
OBJECTS = $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SOURCES))
EXECUTABLE = $(BIN_DIR)/PhloxEngine
.PHONY: all clean copy_assets
all: $(EXECUTABLE) copy_assets
$(EXECUTABLE): $(OBJECTS)
@mkdir -p $(BIN_DIR)
$(CXX) $(CXXFLAGS) $(INCLUDES) $^ -o $@ $(LIBS)
copy_assets:
@mkdir -p $(BIN_DIR)/assets
@cp -r assets/* $(BIN_DIR)/assets/
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
clean:
rm -rf $(OBJ_DIR) $(BIN_DIR)
-include $(OBJECTS:.o=.d)
$(OBJ_DIR)/%.d: $(SRC_DIR)/%.cpp
@mkdir -p $(@D)
@$(CXX) $(CXXFLAGS) $(INCLUDES) -MM -MT $(@:.d=.o) $< > $@