forked from ReMinecraftPE/mcpe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakefileMinGW
86 lines (65 loc) · 2.35 KB
/
MakefileMinGW
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
# ReMinecraftPE - Makefile for MinGW
# User Settings
EMULATE_VBOS ?= no
ifeq ($(EMULATE_VBOS), yes)
VBO_EMULATION_FLAG = -DUSE_GL_VBO_EMULATION
endif
# Commonly included directories.
SRC_DIR=source
BLD_DIR=build
RKN_DIR=thirdparty/raknet
ZLB_DIR=thirdparty/zlib
PLT_DIR=platforms
TGL_DIR=thirdparty/GL
# Target executable's name.
TARGET=minecraftcpp.exe
# Compilation flags for C++ source files
CXXFLAGS=-Isource -I. -Ithirdparty/raknet -Ithirdparty/zlib -DUSE_MATH_DEFINES -DSHA1_HAS_TCHAR -DHANDLE_CHARS_SEPARATELY -DUSE_WIN32_THREADS -DLOCKLESS_TYPES_USE_MUTEX -DNDEBUG -O3 -mno-sse -mno-sse2 -mno-mmx -march=i386 -MMD $(VBO_EMULATION_FLAG)
# Compilation flags for zlib source files
ZLIBFLAGS=-O3 -I. -MMD -Ithirdparty/stb_image/include
# Link flags
LINKFLAGS=-lopengl32 -lws2_32 -lglu32 -lgdi32 -ldsound -ldxguid -luuid -static-libgcc -mwindows
#include everything in source/, plus certain files from platforms
SRC_FILES = $(shell find $(SRC_DIR) -name '*.cpp')
PLT_FILES = $(shell find $(PLT_DIR)/windows -name '*.cpp')
RKN_FILES = $(shell find $(RKN_DIR) -name '*.cpp')
TGL_FILES = $(shell find $(TGL_DIR) -name '*.cpp')
ZLB_FILES = $(shell find $(ZLB_DIR) -name '*.c')
OBJ_FILES = \
$(patsubst $(SRC_DIR)/%,$(BLD_DIR)/s/%,$(SRC_FILES:.cpp=.o)) \
$(patsubst $(PLT_DIR)/%,$(BLD_DIR)/p/%,$(PLT_FILES:.cpp=.o)) \
$(patsubst $(RKN_DIR)/%,$(BLD_DIR)/r/%,$(RKN_FILES:.cpp=.o)) \
$(patsubst $(TGL_DIR)/%,$(BLD_DIR)/g/%,$(TGL_FILES:.cpp=.o)) \
$(patsubst $(ZLB_DIR)/%,$(BLD_DIR)/z/%,$(ZLB_FILES:.c=.o)) \
build/t/stb_image_impl.o
DEP_FILES = $(OBJ_FILES:.o=.d))
#default target.
.PHONY = all
all: program
#link rules for the executable
$(TARGET): $(OBJ_FILES)
$(CXX) -o $@ $^ $(LINKFLAGS)
#include header dependencies
-include $(DEP_FILES)
$(BLD_DIR)/p/%.o: $(PLT_DIR)/%.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(BLD_DIR)/g/%.o: $(TGL_DIR)/%.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(BLD_DIR)/r/%.o: $(RKN_DIR)/%.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(BLD_DIR)/z/%.o: $(ZLB_DIR)/%.c
@mkdir -p $(dir $@)
$(CC) $(ZLIBFLAGS) -c -o $@ $<
$(BLD_DIR)/s/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(BLD_DIR)/t/%.o: thirdparty/stb_image/src/%.c
@mkdir -p $(dir $@)
$(CC) $(ZLIBFLAGS) -c -o $@ $<
program: $(TARGET)
clean:
rm -rf $(BLD_DIR)
rm -rf minecraftcpp