Fix harmless compiler warning.
[sqlite.git] / main.mk
blob838e0753d99f327a47c27897969a9f45be6cfb02
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 # LIBS Extra libraries options
17 # OPTS Extra compiler command-line options.
19 # EXE The suffix to add to executable files. ".exe" for windows
20 # and "" for Unix.
22 # TCC C Compiler and options for use in building executables that
23 # will run on the target platform. This is usually the same
24 # as BCC, unless you are cross-compiling.
26 # AR Tools used to build a static library.
27 # RANLIB
29 # TCL_FLAGS Extra compiler options needed for programs that use the
30 # TCL library.
32 # LIBTCL Linker options needed to link against the TCL library.
34 # READLINE_FLAGS Compiler options needed for programs that use the
35 # readline() library.
37 # LIBREADLINE Linker options needed by programs using readline() must
38 # link against.
40 # Once the macros above are defined, the rest of this make script will
41 # build the SQLite library and testing tools.
42 ################################################################################
44 # This is how we compile
46 TCCX = $(TCC) $(OPTS) -I. -I$(TOP)/src -I$(TOP)
47 TCCX += -I$(TOP)/ext/rtree -I$(TOP)/ext/icu -I$(TOP)/ext/fts3
48 TCCX += -I$(TOP)/ext/async -I$(TOP)/ext/userauth
49 TCCX += -I$(TOP)/ext/fts5
50 THREADLIB += $(LIBS)
52 # Object files for the SQLite library.
54 LIBOBJ+= vdbe.o parse.o \
55 alter.o analyze.o attach.o auth.o \
56 backup.o bitvec.o btmutex.o btree.o build.o \
57 callback.o complete.o ctime.o date.o dbstat.o delete.o expr.o \
58 fault.o fkey.o \
59 fts3.o fts3_aux.o fts3_expr.o fts3_hash.o fts3_icu.o fts3_porter.o \
60 fts3_snippet.o fts3_tokenizer.o fts3_tokenizer1.o \
61 fts3_tokenize_vtab.o \
62 fts3_unicode.o fts3_unicode2.o \
63 fts3_write.o fts5.o func.o global.o hash.o \
64 icu.o insert.o journal.o json1.o legacy.o loadext.o \
65 main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \
66 memjournal.o \
67 mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \
68 notify.o opcodes.o os.o os_unix.o os_win.o \
69 pager.o pcache.o pcache1.o pragma.o prepare.o printf.o \
70 random.o resolve.o rowset.o rtree.o select.o sqlite3rbu.o status.o \
71 table.o threads.o tokenize.o treeview.o trigger.o \
72 update.o userauth.o util.o vacuum.o \
73 vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \
74 vdbetrace.o wal.o walker.o where.o wherecode.o whereexpr.o \
75 utf.o vtab.o
78 # All of the source code files.
80 SRC = \
81 $(TOP)/src/alter.c \
82 $(TOP)/src/analyze.c \
83 $(TOP)/src/attach.c \
84 $(TOP)/src/auth.c \
85 $(TOP)/src/backup.c \
86 $(TOP)/src/bitvec.c \
87 $(TOP)/src/btmutex.c \
88 $(TOP)/src/btree.c \
89 $(TOP)/src/btree.h \
90 $(TOP)/src/btreeInt.h \
91 $(TOP)/src/build.c \
92 $(TOP)/src/callback.c \
93 $(TOP)/src/complete.c \
94 $(TOP)/src/ctime.c \
95 $(TOP)/src/date.c \
96 $(TOP)/src/dbstat.c \
97 $(TOP)/src/delete.c \
98 $(TOP)/src/expr.c \
99 $(TOP)/src/fault.c \
100 $(TOP)/src/fkey.c \
101 $(TOP)/src/func.c \
102 $(TOP)/src/global.c \
103 $(TOP)/src/hash.c \
104 $(TOP)/src/hash.h \
105 $(TOP)/src/hwtime.h \
106 $(TOP)/src/insert.c \
107 $(TOP)/src/journal.c \
108 $(TOP)/src/legacy.c \
109 $(TOP)/src/loadext.c \
110 $(TOP)/src/main.c \
111 $(TOP)/src/malloc.c \
112 $(TOP)/src/mem0.c \
113 $(TOP)/src/mem1.c \
114 $(TOP)/src/mem2.c \
115 $(TOP)/src/mem3.c \
116 $(TOP)/src/mem5.c \
117 $(TOP)/src/memjournal.c \
118 $(TOP)/src/msvc.h \
119 $(TOP)/src/mutex.c \
120 $(TOP)/src/mutex.h \
121 $(TOP)/src/mutex_noop.c \
122 $(TOP)/src/mutex_unix.c \
123 $(TOP)/src/mutex_w32.c \
124 $(TOP)/src/notify.c \
125 $(TOP)/src/os.c \
126 $(TOP)/src/os.h \
127 $(TOP)/src/os_common.h \
128 $(TOP)/src/os_setup.h \
129 $(TOP)/src/os_unix.c \
130 $(TOP)/src/os_win.c \
131 $(TOP)/src/os_win.h \
132 $(TOP)/src/pager.c \
133 $(TOP)/src/pager.h \
134 $(TOP)/src/parse.y \
135 $(TOP)/src/pcache.c \
136 $(TOP)/src/pcache.h \
137 $(TOP)/src/pcache1.c \
138 $(TOP)/src/pragma.c \
139 $(TOP)/src/pragma.h \
140 $(TOP)/src/prepare.c \
141 $(TOP)/src/printf.c \
142 $(TOP)/src/random.c \
143 $(TOP)/src/resolve.c \
144 $(TOP)/src/rowset.c \
145 $(TOP)/src/select.c \
146 $(TOP)/src/status.c \
147 $(TOP)/src/shell.c \
148 $(TOP)/src/sqlite.h.in \
149 $(TOP)/src/sqlite3ext.h \
150 $(TOP)/src/sqliteInt.h \
151 $(TOP)/src/sqliteLimit.h \
152 $(TOP)/src/table.c \
153 $(TOP)/src/tclsqlite.c \
154 $(TOP)/src/threads.c \
155 $(TOP)/src/tokenize.c \
156 $(TOP)/src/treeview.c \
157 $(TOP)/src/trigger.c \
158 $(TOP)/src/utf.c \
159 $(TOP)/src/update.c \
160 $(TOP)/src/util.c \
161 $(TOP)/src/vacuum.c \
162 $(TOP)/src/vdbe.c \
163 $(TOP)/src/vdbe.h \
164 $(TOP)/src/vdbeapi.c \
165 $(TOP)/src/vdbeaux.c \
166 $(TOP)/src/vdbeblob.c \
167 $(TOP)/src/vdbemem.c \
168 $(TOP)/src/vdbesort.c \
169 $(TOP)/src/vdbetrace.c \
170 $(TOP)/src/vdbeInt.h \
171 $(TOP)/src/vtab.c \
172 $(TOP)/src/vxworks.h \
173 $(TOP)/src/wal.c \
174 $(TOP)/src/wal.h \
175 $(TOP)/src/walker.c \
176 $(TOP)/src/where.c \
177 $(TOP)/src/wherecode.c \
178 $(TOP)/src/whereexpr.c \
179 $(TOP)/src/whereInt.h
181 # Source code for extensions
183 SRC += \
184 $(TOP)/ext/fts1/fts1.c \
185 $(TOP)/ext/fts1/fts1.h \
186 $(TOP)/ext/fts1/fts1_hash.c \
187 $(TOP)/ext/fts1/fts1_hash.h \
188 $(TOP)/ext/fts1/fts1_porter.c \
189 $(TOP)/ext/fts1/fts1_tokenizer.h \
190 $(TOP)/ext/fts1/fts1_tokenizer1.c
191 SRC += \
192 $(TOP)/ext/fts2/fts2.c \
193 $(TOP)/ext/fts2/fts2.h \
194 $(TOP)/ext/fts2/fts2_hash.c \
195 $(TOP)/ext/fts2/fts2_hash.h \
196 $(TOP)/ext/fts2/fts2_icu.c \
197 $(TOP)/ext/fts2/fts2_porter.c \
198 $(TOP)/ext/fts2/fts2_tokenizer.h \
199 $(TOP)/ext/fts2/fts2_tokenizer.c \
200 $(TOP)/ext/fts2/fts2_tokenizer1.c
201 SRC += \
202 $(TOP)/ext/fts3/fts3.c \
203 $(TOP)/ext/fts3/fts3.h \
204 $(TOP)/ext/fts3/fts3Int.h \
205 $(TOP)/ext/fts3/fts3_aux.c \
206 $(TOP)/ext/fts3/fts3_expr.c \
207 $(TOP)/ext/fts3/fts3_hash.c \
208 $(TOP)/ext/fts3/fts3_hash.h \
209 $(TOP)/ext/fts3/fts3_icu.c \
210 $(TOP)/ext/fts3/fts3_porter.c \
211 $(TOP)/ext/fts3/fts3_snippet.c \
212 $(TOP)/ext/fts3/fts3_tokenizer.h \
213 $(TOP)/ext/fts3/fts3_tokenizer.c \
214 $(TOP)/ext/fts3/fts3_tokenizer1.c \
215 $(TOP)/ext/fts3/fts3_tokenize_vtab.c \
216 $(TOP)/ext/fts3/fts3_unicode.c \
217 $(TOP)/ext/fts3/fts3_unicode2.c \
218 $(TOP)/ext/fts3/fts3_write.c
219 SRC += \
220 $(TOP)/ext/icu/sqliteicu.h \
221 $(TOP)/ext/icu/icu.c
222 SRC += \
223 $(TOP)/ext/rtree/sqlite3rtree.h \
224 $(TOP)/ext/rtree/rtree.h \
225 $(TOP)/ext/rtree/rtree.c
226 SRC += \
227 $(TOP)/ext/userauth/userauth.c \
228 $(TOP)/ext/userauth/sqlite3userauth.h
229 SRC += \
230 $(TOP)/ext/rbu/sqlite3rbu.c \
231 $(TOP)/ext/rbu/sqlite3rbu.h
232 SRC += \
233 $(TOP)/ext/misc/json1.c
236 # FTS5 things
238 FTS5_HDR = \
239 $(TOP)/ext/fts5/fts5.h \
240 $(TOP)/ext/fts5/fts5Int.h \
241 fts5parse.h
243 FTS5_SRC = \
244 $(TOP)/ext/fts5/fts5_aux.c \
245 $(TOP)/ext/fts5/fts5_buffer.c \
246 $(TOP)/ext/fts5/fts5_main.c \
247 $(TOP)/ext/fts5/fts5_config.c \
248 $(TOP)/ext/fts5/fts5_expr.c \
249 $(TOP)/ext/fts5/fts5_hash.c \
250 $(TOP)/ext/fts5/fts5_index.c \
251 fts5parse.c \
252 $(TOP)/ext/fts5/fts5_storage.c \
253 $(TOP)/ext/fts5/fts5_tokenize.c \
254 $(TOP)/ext/fts5/fts5_unicode2.c \
255 $(TOP)/ext/fts5/fts5_varint.c \
256 $(TOP)/ext/fts5/fts5_vocab.c \
259 # Generated source code files
261 SRC += \
262 keywordhash.h \
263 opcodes.c \
264 opcodes.h \
265 parse.c \
266 parse.h \
267 sqlite3.h
270 # Source code to the test files.
272 TESTSRC = \
273 $(TOP)/ext/fts3/fts3_term.c \
274 $(TOP)/ext/fts3/fts3_test.c \
275 $(TOP)/ext/rbu/test_rbu.c \
276 $(TOP)/src/test1.c \
277 $(TOP)/src/test2.c \
278 $(TOP)/src/test3.c \
279 $(TOP)/src/test4.c \
280 $(TOP)/src/test5.c \
281 $(TOP)/src/test6.c \
282 $(TOP)/src/test7.c \
283 $(TOP)/src/test8.c \
284 $(TOP)/src/test9.c \
285 $(TOP)/src/test_autoext.c \
286 $(TOP)/src/test_async.c \
287 $(TOP)/src/test_backup.c \
288 $(TOP)/src/test_blob.c \
289 $(TOP)/src/test_btree.c \
290 $(TOP)/src/test_config.c \
291 $(TOP)/src/test_demovfs.c \
292 $(TOP)/src/test_devsym.c \
293 $(TOP)/src/test_fs.c \
294 $(TOP)/src/test_func.c \
295 $(TOP)/src/test_hexio.c \
296 $(TOP)/src/test_init.c \
297 $(TOP)/src/test_intarray.c \
298 $(TOP)/src/test_journal.c \
299 $(TOP)/src/test_malloc.c \
300 $(TOP)/src/test_multiplex.c \
301 $(TOP)/src/test_mutex.c \
302 $(TOP)/src/test_onefile.c \
303 $(TOP)/src/test_osinst.c \
304 $(TOP)/src/test_pcache.c \
305 $(TOP)/src/test_quota.c \
306 $(TOP)/src/test_rtree.c \
307 $(TOP)/src/test_schema.c \
308 $(TOP)/src/test_server.c \
309 $(TOP)/src/test_sqllog.c \
310 $(TOP)/src/test_superlock.c \
311 $(TOP)/src/test_syscall.c \
312 $(TOP)/src/test_tclvar.c \
313 $(TOP)/src/test_thread.c \
314 $(TOP)/src/test_vfs.c \
315 $(TOP)/src/test_wsd.c
317 # Extensions to be statically loaded.
319 TESTSRC += \
320 $(TOP)/ext/misc/amatch.c \
321 $(TOP)/ext/misc/closure.c \
322 $(TOP)/ext/misc/eval.c \
323 $(TOP)/ext/misc/fileio.c \
324 $(TOP)/ext/misc/fuzzer.c \
325 $(TOP)/ext/misc/ieee754.c \
326 $(TOP)/ext/misc/nextchar.c \
327 $(TOP)/ext/misc/percentile.c \
328 $(TOP)/ext/misc/regexp.c \
329 $(TOP)/ext/misc/series.c \
330 $(TOP)/ext/misc/spellfix.c \
331 $(TOP)/ext/misc/totype.c \
332 $(TOP)/ext/misc/wholenumber.c \
333 $(TOP)/ext/misc/vfslog.c \
334 $(TOP)/ext/fts5/fts5_tcl.c \
335 $(TOP)/ext/fts5/fts5_test_mi.c
338 #TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c
339 #TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c
341 TESTSRC2 = \
342 $(TOP)/src/attach.c \
343 $(TOP)/src/backup.c \
344 $(TOP)/src/btree.c \
345 $(TOP)/src/build.c \
346 $(TOP)/src/date.c \
347 $(TOP)/src/dbstat.c \
348 $(TOP)/src/expr.c \
349 $(TOP)/src/func.c \
350 $(TOP)/src/insert.c \
351 $(TOP)/src/wal.c \
352 $(TOP)/src/main.c \
353 $(TOP)/src/mem5.c \
354 $(TOP)/src/os.c \
355 $(TOP)/src/os_unix.c \
356 $(TOP)/src/os_win.c \
357 $(TOP)/src/pager.c \
358 $(TOP)/src/pragma.c \
359 $(TOP)/src/prepare.c \
360 $(TOP)/src/printf.c \
361 $(TOP)/src/random.c \
362 $(TOP)/src/pcache.c \
363 $(TOP)/src/pcache1.c \
364 $(TOP)/src/select.c \
365 $(TOP)/src/threads.c \
366 $(TOP)/src/tokenize.c \
367 $(TOP)/src/utf.c \
368 $(TOP)/src/util.c \
369 $(TOP)/src/vdbeapi.c \
370 $(TOP)/src/vdbeaux.c \
371 $(TOP)/src/vdbe.c \
372 $(TOP)/src/vdbemem.c \
373 $(TOP)/src/where.c \
374 $(TOP)/src/wherecode.c \
375 $(TOP)/src/whereexpr.c \
376 parse.c \
377 $(TOP)/ext/fts3/fts3.c \
378 $(TOP)/ext/fts3/fts3_aux.c \
379 $(TOP)/ext/fts3/fts3_expr.c \
380 $(TOP)/ext/fts3/fts3_tokenizer.c \
381 $(TOP)/ext/fts3/fts3_write.c \
382 $(TOP)/ext/async/sqlite3async.c
384 # Header files used by all library source files.
386 HDR = \
387 $(TOP)/src/btree.h \
388 $(TOP)/src/btreeInt.h \
389 $(TOP)/src/hash.h \
390 $(TOP)/src/hwtime.h \
391 keywordhash.h \
392 $(TOP)/src/msvc.h \
393 $(TOP)/src/mutex.h \
394 opcodes.h \
395 $(TOP)/src/os.h \
396 $(TOP)/src/os_common.h \
397 $(TOP)/src/os_setup.h \
398 $(TOP)/src/os_win.h \
399 $(TOP)/src/pager.h \
400 $(TOP)/src/pcache.h \
401 parse.h \
402 $(TOP)/src/pragma.h \
403 sqlite3.h \
404 $(TOP)/src/sqlite3ext.h \
405 $(TOP)/src/sqliteInt.h \
406 $(TOP)/src/sqliteLimit.h \
407 $(TOP)/src/vdbe.h \
408 $(TOP)/src/vdbeInt.h \
409 $(TOP)/src/vxworks.h \
410 $(TOP)/src/whereInt.h
412 # Header files used by extensions
414 EXTHDR += \
415 $(TOP)/ext/fts1/fts1.h \
416 $(TOP)/ext/fts1/fts1_hash.h \
417 $(TOP)/ext/fts1/fts1_tokenizer.h
418 EXTHDR += \
419 $(TOP)/ext/fts2/fts2.h \
420 $(TOP)/ext/fts2/fts2_hash.h \
421 $(TOP)/ext/fts2/fts2_tokenizer.h
422 EXTHDR += \
423 $(TOP)/ext/fts3/fts3.h \
424 $(TOP)/ext/fts3/fts3Int.h \
425 $(TOP)/ext/fts3/fts3_hash.h \
426 $(TOP)/ext/fts3/fts3_tokenizer.h
427 EXTHDR += \
428 $(TOP)/ext/rtree/rtree.h
429 EXTHDR += \
430 $(TOP)/ext/icu/sqliteicu.h
431 EXTHDR += \
432 $(TOP)/ext/fts5/fts5Int.h \
433 fts5parse.h \
434 $(TOP)/ext/fts5/fts5.h
435 EXTHDR += \
436 $(TOP)/ext/userauth/sqlite3userauth.h
438 # executables needed for testing
440 TESTPROGS = \
441 testfixture$(EXE) \
442 sqlite3$(EXE) \
443 sqlite3_analyzer$(EXE) \
444 sqldiff$(EXE)
446 # Databases containing fuzzer test cases
448 FUZZDATA = \
449 $(TOP)/test/fuzzdata1.db \
450 $(TOP)/test/fuzzdata2.db \
451 $(TOP)/test/fuzzdata3.db \
452 $(TOP)/test/fuzzdata4.db
454 # Standard options to testfixture
456 TESTOPTS = --verbose=file --output=test-out.txt
458 # Extra compiler options for various shell tools
460 SHELL_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5
461 FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1
462 FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1
464 # This is the default Makefile target. The objects listed here
465 # are what get build when you type just "make" with no arguments.
467 all: sqlite3.h libsqlite3.a sqlite3$(EXE)
469 libsqlite3.a: $(LIBOBJ)
470 $(AR) libsqlite3.a $(LIBOBJ)
471 $(RANLIB) libsqlite3.a
473 sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h
474 $(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE) $(SHELL_OPT) \
475 $(TOP)/src/shell.c libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB)
477 sqldiff$(EXE): $(TOP)/tool/sqldiff.c sqlite3.c sqlite3.h
478 $(TCCX) -o sqldiff$(EXE) -DSQLITE_THREADSAFE=0 \
479 $(TOP)/tool/sqldiff.c sqlite3.c $(TLIBS) $(THREADLIB)
481 fuzzershell$(EXE): $(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h
482 $(TCCX) -o fuzzershell$(EXE) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \
483 $(FUZZERSHELL_OPT) $(TOP)/tool/fuzzershell.c sqlite3.c \
484 $(TLIBS) $(THREADLIB)
486 fuzzcheck$(EXE): $(TOP)/test/fuzzcheck.c sqlite3.c sqlite3.h
487 $(TCCX) -o fuzzcheck$(EXE) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \
488 -DSQLITE_ENABLE_MEMSYS5 $(FUZZCHECK_OPT) \
489 $(TOP)/test/fuzzcheck.c sqlite3.c $(TLIBS) $(THREADLIB)
491 mptester$(EXE): sqlite3.c $(TOP)/mptest/mptest.c
492 $(TCCX) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.c \
493 $(TLIBS) $(THREADLIB)
495 MPTEST1=./mptester$(EXE) mptest.db $(TOP)/mptest/crash01.test --repeat 20
496 MPTEST2=./mptester$(EXE) mptest.db $(TOP)/mptest/multiwrite01.test --repeat 20
497 mptest: mptester$(EXE)
498 rm -f mptest.db
499 $(MPTEST1) --journalmode DELETE
500 $(MPTEST2) --journalmode WAL
501 $(MPTEST1) --journalmode WAL
502 $(MPTEST2) --journalmode PERSIST
503 $(MPTEST1) --journalmode PERSIST
504 $(MPTEST2) --journalmode TRUNCATE
505 $(MPTEST1) --journalmode TRUNCATE
506 $(MPTEST2) --journalmode DELETE
508 sqlite3.o: sqlite3.c
509 $(TCCX) -I. -c sqlite3.c
511 # This target creates a directory named "tsrc" and fills it with
512 # copies of all of the C source code and header files needed to
513 # build on the target system. Some of the C source code and header
514 # files are automatically generated. This target takes care of
515 # all that automatic generation.
517 target_source: $(SRC) $(TOP)/tool/vdbe-compress.tcl fts5.c
518 rm -rf tsrc
519 mkdir tsrc
520 cp -f $(SRC) tsrc
521 rm tsrc/sqlite.h.in tsrc/parse.y
522 tclsh $(TOP)/tool/vdbe-compress.tcl $(OPTS) <tsrc/vdbe.c >vdbe.new
523 mv vdbe.new tsrc/vdbe.c
524 cp fts5.c fts5.h tsrc
525 touch target_source
527 sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl
528 tclsh $(TOP)/tool/mksqlite3c.tcl
529 cp tsrc/shell.c tsrc/sqlite3ext.h .
530 echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c
531 cat sqlite3.c >>tclsqlite3.c
532 echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite3.c
533 cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
535 sqlite3ext.h: target_source
536 cp tsrc/sqlite3ext.h .
538 sqlite3.c-debug: target_source $(TOP)/tool/mksqlite3c.tcl
539 tclsh $(TOP)/tool/mksqlite3c.tcl --linemacros
540 echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c
541 cat sqlite3.c >>tclsqlite3.c
542 echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite3.c
543 echo '#line 1 "tclsqlite.c"' >>tclsqlite3.c
544 cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
546 sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl
547 tclsh $(TOP)/tool/split-sqlite3c.tcl
549 fts2amal.c: target_source $(TOP)/ext/fts2/mkfts2amal.tcl
550 tclsh $(TOP)/ext/fts2/mkfts2amal.tcl
552 fts3amal.c: target_source $(TOP)/ext/fts3/mkfts3amal.tcl
553 tclsh $(TOP)/ext/fts3/mkfts3amal.tcl
555 # Rules to build the LEMON compiler generator
557 lemon: $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
558 $(BCC) -o lemon $(TOP)/tool/lemon.c
559 cp $(TOP)/tool/lempar.c .
561 # Rules to build individual *.o files from generated *.c files. This
562 # applies to:
564 # parse.o
565 # opcodes.o
567 %.o: %.c $(HDR)
568 $(TCCX) -c $<
570 # Rules to build individual *.o files from files in the src directory.
572 %.o: $(TOP)/src/%.c $(HDR)
573 $(TCCX) -c $<
575 tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR)
576 $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
580 # Rules to build opcodes.c and opcodes.h
582 opcodes.c: opcodes.h $(TOP)/tool/mkopcodec.tcl
583 tclsh $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c
585 opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl
586 cat parse.h $(TOP)/src/vdbe.c | \
587 tclsh $(TOP)/tool/mkopcodeh.tcl >opcodes.h
589 # Rules to build parse.c and parse.h - the outputs of lemon.
591 parse.h: parse.c
593 parse.c: $(TOP)/src/parse.y lemon $(TOP)/tool/addopcodes.tcl
594 cp $(TOP)/src/parse.y .
595 rm -f parse.h
596 ./lemon -s $(OPTS) parse.y
597 mv parse.h parse.h.temp
598 tclsh $(TOP)/tool/addopcodes.tcl parse.h.temp >parse.h
600 sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION $(TOP)/ext/rtree/sqlite3rtree.h
601 tclsh $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
603 keywordhash.h: $(TOP)/tool/mkkeywordhash.c
604 $(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c
605 ./mkkeywordhash >keywordhash.h
609 # Rules to build the extension objects.
611 icu.o: $(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR)
612 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/icu/icu.c
614 fts2.o: $(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR)
615 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2.c
617 fts2_hash.o: $(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR)
618 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_hash.c
620 fts2_icu.o: $(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR)
621 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_icu.c
623 fts2_porter.o: $(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR)
624 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_porter.c
626 fts2_tokenizer.o: $(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR)
627 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c
629 fts2_tokenizer1.o: $(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR)
630 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c
632 fts3.o: $(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR)
633 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3.c
635 fts3_aux.o: $(TOP)/ext/fts3/fts3_aux.c $(HDR) $(EXTHDR)
636 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_aux.c
638 fts3_expr.o: $(TOP)/ext/fts3/fts3_expr.c $(HDR) $(EXTHDR)
639 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_expr.c
641 fts3_hash.o: $(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR)
642 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_hash.c
644 fts3_icu.o: $(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR)
645 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_icu.c
647 fts3_snippet.o: $(TOP)/ext/fts3/fts3_snippet.c $(HDR) $(EXTHDR)
648 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_snippet.c
650 fts3_porter.o: $(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR)
651 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_porter.c
653 fts3_tokenizer.o: $(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR)
654 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c
656 fts3_tokenizer1.o: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR)
657 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c
659 fts3_tokenize_vtab.o: $(TOP)/ext/fts3/fts3_tokenize_vtab.c $(HDR) $(EXTHDR)
660 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenize_vtab.c
662 fts3_unicode.o: $(TOP)/ext/fts3/fts3_unicode.c $(HDR) $(EXTHDR)
663 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_unicode.c
665 fts3_unicode2.o: $(TOP)/ext/fts3/fts3_unicode2.c $(HDR) $(EXTHDR)
666 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_unicode2.c
668 fts3_write.o: $(TOP)/ext/fts3/fts3_write.c $(HDR) $(EXTHDR)
669 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_write.c
671 fts5.o: fts5.c
672 $(TCCX) -DSQLITE_CORE -c fts5.c
674 json1.o: $(TOP)/ext/misc/json1.c
675 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/misc/json1.c
677 rtree.o: $(TOP)/ext/rtree/rtree.c $(HDR) $(EXTHDR)
678 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/rtree/rtree.c
682 fts5parse.c: $(TOP)/ext/fts5/fts5parse.y lemon
683 cp $(TOP)/ext/fts5/fts5parse.y .
684 rm -f fts5parse.h
685 ./lemon $(OPTS) fts5parse.y
687 fts5parse.h: fts5parse.c
689 fts5.c: $(FTS5_SRC) $(FTS5_HDR)
690 tclsh $(TOP)/ext/fts5/tool/mkfts5c.tcl
691 cp $(TOP)/ext/fts5/fts5.h .
693 userauth.o: $(TOP)/ext/userauth/userauth.c $(HDR) $(EXTHDR)
694 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/userauth/userauth.c
696 sqlite3rbu.o: $(TOP)/ext/rbu/sqlite3rbu.c $(HDR) $(EXTHDR)
697 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/rbu/sqlite3rbu.c
700 # Rules for building test programs and for running tests
702 tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a
703 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \
704 $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB)
706 sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl
707 echo "#define TCLSH 2" > $@
708 echo "#define SQLITE_ENABLE_DBSTAT_VTAB 1" >> $@
709 cat sqlite3.c $(TOP)/src/tclsqlite.c >> $@
710 echo "static const char *tclsh_main_loop(void){" >> $@
711 echo "static const char *zMainloop = " >> $@
712 tclsh $(TOP)/tool/tostr.tcl $(TOP)/tool/spaceanal.tcl >> $@
713 echo "; return zMainloop; }" >> $@
715 sqlite3_analyzer$(EXE): sqlite3_analyzer.c
716 $(TCCX) $(TCL_FLAGS) sqlite3_analyzer.c -o $@ $(LIBTCL) $(THREADLIB)
718 # Rules to build the 'testfixture' application.
720 TESTFIXTURE_FLAGS = -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
721 TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
723 testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c
724 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
725 $(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \
726 -o testfixture$(EXE) $(LIBTCL) libsqlite3.a $(THREADLIB)
728 amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c
729 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
730 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
731 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
733 fts3-testfixture$(EXE): sqlite3.c fts3amal.c $(TESTSRC) $(TOP)/src/tclsqlite.c
734 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
735 -DSQLITE_ENABLE_FTS3=1 \
736 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c fts3amal.c \
737 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
739 fulltest: $(TESTPROGS) fuzztest
740 ./testfixture$(EXE) $(TOP)/test/all.test $(TESTOPTS)
742 soaktest: $(TESTPROGS)
743 ./testfixture$(EXE) $(TOP)/test/all.test -soak=1 $(TESTOPTS)
745 fulltestonly: $(TESTPROGS) fuzztest
746 ./testfixture$(EXE) $(TOP)/test/full.test $(TESTOPTS)
748 queryplantest: testfixture$(EXE) sqlite3$(EXE)
749 ./testfixture$(EXE) $(TOP)/test/permutations.test queryplanner $(TESTOPTS)
751 fuzztest: fuzzcheck$(EXE) $(FUZZDATA)
752 ./fuzzcheck$(EXE) $(FUZZDATA)
754 fastfuzztest: fuzzcheck$(EXE) $(FUZZDATA)
755 ./fuzzcheck$(EXE) --limit-mem 100M $(FUZZDATA)
757 valgrindfuzz: fuzzcheck$(EXE) $(FUZZDATA)
758 valgrind ./fuzzcheck$(EXE) --cell-size-check --limit-mem 10M --timeout 600 $(FUZZDATA)
760 # A very quick test using only testfixture and omitting all the slower
761 # tests. Designed to run in under 3 minutes on a workstation.
763 quicktest: ./testfixture$(EXE)
764 ./testfixture$(EXE) $(TOP)/test/extraquick.test $(TESTOPTS)
766 # The default test case. Runs most of the faster standard TCL tests,
767 # and fuzz tests, and sqlite3_analyzer and sqldiff tests.
769 test: $(TESTPROGS) fastfuzztest
770 ./testfixture$(EXE) $(TOP)/test/veryquick.test $(TESTOPTS)
772 # Run a test using valgrind. This can take a really long time
773 # because valgrind is so much slower than a native machine.
775 valgrindtest: $(TESTPROGS) valgrindfuzz
776 OMIT_MISUSE=1 valgrind -v \
777 ./testfixture$(EXE) $(TOP)/test/permutations.test valgrind $(TESTOPTS)
779 # A very fast test that checks basic sanity. The name comes from
780 # the 60s-era electronics testing: "Turn it on and see if smoke
781 # comes out."
783 smoketest: $(TESTPROGS) fuzzcheck$(EXE)
784 ./testfixture$(EXE) $(TOP)/test/main.test $(TESTOPTS)
786 # The next two rules are used to support the "threadtest" target. Building
787 # threadtest runs a few thread-safety tests that are implemented in C. This
788 # target is invoked by the releasetest.tcl script.
790 THREADTEST3_SRC = $(TOP)/test/threadtest3.c \
791 $(TOP)/test/tt3_checkpoint.c \
792 $(TOP)/test/tt3_index.c \
793 $(TOP)/test/tt3_vacuum.c \
794 $(TOP)/test/tt3_stress.c \
795 $(TOP)/test/tt3_lookaside1.c
797 threadtest3$(EXE): sqlite3.o $(THREADTEST3_SRC)
798 $(TCCX) $(TOP)/test/threadtest3.c sqlite3.o -o $@ $(THREADLIB)
800 threadtest: threadtest3$(EXE)
801 ./threadtest3$(EXE)
803 TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO)
804 $(TEST_EXTENSION): $(TOP)/src/test_loadext.c
805 $(MKSHLIB) $(TOP)/src/test_loadext.c -o $(TEST_EXTENSION)
807 extensiontest: testfixture$(EXE) $(TEST_EXTENSION)
808 ./testfixture$(EXE) $(TOP)/test/loadext.test
810 showdb$(EXE): $(TOP)/tool/showdb.c sqlite3.o
811 $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o showdb$(EXE) \
812 $(TOP)/tool/showdb.c sqlite3.o $(THREADLIB)
814 showstat4$(EXE): $(TOP)/tool/showstat4.c sqlite3.o
815 $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o showstat4$(EXE) \
816 $(TOP)/tool/showstat4.c sqlite3.o $(THREADLIB)
818 showjournal$(EXE): $(TOP)/tool/showjournal.c sqlite3.o
819 $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o showjournal$(EXE) \
820 $(TOP)/tool/showjournal.c sqlite3.o $(THREADLIB)
822 showwal$(EXE): $(TOP)/tool/showwal.c sqlite3.o
823 $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o showwal$(EXE) \
824 $(TOP)/tool/showwal.c sqlite3.o $(THREADLIB)
826 fts3view$(EXE): $(TOP)/ext/fts3/tool/fts3view.c sqlite3.o
827 $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o fts3view$(EXE) \
828 $(TOP)/ext/fts3/tool/fts3view.c sqlite3.o $(THREADLIB)
830 rollback-test$(EXE): $(TOP)/tool/rollback-test.c sqlite3.o
831 $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o rollback-test$(EXE) \
832 $(TOP)/tool/rollback-test.c sqlite3.o $(THREADLIB)
834 LogEst$(EXE): $(TOP)/tool/logest.c sqlite3.h
835 $(TCC) -o LogEst$(EXE) $(TOP)/tool/logest.c
837 wordcount$(EXE): $(TOP)/test/wordcount.c sqlite3.c
838 $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o wordcount$(EXE) \
839 $(TOP)/test/wordcount.c sqlite3.c
841 speedtest1$(EXE): $(TOP)/test/speedtest1.c sqlite3.o
842 $(TCC) -I. $(OTAFLAGS) -o speedtest1$(EXE) $(TOP)/test/speedtest1.c sqlite3.o $(THREADLIB)
844 rbu$(EXE): $(TOP)/ext/rbu/rbu.c $(TOP)/ext/rbu/sqlite3rbu.c sqlite3.o
845 $(TCC) -I. -o rbu$(EXE) $(TOP)/ext/rbu/rbu.c sqlite3.o \
846 $(THREADLIB)
848 loadfts: $(TOP)/tool/loadfts.c libsqlite3.a
849 $(TCC) $(TOP)/tool/loadfts.c libsqlite3.a -o loadfts $(THREADLIB)
851 # This target will fail if the SQLite amalgamation contains any exported
852 # symbols that do not begin with "sqlite3_". It is run as part of the
853 # releasetest.tcl script.
855 checksymbols: sqlite3.o
856 nm -g --defined-only sqlite3.o | grep -v " sqlite3_" ; test $$? -ne 0
858 # Build the amalgamation-autoconf package.
860 amalgamation-tarball: sqlite3.c
861 TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh
864 # Standard install and cleanup targets
866 install: sqlite3 libsqlite3.a sqlite3.h
867 mv sqlite3 /usr/bin
868 mv libsqlite3.a /usr/lib
869 mv sqlite3.h /usr/include
871 clean:
872 rm -f *.o sqlite3 sqlite3.exe libsqlite3.a sqlite3.h opcodes.*
873 rm -f lemon lemon.exe lempar.c parse.* sqlite*.tar.gz
874 rm -f mkkeywordhash mkkeywordhash.exe keywordhash.h
875 rm -f $(PUBLISH)
876 rm -f *.da *.bb *.bbg gmon.out
877 rm -rf quota2a quota2b quota2c
878 rm -rf tsrc target_source
879 rm -f testloadext.dll libtestloadext.so
880 rm -f amalgamation-testfixture amalgamation-testfixture.exe
881 rm -f fts3-testfixture fts3-testfixture.exe
882 rm -f testfixture testfixture.exe
883 rm -f threadtest3 threadtest3.exe
884 rm -f LogEst LogEst.exe
885 rm -f fts3view fts3view.exe
886 rm -f rollback-test rollback-test.exe
887 rm -f showdb showdb.exe
888 rm -f showjournal showjournal.exe
889 rm -f showstat4 showstat4.exe
890 rm -f showwal showwal.exe
891 rm -f speedtest1 speedtest1.exe
892 rm -f wordcount wordcount.exe
893 rm -f sqlite3.c sqlite3-*.c fts?amal.c tclsqlite3.c
894 rm -f sqlite3rc.h
895 rm -f shell.c sqlite3ext.h
896 rm -f sqlite3_analyzer sqlite3_analyzer.exe sqlite3_analyzer.c
897 rm -f sqlite-*-output.vsix
898 rm -f mptester mptester.exe
899 rm -f fuzzershell fuzzershell.exe
900 rm -f fuzzcheck fuzzcheck.exe
901 rm -f sqldiff sqldiff.exe
902 rm -f fts5.* fts5parse.*