Merge branch 'prerelease' of github.com:sqlcipher/sqlcipher into prerelease
[sqlcipher.git] / main.mk
blob912ebb4045aa776c34d4a0607904f1d1d46713fd
1 ###############################################################################
2 # The following macros should be defined before this script is
3 # invoked:
5 # TOP The toplevel directory of the source tree. This is the
6 # directory that contains this "Makefile.in" and the
7 # "configure.in" script.
9 # BCC C Compiler and options for use in building executables that
10 # will run on the platform that is doing the build.
12 # THREADLIB Specify any extra linker options needed to make the library
13 # thread safe
15 # OPTS Extra compiler command-line options.
17 # EXE The suffix to add to executable files. ".exe" for windows
18 # and "" for Unix.
20 # TCC C Compiler and options for use in building executables that
21 # will run on the target platform. This is usually the same
22 # as BCC, unless you are cross-compiling.
24 # AR Tools used to build a static library.
25 # RANLIB
27 # TCL_FLAGS Extra compiler options needed for programs that use the
28 # TCL library.
30 # LIBTCL Linker options needed to link against the TCL library.
32 # READLINE_FLAGS Compiler options needed for programs that use the
33 # readline() library.
35 # LIBREADLINE Linker options needed by programs using readline() must
36 # link against.
38 # NAWK Nawk compatible awk program. Older (obsolete?) solaris
39 # systems need this to avoid using the original AT&T AWK.
41 # Once the macros above are defined, the rest of this make script will
42 # build the SQLite library and testing tools.
43 ################################################################################
45 # This is how we compile
47 TCCX = $(TCC) $(OPTS) -I. -I$(TOP)/src -I$(TOP)
48 TCCX += -I$(TOP)/ext/rtree -I$(TOP)/ext/icu -I$(TOP)/ext/fts3
49 TCCX += -I$(TOP)/ext/async
51 # Object files for the SQLite library.
53 LIBOBJ+= alter.o analyze.o attach.o auth.o \
54 backup.o bitvec.o btmutex.o btree.o build.o \
55 callback.o complete.o ctime.o date.o delete.o expr.o fault.o fkey.o \
56 fts3.o fts3_aux.o fts3_expr.o fts3_hash.o fts3_icu.o fts3_porter.o \
57 fts3_snippet.o fts3_tokenizer.o fts3_tokenizer1.o \
58 fts3_tokenize_vtab.o \
59 fts3_unicode.o fts3_unicode2.o \
60 fts3_write.o func.o global.o hash.o \
61 icu.o insert.o journal.o legacy.o loadext.o \
62 main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \
63 memjournal.o \
64 mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \
65 notify.o opcodes.o os.o os_unix.o os_win.o \
66 pager.o parse.o pcache.o pcache1.o pragma.o prepare.o printf.o \
67 random.o resolve.o rowset.o rtree.o select.o status.o \
68 table.o tokenize.o trigger.o \
69 update.o util.o vacuum.o \
70 vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \
71 vdbetrace.o wal.o walker.o where.o utf.o vtab.o
75 # All of the source code files.
77 SRC = \
78 $(TOP)/src/alter.c \
79 $(TOP)/src/analyze.c \
80 $(TOP)/src/attach.c \
81 $(TOP)/src/auth.c \
82 $(TOP)/src/backup.c \
83 $(TOP)/src/bitvec.c \
84 $(TOP)/src/btmutex.c \
85 $(TOP)/src/btree.c \
86 $(TOP)/src/btree.h \
87 $(TOP)/src/btreeInt.h \
88 $(TOP)/src/build.c \
89 $(TOP)/src/callback.c \
90 $(TOP)/src/complete.c \
91 $(TOP)/src/ctime.c \
92 $(TOP)/src/date.c \
93 $(TOP)/src/delete.c \
94 $(TOP)/src/expr.c \
95 $(TOP)/src/fault.c \
96 $(TOP)/src/fkey.c \
97 $(TOP)/src/func.c \
98 $(TOP)/src/global.c \
99 $(TOP)/src/hash.c \
100 $(TOP)/src/hash.h \
101 $(TOP)/src/hwtime.h \
102 $(TOP)/src/insert.c \
103 $(TOP)/src/journal.c \
104 $(TOP)/src/legacy.c \
105 $(TOP)/src/loadext.c \
106 $(TOP)/src/main.c \
107 $(TOP)/src/malloc.c \
108 $(TOP)/src/mem0.c \
109 $(TOP)/src/mem1.c \
110 $(TOP)/src/mem2.c \
111 $(TOP)/src/mem3.c \
112 $(TOP)/src/mem5.c \
113 $(TOP)/src/memjournal.c \
114 $(TOP)/src/mutex.c \
115 $(TOP)/src/mutex.h \
116 $(TOP)/src/mutex_noop.c \
117 $(TOP)/src/mutex_unix.c \
118 $(TOP)/src/mutex_w32.c \
119 $(TOP)/src/notify.c \
120 $(TOP)/src/os.c \
121 $(TOP)/src/os.h \
122 $(TOP)/src/os_common.h \
123 $(TOP)/src/os_unix.c \
124 $(TOP)/src/os_win.c \
125 $(TOP)/src/pager.c \
126 $(TOP)/src/pager.h \
127 $(TOP)/src/parse.y \
128 $(TOP)/src/pcache.c \
129 $(TOP)/src/pcache.h \
130 $(TOP)/src/pcache1.c \
131 $(TOP)/src/pragma.c \
132 $(TOP)/src/prepare.c \
133 $(TOP)/src/printf.c \
134 $(TOP)/src/random.c \
135 $(TOP)/src/resolve.c \
136 $(TOP)/src/rowset.c \
137 $(TOP)/src/select.c \
138 $(TOP)/src/status.c \
139 $(TOP)/src/shell.c \
140 $(TOP)/src/sqlite.h.in \
141 $(TOP)/src/sqlite3ext.h \
142 $(TOP)/src/sqliteInt.h \
143 $(TOP)/src/sqliteLimit.h \
144 $(TOP)/src/table.c \
145 $(TOP)/src/tclsqlite.c \
146 $(TOP)/src/tokenize.c \
147 $(TOP)/src/trigger.c \
148 $(TOP)/src/utf.c \
149 $(TOP)/src/update.c \
150 $(TOP)/src/util.c \
151 $(TOP)/src/vacuum.c \
152 $(TOP)/src/vdbe.c \
153 $(TOP)/src/vdbe.h \
154 $(TOP)/src/vdbeapi.c \
155 $(TOP)/src/vdbeaux.c \
156 $(TOP)/src/vdbeblob.c \
157 $(TOP)/src/vdbemem.c \
158 $(TOP)/src/vdbesort.c \
159 $(TOP)/src/vdbetrace.c \
160 $(TOP)/src/vdbeInt.h \
161 $(TOP)/src/vtab.c \
162 $(TOP)/src/wal.c \
163 $(TOP)/src/wal.h \
164 $(TOP)/src/walker.c \
165 $(TOP)/src/where.c
167 # Source code for extensions
169 SRC += \
170 $(TOP)/ext/fts1/fts1.c \
171 $(TOP)/ext/fts1/fts1.h \
172 $(TOP)/ext/fts1/fts1_hash.c \
173 $(TOP)/ext/fts1/fts1_hash.h \
174 $(TOP)/ext/fts1/fts1_porter.c \
175 $(TOP)/ext/fts1/fts1_tokenizer.h \
176 $(TOP)/ext/fts1/fts1_tokenizer1.c
177 SRC += \
178 $(TOP)/ext/fts2/fts2.c \
179 $(TOP)/ext/fts2/fts2.h \
180 $(TOP)/ext/fts2/fts2_hash.c \
181 $(TOP)/ext/fts2/fts2_hash.h \
182 $(TOP)/ext/fts2/fts2_icu.c \
183 $(TOP)/ext/fts2/fts2_porter.c \
184 $(TOP)/ext/fts2/fts2_tokenizer.h \
185 $(TOP)/ext/fts2/fts2_tokenizer.c \
186 $(TOP)/ext/fts2/fts2_tokenizer1.c
187 SRC += \
188 $(TOP)/ext/fts3/fts3.c \
189 $(TOP)/ext/fts3/fts3.h \
190 $(TOP)/ext/fts3/fts3Int.h \
191 $(TOP)/ext/fts3/fts3_aux.c \
192 $(TOP)/ext/fts3/fts3_expr.c \
193 $(TOP)/ext/fts3/fts3_hash.c \
194 $(TOP)/ext/fts3/fts3_hash.h \
195 $(TOP)/ext/fts3/fts3_icu.c \
196 $(TOP)/ext/fts3/fts3_porter.c \
197 $(TOP)/ext/fts3/fts3_snippet.c \
198 $(TOP)/ext/fts3/fts3_tokenizer.h \
199 $(TOP)/ext/fts3/fts3_tokenizer.c \
200 $(TOP)/ext/fts3/fts3_tokenizer1.c \
201 $(TOP)/ext/fts3/fts3_tokenize_vtab.c \
202 $(TOP)/ext/fts3/fts3_unicode.c \
203 $(TOP)/ext/fts3/fts3_unicode2.c \
204 $(TOP)/ext/fts3/fts3_write.c
205 SRC += \
206 $(TOP)/ext/icu/sqliteicu.h \
207 $(TOP)/ext/icu/icu.c
208 SRC += \
209 $(TOP)/ext/rtree/rtree.h \
210 $(TOP)/ext/rtree/rtree.c
213 # Generated source code files
215 SRC += \
216 keywordhash.h \
217 opcodes.c \
218 opcodes.h \
219 parse.c \
220 parse.h \
221 sqlite3.h
224 # Source code to the test files.
226 TESTSRC = \
227 $(TOP)/ext/fts3/fts3_term.c \
228 $(TOP)/ext/fts3/fts3_test.c \
229 $(TOP)/src/test1.c \
230 $(TOP)/src/test2.c \
231 $(TOP)/src/test3.c \
232 $(TOP)/src/test4.c \
233 $(TOP)/src/test5.c \
234 $(TOP)/src/test6.c \
235 $(TOP)/src/test7.c \
236 $(TOP)/src/test8.c \
237 $(TOP)/src/test9.c \
238 $(TOP)/src/test_autoext.c \
239 $(TOP)/src/test_async.c \
240 $(TOP)/src/test_backup.c \
241 $(TOP)/src/test_btree.c \
242 $(TOP)/src/test_config.c \
243 $(TOP)/src/test_demovfs.c \
244 $(TOP)/src/test_devsym.c \
245 $(TOP)/src/test_fs.c \
246 $(TOP)/src/test_func.c \
247 $(TOP)/src/test_hexio.c \
248 $(TOP)/src/test_init.c \
249 $(TOP)/src/test_intarray.c \
250 $(TOP)/src/test_journal.c \
251 $(TOP)/src/test_malloc.c \
252 $(TOP)/src/test_multiplex.c \
253 $(TOP)/src/test_mutex.c \
254 $(TOP)/src/test_onefile.c \
255 $(TOP)/src/test_osinst.c \
256 $(TOP)/src/test_pcache.c \
257 $(TOP)/src/test_quota.c \
258 $(TOP)/src/test_rtree.c \
259 $(TOP)/src/test_schema.c \
260 $(TOP)/src/test_server.c \
261 $(TOP)/src/test_stat.c \
262 $(TOP)/src/test_sqllog.c \
263 $(TOP)/src/test_superlock.c \
264 $(TOP)/src/test_syscall.c \
265 $(TOP)/src/test_tclvar.c \
266 $(TOP)/src/test_thread.c \
267 $(TOP)/src/test_vfs.c \
268 $(TOP)/src/test_wsd.c
270 # Extensions to be statically loaded.
272 TESTSRC += \
273 $(TOP)/ext/misc/amatch.c \
274 $(TOP)/ext/misc/closure.c \
275 $(TOP)/ext/misc/fuzzer.c \
276 $(TOP)/ext/misc/ieee754.c \
277 $(TOP)/ext/misc/nextchar.c \
278 $(TOP)/ext/misc/regexp.c \
279 $(TOP)/ext/misc/spellfix.c \
280 $(TOP)/ext/misc/wholenumber.c
283 #TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c
284 #TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c
286 TESTSRC2 = \
287 $(TOP)/src/attach.c \
288 $(TOP)/src/backup.c \
289 $(TOP)/src/btree.c \
290 $(TOP)/src/build.c \
291 $(TOP)/src/date.c \
292 $(TOP)/src/expr.c \
293 $(TOP)/src/func.c \
294 $(TOP)/src/insert.c \
295 $(TOP)/src/wal.c \
296 $(TOP)/src/main.c \
297 $(TOP)/src/mem5.c \
298 $(TOP)/src/os.c \
299 $(TOP)/src/os_unix.c \
300 $(TOP)/src/os_win.c \
301 $(TOP)/src/pager.c \
302 $(TOP)/src/pragma.c \
303 $(TOP)/src/prepare.c \
304 $(TOP)/src/printf.c \
305 $(TOP)/src/random.c \
306 $(TOP)/src/pcache.c \
307 $(TOP)/src/pcache1.c \
308 $(TOP)/src/select.c \
309 $(TOP)/src/tokenize.c \
310 $(TOP)/src/utf.c \
311 $(TOP)/src/util.c \
312 $(TOP)/src/vdbeapi.c \
313 $(TOP)/src/vdbeaux.c \
314 $(TOP)/src/vdbe.c \
315 $(TOP)/src/vdbemem.c \
316 $(TOP)/src/where.c \
317 parse.c \
318 $(TOP)/ext/fts3/fts3.c \
319 $(TOP)/ext/fts3/fts3_aux.c \
320 $(TOP)/ext/fts3/fts3_expr.c \
321 $(TOP)/ext/fts3/fts3_tokenizer.c \
322 $(TOP)/ext/fts3/fts3_write.c \
323 $(TOP)/ext/async/sqlite3async.c
325 # Header files used by all library source files.
327 HDR = \
328 $(TOP)/src/btree.h \
329 $(TOP)/src/btreeInt.h \
330 $(TOP)/src/hash.h \
331 $(TOP)/src/hwtime.h \
332 keywordhash.h \
333 $(TOP)/src/mutex.h \
334 opcodes.h \
335 $(TOP)/src/os.h \
336 $(TOP)/src/os_common.h \
337 $(TOP)/src/pager.h \
338 $(TOP)/src/pcache.h \
339 parse.h \
340 sqlite3.h \
341 $(TOP)/src/sqlite3ext.h \
342 $(TOP)/src/sqliteInt.h \
343 $(TOP)/src/sqliteLimit.h \
344 $(TOP)/src/vdbe.h \
345 $(TOP)/src/vdbeInt.h
347 # Header files used by extensions
349 EXTHDR += \
350 $(TOP)/ext/fts1/fts1.h \
351 $(TOP)/ext/fts1/fts1_hash.h \
352 $(TOP)/ext/fts1/fts1_tokenizer.h
353 EXTHDR += \
354 $(TOP)/ext/fts2/fts2.h \
355 $(TOP)/ext/fts2/fts2_hash.h \
356 $(TOP)/ext/fts2/fts2_tokenizer.h
357 EXTHDR += \
358 $(TOP)/ext/fts3/fts3.h \
359 $(TOP)/ext/fts3/fts3Int.h \
360 $(TOP)/ext/fts3/fts3_hash.h \
361 $(TOP)/ext/fts3/fts3_tokenizer.h
362 EXTHDR += \
363 $(TOP)/ext/rtree/rtree.h
364 EXTHDR += \
365 $(TOP)/ext/icu/sqliteicu.h
367 # This is the default Makefile target. The objects listed here
368 # are what get build when you type just "make" with no arguments.
370 all: sqlite3.h libsqlite3.a sqlite3$(EXE)
372 libsqlite3.a: $(LIBOBJ)
373 $(AR) libsqlite3.a $(LIBOBJ)
374 $(RANLIB) libsqlite3.a
376 sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h
377 $(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE) \
378 $(TOP)/src/shell.c \
379 libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB)
381 mptester$(EXE): sqlite3.c $(TOP)/mptest/mptest.c
382 $(TCCX) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.c \
383 $(TLIBS) $(THREADLIB)
385 sqlite3.o: sqlite3.c
386 $(TCCX) -c sqlite3.c
388 # This target creates a directory named "tsrc" and fills it with
389 # copies of all of the C source code and header files needed to
390 # build on the target system. Some of the C source code and header
391 # files are automatically generated. This target takes care of
392 # all that automatic generation.
394 target_source: $(SRC) $(TOP)/tool/vdbe-compress.tcl
395 rm -rf tsrc
396 mkdir tsrc
397 cp -f $(SRC) tsrc
398 rm tsrc/sqlite.h.in tsrc/parse.y
399 tclsh $(TOP)/tool/vdbe-compress.tcl <tsrc/vdbe.c >vdbe.new
400 mv vdbe.new tsrc/vdbe.c
401 touch target_source
403 sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl
404 tclsh $(TOP)/tool/mksqlite3c.tcl
405 cp tsrc/shell.c tsrc/sqlite3ext.h .
406 echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c
407 cat sqlite3.c >>tclsqlite3.c
408 echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite3.c
409 cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
411 sqlite3.c-debug: target_source $(TOP)/tool/mksqlite3c.tcl
412 tclsh $(TOP)/tool/mksqlite3c.tcl --linemacros
413 echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c
414 cat sqlite3.c >>tclsqlite3.c
415 echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite3.c
416 echo '#line 1 "tclsqlite.c"' >>tclsqlite3.c
417 cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
419 sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl
420 tclsh $(TOP)/tool/split-sqlite3c.tcl
422 fts2amal.c: target_source $(TOP)/ext/fts2/mkfts2amal.tcl
423 tclsh $(TOP)/ext/fts2/mkfts2amal.tcl
425 fts3amal.c: target_source $(TOP)/ext/fts3/mkfts3amal.tcl
426 tclsh $(TOP)/ext/fts3/mkfts3amal.tcl
428 # Rules to build the LEMON compiler generator
430 lemon: $(TOP)/tool/lemon.c $(TOP)/src/lempar.c
431 $(BCC) -o lemon $(TOP)/tool/lemon.c
432 cp $(TOP)/src/lempar.c .
434 # Rules to build individual *.o files from generated *.c files. This
435 # applies to:
437 # parse.o
438 # opcodes.o
440 %.o: %.c $(HDR)
441 $(TCCX) -c $<
443 # Rules to build individual *.o files from files in the src directory.
445 %.o: $(TOP)/src/%.c $(HDR)
446 $(TCCX) -c $<
448 tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR)
449 $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
453 # Rules to build opcodes.c and opcodes.h
455 opcodes.c: opcodes.h $(TOP)/mkopcodec.awk
456 $(NAWK) -f $(TOP)/mkopcodec.awk opcodes.h >opcodes.c
458 opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
459 cat parse.h $(TOP)/src/vdbe.c | \
460 $(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h
462 # Rules to build parse.c and parse.h - the outputs of lemon.
464 parse.h: parse.c
466 parse.c: $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk
467 cp $(TOP)/src/parse.y .
468 rm -f parse.h
469 ./lemon $(OPTS) parse.y
470 mv parse.h parse.h.temp
471 $(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
473 sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION
474 tclsh $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
476 keywordhash.h: $(TOP)/tool/mkkeywordhash.c
477 $(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c
478 ./mkkeywordhash >keywordhash.h
482 # Rules to build the extension objects.
484 icu.o: $(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR)
485 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/icu/icu.c
487 fts2.o: $(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR)
488 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2.c
490 fts2_hash.o: $(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR)
491 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_hash.c
493 fts2_icu.o: $(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR)
494 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_icu.c
496 fts2_porter.o: $(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR)
497 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_porter.c
499 fts2_tokenizer.o: $(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR)
500 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c
502 fts2_tokenizer1.o: $(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR)
503 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c
505 fts3.o: $(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR)
506 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3.c
508 fts3_aux.o: $(TOP)/ext/fts3/fts3_aux.c $(HDR) $(EXTHDR)
509 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_aux.c
511 fts3_expr.o: $(TOP)/ext/fts3/fts3_expr.c $(HDR) $(EXTHDR)
512 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_expr.c
514 fts3_hash.o: $(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR)
515 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_hash.c
517 fts3_icu.o: $(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR)
518 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_icu.c
520 fts3_snippet.o: $(TOP)/ext/fts3/fts3_snippet.c $(HDR) $(EXTHDR)
521 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_snippet.c
523 fts3_porter.o: $(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR)
524 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_porter.c
526 fts3_tokenizer.o: $(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR)
527 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c
529 fts3_tokenizer1.o: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR)
530 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c
532 fts3_tokenize_vtab.o: $(TOP)/ext/fts3/fts3_tokenize_vtab.c $(HDR) $(EXTHDR)
533 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenize_vtab.c
535 fts3_unicode.o: $(TOP)/ext/fts3/fts3_unicode.c $(HDR) $(EXTHDR)
536 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_unicode.c
538 fts3_unicode2.o: $(TOP)/ext/fts3/fts3_unicode2.c $(HDR) $(EXTHDR)
539 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_unicode2.c
541 fts3_write.o: $(TOP)/ext/fts3/fts3_write.c $(HDR) $(EXTHDR)
542 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_write.c
544 rtree.o: $(TOP)/ext/rtree/rtree.c $(HDR) $(EXTHDR)
545 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/rtree/rtree.c
548 # Rules for building test programs and for running tests
550 tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a
551 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \
552 $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB)
554 sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl
555 echo "#define TCLSH 2" > $@
556 cat sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c >> $@
557 echo "static const char *tclsh_main_loop(void){" >> $@
558 echo "static const char *zMainloop = " >> $@
559 $(NAWK) -f $(TOP)/tool/tostr.awk $(TOP)/tool/spaceanal.tcl >> $@
560 echo "; return zMainloop; }" >> $@
562 sqlite3_analyzer$(EXE): sqlite3_analyzer.c
563 $(TCCX) $(TCL_FLAGS) sqlite3_analyzer.c -o $@ $(LIBTCL) $(THREADLIB)
565 # Rules to build the 'testfixture' application.
567 TESTFIXTURE_FLAGS = -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
568 TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
570 testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c
571 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
572 $(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \
573 -o testfixture$(EXE) $(LIBTCL) libsqlite3.a $(THREADLIB)
575 amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c
576 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
577 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
578 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
580 fts3-testfixture$(EXE): sqlite3.c fts3amal.c $(TESTSRC) $(TOP)/src/tclsqlite.c
581 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
582 -DSQLITE_ENABLE_FTS3=1 \
583 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c fts3amal.c \
584 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
586 fulltest: testfixture$(EXE) sqlite3$(EXE)
587 ./testfixture$(EXE) $(TOP)/test/all.test
589 soaktest: testfixture$(EXE) sqlite3$(EXE)
590 ./testfixture$(EXE) $(TOP)/test/all.test -soak=1
592 fulltestonly: testfixture$(EXE) sqlite3$(EXE)
593 ./testfixture$(EXE) $(TOP)/test/full.test
595 test: testfixture$(EXE) sqlite3$(EXE)
596 ./testfixture$(EXE) $(TOP)/test/veryquick.test
598 # The next two rules are used to support the "threadtest" target. Building
599 # threadtest runs a few thread-safety tests that are implemented in C. This
600 # target is invoked by the releasetest.tcl script.
602 threadtest3$(EXE): sqlite3.o $(TOP)/test/threadtest3.c $(TOP)/test/tt3_checkpoint.c
603 $(TCCX) -O2 sqlite3.o $(TOP)/test/threadtest3.c \
604 -o threadtest3$(EXE) $(THREADLIB)
606 threadtest: threadtest3$(EXE)
607 ./threadtest3$(EXE)
609 TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO)
610 $(TEST_EXTENSION): $(TOP)/src/test_loadext.c
611 $(MKSHLIB) $(TOP)/src/test_loadext.c -o $(TEST_EXTENSION)
613 extensiontest: testfixture$(EXE) $(TEST_EXTENSION)
614 ./testfixture$(EXE) $(TOP)/test/loadext.test
616 # This target will fail if the SQLite amalgamation contains any exported
617 # symbols that do not begin with "sqlite3_". It is run as part of the
618 # releasetest.tcl script.
620 checksymbols: sqlite3.o
621 nm -g --defined-only sqlite3.o | grep -v " sqlite3_" ; test $$? -ne 0
624 # Standard install and cleanup targets
626 install: sqlite3 libsqlite3.a sqlite3.h
627 mv sqlite3 /usr/bin
628 mv libsqlite3.a /usr/lib
629 mv sqlite3.h /usr/include
631 clean:
632 rm -f *.o sqlite3 sqlite3.exe libsqlite3.a sqlite3.h opcodes.*
633 rm -f lemon lemon.exe lempar.c parse.* sqlite*.tar.gz
634 rm -f mkkeywordhash mkkeywordhash.exe keywordhash.h
635 rm -f $(PUBLISH)
636 rm -f *.da *.bb *.bbg gmon.out
637 rm -rf quota2a quota2b quota2c
638 rm -rf tsrc target_source
639 rm -f testloadext.dll libtestloadext.so
640 rm -f amalgamation-testfixture amalgamation-testfixture.exe
641 rm -f fts3-testfixture fts3-testfixture.exe
642 rm -f testfixture testfixture.exe
643 rm -f threadtest3 threadtest3.exe
644 rm -f sqlite3.c fts?amal.c tclsqlite3.c
645 rm -f sqlite3rc.h
646 rm -f shell.c sqlite3ext.h
647 rm -f sqlite3_analyzer sqlite3_analyzer.exe sqlite3_analyzer.c
648 rm -f sqlite-*-output.vsix
649 rm -f mptester mptester.exe