-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
450 lines (370 loc) · 16.8 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
#ter 20 set 2022 20:51:51 -03
ENDIAN?=LITTLE
STAT?=WITH_STATISTICS
AR=ar rcs
LD=ld -r -b binary
CC=gcc
STRIP=strip
CURDIR=$(PWD)
INCLUDEDIR=$(CURDIR)/include
#FLAG=-DWITH_ZLIB -DWITH_OPENSSL -DWITH_NOSERVEREQUEST -Wno-stringop-truncation
FLAG=-lpthread -Wno-stringop-truncation -D$(STAT) -DCWS_$(ENDIAN)_ENDIAN
DEBUG_FLAG=-g -fsanitize=address,leak -DSOAP_DEBUG $(FLAG)
TARG=cws
TARG_DBG=$(TARG)_debug
LIBANAME=cws
LIBDIR=$(CURDIR)/lib
MONGO_C_GIT=https://github.com/mongodb/mongo-c-driver.git
MONGO_C_BRANCH=1.28.1
MONGO_C_DIR=$(CURDIR)/third-party/mongo-c-driver
FLAG_JNI=-Wno-stringop-truncation -DJNI_RUSAGE_CHILDREN -DCWS_$(ENDIAN)_ENDIAN -D$(STAT)
LIBANAME_JNI=$(LIBANAME)_jni
LIBJNI=libjwitsmlparser21.so
JAVAINCLUDE=/usr/lib/jvm/java-11-openjdk-amd64/include
JAVAINCLUDE_LINUX=/usr/lib/jvm/java-11-openjdk-amd64/include/linux
EXECSTACK=execstack -c
LIBANAME_PY=$(LIBANAME)_py
FLAG_PY=-Wno-stringop-truncation -DJNI_RUSAGE_CHILDREN -DCWS_$(ENDIAN)_ENDIAN -D$(STAT)
LIBANAME_JS=$(LIBANAME)_js
FLAG_JS=-Wno-stringop-truncation -DJNI_RUSAGE_CHILDREN -DCWS_$(ENDIAN)_ENDIAN -D$(STAT)
TEST_DIR=$(CURDIR)/tests
TEST_C_DIR=$(TEST_DIR)/C
TEST_INCLUDE_DIR=$(TEST_C_DIR)/include
TEST_C_EXEC_NAME=testexec
all: main
cws_version.o:
@echo "Generating version ..."
@$(CC) -O2 $(CURDIR)/misc/versionBuilder.c $(CURDIR)/src/cws_utils.c $(CURDIR)/src/cws_bson_utils.c -I$(INCLUDEDIR) -o $(CURDIR)/misc/versionBuilder -L$(LIBDIR) -lbson-static-1.0 -Wall $(FLAG) -DVERGEN
cd $(CURDIR)/misc/;./versionBuilder
$(LD) -o $(CURDIR)/src/version_bson.o version.bson
cws_utils.o:
@echo "Build utilities for CWS for parsing ..."
@$(CC) -O2 -c $(CURDIR)/src/cws_utils.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_utils.o -Wall $(FLAG)
request_context.o:
@echo "Build request context for parsing ..."
@$(CC) -O2 -c $(CURDIR)/src/request_context.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/request_context.o -Wall $(FLAG)
wistml2bson_deserializer.o:
@echo "Build WITSML to BSON deserializer ..."
@$(CC) -O2 -c $(CURDIR)/src/wistml2bson_deserializer.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/wistml2bson_deserializer.o -Wall $(FLAG)
cws_soap.o:
@echo "Build CWS INTERNAL/EXTERNAL SOAP constructors/destructors ..."
@$(CC) -O2 -c $(CURDIR)/src/cws_soap.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_soap.o -Wall $(FLAG)
cws_memory.o:
@echo "Build memory management for CWS ..."
@$(CC) -O2 -c $(CURDIR)/src/cws_memory.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/cws_memory.o -Wall $(FLAG)
cws_bson_utils.o:
@echo "Build BSON utilities for CWS ..."
@$(CC) -O2 -c $(CURDIR)/src/cws_bson_utils.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_bson_utils.o -Wall $(FLAG)
lib$(LIBANAME).a: cws_version.o cws_utils.o request_context.o cws_memory.o cws_bson_utils.o cws_soap.o wistml2bson_deserializer.o
@echo "Build lib$(LIBANAME).a ..."
$(AR) $(LIBDIR)/lib$(LIBANAME).a $(CURDIR)/src/*.o -v
soapC.o:
@echo "Building soapC.o ... It can take a little time ..."
@$(CC) -O2 -c -o soapC.o soapC.c -Wall $(FLAG)
@echo "Finishing soapC.o"
soapC_shared.o:
@echo "Building soapC_shared.o ... It can take a little time ..."
@$(CC) -O2 -fPIC -c -o soapC_shared.o soapC.c -Wall $(FLAG)
@echo "Finishing soapC_shared.o"
wistml2bson_deserializer_debug.o:
@echo "Build WITSML to BSON deserializer (DEBUG) ..."
@$(CC) -O2 -c $(CURDIR)/src/wistml2bson_deserializer.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/wistml2bson_deserializer_debug.o -Wall $(DEBUG_FLAG)
cws_utils_debug.o:
@echo "Build utilities for CWS for parsing (DEBUG) ..."
@$(CC) -O2 -c $(CURDIR)/src/cws_utils.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_utils_debug.o -Wall $(DEBUG_FLAG)
request_context_debug.o:
@echo "Build request context for parsing (DEBUG) ..."
@$(CC) -O2 -c $(CURDIR)/src/request_context.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/request_context_debug.o -Wall $(DEBUG_FLAG)
cws_soap_debug.o:
@echo "Build CWS INTERNAL/EXTERNAL SOAP constructors/destructors (DEBUG) ..."
@$(CC) -O2 -c $(CURDIR)/src/cws_soap.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_soap_debug.o -Wall $(DEBUG_FLAG)
cws_memory_debug.o:
@echo "Build memory management for CWS (DEBUG) ..."
@$(CC) -O2 -c $(CURDIR)/src/cws_memory.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/cws_memory_debug.o -Wall $(DEBUG_FLAG)
cws_bson_utils_debug.o:
@echo "Build BSON utilities for CWS (DEBUG) ..."
@$(CC) -O2 -c $(CURDIR)/src/cws_bson_utils.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_bson_utils_debug.o -Wall $(DEBUG_FLAG)
lib$(LIBANAME)_debug.a: cws_version.o cws_utils_debug.o request_context_debug.o cws_memory_debug.o cws_bson_utils_debug.o cws_soap_debug.o wistml2bson_deserializer_debug.o
@echo "Build lib$(LIBANAME)_debug.a ..."
$(AR) $(LIBDIR)/lib$(LIBANAME)_debug.a $(CURDIR)/src/*.o -v
soapC_debug_sanitize.o:
@echo "Building soapC_debug_sanitize.o ... It can take a little time ..."
@$(CC) -O2 -c -o soapC_debug_sanitize.o soapC.c -Wall $(DEBUG_FLAG)
@echo "Finishing soapC_debug_sanitize.o"
###
soapC_shared_debug_sanitize.o:
@echo "Building soapC_shared_debug_sanitize.o ... It can take a little time ..."
@$(CC) -O2 -fPIC -c -o soapC_shared_debug_sanitize.o soapC.c -Wall $(DEBUG_FLAG)
@echo "Finishing soapC_shared_debug_sanitize.o"
main: soapC.o lib$(LIBANAME).a
@echo "Compiling ..."
@$(CC) -O2 -o $(TARG) main.c stdsoap2.c soapC.o soapServer.c -I$(INCLUDEDIR) -L$(LIBDIR) -lcws -lpthread -lbson-static-1.0 -Wall $(FLAG)
@echo "Finished"
dbg: soapC_debug_sanitize.o lib$(LIBANAME)_debug.a
@echo "Compiling in debug mode ..."
@$(CC) -O2 -o $(TARG_DBG) main.c stdsoap2.c soapC_debug_sanitize.o soapServer.c -I$(INCLUDEDIR) -L$(LIBDIR) -l$(LIBANAME)_debug -lpthread -lbson-static-1.0 -Wall $(DEBUG_FLAG)
@echo "Finished in debug mode."
##JNI ONLY SOAP INTERNAL
cws_utils_jni.o:
@echo "Build utilities for CWS for parsing (JNI) ..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/cws_utils.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_utils_jni.o -Wall $(FLAG_JNI)
request_context_jni.o:
@echo "Build request context for parsing (JNI)..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/request_context.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/request_context_jni.o -Wall $(FLAG_JNI)
wistml2bson_deserializer_jni.o:
@echo "Build WITSML to BSON deserializer (JNI) ..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/wistml2bson_deserializer.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/wistml2bson_deserializer_jni.o -Wall $(FLAG_JNI)
cws_soap_jni.o:
@echo "Build CWS INTERNAL/EXTERNAL SOAP constructors/destructors (JNI)..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/cws_soap.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_soap_jni.o -Wall $(FLAG_JNI)
cws_memory_jni.o:
@echo "Build memory management for CWS (JNI)..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/cws_memory.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/cws_memory_jni.o -Wall $(FLAG_JNI)
cws_bson_utils_jni.o:
@echo "Build BSON utilities for CWS (JNI)..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/cws_bson_utils.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_bson_utils_jni.o -Wall $(FLAG_JNI)
lib$(LIBANAME_JNI).a: cws_version.o cws_utils_jni.o request_context_jni.o wistml2bson_deserializer_jni.o cws_soap_jni.o cws_memory_jni.o cws_bson_utils_jni.o
@echo "Build lib$(LIBANAME_JNI).a for Java/Kotlin ..."
$(AR) $(LIBDIR)/lib$(LIBANAME_JNI).a $(CURDIR)/src/*.o -v
#PY
cws_utils_py.o:
@echo "Build utilities for CWS for parsing (Python) ..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/cws_utils.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_utils_py.o -Wall $(FLAG_PY)
request_context_py.o:
@echo "Build request context for parsing (Python)..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/request_context.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/request_context_py.o -Wall $(FLAG_PY)
wistml2bson_deserializer_py.o:
@echo "Build WITSML to BSON deserializer (Python) ..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/wistml2bson_deserializer.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/wistml2bson_deserializer_py.o -Wall $(FLAG_PY)
cws_soap_py.o:
@echo "Build CWS INTERNAL/EXTERNAL SOAP constructors/destructors (Python)..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/cws_soap.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_soap_py.o -Wall $(FLAG_PY)
cws_memory_py.o:
@echo "Build memory management for CWS (Python)..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/cws_memory.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/cws_memory_py.o -Wall $(FLAG_PY)
cws_bson_utils_py.o:
@echo "Build BSON utilities for CWS (Python)..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/cws_bson_utils.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_bson_utils_py.o -Wall $(FLAG_PY)
lib$(LIBANAME_PY).a: cws_version.o cws_utils_py.o request_context_py.o wistml2bson_deserializer_py.o cws_soap_py.o cws_memory_py.o cws_bson_utils_py.o
@echo "Build lib$(LIBANAME_PY).a for Python 3 ..."
$(AR) $(LIBDIR)/lib$(LIBANAME_PY).a $(CURDIR)/src/*.o -v
#NODE
cws_utils_js.o:
@echo "Build utilities for CWS for parsing (Node JS) ..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/cws_utils.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_utils_js.o -Wall $(FLAG_JS)
request_context_js.o:
@echo "Build request context for parsing (Node JS)..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/request_context.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/request_context_js.o -Wall $(FLAG_JS)
wistml2bson_deserializer_js.o:
@echo "Build WITSML to BSON deserializer (NodeJS) ..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/wistml2bson_deserializer.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/wistml2bson_deserializer_js.o -Wall $(FLAG_JS)
cws_soap_js.o:
@echo "Build CWS INTERNAL/EXTERNAL SOAP constructors/destructors (NodeJS)..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/cws_soap.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_soap_js.o -Wall $(FLAG_JS)
cws_memory_js.o:
@echo "Build memory management for CWS (NodeJS)..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/cws_memory.c -I$(INCLUDEDIR) -I$(CURDIR) -o $(CURDIR)/src/cws_memory_js.o -Wall $(FLAG_JS)
cws_bson_utils_js.o:
@echo "Build BSON utilities for CWS (NodeJS)..."
@$(CC) -O2 -fPIC -c $(CURDIR)/src/cws_bson_utils.c -I$(INCLUDEDIR) -o $(CURDIR)/src/cws_bson_utils_js.o -Wall $(FLAG_JS)
lib$(LIBANAME_JS).a: cws_version.o cws_utils_js.o request_context_js.o wistml2bson_deserializer_js.o cws_soap_js.o cws_memory_js.o cws_bson_utils_js.o
@echo "Build lib$(LIBANAME_JS).a for Node JS (>= 16.20.2) ..."
$(AR) $(LIBDIR)/lib$(LIBANAME_JS).a $(CURDIR)/src/*.o -v
.PHONY:
clean:
ifneq ("$(wildcard $(CURDIR)/misc/versionBuilder)","")
@echo "Removing versionBuilder ..."
rm -v $(CURDIR)/misc/versionBuilder
else
@echo "Nothing to do with versionBuilder"
endif
ifneq ("$(wildcard $(CURDIR)/src/*.o)","")
@echo "Removing objects ..."
rm -v $(CURDIR)/src/*.o
else
@echo "Nothing to do with objects"
endif
ifneq ("$(wildcard $(CURDIR)/$(TARG_DBG))","")
@echo "Removing main $(TARG_DBG)..."
rm -v $(CURDIR)/$(TARG_DBG)
else
@echo "Nothing to do $(TARG_DBG)"
endif
ifneq ("$(wildcard $(CURDIR)/$(TARG))","")
@echo "Removing main $(TARG)..."
rm -v $(CURDIR)/$(TARG)
else
@echo "Nothing to do $(TARG)"
endif
ifneq ("$(wildcard $(LIBDIR)/lib$(LIBANAME).a)","")
@echo "Removing lib$(LIBANAME).a..."
rm -v $(LIBDIR)/lib$(LIBANAME).a
else
@echo "Nothing to do $(LIBDIR)/lib$(LIBANAME).a"
endif
ifneq ("$(wildcard $(LIBDIR)/lib$(LIBANAME)_debug.a)","")
@echo "Removing lib$(LIBANAME)_debug.a..."
rm -v $(LIBDIR)/lib$(LIBANAME)_debug.a
else
@echo "Nothing to do $(LIBDIR)/lib$(LIBANAME)_debug.a"
endif
ifneq ("$(wildcard $(LIBDIR)/lib$(LIBANAME_JNI).a)","")
@echo "Removing lib$(LIBANAME_JNI).a..."
rm -v $(LIBDIR)/lib$(LIBANAME_JNI).a
else
@echo "Nothing to do $(LIBDIR)/lib$(LIBANAME_JNI).a"
endif
ifneq ("$(wildcard $(LIBDIR)/lib$(LIBANAME_PY).a)","")
@echo "Removing lib$(LIBANAME_PY).a..."
rm -v $(LIBDIR)/lib$(LIBANAME_PY).a
else
@echo "Nothing to do $(LIBDIR)/lib$(LIBANAME_PY).a"
endif
ifneq ("$(wildcard $(LIBDIR)/lib$(LIBANAME_JS).a)","")
@echo "Removing lib$(LIBANAME_JS).a..."
rm -v $(LIBDIR)/lib$(LIBANAME_JS).a
else
@echo "Nothing to do $(LIBDIR)/lib$(LIBANAME_JS).a"
endif
ifneq ("$(wildcard $(CURDIR)/build)","")
@echo "Removing Python 3 and/or NodeJS library $(CURDIR)/build ..."
rm -frv $(CURDIR)/build
else
@echo "Nothing to do $(CURDIR)/build"
endif
ifneq ("$(wildcard $(CURDIR)/*.log)","")
@echo "Removing debug logs ..."
rm -iv $(CURDIR)/*.log
else
@echo "Nothing to do with logs"
endif
ifneq ("$(wildcard $(CURDIR)/*.bson)","")
@echo "Removing BSON files ..."
rm -v $(CURDIR)/*.bson
else
@echo "Nothing to do with BSON files"
endif
ifneq ("$(wildcard $(CURDIR)/$(LIBJNI))","")
@echo "Removing shared object $(LIBJNI) ..."
rm -v $(CURDIR)/$(LIBJNI)
else
@echo "Nothing to do with $(LIBJNI)"
endif
ifneq ("$(wildcard $(CURDIR)/examples/*.json)","")
@echo "Removing json files example ..."
rm -v $(CURDIR)/examples/*.json
else
@echo "Nothing to do with examples/*.json"
endif
ifneq ("$(wildcard $(CURDIR)/examples/*.bson)","")
@echo "Removing BSON files example ..."
rm -v $(CURDIR)/examples/*.bson
else
@echo "Nothing to do with examples/*.bson"
endif
ifneq ("$(wildcard $(TEST_C_DIR)/*.o)","")
@echo "Checking C objects (TEST) ..."
rm -v $(TEST_C_DIR)/*.o
else
@echo "Nothing to do with C test objects"
endif
ifneq ("$(wildcard $(TEST_C_DIR)/$(TEST_C_EXEC_NAME))","")
@echo "Checking C test executable $(TEST_C_EXEC_NAME) (TEST) ..."
rm -v $(TEST_C_DIR)/$(TEST_C_EXEC_NAME)
else
@echo "Nothing to do with $(TEST_C_EXEC_NAME)"
endif
.PHONY:
pre_remove:
ifneq ("$(wildcard $(CURDIR)/soapC.o)","")
@echo "Removing soapC.o ..."
rm -v $(CURDIR)/soapC.o
else
@echo "Nothing to do with soapC.o"
endif
ifneq ("$(wildcard $(CURDIR)/soapC_debug_sanitize.o)","")
@echo "Removing object soapC_debug_sanitize.o ..."
rm -v $(CURDIR)/soapC_debug_sanitize.o
else
@echo "Nothing to do with soapC_debug_sanitize.o"
endif
ifneq ("$(wildcard $(CURDIR)/soapC_shared.o)","")
@echo "Removing object soapC_shared.o ..."
rm -v $(CURDIR)/soapC_shared.o
else
@echo "Nothing to do with soapC_shared.o"
endif
ifneq ("$(wildcard $(CURDIR)/soapC_shared_debug_sanitize.o)","")
@echo "Removing object soapC_shared_debug_sanitize.o ..."
rm -v $(CURDIR)/soapC_shared_debug_sanitize.o
else
@echo "Nothing to do with soapC_shared_debug_sanitize.o"
endif
.PHONY:
pre: soapC.o soapC_debug_sanitize.o
.PHONY:
pre_shared: soapC_shared.o soapC_shared_debug_sanitize.o
#JNI ONLY SOAP INTERNAL
.PHONY:
jni: lib$(LIBANAME_JNI).a
@echo "Compiling $(LIBJNI)..."
@$(CC) -O2 -shared -fPIC -o $(LIBJNI) src/jni/parser.c stdsoap2.c soapC_shared.o soapServer.c -I$(INCLUDEDIR) -I$(JAVAINCLUDE) -I$(JAVAINCLUDE_LINUX) -L$(LIBDIR) -lcws_jni -lpthread -lbson-shared-1.0 -Wall $(FLAG_JNI)
@echo "Striping $(LIBJNI) ..."
@$(STRIP) $(LIBJNI)
@echo "Disabling execstack ..."
@$(EXECSTACK) $(LIBJNI)
@echo "Unchecking executable library ..."
@chmod -x $(LIBJNI)
@echo "Finished"
#PYTHON ONLY SOAP INTERNAL
.PHONY:
py: lib$(LIBANAME_PY).a
@echo "Compiling Python 3 module ..."
@python3 setup.py build
@echo "Finished"
#NODEJS ONLY SOAP INTERNAL
.PHONY:
nodejs: lib$(LIBANAME_JS).a
@echo "Compiling NodeJS (>= v16.20.2) module ..."
@node-gyp configure #--thin=yes --verbose
@node-gyp build #--thin=yes --verbose
@echo "Finished"
.PHONY:
install_bson:
@echo "Check if mongo-c-driver directory exists ..."
ifneq ("$(wildcard $(MONGO_C_DIR))","")
@echo "Already cloned. Skip"
else
@echo "Cloning branch $(MONGO_C_BRANCH) from $(MONGO_C_GIT)"
pwd; cd $(CURDIR)/third-party; pwd; git clone -b $(MONGO_C_BRANCH) $(MONGO_C_GIT); cd mongo-c-driver;mkdir compiled && cd compiled; cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_MONGOC=OFF -DCMAKE_INSTALL_PREFIX=$(MONGO_C_DIR)/compiled/out; make -j12;make install; pwd; cp out/lib/libbson-static-1.0.a $(LIBDIR) -v;cp -frv out/include/libbson-1.0/bson $(INCLUDEDIR);cd src/libbson/CMakeFiles/bson_shared.dir; pwd; ar rcs $(LIBDIR)/libbson-shared-1.0.a src/bson/*.o src/jsonsl/*.o __/common/*.o
endif
remove_bson:
ifneq ("$(wildcard $(LIBDIR)/lib*.a)","")
@echo "Removing BSON library"
rm -v $(LIBDIR)/lib*.a
@echo "Removed"
else
@echo "Nothing to do to remove BSON library"
endif
ifneq ("$(wildcard $(INCLUDEDIR)/bson)","")
@echo "Removing BSON includes $(INCLUDEDIR)/bson"
rm -rfv $(INCLUDEDIR)/bson
@echo "Removed BSON includes $(INCLUDEDIR)/bson"
else
@echo "Nothing to do to remove BSON includes $(INCLUDEDIR)/bson"
endif
ifneq ("$(wildcard $(MONGO_C_DIR))","")
@echo "Removing Mongo C branch $(MONGO_C_BRANCH)"
rm -rfv $(MONGO_C_DIR)
@echo "Removed Mongo C $(MONGO_C_BRANCH)"
else
@echo "Nothing to do to remove Mongo C $(MONGO_C_BRANCH)"
endif
#TESTS
pointers_assert:
@echo "Building C pointer assert (TEST)"
@$(CC) -c -O2 $(TEST_C_DIR)/pointers_assert.c -I$(INCLUDEDIR) -I$(TEST_INCLUDE_DIR) -I$(CURDIR) -L$(LIBDIR) -lpthread -lbson-static-1.0 -o $(TEST_C_DIR)/pointers_assert.o -Wall $(DEBUG_FLAG)
test: lib$(LIBANAME)_debug.a pointers_assert
@echo "Build C test (TEST) ..."
@$(CC) -O2 $(TEST_C_DIR)/main.c $(CURDIR)/src/ctest/asserts.c $(TEST_C_DIR)/pointers_assert.o stdsoap2.c soapC_debug_sanitize.o soapServer.c -I$(TEST_INCLUDE_DIR) -I$(INCLUDEDIR) -I$(CURDIR) -L$(LIBDIR) -l$(LIBANAME)_debug -lpthread -lbson-static-1.0 -o $(TEST_C_DIR)/$(TEST_C_EXEC_NAME) -Wall $(DEBUG_FLAG)
@$(TEST_C_DIR)/./$(TEST_C_EXEC_NAME)