forked from Sphereserver/Source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile.alt
214 lines (186 loc) · 6.87 KB
/
makefile.alt
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
SHELL = /bin/bash
# Generic makefile
MARCH = -march=i686 -m32
OPTDEFAULT = -fno-omit-frame-pointer -ffast-math -fpermissive $(MARCH)
COPTDEFAULT = -fno-omit-frame-pointer -ffast-math $(MARCH)
OPT = -O0 -fno-expensive-optimizations $(OPTDEFAULT)
COPT = -O0 -fno-expensive-optimizations $(COPTDEFAULT)
WARN = -Wall -Wno-unknown-pragmas -Wno-invalid-offsetof -Wno-unused-but-set-variable -Wno-switch
CWARN = -Wall -Wno-unknown-pragmas -Wno-unused-but-set-variable -Wno-switch -Wno-implicit-function-declaration
ifdef DBG
DEBUG = -s -ggdb3
else
DEBUG = -s
endif
# DB includes + libs
DBINCL = -I/usr/include/mysql
DBLIBS = -lmysqlclient
# Linux
INCLUDE = -I./src/common $(DBINCL)
LIBS = -dynamic -L/usr/lib -lpthread $(DBLIBS) -lrt -ldl
DEFNIX = -D_LINUX
ifdef NIGHTLY
NIGHTLYDEFS = -D_NIGHTLYBUILD
# NIGHTLYDEFS = -D_NIGHTLYBUILD -DTHREAD_TRACK_CALLSTACK
endif
ifdef DBG
DEBUGDEFS = -D_DEBUG -DTHREAD_TRACK_CALLSTACK
DBGWARN = -Wno-unused-variable
# DEBUGDEFS = -D_DEBUG -D_PACKETDUMP -D_TESTEXCEPTION -DDEBUG_CRYPT_MSGS
endif
EXTRADEFS = -D_MTNETWORK
SVNDEFS = -D_SUBVERSION
DEFINES = -DGRAY_SVR -D_CONSOLE -D_REENTRANT $(DEFNIX) $(NIGHTLYDEFS) $(EXTRADEFS) $(DEBUGDEFS) $(SVNDEFS)
EXE = spheresvr
CC = g++
CCO = gcc
NO = -fno-rtti -fno-exceptions
EX = -fexceptions -fnon-call-exceptions
SPECIAL = $(EX) $(DEBUG)
GITHASHCMD = "$(shell git log -1 HEAD --format=%h)"
GITREVISIONCMD = $(shell echo $(shell git rev-list --count HEAD) + 410 | bc)
PROF = -pg
PIPE = -pipe
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/CClientGMPage.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/CResource.cpp \
./src/graysvr/CResourceCalc.cpp \
./src/graysvr/CResourceDef.cpp \
./src/graysvr/CSector.cpp \
./src/graysvr/CServer.cpp \
./src/graysvr/CServRef.cpp \
./src/graysvr/CWebPage.cpp \
./src/graysvr/CWorld.cpp \
./src/graysvr/CWorldImport.cpp \
./src/graysvr/CWorldMap.cpp \
./src/graysvr/graysvr.cpp \
./src/graysvr/PingServer.cpp \
./src/graysvr/UnixTerminal.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/CDataBase.cpp \
./src/common/CEncrypt.cpp \
./src/common/CExpression.cpp \
./src/common/CException.cpp \
./src/common/CacheableScriptFile.cpp \
./src/common/CFile.cpp \
./src/common/CFileList.cpp \
./src/common/CGrayData.cpp \
./src/common/CGrayInst.cpp \
./src/common/CGrayMap.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/CsvFile.cpp \
./src/common/CTime.cpp \
./src/common/CString.cpp \
./src/common/CVarDefMap.cpp \
./src/common/CVarFloat.cpp \
./src/common/ListDefContMap.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
O_FLAGS = $(WARN) $(DBGWARN) $(PIPE) $(SPECIAL)
CO_FLAGS = $(CWARN) $(DBGWARN) $(PIPE) $(SPECIAL)
C_FLAGS = $(OPT) $(INCLUDE) $(DEFINES)
CC_FLAGS = $(COPT) $(INCLUDE) $(DEFINES)
.PHONY: all clean tidy
all: $(EXE)
clean: tidy
rm -f ./src/graysvr/*.o ./src/common/*.o ./src/common/mtrand/*.o ./src/common/twofish/*.o ./src/common/libev/*.o ./src/common/zlib/*.o ./src/common/sqlite/*.o ./src/sphere/*.o ./src/network/*.o ./src/tests/*.o $(EXE)
tidy:
rm -f ./src/graysvr/*~ ./src/graysvr/*orig ./src/graysvr/*bak ./src/graysvr/*rej \
./src/common/*~ ./src/common/*orig ./src/common*bak \
./src/common/mtrand/*~ ./src/common/mtrand/*orig ./src/common/mtrand/*bak \
./src/common/twofish/*~ ./src/common/twofish/*orig ./src/common/twofish/*bak \
./src/common/libev/*~ ./src/common/libev/*orig ./src/common/libev/*bak \
./src/common/zlib/*~ ./src/common/zlib/*orig ./src/common/zlib/*bak \
./src/common/sqlite/*~ ./src/common/sqlite/*orig ./src/common/sqlite/*bak \
./src/sphere/*~ ./src/sphere/*orig ./src/sphere/*bak \
./src/network/*~ ./src/network/*orig ./src/network/*bak \
./src/tests/*~ ./src/tests/*orig ./src/tests/*bak
tags: $(SRC)
ctags $(SRC)
git:
@echo '#define __GITHASH__ ${GITHASHCMD}' > ./src/common/version/GitRevision.h
@echo '#define __GITREVISION__ ${GITREVISIONCMD}' >> ./src/common/version/GitRevision.h
@echo 'Git Hash is ${GITHASHCMD}. Revision No. is ${GITREVISIONCMD}'
gray: $(SRC:.cpp=.o) $(SRC:.c=.co)
flags:
@echo "Compiler Flags: $(CC) -c $(O_FLAGS) $(C_FLAGS)"
$(EXE): git flags gray
@$(CC) $(O_FLAGS) $(C_FLAGS) -o $(EXE) ./src/graysvr/*.o ./src/common/*.o ./src/common/twofish/*.o ./src/common/libev/*.o ./src/common/zlib/*.o ./src/common/sqlite/*.o ./src/sphere/*.o ./src/network/*.o $(LIBS)
%.o: %.cpp
@echo " Compiling $<"
@$(CC) -c $(O_FLAGS) $(C_FLAGS) $< -o $@
%.co: %.c
@echo " Compiling $<"
@$(CCO) -c $(CO_FLAGS) $(CC_FLAGS) $< -o $(@:.co=.o)