forked from Sphereserver/Source
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
182 lines (164 loc) · 5.41 KB
/
makefile
File metadata and controls
182 lines (164 loc) · 5.41 KB
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
MAKEFLAGS := -j$(shell nproc)
TARGET := spheresvr
CXX := g++ -std=c++14
CC := gcc
OVERALL_FLAGS := -pipe
OPTIMIZATION_FLAGS := -O2 -ffast-math -flto=auto -fno-omit-frame-pointer -fno-strict-aliasing
DEBUG_FLAGS :=
CODE_GEN_FLAGS := -fexceptions -fnon-call-exceptions
ARCH_FLAGS := -m64 -Dx64
CPPFLAGS := -D_THREAD_TRACK_CALLSTACK
ifdef DEBUG
CPPFLAGS += -D_DEBUG
DEBUG_FLAGS += -ggdb3
endif
ifdef NIGHTLY
CPPFLAGS += -D_NIGHTLYBUILD
endif
WARN_CXXFLAGS := -Wall -Wno-aggressive-loop-optimizations -Wno-lto-type-mismatch -Wno-return-local-addr
WARN_CFLAGS := -Wall -Wno-implicit-function-declaration -Wno-misleading-indentation -Wno-unused-result
CXXFLAGS := $(OVERALL_FLAGS) $(OPTIMIZATION_FLAGS) $(DEBUG_FLAGS) $(CODE_GEN_FLAGS) $(ARCH_FLAGS) $(CPPFLAGS) $(WARN_CXXFLAGS)
CFLAGS := $(OVERALL_FLAGS) $(OPTIMIZATION_FLAGS) $(DEBUG_FLAGS) $(CODE_GEN_FLAGS) $(ARCH_FLAGS) $(CPPFLAGS) $(WARN_CFLAGS)
LDLIBS := -lmysqlclient -lpthread -ldl
LDFLAGS := -pthread -L/usr/lib/mysql
ifndef DEBUG
LDFLAGS += -s
endif
SRC := ./src/graysvr/CAccount.cpp \
./src/graysvr/CBase.cpp \
./src/graysvr/CChar.cpp \
./src/graysvr/CCharAct.cpp \
./src/graysvr/CCharBase.cpp \
./src/graysvr/CCharFight.cpp \
./src/graysvr/CCharNPC.cpp \
./src/graysvr/CCharNPCAct.cpp \
./src/graysvr/CCharNPCPet.cpp \
./src/graysvr/CCharNPCStatus.cpp \
./src/graysvr/CCharSkill.cpp \
./src/graysvr/CCharSpell.cpp \
./src/graysvr/CCharStatus.cpp \
./src/graysvr/CCharUse.cpp \
./src/graysvr/CChat.cpp \
./src/graysvr/CClient.cpp \
./src/graysvr/CClientDialog.cpp \
./src/graysvr/CClientEvent.cpp \
./src/graysvr/CClientLog.cpp \
./src/graysvr/CClientMsg.cpp \
./src/graysvr/CClientTarg.cpp \
./src/graysvr/CClientUse.cpp \
./src/graysvr/CContain.cpp \
./src/graysvr/CGMPage.cpp \
./src/graysvr/CItem.cpp \
./src/graysvr/CItemBase.cpp \
./src/graysvr/CItemMulti.cpp \
./src/graysvr/CItemMultiCustom.cpp \
./src/graysvr/CItemShip.cpp \
./src/graysvr/CItemSpawn.cpp \
./src/graysvr/CItemStone.cpp \
./src/graysvr/CItemVend.cpp \
./src/graysvr/CLog.cpp \
./src/graysvr/CObjBase.cpp \
./src/graysvr/CParty.cpp \
./src/graysvr/CPathFinder.cpp \
./src/graysvr/CPingServer.cpp \
./src/graysvr/CResource.cpp \
./src/graysvr/CResourceCalc.cpp \
./src/graysvr/CResourceDef.cpp \
./src/graysvr/CSector.cpp \
./src/graysvr/CServer.cpp \
./src/graysvr/CServRef.cpp \
./src/graysvr/CUnixTerminal.cpp \
./src/graysvr/CWebPage.cpp \
./src/graysvr/CWorld.cpp \
./src/graysvr/CWorldImport.cpp \
./src/graysvr/CWorldMap.cpp \
./src/graysvr/graysvr.cpp \
./src/common/twofish/twofish2.cpp \
./src/common/libev/wrapper_ev.c \
./src/common/zlib/adler32.c \
./src/common/zlib/compress.c \
./src/common/zlib/crc32.c \
./src/common/zlib/deflate.c \
./src/common/zlib/gzclose.c \
./src/common/zlib/gzlib.c \
./src/common/zlib/gzread.c \
./src/common/zlib/gzwrite.c \
./src/common/zlib/infback.c \
./src/common/zlib/inffast.c \
./src/common/zlib/inflate.c \
./src/common/zlib/inftrees.c \
./src/common/zlib/trees.c \
./src/common/zlib/uncompr.c \
./src/common/zlib/zutil.c \
./src/common/CArray.cpp \
./src/common/CAssoc.cpp \
./src/common/CCacheableScriptFile.cpp \
./src/common/CCSVFile.cpp \
./src/common/CDataBase.cpp \
./src/common/CEncrypt.cpp \
./src/common/CExpression.cpp \
./src/common/CException.cpp \
./src/common/CFile.cpp \
./src/common/CFileList.cpp \
./src/common/CGrayData.cpp \
./src/common/CGrayInst.cpp \
./src/common/CGrayMap.cpp \
./src/common/CListDefMap.cpp \
./src/common/CMD5.cpp \
./src/common/CQueue.cpp \
./src/common/CRect.cpp \
./src/common/CRegion.cpp \
./src/common/CResourceBase.cpp \
./src/common/CScript.cpp \
./src/common/CScriptObj.cpp \
./src/common/CSectorTemplate.cpp \
./src/common/CSocket.cpp \
./src/common/CTime.cpp \
./src/common/CString.cpp \
./src/common/CVarDefMap.cpp \
./src/common/CVarFloat.cpp \
./src/common/graycom.cpp \
./src/common/sqlite/SQLite.cpp \
./src/common/sqlite/sqlite3.c \
./src/sphere/mutex.cpp \
./src/sphere/strings.cpp \
./src/sphere/threads.cpp \
./src/sphere/linuxev.cpp \
./src/sphere/asyncdb.cpp \
./src/sphere/ProfileData.cpp \
./src/network/network.cpp \
./src/network/packet.cpp \
./src/network/send.cpp \
./src/network/receive.cpp
OBJS := $(patsubst %.cpp,%.o,$(filter %.cpp,$(SRC))) \
$(patsubst %.c,%.o,$(filter %.c,$(SRC)))
.PHONY: all clean flags revision
all: $(TARGET)
clean:
@rm -f $(TARGET)
@find . -name "*.o" -type f -delete
flags:
@echo 'Compiler flags: $(CXX) $(CXXFLAGS)'
revision: flags
@VERSIONING_FILE="./src/common/version/GitRevision.h"; \
mkdir -p $$(dirname "$${VERSIONING_FILE}"); \
echo "// This file is auto-generated. Do not edit." > "$${VERSIONING_FILE}"; \
if [ "$$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then \
GITREVISION=$$(expr $$(git rev-list --count HEAD) - 2406); \
GITHASH=$$(git rev-parse --short HEAD); \
echo "#define __GITREVISION__ $${GITREVISION}" >> "$${VERSIONING_FILE}"; \
echo "#define __GITHASH__ \"$${GITHASH}\"" >> "$${VERSIONING_FILE}"; \
echo "Current build revision: $${GITREVISION} (Git hash: $${GITHASH})"; \
else \
echo "// Versioning disabled (not a git repository)" >> "$${VERSIONING_FILE}"; \
fi
$(OBJS): revision
$(TARGET): $(OBJS)
@$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LDLIBS)
@echo ' $(lastword $(MAKEFILE_LIST)) -> $(shell readlink -f $(TARGET))'
%.o: %.cpp
@echo ' $(notdir $<)'
@$(CXX) -c $(CXXFLAGS) $< -o $@
%.o: %.c
@echo ' $(notdir $<)'
@$(CC) -c $(CFLAGS) $< -o $@