/
Makefile
executable file
·491 lines (360 loc) · 11.1 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
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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
# Copyright (C) 2017 Claude SIMON (http://q37.info/contact/).
#
# This file is part of XDHq.
#
# XDHq is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# XDHq 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
# Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with XDHq. If not, see <http://www.gnu.org/licenses/>.
name = xdhqxdh
# Epeios general debugging features
copt += -DE_DEBUG
# Required for multitasking
#copt += -DE_MT
# For using <setjmp.h> instead of C++ exceptions.
#copt += -DERR_JMPUSE
mods += ags aem bch bitbch bomhdl
mods += bso cdgb64 cio cpe crptgr
mods += cslio crt ctn dir dte
mods += dtfbsc dtfptb epsmsc err fdr
mods += fil flf flsq flw flx
mods += fnm ias idsq iof iop
mods += lcl lck lst lstbch lstcrt
mods += lstctn mns mtk mtx ntvstr
mods += osd que rgstry rnd sdr
mods += stkbse stkbch stkcrt stkctn str
mods += strng stsfsm tagsbs tht thtsub
mods += tol txf tys uys utf
mods += xml xpp xtf llio dlbrry
mods += plgn plgncore btr cdgurl cnvfdr
mods += idxbtr idxque idxbtq logq ltf
mods += sck strmrg
mods += csdrcc csdbnc csdbns csdcmn csdmnc
mods += csdmxb csdmxc csdscb
mods += fblcmd fblcst fblfep fblfph fblfrd
mods += fblfrp fblovl fbltyp
mods += scla scli sclm scle scll
mods += sclr sclf
mods += xdhcdc xdhcmn xdhcuc xdhdws xdhutl
mods += faas faasbckd faasbkds faasdpot faasgate
mods += faaspool
mods += plugins prtcl
mods += common registry slfhlead session
pmods += pllio
wmods += wllio
##############################
# Common to all environment. #
##############################
# Generates debugging data.
#CXXFLAGS += -g
# General optimization.
CXXFLAGS += -O
# To use with gprof
#CXXFLAGS += -pg
###############################
win=win
win32=win32
win64=win64
IA_32=x86
AMD64=x64
Cygwin=Cygwin
MinGW=Msys
GNULinux=GNU/Linux
FreeBSD=FreeBSD
Linux=Linux
MacOS=Darwin
Android=Android
os=$(shell uname -o 2>/dev/null || uname -s)
mach=$(shell uname -m)
ifdef Q37_EPEIOS
src += :..
src += :../..
endif
##########################
# For Cygwin environment #
##########################
ifeq ("$(os)","$(Cygwin)")
# By default, vanilla Cygwin compiler ('g++') is used.
# Resulting application uses the Cygwin POSIX Layer.
# directly the MS CRT, see below.
# Use of the MinGW compiler under Cygwin.
# To build native binary, i.e. with the MS CRT,
# without using the Cygwin/POSIX layer,
# Uncomment follwing line :
#target=$(win)
endif
##########################
#########################
# For MinGW environment #
#########################
ifeq ("$(os)", "$(MinGW)")
co += -fpermissive
endif
#########################
#############################
# For GNU/Linux environment #
#############################
ifeq ("$(os)","$(GNULinux)")
# By default, 'CXX' is set to 'g++'.
# CXX = clang++
endif
#############################
###########################
# For FreeBSD environment #
###########################
ifeq ("$(os)","$(FreeBSD)")
# By default, 'CXX' is set to 'clang++'.
# CXX = g++
endif
###########################
#########################
# For Linux environment #
#########################
ifeq ("$(os)","$(Linux)")
endif
#############################
##########################
# For MacOS environment #
##########################
ifeq ("$(os)","$(MacOS)")
endif
##########################
####################################
# For Android (Termux) environment #
####################################
ifeq ("$(os)","$(Android)")
endif
#############################
###################################
###################################
##### DON'T MODIFY BELOW !!! ######
###################################
###################################
##########################
# For Cygwin environment #
##########################
ifeq ("$(os)","$(Cygwin)")
co += -std=gnu++11 -DUNICODE -D_FILE_OFFSET_BITS=64
ifneq ("$(target)","$(Android)")
libs += -lws2_32
LDFLAGS += -static
endif
ifeq ("$(target)","$(win)")
ifeq ("$(mach)","i686")
override target=$(win32)
else # 'ifeq' on other line due to GNU 3.80 (Maemo on N900)
ifeq ("$(mach)","x86_64")
override target=$(win64)
endif
endif
endif
ifeq ("$(target)","$(IA_32)")
override target=$(win32)
else # 'ifeq' on other line due to GNU 3.80 (Maemo on N900)
ifeq ("$(target)","$(AMD64)")
override target=$(win64)
endif
endif
ifeq ("$(target)","$(win32)")
CXX = i686-w64-mingw32-g++
mods += $(wmods)
lo += -municode -m32
co += -m32
else # 'ifeq' on other line due to GNU 3.80 (Maemo on N900)
ifeq ("$(target)","$(win64)")
CXX = x86_64-w64-mingw32-g++
mods += $(wmods)
lo += -municode -m64
co += -m64
else
ifeq ("$(target)","$(Android)")
CXX = C:/Users/csimon/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
mods += $(pmods)
binary=lib$(name).so
lo += -target i686-none-linux-android -gcc-toolchain C:/Users/csimon/AppData/Local/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64 --sysroot=C:/Users/csimon/AppData/Local/Android/sdk/ndk-bundle/platforms/android-14/arch-x86 -fPIC -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -fno-exceptions -fno-rtti -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -fno-exceptions -fno-rtti -fexceptions -std=c++11 -O0 -fno-limit-debug-info -O0 -fno-limit-debug-info -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared
co += -target i686-none-linux-android -gcc-toolchain C:/Users/csimon/AppData/Local/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64 --sysroot=C:/Users/csimon/AppData/Local/Android/sdk/ndk-bundle/platforms/android-14/arch-x86 -DXXX_DEBUG -Ih:/hg/epeios/stable -isystem C:/Users/csimon/AppData/Local/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:/Users/csimon/AppData/Local/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include -isystem C:/Users/csimon/AppData/Local/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -fno-rtti -fexceptions -std=c++11 -O0 -fno-limit-debug-info -fPIC -MD
libs += -ldl -landroid -llog -lm "C:/Users/csimon/AppData/Local/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/libgnustl_static.a"
else
mods += $(pmods)
endif
endif
endif
ifneq ("$(target)","$(Android)")
binary=$(name).dll
lo += -Wl,--kill-at -shared
endif
dest=/cygdrive/h/bin/
endif
##########################
#########################
# For MinGW environment #
#########################
ifeq ("$(os)", "$(MinGW)")
co += -DMSYS -std=gnu++11 -DUNICODE
lo += -municode
mods += $(wmods)
LDFLAGS += -static
ifeq ("$(target)","$(IA_32)")
co += -m32
lo += -m32
else # 'ifeq' on other line due to GNU 3.80 (Maemo on N900).
ifeq ("$(arch)","$(AMD64)")
co += -m64
lo += -m64
endif
endif
binary=$(name).dll
lo += -Wl,--kill-at -shared
dest=/h/bin/
endif
#########################
#############################
# For GNU/Linux environment #
#############################
ifeq ("$(os)","$(GNULinux)")
co += -std=gnu++11 -DUNICODE -D_FILE_OFFSET_BITS=64
mods += $(pmods)
libs += -lpthread -ldl -lrt
ifeq ("$(target)","$(IA_32)")
co += -m32
lo += -m32
else # 'ifeq' on other line due to GNU 3.80 (Maemo on N900).
ifeq ("$(target)","$(AMD64)")
co += -m64
lo += -m64
endif
endif
binary=lib$(name).so
lo += -shared
co += -fPIC
dest=/home/csimon/bin/
endif
#############################
###########################
# For FreeBSD environment #
###########################
ifeq ("$(os)","$(FreeBSD)")
co += -std=gnu++11 -DUNICODE -D_FILE_OFFSET_BITS=64
mods += $(pmods)
libs += -lpthread -ldl -lrt
ifeq ("$(target)","$(IA_32)")
co += -m32
lo += -m32
else # 'ifeq' on other line due to GNU 3.80 (Maemo on N900).
ifeq ("$(target)","$(AMD64)")
co += -m64
lo += -m64
endif
endif
binary=lib$(name).so
lo += -shared
co += -fPIC
dest=/home/csimon/bin/
endif
###########################
#########################
# For Linux environment #
#########################
ifeq ("$(os)","$(Linux)")
co += -std=gnu++11 -DUNICODE -D_FILE_OFFSET_BITS=64
mods += $(pmods)
libs += -lpthread -ldl -lrt
ifeq ("$(target)","$(IA_32)")
co += -m32
lo += -m32
else # 'ifeq' on other line due to GNU 3.80 (Maemo on N900).
ifeq ("$(target)","$(AMD64)")
co += -m64
lo += -m64
endif
endif
binary=lib$(name).so
lo += -shared
co += -fPIC
endif
#############################
##########################
# For MacOS environment #
##########################
ifeq ("$(os)","$(MacOS)")
co += -std=gnu++11 -DUNICODE -D_FILE_OFFSET_BITS=64
mods += $(pmods)
ifeq ("$(target)","$(IA_32)")
co += -m32
lo += -m32
else # 'ifeq' on other line due to GNU 3.80 (Maemo on N900).
ifeq ("$(target)","$(AMD64)")
co += -m64
lo += -m64
endif
endif
binary=lib$(name).dylib
lo += -dynamiclib
dest=/Users/csimon/bin/
endif
##########################
####################################
# For Android (Termux) environment #
####################################
ifeq ("$(os)","$(Android)")
co += -std=gnu++11 -DUNICODE -D_FILE_OFFSET_BITS=64
mods += $(pmods)
libs += -lpthread -ldl -lrt
ifeq ("$(target)","$(IA_32)")
co += -m32
lo += -m32
else # 'ifeq' on other line due to GNU 3.80 (Maemo on N900).
ifeq ("$(target)","$(AMD64)")
co += -m64
lo += -m64
endif
endif
binary=lib$(name).so
lo += -shared
co += -fPIC
endif
#############################
all: $(binary)
rm -rf *.o
ifeq ("$(target)","$(Android)")
rm -rf *.d
endif
copt += -DVERSION=\""20230704"\"
copt += -DCOPYRIGHT_YEARS=\""2017"\"
copt += -DIDENTIFIER=\""5f3ad6c6-4f0d-428d-9c00-678e1ed3967f"\"
ifndef Q37_EPEIOS
src += :src:src/epeios
out = ./
else
src += :$(Q37_EPEIOS)/stable
out = $(dest)
endif
ox = o
ds = :
vpath %.cpp $(subst $(ds),:,$(src))
vpath %.mm $(subst $(ds),:,$(src))
srcd = $(subst $(ds), ,$(src))
co := -c $(co) $(copt) $(subst :, -I,$(src))
lo += -o $(binary) $(objs)
objs = $(name).$(ox) $(mods:=.$(ox))
$(binary): $(objs)
$(CXX) $(lo) $(libs) $(LDFLAGS)
ifdef Q37_EPEIOS
mkdir -p $(out)
cp $(binary) $(out)
endif
%.$(ox): %.cpp
$(CXX) $(CPPFLAGS) $(co) $(CXXFLAGS) $<
clean:
rm -rf *.o
ifeq ("$(target)","$(Android)")
rm -rf *.d
endif