-
Notifications
You must be signed in to change notification settings - Fork 25
/
makefile.osx
368 lines (249 loc) · 10.4 KB
/
makefile.osx
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
# -*- makefile -*-
# Makefile for Generic Unix with GCC compiler
FAULT_TOLERANT=0
# Default install directory
PREFIX ?= /usr/local
# Place where to copy GastDB header files
INCSPATH=$(PREFIX)/include/fastdb
#Place where to copy Fastdb library
LIBSPATH=$(PREFIX)/lib
#Place where to copy Fastdb subsql utility
BINSPATH=$(PREFIX)/bin
ifdef NO_PTHREADS
OBJS = class.o compiler.o database.o xml.o hashtab.o file.o symtab.o ttree.o rtree.o container.o \
cursor.o query.o wwwapi.o unisock.o sync.o localcli.o stdtp.o
else
OBJS = class.o compiler.o database.o xml.o hashtab.o file.o symtab.o ttree.o rtree.o container.o \
cursor.o query.o wwwapi.o unisock.o sync.o localcli.o stdtp.o server.o
endif
CLI_OBJS = cli.o unisock.o repsock.o stdtp.o
INCS = inc/fastdb.h inc/stdtp.h inc/config.h inc/class.h inc/database.h inc/cursor.h inc/reference.h inc/wwwapi.h \
inc/cli.h inc/array.h inc/file.h inc/hashtab.h inc/ttree.h inc/rtree.h inc/container.h inc/sync.h inc/sync_unix.h \
inc/query.h inc/datetime.h inc/harray.h inc/timeseries.h inc/rectangle.h inc/exception.h
#
# threads settings - please comment this lines for single-threaded libs
#
ifdef NO_PTHREADS
TFLAGS=-DNO_PTHREADS
THRLIBS=
SUFF=
else
TFLAGS=-pthread
THRLIBS=
SUFF=_r
endif
STDLIBS = -lm $(THRLIBS)
SOCKLIBS =
VERSION=2
FASTDB_LIB = libfastdb$(SUFF).a
FASTDB_SHARED = libfastdb$(SUFF).${VERSION}.dylib
CLI_LIB = libcli$(SUFF).a
CLI_SHARED = libcli$(SUFF).${VERSION}.dylib
EXES = subsql forcerecovery cleanupsem
#FASTDB_LIBS=-L. -lfastdb$(SUFF)
#CLI_LIBS=-L. -lcli$(SUFF)
FASTDB_LIBS=$(FASTDB_LIB)
CLI_LIBS=$(CLI_LIB)
EXAMPLES = guess testdb testleak testjoin testddl testperf testsync testconc testiref testtrav testidx clitest clitest2 testalter testraw localclitest testharr testspat testtl
WEB_EXAMPLES = cgistub bugdb clidb
CC = g++
# DEFS macro is deprecatred, edit inc/config.h file instead
DEFS =
#CFLAGS = $(TFLAGS) -c -Iinc -Wall -O5 -g -fPIC $(DEFS)
CFLAGS = -c -Iinc -Wall -O0 -g -fPIC $(DEFS) $(TFLAGS)
#CFLAGS = -c -Iinc -Wall -O0 -fPIC -DFASTDB_DEBUG=DEBUG_TRACE -g $(DEFS) $(TFLAGS)
#SHFLAGS=-shared -Wl,-soname,$@
SHFLAGS=-dynamiclib
LD = $(CC)
LDFLAGS = -g $(TFLAGS)
AR = ar
ARFLAGS = -cru
RANLIB = ranlib
ifneq (0,$(FAULT_TOLERANT))
STDLIBS += $(SOCKLIBS)
DEFS += -DREPLICATION_SUPPORT
endif
all: static shared bins
static: $(FASTDB_LIB) $(CLI_LIB)
shared: $(FASTDB_SHARED) $(CLI_SHARED)
bins: $(EXES) $(EXAMPLES)
www: $(FASTDB_SHARED) $(WEB_EXAMPLES)
class.o: src/class.cpp inc/compiler.h inc/compiler.d inc/symtab.h $(INCS)
$(CC) $(CFLAGS) src/class.cpp
compiler.o: src/compiler.cpp inc/compiler.h inc/compiler.d inc/symtab.h $(INCS)
$(CC) $(CFLAGS) src/compiler.cpp
query.o: src/query.cpp inc/compiler.h inc/compiler.d inc/symtab.h $(INCS)
$(CC) $(CFLAGS) src/query.cpp
database.o: src/database.cpp inc/compiler.h inc/compiler.d inc/symtab.h $(INCS)
$(CC) $(CFLAGS) src/database.cpp
xml.o: src/xml.cpp inc/compiler.h inc/compiler.d inc/symtab.h $(INCS)
$(CC) $(CFLAGS) src/xml.cpp
localcli.o: src/localcli.cpp inc/compiler.h inc/compiler.d inc/symtab.h inc/localcli.h $(INCS)
$(CC) $(CFLAGS) src/localcli.cpp
cursor.o: src/cursor.cpp inc/compiler.h inc/compiler.d $(INCS)
$(CC) $(CFLAGS) src/cursor.cpp
hashtab.o: src/hashtab.cpp $(INCS)
$(CC) $(CFLAGS) src/hashtab.cpp
file.o: src/file.cpp $(INCS)
$(CC) $(CFLAGS) src/file.cpp
stdtp.o: src/stdtp.cpp $(INCS)
$(CC) $(CFLAGS) src/stdtp.cpp
sync.o: src/sync.cpp $(INCS)
$(CC) $(CFLAGS) src/sync.cpp
symtab.o: src/symtab.cpp inc/symtab.h $(INCS)
$(CC) $(CFLAGS) src/symtab.cpp
ttree.o: src/ttree.cpp $(INCS)
$(CC) $(CFLAGS) src/ttree.cpp
rtree.o: src/rtree.cpp $(INCS)
$(CC) $(CFLAGS) src/rtree.cpp
container.o: src/container.cpp $(INCS)
$(CC) $(CFLAGS) src/container.cpp
wwwapi.o: src/wwwapi.cpp inc/wwwapi.h inc/sockio.h inc/stdtp.h inc/sync.h inc/config.h inc/sync_unix.h
$(CC) $(CFLAGS) src/wwwapi.cpp
unisock.o: src/unisock.cpp inc/unisock.h inc/sockio.h inc/stdtp.h
$(CC) $(CFLAGS) src/unisock.cpp
repsock.o: src/repsock.cpp inc/unisock.h inc/sockio.h inc/stdtp.h inc/sync.h inc/sync_unix.h inc/config.h
$(CC) $(CFLAGS) src/repsock.cpp
cli.o: src/cli.cpp inc/cli.h inc/cliproto.h
$(CC) $(CFLAGS) src/cli.cpp
$(FASTDB_LIB): $(OBJS)
rm -f $(FASTDB_LIB)
$(AR) $(ARFLAGS) $(FASTDB_LIB) $(OBJS)
$(RANLIB) $(FASTDB_LIB)
$(FASTDB_SHARED): $(OBJS)
rm -f $(FASTDB_SHARED)
$(CC) $(SHFLAGS) -o $(FASTDB_SHARED) $(OBJS) $(THRLIBS)
ln -f -s $(FASTDB_SHARED) libfastdb$(SUFF).so
$(CLI_LIB): $(CLI_OBJS)
rm -f $(CLI_LIB)
$(AR) $(ARFLAGS) $(CLI_LIB) $(CLI_OBJS)
$(RANLIB) $(CLI_LIB)
$(CLI_SHARED): $(CLI_OBJS)
rm -f $(CLI_SHARED)
$(CC) $(SHFLAGS) -o $(CLI_SHARED) $(CLI_OBJS) $(THRLIBS)
ln -f -s $(CLI_SHARED) libcli$(SUFF).so
clitest.o: examples/clitest.c inc/cli.h
$(CC) $(CFLAGS) examples/clitest.c
clitest: clitest.o $(CLI_LIB)
$(LD) $(LDFLAGS) -o clitest clitest.o $(CLI_LIBS) $(STDLIBS) $(SOCKLIBS)
clitest2.o: examples/clitest2.c inc/cli.h
$(CC) $(CFLAGS) examples/clitest2.c
clitest2: clitest2.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o clitest2 clitest2.o $(FASTDB_LIB) $(STDLIBS)
testalter.o: examples/testalter.c inc/cli.h
$(CC) $(CFLAGS) examples/testalter.c
testalter: testalter.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testalter testalter.o $(FASTDB_LIB) $(STDLIBS)
localclitest: clitest.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o localclitest clitest.o $(FASTDB_LIB) $(STDLIBS)
subsql.o: src/subsql.cpp inc/subsql.h inc/compiler.h inc/compiler.d inc/symtab.h $(INCS)
$(CC) $(CFLAGS) src/subsql.cpp
server.o: src/server.cpp inc/server.h inc/cli.h inc/cliproto.h inc/subsql.h inc/compiler.h inc/compiler.d inc/symtab.h $(INCS)
$(CC) $(CFLAGS) src/server.cpp
subsql: subsql.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o subsql subsql.o $(FASTDB_LIBS) $(STDLIBS) $(SOCKLIBS)
bugdb.o: examples/bugdb.cpp examples/bugdb.h $(INCS)
$(CC) $(CFLAGS) examples/bugdb.cpp
bugdb: bugdb.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o bugdb bugdb.o $(FASTDB_LIBS) $(STDLIBS) $(SOCKLIBS)
clidb.o: examples/clidb.cpp examples/clidb.h $(INCS)
$(CC) $(CFLAGS) examples/clidb.cpp
clidb: clidb.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o clidb clidb.o $(FASTDB_LIBS) $(STDLIBS) $(SOCKLIBS)
cgistub.o: src/cgistub.cpp inc/stdtp.h inc/sockio.h
$(CC) $(CFLAGS) src/cgistub.cpp
cgistub: cgistub.o
$(LD) $(LDFLAGS) -o cgistub cgistub.o $(FASTDB_LIBS) $(STDLIBS) $(SOCKLIBS)
forcerecovery.o: src/forcerecovery.cpp inc/database.h
$(CC) $(CFLAGS) src/forcerecovery.cpp
forcerecovery: forcerecovery.o
$(LD) $(LDFLAGS) -o forcerecovery forcerecovery.o
cleanupsem.o: src/cleanupsem.cpp inc/database.h
$(CC) $(CFLAGS) src/cleanupsem.cpp
cleanupsem: cleanupsem.o
$(LD) $(LDFLAGS) -o cleanupsem cleanupsem.o
guess.o: examples/guess.cpp $(INCS)
$(CC) $(CFLAGS) examples/guess.cpp
guess: guess.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o guess guess.o $(FASTDB_LIBS) $(STDLIBS)
testharr.o: examples/testharr.cpp $(INCS)
$(CC) $(CFLAGS) examples/testharr.cpp
testharr: testharr.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testharr testharr.o $(FASTDB_LIBS) $(STDLIBS)
testdb.o: examples/testdb.cpp $(INCS)
$(CC) $(CFLAGS) examples/testdb.cpp
testdb: testdb.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testdb testdb.o $(FASTDB_LIBS) $(STDLIBS)
testraw.o: examples/testraw.cpp $(INCS)
$(CC) $(CFLAGS) examples/testraw.cpp
testraw: testraw.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testraw testraw.o $(FASTDB_LIBS) $(STDLIBS)
testleak.o: examples/testleak.cpp $(INCS)
$(CC) $(CFLAGS) examples/testleak.cpp
testleak: testleak.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testleak testleak.o $(FASTDB_LIBS) $(STDLIBS)
testjoin.o: examples/testjoin.cpp $(INCS)
$(CC) $(CFLAGS) examples/testjoin.cpp
testjoin: testjoin.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testjoin testjoin.o $(FASTDB_LIBS) $(STDLIBS)
testddl.o: examples/testddl.cpp $(INCS)
$(CC) $(CFLAGS) examples/testddl.cpp
testddl: testddl.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testddl testddl.o $(FASTDB_LIBS) $(STDLIBS)
testperf.o: examples/testperf.cpp $(INCS)
$(CC) $(CFLAGS) examples/testperf.cpp
testperf: testperf.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testperf testperf.o $(FASTDB_LIBS) $(STDLIBS)
testidx.o: examples/testidx.cpp $(INCS)
$(CC) $(CFLAGS) examples/testidx.cpp
testidx: testidx.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testidx testidx.o $(FASTDB_LIBS) $(STDLIBS)
testtl.o: examples/testtl.cpp $(INCS)
$(CC) $(CFLAGS) examples/testtl.cpp
testtl: testtl.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testtl testtl.o $(FASTDB_LIBS) $(STDLIBS)
testspat.o: examples/testspat.cpp $(INCS)
$(CC) $(CFLAGS) examples/testspat.cpp
testspat: testspat.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testspat testspat.o $(FASTDB_LIBS) $(STDLIBS)
testsync.o: examples/testsync.cpp $(INCS)
$(CC) $(CFLAGS) examples/testsync.cpp
testsync: testsync.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testsync testsync.o $(FASTDB_LIBS) $(STDLIBS)
testconc.o: examples/testconc.cpp $(INCS)
$(CC) $(CFLAGS) examples/testconc.cpp
testconc: testconc.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testconc testconc.o $(FASTDB_LIBS) $(STDLIBS)
testiref.o: examples/testiref.cpp $(INCS)
$(CC) $(CFLAGS) examples/testiref.cpp
testiref: testiref.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testiref testiref.o $(FASTDB_LIBS) $(STDLIBS)
testtrav.o: examples/testtrav.cpp $(INCS)
$(CC) $(CFLAGS) examples/testtrav.cpp
testtrav: testtrav.o $(FASTDB_LIB)
$(LD) $(LDFLAGS) -o testtrav testtrav.o $(FASTDB_LIBS) $(STDLIBS)
install: subsql installlib
mkdir -p $(BINSPATH)
cp subsql $(BINSPATH)
strip $(BINSPATH)/subsql
installlib: $(FASTDB_LIB) $(CLI_LIB) $(FASTDB_SHARED) $(CLI_SHARED)
mkdir -p $(INCSPATH)
cp $(INCS) $(INCSPATH)
mkdir -p $(LIBSPATH)
cp $(FASTDB_LIB) $(CLI_LIB) $(FASTDB_SHARED) $(CLI_SHARED) $(LIBSPATH)
cd $(LIBSPATH); ln -f -s $(FASTDB_SHARED) libfastdb$(SUFF).so
cd $(LIBSPATH); ln -f -s $(CLI_SHARED) libcli$(SUFF).so
uninstall:
rm -fr $(INCSPATH)
cd $(LIBSPATH); rm -f $(FASTDB_LIB) $(CLI_LIB) $(FASTDB_SHARED) $(CLI_SHARED) libfastdb$(SUFF).so libcli$(SUFF).so
rm $(BINSPATH)/subsql
cleanobj:
rm -fr *.o *.tgz core *~ cxx_repository
cleandbs:
rm -f *.fdb
clean: cleanobj cleandbs
rm -f *.a *.so *.so.* $(EXAMPLES) $(WEB_EXAMPLES) $(EXES)
tgz: clean
cd ..; tar cvzf fastdb.tgz fastdb
copytgz: tgz
mcopy -o ../fastdb.tgz a: