forked from brodock/sunuo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
362 lines (283 loc) · 11.9 KB
/
Makefile
File metadata and controls
362 lines (283 loc) · 11.9 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
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
#
# SunUO
# $Id$
#
# (c) 2005-2006 Max Kellermann <max@duempel.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
MCS := mcs
SUNUO_BASE = $(HOME)/dl/runuo
VERSION := $(shell perl -ne 'print "$$1\n" if /^sunuo \((.*?)\)/' NEWS |head -1)
DISTDIR = build/sunuo-$(VERSION)
DISTDLL = MySql.Data.dll
DIST_FILES = bin/mono/log4net.dll bin/mono/Npgsql.dll
MCS_FLAGS += -define:MONO -debug -lib:lib
CP_FLAGS = -lf
SUNUO_SOURCES := $(shell find src -name "*.cs" )
SUNLOGIN_SOURCES := src/AssemblyInfo.cs $(shell find login -name "*.cs" ) $(shell find src/Network/Encryption -name "*.cs" )
SUNLOGIN_SOURCES += src/Network/MessagePump.cs src/Network/ByteQueue.cs src/Network/PacketReader.cs src/Network/Listener.cs src/Network/SendQueue.cs src/Network/BufferPool.cs src/Network/PacketWriter.cs src/ClientVersion.cs src/Config.cs src/Timer.cs src/Insensitive.cs src/Network/PacketProfile.cs src/Attributes.cs src/Network/Compression.cs src/Network/PacketHandler.cs
SCRIPTS = legacy reports remote-admin myrunuo profiler
SCRIPTS_DLL = $(patsubst %,build/scripts/%.dll,$(SCRIPTS))
export MONO_PATH := .:lib
ifeq ($(DEBIAN),1)
export MONO_PATH := $(MONO_PATH):/usr/lib/cli/log4net-1.2
else
LOG4NET_DEPS := lib/log4net.dll
endif
ifeq ($(PORTABLE),1)
DIST_FILES += bin/w32/SunUO.exe bin/w32/zlib.dll bin/w32/log4net.dll bin/w32/Npgsql.dll
DIST_FILES += bin/w64/SunUO.exe bin/w64/zlib.dll bin/w64/log4net.dll bin/w64/Npgsql.dll
endif
.PHONY: all core debian-all clean install
all: core build/SunLogin.exe build/UOGQuery.exe $(SCRIPTS_DLL)
core: build/SunUO.exe
debian-all: core $(SCRIPTS_DLL) docs
clean:
rm -f doc/sunuo.html
rm -rf build
install: all
install -d -m 0755 $(SUNUO_BASE) $(SUNUO_BASE)/etc $(SUNUO_BASE)/local $(SUNUO_BASE)/local/lib
install -m 0755 run.sh build/SunUO.exe $(SUNUO_BASE)/
test -f build/SunUO.exe.mdb && install -m 0644 build/SunUO.exe.mdb $(SUNUO_BASE)/
test -f $(SUNUO_BASE)/SunUO.exe.config || install -m 0644 conf/SunUO.exe.config $(SUNUO_BASE)/
test -f $(SUNUO_BASE)/SunLogin.exe.config || install -m 0644 conf/SunLogin.exe.config $(SUNUO_BASE)/
test -f $(SUNUO_BASE)/etc/sunuo.xml || install -m 0644 conf/sunuo.xml $(SUNUO_BASE)/etc/
install -m 0644 $(addprefix lib/,$(DISTDLL)) $(SUNUO_BASE)/
install -m 0644 $(SCRIPTS_DLL) $(SUNUO_BASE)/local/lib/
# compile targets
build/SunUO.exe: $(SUNUO_SOURCES) $(LOG4NET_DEPS)
@mkdir -p $(dir $@)
@rm -f $@.mdb
$(MCS) $(MCS_FLAGS) -out:$@ -r:log4net.dll $(SUNUO_SOURCES)
build/SunLogin.exe: $(SUNLOGIN_SOURCES) build/MySql.Data.dll $(LOG4NET_DEPS)
@mkdir -p $(dir $@)
@rm -f $@.mdb
$(MCS) $(MCS_FLAGS) -out:$@ -r:System.Data.dll -r:MySql.Data -r:log4net.dll $(SUNLOGIN_SOURCES)
build/UOGQuery.exe: util/UOGQuery.cs
@mkdir -p $(dir $@)
@rm -f $@.mdb
$(MCS) $(MCS_FLAGS) -out:$@ util/UOGQuery.cs
build/scripts/legacy.dll: LIBS = System.Web.dll System.Data.dll log4net.dll
build/scripts/legacy.dll: build/SunUO.exe
@mkdir -p $(dir $@)
$(MCS) $(MCS_FLAGS) -target:library -out:$@ -lib:build $(addprefix -r:,$(LIBS)) -r:SunUO.exe -recurse:'scripts/legacy/*.cs'
build/scripts/reports.dll: LIBS = System.Drawing.dll System.Web.dll System.Windows.Forms.dll log4net.dll
build/scripts/reports.dll: build/SunUO.exe build/scripts/legacy.dll
@mkdir -p $(dir $@)
$(MCS) $(MCS_FLAGS) -target:library -out:$@ -lib:build $(addprefix -r:,$(LIBS)) -r:SunUO.exe -lib:build/scripts -r:legacy.dll -recurse:'scripts/reports/*.cs'
build/scripts/remote-admin.dll: LIBS = log4net.dll
build/scripts/remote-admin.dll: build/SunUO.exe build/scripts/legacy.dll
@mkdir -p $(dir $@)
$(MCS) $(MCS_FLAGS) -target:library -out:$@ -lib:build $(addprefix -r:,$(LIBS)) -r:SunUO.exe -lib:build/scripts -r:legacy.dll -recurse:'scripts/remote-admin/*.cs'
build/scripts/myrunuo.dll: LIBS = System.Data.dll log4net.dll
build/scripts/myrunuo.dll: build/SunUO.exe build/scripts/legacy.dll
@mkdir -p $(dir $@)
$(MCS) $(MCS_FLAGS) -target:library -out:$@ -lib:build $(addprefix -r:,$(LIBS)) -r:SunUO.exe -lib:build/scripts -r:legacy.dll -recurse:'scripts/myrunuo/*.cs'
build/scripts/profiler.dll: build/SunUO.exe build/scripts/legacy.dll
@mkdir -p $(dir $@)
$(MCS) $(MCS_FLAGS) -target:library -out:$@ -lib:build -r:SunUO.exe -lib:build/scripts -r:legacy.dll -recurse:'scripts/profiler/*.cs'
# dist targets
.PHONY: dist
dist: build/dist/sunuo-$(VERSION).zip build/dist/sunuo-$(VERSION)-src.zip
$(addprefix $(DISTDIR)/,COPYING AUTHORS README NEWS): $(DISTDIR)/%: %
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
$(DISTDIR)/bin/mono/SunUO.exe: $(DISTDIR)/bin/mono/%: build/%
@mkdir -p $(dir $@)
test -f $<.mdb && cp $(CP_FLAGS) $<.mdb $@.mdb
cp $(CP_FLAGS) $< $@
$(DISTDIR)/SunUO.exe.config: conf/SunUO.exe.config
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
$(DISTDIR)/run.sh $(DISTDIR)/run.bat $(DISTDIR)/run64.bat: $(DISTDIR)/%: %
@mkdir -p $(dir $@)
install -m 0755 $< $@
$(DISTDIR)/etc/sunuo.xml: conf/sunuo.xml
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
$(DISTDIR)/SunLogin.exe.config: conf/SunLogin.exe.config
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
$(addprefix $(DISTDIR)/,$(DISTDLL)): $(DISTDIR)/%: lib/%
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
$(DISTDIR)/bin/mono/Npgsql.dll: $(DISTDIR)/bin/mono/%: lib/%
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
$(DISTDIR)/bin/mono/log4net.dll: $(DISTDIR)/bin/mono/%: lib/%
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
ifeq ($(PORTABLE),1)
build/w32/SunUO.exe:
@mkdir -p $(dir $@)
scp jaguar:svn/sunuo/build/32/SunUO.{exe,pdb} $(dir $@)
build/w64/SunUO.exe:
@mkdir -p $(dir $@)
scp jaguar:svn/sunuo/build/64/SunUO.{exe,pdb} $(dir $@)
$(DISTDIR)/bin/w32/SunUO.exe: build/w32/SunUO.exe
@mkdir -p $(dir $@)
cp $(CP_FLAGS) build/w32/SunUO.exe build/w32/SunUO.pdb $(dir $@)
$(DISTDIR)/bin/w32/zlib.dll: $(DISTDIR)/bin/%: lib/%
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
$(DISTDIR)/bin/w32/Npgsql.dll: $(DISTDIR)/bin/%: lib/%
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
$(DISTDIR)/bin/w32/log4net.dll: $(DISTDIR)/bin/%: lib/%
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
$(DISTDIR)/bin/w64/SunUO.exe: build/w64/SunUO.exe
@mkdir -p $(dir $@)
cp $(CP_FLAGS) build/w64/SunUO.exe build/w64/SunUO.pdb $(dir $@)
$(DISTDIR)/bin/w64/zlib.dll: $(DISTDIR)/bin/%: lib/%
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
$(DISTDIR)/bin/w64/Npgsql.dll: $(DISTDIR)/bin/%: lib/%
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
$(DISTDIR)/bin/w64/log4net.dll: $(DISTDIR)/bin/%: lib/%
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
endif
.PHONY: export-scripts export-data export-saves
export-scripts:
rm -rf $(DISTDIR)/Scripts $(DISTDIR)/local/src/profiler
@mkdir -p $(DISTDIR)/local/src
svn export scripts/legacy $(DISTDIR)/Scripts
svn export scripts/profiler $(DISTDIR)/local/src/profiler
export-data:
rm -rf $(DISTDIR)/Data
svn export data $(DISTDIR)/Data
export-saves:
rm -rf $(DISTDIR)/Saves
svn export saves $(DISTDIR)/Saves
build/dist/sunuo-$(VERSION).zip: $(addprefix $(DISTDIR)/,bin/mono/SunUO.exe SunUO.exe.config run.sh run.bat run64.bat sunuo.html COPYING AUTHORS README NEWS etc/sunuo.xml $(DISTDLL) $(DIST_FILES)) export-scripts export-data export-saves
@mkdir -p $(dir $@)
cd build && fakeroot zip -q -r $(shell pwd)/$@ sunuo-$(VERSION)
.PHONY: svn-export
svn-export:
@rm -rf build/tmp
@mkdir -p build/tmp
svn export . build/tmp/sunuo-$(VERSION)-src
build/dist/sunuo-$(VERSION)-src.zip: svn-export
@mkdir -p build/tmp/sunuo-$(VERSION)-src/lib/w32
cp $(addprefix lib/,$(DISTDLL)) build/tmp/sunuo-$(VERSION)-src/lib/
cp lib/w32/zlib.dll build/tmp/sunuo-$(VERSION)-src/lib/w32/
@mkdir -p $(dir $@)
cd build/tmp && fakeroot zip -q -r $(shell pwd)/$@ sunuo-$(VERSION)-src
@rm -rf build/tmp
# auto-download targets
ifneq ($(DEBIAN),1)
download/mysql-connector-net-1.0.7-noinstall.zip:
@mkdir -p $(dir $@)
wget http://sunsite.informatik.rwth-aachen.de/mysql/Downloads/Connector-Net/mysql-connector-net-1.0.7-noinstall.zip -O $@.tmp
mv $@.tmp $@
lib/MySql.Data.dll: download/mysql-connector-net-1.0.7-noinstall.zip
rm -rf build/tmp && mkdir -p build/tmp
unzip -q -d build/tmp $<
@mkdir -p $(dir $@)
cp build/tmp/bin/mono-1.0/release/MySql.Data.dll lib/
rm -rf build/tmp
download/Npgsql1.0-bin-mono1.1.tar.bz2:
@mkdir -p $(dir $@)
wget http://pgfoundry.org/frs/download.php/1099/Npgsql1.0-bin-mono1.1.tar.bz2 -O $@.tmp
mv $@.tmp $@
download/Npgsql1.0-bin-ms1.1.tar.bz2:
@mkdir -p $(dir $@)
wget http://pgfoundry.org/frs/download.php/1105/Npgsql1.0-bin-ms1.1.tar.bz2 -O $@.tmp
mv $@.tmp $@
download/Npgsql1.0-bin-ms2.0.tar.bz2:
@mkdir -p $(dir $@)
wget http://pgfoundry.org/frs/download.php/1109/Npgsql1.0-bin-ms2.0.tar.bz2 -O $@.tmp
mv $@.tmp $@
lib/Npgsql.dll: download/Npgsql1.0-bin-mono1.1.tar.bz2
rm -rf build/tmp && mkdir -p build/tmp
tar xjfC $< build/tmp
@mkdir -p $(dir $@)
cp build/tmp/Npgsql1.0/Npgsql/bin/mono1.1/Npgsql.dll lib/
rm -rf build/tmp
lib/w32/Npgsql.dll: download/Npgsql1.0-bin-ms1.1.tar.bz2
rm -rf build/tmp && mkdir -p build/tmp
tar xjfC $< build/tmp
@mkdir -p $(dir $@)
cp build/tmp/Npgsql1.0/Npgsql/bin/ms1.1/Npgsql.dll lib/w32/
rm -rf build/tmp
lib/w64/Npgsql.dll: download/Npgsql1.0-bin-ms2.0.tar.bz2
rm -rf build/tmp && mkdir -p build/tmp
tar xzfC $< build/tmp
@mkdir -p $(dir $@)
cp build/tmp/Npgsql1.0/Npgsql/bin/ms2.0/Npgsql.dll lib/w64/
rm -rf build/tmp
download/incubating-log4net-1.2.10.zip:
@mkdir -p $(dir $@)
wget http://archive.apache.org/dist/incubator/log4net/1.2.10/incubating-log4net-1.2.10.zip -O $@.tmp
mv $@.tmp $@
lib/log4net.dll lib/w32/log4net.dll lib/w64/log4net.dll: download/incubating-log4net-1.2.10.zip
rm -rf build/tmp && mkdir -p build/tmp
unzip -q -d build/tmp $<
@mkdir -p lib/w32 lib/w64
cp build/tmp/log4net-1.2.10/bin/mono/1.0/release/log4net.dll lib/
cp build/tmp/log4net-1.2.10/bin/net/1.1/release/log4net.dll lib/w32
cp build/tmp/log4net-1.2.10/bin/net/2.0/release/log4net.dll lib/w64
rm -rf build/tmp
$(addprefix build/,$(DISTDLL)): build/%: lib/%
@mkdir -p $(dir $@)
cp $(CP_FLAGS) $< $@
download/zlib123-dll.zip:
@mkdir -p $(dir $@)
wget http://www.gzip.org/zlib/zlib123-dll.zip -O $@.tmp
mv $@.tmp $@
lib/w32/zlib.dll: download/zlib123-dll.zip
rm -rf build/tmp && mkdir -p build/tmp
unzip -q -d build/tmp $<
@mkdir -p $(dir $@)
cp build/tmp/zlib1.dll $@
rm -rf build/tmp
download/zlib123dllx64.zip:
@mkdir -p $(dir $@)
wget http://www.winimage.com/zLibDll/zlib123dllx64.zip -O $@.tmp
mv $@.tmp $@
lib/w64/zlib.dll: download/zlib123dllx64.zip
rm -rf build/tmp && mkdir -p build/tmp
unzip -q -d build/tmp $<
@mkdir -p $(dir $@)
cp build/tmp/dll_x64/zlibwapi.lib $@
rm -rf build/tmp
endif
# documentation targets
.PHONY: docs
docs: doc/sunuo.html
doc/sunuo.html: doc/sunuo.xml
xmlto -v -o $(dir $@) xhtml-nochunks $<
$(DISTDIR)/sunuo.html: doc/sunuo.html
cp $(CP_FLAGS) $< $@
# release targets
export:
rm -rf /mnt/misc/sunuo /mnt/misc/runuo/SunUO.exe
svn export . /mnt/misc/sunuo
release: all docs
rm -rf /tmp/sunuo
mkdir -p /tmp/sunuo
svn export . /tmp/sunuo/sunuo-$(VERSION)
cd /tmp/sunuo && fakeroot zip -qr sunuo-$(VERSION).zip sunuo-$(VERSION)
cd /tmp/sunuo && fakeroot tar cjf sunuo-$(VERSION).tar.bz2 sunuo-$(VERSION)
mkdir -p /tmp/sunuo/sunuo-$(VERSION)-bin
cp AUTHORS COPYING NEWS README doc/sunuo.html /tmp/sunuo/sunuo-$(VERSION)-bin
cp NEWS /tmp/sunuo/sunuo-$(VERSION)-bin/NEWS
cp src/SunUO.exe util/UOGQuery.exe /tmp/sunuo/sunuo-$(VERSION)-bin
cd /tmp/sunuo && fakeroot zip -qr sunuo-$(VERSION)-bin.zip sunuo-$(VERSION)-bin
upload: docs
scp README NEWS doc/sunuo.html max@swift:/var/www/gzipped/download/sunuo/doc/
ssh max@swift chmod a+rX -R /var/www/gzipped/download/sunuo/doc/