-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
53 lines (42 loc) · 1.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
CXX := g++
CXXFLAGS := -Wall -O0 -g -std=c++17 -MMD -MP
SRCDIR := src
OBJDIR := build/obj
INCL := include
LIBDIR := lib
LDFLAGS := -g
LDLIBS := -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf -lassimp
MKDIR := mkdir
ifeq ($(OS),Windows_NT)
OUT := bin/main.exe
LDLIBS += -lmingw32 -lopengl32 -lglew32
#LDFLAGS += -mwindows
else
OUT := bin/main.run
INCL :=
LDLIBS += -lGL -lGLEW
MKDIR += -p
endif
SRCS := DataStore/GPUAllocator.cpp \
Main/main.cpp Main/Game.cpp Main/ScaledDeltaTimer.cpp \
Scene/InGameScene.cpp \
Model/Mesh/Mesh3D.cpp Model/WindowInfo.cpp Model/FrameParams.cpp Model/LightParams.cpp Model/Material/MaterialParams.cpp Model/ModelLoader.cpp \
Init/SDLInit.cpp Init/GlewInit.cpp \
Manager/WindowManager.cpp Manager/SceneManager.cpp \
Helper/Program.cpp Helper/UniformBuffer.cpp Helper/Shader.cpp Helper/Utility.cpp \
Program/Mesh3DColor.cpp
OBJNAMES := $(SRCS:.cpp=.o)
OBJS := $(addprefix $(OBJDIR)/,$(OBJNAMES))
BUILD_DIRS := $(patsubst %/,%,$(sort $(dir $(OBJS))))
all : $(OUT)
.PHONY: clean all
$(OBJS): $(OBJDIR)/%.o : $(SRCDIR)/%.cpp | $(BUILD_DIRS)
$(CXX) $< -c $(CXXFLAGS) -o $@
$(OUT) : $(OBJS)
$(CXX) $^ $(LDFLAGS) $(LDLIBS) -o $(OUT)
$(BUILD_DIRS):
$(MKDIR) "$@"
clean :
$(RM) "$(OUT)"
$(RM) -r "$(OBJDIR)"
-include $(OBJS:.o=.d)