1# -*- makefile -*-
2# Makefile for Windows with MinGW
3
4ifdef NO_PTHREADS
5OBJS = class.o compiler.o database.o xml.o hashtab.o file.o symtab.o ttree.o rtree.o container.o \
6	cursor.o query.o wwwapi.o w32sock.o sync.o localcli.o stdtp.o
7else
8OBJS = class.o compiler.o database.o xml.o hashtab.o file.o symtab.o ttree.o rtree.o container.o \
9	cursor.o query.o wwwapi.o w32sock.o sync.o localcli.o stdtp.o server.o
10endif
11
12CLI_OBJS = cli.o w32sock.o repsock.o stdtp.o
13
14INCS = inc/fastdb.h inc/stdtp.h inc/class.h inc/database.h inc/cursor.h inc/reference.h inc/wwwapi.h \
15	inc/array.h inc/file.h inc/hashtab.h inc/ttree.h inc/rtree.h inc/container.h inc/sync.h inc/query.h inc/datetime.h inc/sync_w32.h \
16	inc/config.h inc/timeseries.h inc/rectangle.h inc/exception.h
17
18STDLIBS =  -lwsock32
19
20VERSION=2
21FASTDB_LIB = libfastdb.a
22CLI_LIB = libcli.a
23
24EXES.exe = subsql forcerecovery.exe
25FASTDB_LIBS=$(FASTDB_LIB)
26CLI_LIBS=$(CLI_LIB)
27
28EXAMPLES = guess.exe testdb.exe testleak.exe testjoin.exe testddl.exe testperf.exe testsync.exe testconc.exe testiref.exe testtrav.exe testidx.exe clitest.exe testraw.exe localclitest.exe testspat.exe testtl.exe
29
30WEB_EXAMPLES = cgistub.exe bugdb.exe clidb.exe
31
32CC = g++
33
34# DEFS macro is deprecatred, edit inc/config.h file instead
35DEFS = -Wno-invalid-offsetof
36
37#CFLAGS = $(TFLAGS) -c -Wall -O5 -g
38
39CFLAGS = -c -Iinc -Wall -O0 -g $(DEFS)
40#CFLAGS = -c -Iinc -Wall -O0 -DFASTDB_DEBUG=DEBUG_TRACE -g $(DEFS)
41
42
43LD = $(CC)
44LDFLAGS = -g
45
46AR = ar
47ARFLAGS = -cru
48
49RANLIB = ranlib
50
51all: static bins
52
53static: $(FASTDB_LIB) $(CLI_LIB)
54
55bins: $(EXES) $(EXAMPLES)
56
57www: $(FASTDB_SHARED) $(WEB_EXAMPLES)
58
59
60class.o: src/class.cpp inc/compiler.h inc/compiler.d inc/symtab.h $(INCS)
61	$(CC) $(CFLAGS) src/class.cpp
62
63compiler.o: src/compiler.cpp inc/compiler.h inc/compiler.d inc/symtab.h $(INCS)
64	$(CC) $(CFLAGS) src/compiler.cpp
65
66query.o: src/query.cpp inc/compiler.h inc/compiler.d inc/symtab.h $(INCS)
67	$(CC) $(CFLAGS) src/query.cpp
68
69database.o: src/database.cpp inc/compiler.h inc/compiler.d inc/symtab.h $(INCS)
70	$(CC) $(CFLAGS) src/database.cpp
71
72xml.o: src/xml.cpp inc/compiler.h inc/compiler.d inc/symtab.h $(INCS)
73	$(CC) $(CFLAGS) src/xml.cpp
74
75localcli.o: src/localcli.cpp inc/compiler.h inc/compiler.d inc/symtab.h inc/localcli.h $(INCS)
76	$(CC) $(CFLAGS) src/localcli.cpp
77
78cursor.o: src/cursor.cpp inc/compiler.h inc/compiler.d $(INCS)
79	$(CC) $(CFLAGS) src/cursor.cpp
80
81hashtab.o: src/hashtab.cpp $(INCS)
82	$(CC) $(CFLAGS) src/hashtab.cpp
83
84file.o: src/file.cpp $(INCS)
85	$(CC) $(CFLAGS) src/file.cpp
86
87stdtp.o: src/stdtp.cpp $(INCS)
88	$(CC) $(CFLAGS) src/stdtp.cpp
89
90sync.o: src/sync.cpp $(INCS)
91	$(CC) $(CFLAGS) src/sync.cpp
92
93symtab.o: src/symtab.cpp inc/symtab.h $(INCS)
94	$(CC) $(CFLAGS) src/symtab.cpp
95
96ttree.o: src/ttree.cpp $(INCS)
97	$(CC) $(CFLAGS) src/ttree.cpp
98
99rtree.o: src/rtree.cpp $(INCS)
100	$(CC) $(CFLAGS) src/rtree.cpp
101
102container.o: src/container.cpp $(INCS)
103	$(CC) $(CFLAGS) src/container.cpp
104
105wwwapi.o: src/wwwapi.cpp inc/wwwapi.h inc/sockio.h inc/stdtp.h inc/sync.h inc/sync_w32.h inc/config.h
106	$(CC) $(CFLAGS) src/wwwapi.cpp
107
108w32sock.o: src/w32sock.cpp inc/w32sock.h inc/sockio.h inc/stdtp.h
109	$(CC) $(CFLAGS) src/w32sock.cpp
110
111repsock.o: src/repsock.cpp inc/repsock.h inc/sockio.h inc/stdtp.h inc/sync.h inc/sync_w32.h inc/config.h
112	$(CC) $(CFLAGS) src/repsock.cpp
113
114cli.o: src/cli.cpp inc/cli.h inc/cliproto.h inc/repsock.h inc/sockio.h inc/stdtp.h inc/sync.h inc/sync_w32.h inc/config.h
115	$(CC) $(CFLAGS) src/cli.cpp
116
117$(FASTDB_LIB): $(OBJS)
118	rm -f $(FASTDB_LIB)
119	$(AR) $(ARFLAGS) $(FASTDB_LIB) $(OBJS)
120	$(RANLIB) $(FASTDB_LIB)
121
122$(CLI_LIB): $(CLI_OBJS)
123	rm -f $(CLI_LIB)
124	$(AR) $(ARFLAGS) $(CLI_LIB) $(CLI_OBJS)
125	$(RANLIB) $(CLI_LIB)
126
127clitest.o: examples/clitest.c inc/cli.h
128	$(CC) $(CFLAGS) examples/clitest.c
129
130clitest.exe: clitest.o $(CLI_LIB)
131	$(LD) $(LDFLAGS) -o clitest.exe clitest.o $(CLI_LIBS) $(STDLIBS) $(SOCKLIBS)
132
133localclitest.exe: clitest.o $(FASTDB_LIB)
134	$(LD) $(LDFLAGS) -o localclitest.exe clitest.o $(FASTDB_LIBS) $(STDLIBS)
135
136subsql.o: src/subsql.cpp inc/subsql.h inc/compiler.h inc/compiler.d inc/symtab.h $(INCS)
137	$(CC) $(CFLAGS) src/subsql.cpp
138
139server.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)
140	$(CC) $(CFLAGS) src/server.cpp
141
142subsql.exe: subsql.o $(FASTDB_LIB)
143	$(LD) $(LDFLAGS) -o subsql.exe subsql.o $(FASTDB_LIBS) $(STDLIBS) $(SOCKLIBS)
144
145bugdb.o: examples/bugdb.cpp examples/bugdb.h $(INCS)
146	$(CC) $(CFLAGS) examples/bugdb.cpp
147
148bugdb.exe: bugdb.o  $(FASTDB_LIB)
149	$(LD) $(LDFLAGS) -o bugdb.exe bugdb.o $(FASTDB_LIBS) $(STDLIBS) $(SOCKLIBS)
150
151clidb.o: examples/clidb.cpp examples/clidb.h $(INCS)
152	$(CC) $(CFLAGS) examples/clidb.cpp
153
154clidb.exe: clidb.o  $(FASTDB_LIB)
155	$(LD) $(LDFLAGS) -o clidb.exe clidb.o $(FASTDB_LIBS) $(STDLIBS) $(SOCKLIBS)
156
157cgistub.o: src/cgistub.cpp inc/stdtp.h inc/sockio.h
158	$(CC) $(CFLAGS) src/cgistub.cpp
159
160cgistub.exe: cgistub.o
161	$(LD) $(LDFLAGS) -o cgistub.exe cgistub.o $(FASTDB_LIBS) $(STDLIBS) $(SOCKLIBS)
162
163
164forcerecovery.o: src/forcerecovery.cpp inc/database.h
165	$(CC) $(CFLAGS) src/forcerecovery.cpp
166
167forcerecovery.exe: forcerecovery.o
168	$(LD) $(LDFLAGS)  -o forcerecovery.exe forcerecovery.o
169
170
171guess.o: examples/guess.cpp $(INCS)
172	$(CC) $(CFLAGS) examples/guess.cpp
173
174guess.exe: guess.o $(FASTDB_LIB)
175	$(LD) $(LDFLAGS) -o guess.exe guess.o $(FASTDB_LIBS) $(STDLIBS)
176
177testdb.o: examples/testdb.cpp $(INCS)
178	$(CC) $(CFLAGS) examples/testdb.cpp
179
180testdb.exe: testdb.o $(FASTDB_LIB)
181	$(LD) $(LDFLAGS) -o testdb.exe testdb.o $(FASTDB_LIBS) $(STDLIBS)
182
183testraw.o: examples/testraw.cpp $(INCS)
184	$(CC) $(CFLAGS) examples/testraw.cpp
185
186testraw.exe: testraw.o $(FASTDB_LIB)
187	$(LD) $(LDFLAGS) -o testraw.exe testraw.o $(FASTDB_LIBS) $(STDLIBS)
188
189testleak.o: examples/testleak.cpp $(INCS)
190	$(CC) $(CFLAGS) examples/testleak.cpp
191
192testleak.exe: testleak.o $(FASTDB_LIB)
193	$(LD) $(LDFLAGS) -o testleak.exe testleak.o $(FASTDB_LIBS) $(STDLIBS)
194
195testjoin.o: examples/testjoin.cpp $(INCS)
196	$(CC) $(CFLAGS) examples/testjoin.cpp
197
198testjoin.exe: testjoin.o $(FASTDB_LIB)
199	$(LD) $(LDFLAGS) -o testjoin.exe testjoin.o $(FASTDB_LIBS) $(STDLIBS)
200
201testddl.o: examples/testddl.cpp $(INCS)
202	$(CC) $(CFLAGS) examples/testddl.cpp
203
204testddl.exe: testddl.o $(FASTDB_LIB)
205	$(LD) $(LDFLAGS) -o testddl.exe testddl.o $(FASTDB_LIBS) $(STDLIBS)
206
207testperf.o: examples/testperf.cpp $(INCS)
208	$(CC) $(CFLAGS) examples/testperf.cpp
209
210testperf.exe: testperf.o $(FASTDB_LIB)
211	$(LD) $(LDFLAGS) -o testperf.exe testperf.o $(FASTDB_LIBS) $(STDLIBS)
212
213testidx.o: examples/testidx.cpp $(INCS)
214	$(CC) $(CFLAGS) examples/testidx.cpp
215
216testidx.exe: testidx.o $(FASTDB_LIB)
217	$(LD) $(LDFLAGS) -o testidx.exe testidx.o $(FASTDB_LIBS) $(STDLIBS)
218
219testtl.o: examples/testtl.cpp $(INCS)
220	$(CC) $(CFLAGS) examples/testtl.cpp
221
222testtl.exe: testtl.o $(FASTDB_LIB)
223	$(LD) $(LDFLAGS) -o testtl.exe testtl.o $(FASTDB_LIBS) $(STDLIBS)
224
225testspat.o: examples/testspat.cpp $(INCS)
226	$(CC) $(CFLAGS) examples/testspat.cpp
227
228testspat.exe: testspat.o $(FASTDB_LIB)
229	$(LD) $(LDFLAGS) -o testspat.exe testspat.o $(FASTDB_LIBS) $(STDLIBS)
230
231testsync.o: examples/testsync.cpp $(INCS)
232	$(CC) $(CFLAGS) examples/testsync.cpp
233
234testsync.exe: testsync.o $(FASTDB_LIB)
235	$(LD) $(LDFLAGS) -o testsync.exe testsync.o $(FASTDB_LIBS) $(STDLIBS)
236
237testconc.o: examples/testconc.cpp $(INCS)
238	$(CC) $(CFLAGS) examples/testconc.cpp
239
240testconc.exe: testconc.o $(FASTDB_LIB)
241	$(LD) $(LDFLAGS) -o testconc.exe testconc.o $(FASTDB_LIBS) $(STDLIBS)
242
243testiref.o: examples/testiref.cpp $(INCS)
244	$(CC) $(CFLAGS) examples/testiref.cpp
245
246testiref.exe: testiref.o $(FASTDB_LIB)
247	$(LD) $(LDFLAGS) -o testiref.exe testiref.o $(FASTDB_LIBS) $(STDLIBS)
248
249testtrav.o: examples/testtrav.cpp $(INCS)
250	$(CC) $(CFLAGS) examples/testtrav.cpp
251
252testtrav.exe: testtrav.o $(FASTDB_LIB)
253	$(LD) $(LDFLAGS) -o testtrav.exe testtrav.o $(FASTDB_LIBS) $(STDLIBS)
254
255
256cleanobj:
257	-del *.o
258	-del javacli/*.class
259	-del *.jar
260	-del *.class
261
262cleandbs:
263	-del *.fdb
264
265
266clean: cleanobj cleandbs
267	-del *.a
268	-del *.exe
269
270