Merge branch 'prerelease' of ssh://github.com/sqlcipher/sqlcipher into prerelease
[sqlcipher.git] / main.mk
blob408e609b8e5c74196aa9a73ba6566c302b54c0f8
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_unicode.o fts3_unicode2.o \
59 fts3_write.o func.o global.o hash.o \
60 icu.o insert.o journal.o legacy.o loadext.o \
61 main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \
62 memjournal.o \
63 mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \
64 notify.o opcodes.o os.o os_unix.o os_win.o \
65 pager.o parse.o pcache.o pcache1.o pragma.o prepare.o printf.o \
66 random.o resolve.o rowset.o rtree.o select.o status.o \
67 table.o tokenize.o trigger.o \
68 update.o util.o vacuum.o \
69 vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \
70 vdbetrace.o wal.o walker.o where.o utf.o vtab.o
74 # All of the source code files.
76 SRC = \
77 $(TOP)/src/alter.c \
78 $(TOP)/src/analyze.c \
79 $(TOP)/src/attach.c \
80 $(TOP)/src/auth.c \
81 $(TOP)/src/backup.c \
82 $(TOP)/src/bitvec.c \
83 $(TOP)/src/btmutex.c \
84 $(TOP)/src/btree.c \
85 $(TOP)/src/btree.h \
86 $(TOP)/src/btreeInt.h \
87 $(TOP)/src/build.c \
88 $(TOP)/src/callback.c \
89 $(TOP)/src/complete.c \
90 $(TOP)/src/ctime.c \
91 $(TOP)/src/date.c \
92 $(TOP)/src/delete.c \
93 $(TOP)/src/expr.c \
94 $(TOP)/src/fault.c \
95 $(TOP)/src/fkey.c \
96 $(TOP)/src/func.c \
97 $(TOP)/src/global.c \
98 $(TOP)/src/hash.c \
99 $(TOP)/src/hash.h \
100 $(TOP)/src/hwtime.h \
101 $(TOP)/src/insert.c \
102 $(TOP)/src/journal.c \
103 $(TOP)/src/legacy.c \
104 $(TOP)/src/loadext.c \
105 $(TOP)/src/main.c \
106 $(TOP)/src/malloc.c \
107 $(TOP)/src/mem0.c \
108 $(TOP)/src/mem1.c \
109 $(TOP)/src/mem2.c \
110 $(TOP)/src/mem3.c \
111 $(TOP)/src/mem5.c \
112 $(TOP)/src/memjournal.c \
113 $(TOP)/src/mutex.c \
114 $(TOP)/src/mutex.h \
115 $(TOP)/src/mutex_noop.c \
116 $(TOP)/src/mutex_unix.c \
117 $(TOP)/src/mutex_w32.c \
118 $(TOP)/src/notify.c \
119 $(TOP)/src/os.c \
120 $(TOP)/src/os.h \
121 $(TOP)/src/os_common.h \
122 $(TOP)/src/os_unix.c \
123 $(TOP)/src/os_win.c \
124 $(TOP)/src/pager.c \
125 $(TOP)/src/pager.h \
126 $(TOP)/src/parse.y \
127 $(TOP)/src/pcache.c \
128 $(TOP)/src/pcache.h \
129 $(TOP)/src/pcache1.c \
130 $(TOP)/src/pragma.c \
131 $(TOP)/src/prepare.c \
132 $(TOP)/src/printf.c \
133 $(TOP)/src/random.c \
134 $(TOP)/src/resolve.c \
135 $(TOP)/src/rowset.c \
136 $(TOP)/src/select.c \
137 $(TOP)/src/status.c \
138 $(TOP)/src/shell.c \
139 $(TOP)/src/sqlite.h.in \
140 $(TOP)/src/sqlite3ext.h \
141 $(TOP)/src/sqliteInt.h \
142 $(TOP)/src/sqliteLimit.h \
143 $(TOP)/src/table.c \
144 $(TOP)/src/tclsqlite.c \
145 $(TOP)/src/tokenize.c \
146 $(TOP)/src/trigger.c \
147 $(TOP)/src/utf.c \
148 $(TOP)/src/update.c \
149 $(TOP)/src/util.c \
150 $(TOP)/src/vacuum.c \
151 $(TOP)/src/vdbe.c \
152 $(TOP)/src/vdbe.h \
153 $(TOP)/src/vdbeapi.c \
154 $(TOP)/src/vdbeaux.c \
155 $(TOP)/src/vdbeblob.c \
156 $(TOP)/src/vdbemem.c \
157 $(TOP)/src/vdbesort.c \
158 $(TOP)/src/vdbetrace.c \
159 $(TOP)/src/vdbeInt.h \
160 $(TOP)/src/vtab.c \
161 $(TOP)/src/wal.c \
162 $(TOP)/src/wal.h \
163 $(TOP)/src/walker.c \
164 $(TOP)/src/where.c
166 # Source code for extensions
168 SRC += \
169 $(TOP)/ext/fts1/fts1.c \
170 $(TOP)/ext/fts1/fts1.h \
171 $(TOP)/ext/fts1/fts1_hash.c \
172 $(TOP)/ext/fts1/fts1_hash.h \
173 $(TOP)/ext/fts1/fts1_porter.c \
174 $(TOP)/ext/fts1/fts1_tokenizer.h \
175 $(TOP)/ext/fts1/fts1_tokenizer1.c
176 SRC += \
177 $(TOP)/ext/fts2/fts2.c \
178 $(TOP)/ext/fts2/fts2.h \
179 $(TOP)/ext/fts2/fts2_hash.c \
180 $(TOP)/ext/fts2/fts2_hash.h \
181 $(TOP)/ext/fts2/fts2_icu.c \
182 $(TOP)/ext/fts2/fts2_porter.c \
183 $(TOP)/ext/fts2/fts2_tokenizer.h \
184 $(TOP)/ext/fts2/fts2_tokenizer.c \
185 $(TOP)/ext/fts2/fts2_tokenizer1.c
186 SRC += \
187 $(TOP)/ext/fts3/fts3.c \
188 $(TOP)/ext/fts3/fts3.h \
189 $(TOP)/ext/fts3/fts3Int.h \
190 $(TOP)/ext/fts3/fts3_aux.c \
191 $(TOP)/ext/fts3/fts3_expr.c \
192 $(TOP)/ext/fts3/fts3_hash.c \
193 $(TOP)/ext/fts3/fts3_hash.h \
194 $(TOP)/ext/fts3/fts3_icu.c \
195 $(TOP)/ext/fts3/fts3_porter.c \
196 $(TOP)/ext/fts3/fts3_snippet.c \
197 $(TOP)/ext/fts3/fts3_tokenizer.h \
198 $(TOP)/ext/fts3/fts3_tokenizer.c \
199 $(TOP)/ext/fts3/fts3_tokenizer1.c \
200 $(TOP)/ext/fts3/fts3_unicode.c \
201 $(TOP)/ext/fts3/fts3_unicode2.c \
202 $(TOP)/ext/fts3/fts3_write.c
203 SRC += \
204 $(TOP)/ext/icu/sqliteicu.h \
205 $(TOP)/ext/icu/icu.c
206 SRC += \
207 $(TOP)/ext/rtree/rtree.h \
208 $(TOP)/ext/rtree/rtree.c
211 # Generated source code files
213 SRC += \
214 keywordhash.h \
215 opcodes.c \
216 opcodes.h \
217 parse.c \
218 parse.h \
219 sqlite3.h
222 # Source code to the test files.
224 TESTSRC = \
225 $(TOP)/ext/fts3/fts3_term.c \
226 $(TOP)/ext/fts3/fts3_test.c \
227 $(TOP)/src/test1.c \
228 $(TOP)/src/test2.c \
229 $(TOP)/src/test3.c \
230 $(TOP)/src/test4.c \
231 $(TOP)/src/test5.c \
232 $(TOP)/src/test6.c \
233 $(TOP)/src/test7.c \
234 $(TOP)/src/test8.c \
235 $(TOP)/src/test9.c \
236 $(TOP)/src/test_autoext.c \
237 $(TOP)/src/test_async.c \
238 $(TOP)/src/test_backup.c \
239 $(TOP)/src/test_btree.c \
240 $(TOP)/src/test_config.c \
241 $(TOP)/src/test_demovfs.c \
242 $(TOP)/src/test_devsym.c \
243 $(TOP)/src/test_func.c \
244 $(TOP)/src/test_fuzzer.c \
245 $(TOP)/src/test_hexio.c \
246 $(TOP)/src/test_init.c \
247 $(TOP)/src/test_intarray.c \
248 $(TOP)/src/test_journal.c \
249 $(TOP)/src/test_malloc.c \
250 $(TOP)/src/test_multiplex.c \
251 $(TOP)/src/test_mutex.c \
252 $(TOP)/src/test_onefile.c \
253 $(TOP)/src/test_osinst.c \
254 $(TOP)/src/test_pcache.c \
255 $(TOP)/src/test_quota.c \
256 $(TOP)/src/test_rtree.c \
257 $(TOP)/src/test_schema.c \
258 $(TOP)/src/test_server.c \
259 $(TOP)/src/test_stat.c \
260 $(TOP)/src/test_superlock.c \
261 $(TOP)/src/test_syscall.c \
262 $(TOP)/src/test_tclvar.c \
263 $(TOP)/src/test_thread.c \
264 $(TOP)/src/test_vfs.c \
265 $(TOP)/src/test_wholenumber.c \
266 $(TOP)/src/test_wsd.c
268 #TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c
269 #TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c
271 TESTSRC2 = \
272 $(TOP)/src/attach.c \
273 $(TOP)/src/backup.c \
274 $(TOP)/src/btree.c \
275 $(TOP)/src/build.c \
276 $(TOP)/src/date.c \
277 $(TOP)/src/expr.c \
278 $(TOP)/src/func.c \
279 $(TOP)/src/insert.c \
280 $(TOP)/src/wal.c \
281 $(TOP)/src/mem5.c \
282 $(TOP)/src/os.c \
283 $(TOP)/src/os_unix.c \
284 $(TOP)/src/os_win.c \
285 $(TOP)/src/pager.c \
286 $(TOP)/src/pragma.c \
287 $(TOP)/src/prepare.c \
288 $(TOP)/src/printf.c \
289 $(TOP)/src/random.c \
290 $(TOP)/src/pcache.c \
291 $(TOP)/src/pcache1.c \
292 $(TOP)/src/select.c \
293 $(TOP)/src/tokenize.c \
294 $(TOP)/src/utf.c \
295 $(TOP)/src/util.c \
296 $(TOP)/src/vdbeapi.c \
297 $(TOP)/src/vdbeaux.c \
298 $(TOP)/src/vdbe.c \
299 $(TOP)/src/vdbemem.c \
300 $(TOP)/src/where.c \
301 parse.c \
302 $(TOP)/ext/fts3/fts3.c \
303 $(TOP)/ext/fts3/fts3_aux.c \
304 $(TOP)/ext/fts3/fts3_expr.c \
305 $(TOP)/ext/fts3/fts3_tokenizer.c \
306 $(TOP)/ext/fts3/fts3_write.c \
307 $(TOP)/ext/async/sqlite3async.c
309 # Header files used by all library source files.
311 HDR = \
312 $(TOP)/src/btree.h \
313 $(TOP)/src/btreeInt.h \
314 $(TOP)/src/hash.h \
315 $(TOP)/src/hwtime.h \
316 keywordhash.h \
317 $(TOP)/src/mutex.h \
318 opcodes.h \
319 $(TOP)/src/os.h \
320 $(TOP)/src/os_common.h \
321 $(TOP)/src/pager.h \
322 $(TOP)/src/pcache.h \
323 parse.h \
324 sqlite3.h \
325 $(TOP)/src/sqlite3ext.h \
326 $(TOP)/src/sqliteInt.h \
327 $(TOP)/src/sqliteLimit.h \
328 $(TOP)/src/vdbe.h \
329 $(TOP)/src/vdbeInt.h
331 # Header files used by extensions
333 EXTHDR += \
334 $(TOP)/ext/fts1/fts1.h \
335 $(TOP)/ext/fts1/fts1_hash.h \
336 $(TOP)/ext/fts1/fts1_tokenizer.h
337 EXTHDR += \
338 $(TOP)/ext/fts2/fts2.h \
339 $(TOP)/ext/fts2/fts2_hash.h \
340 $(TOP)/ext/fts2/fts2_tokenizer.h
341 EXTHDR += \
342 $(TOP)/ext/fts3/fts3.h \
343 $(TOP)/ext/fts3/fts3Int.h \
344 $(TOP)/ext/fts3/fts3_hash.h \
345 $(TOP)/ext/fts3/fts3_tokenizer.h
346 EXTHDR += \
347 $(TOP)/ext/rtree/rtree.h
348 EXTHDR += \
349 $(TOP)/ext/icu/sqliteicu.h
351 # This is the default Makefile target. The objects listed here
352 # are what get build when you type just "make" with no arguments.
354 all: sqlite3.h libsqlite3.a sqlite3$(EXE)
356 libsqlite3.a: $(LIBOBJ)
357 $(AR) libsqlite3.a $(LIBOBJ)
358 $(RANLIB) libsqlite3.a
360 sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h
361 $(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE) \
362 $(TOP)/src/shell.c \
363 libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB)
365 sqlite3.o: sqlite3.c
366 $(TCCX) -c sqlite3.c
368 # This target creates a directory named "tsrc" and fills it with
369 # copies of all of the C source code and header files needed to
370 # build on the target system. Some of the C source code and header
371 # files are automatically generated. This target takes care of
372 # all that automatic generation.
374 target_source: $(SRC) $(TOP)/tool/vdbe-compress.tcl
375 rm -rf tsrc
376 mkdir tsrc
377 cp -f $(SRC) tsrc
378 rm tsrc/sqlite.h.in tsrc/parse.y
379 tclsh $(TOP)/tool/vdbe-compress.tcl <tsrc/vdbe.c >vdbe.new
380 mv vdbe.new tsrc/vdbe.c
381 touch target_source
383 sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl
384 tclsh $(TOP)/tool/mksqlite3c.tcl
385 echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c
386 cat sqlite3.c >>tclsqlite3.c
387 echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite3.c
388 cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
390 sqlite3.c-debug: target_source $(TOP)/tool/mksqlite3c.tcl
391 tclsh $(TOP)/tool/mksqlite3c.tcl --linemacros
392 echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c
393 cat sqlite3.c >>tclsqlite3.c
394 echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite3.c
395 echo '#line 1 "tclsqlite.c"' >>tclsqlite3.c
396 cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
398 sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl
399 tclsh $(TOP)/tool/split-sqlite3c.tcl
401 fts2amal.c: target_source $(TOP)/ext/fts2/mkfts2amal.tcl
402 tclsh $(TOP)/ext/fts2/mkfts2amal.tcl
404 fts3amal.c: target_source $(TOP)/ext/fts3/mkfts3amal.tcl
405 tclsh $(TOP)/ext/fts3/mkfts3amal.tcl
407 # Rules to build the LEMON compiler generator
409 lemon: $(TOP)/tool/lemon.c $(TOP)/src/lempar.c
410 $(BCC) -o lemon $(TOP)/tool/lemon.c
411 cp $(TOP)/src/lempar.c .
413 # Rules to build individual *.o files from generated *.c files. This
414 # applies to:
416 # parse.o
417 # opcodes.o
419 %.o: %.c $(HDR)
420 $(TCCX) -c $<
422 # Rules to build individual *.o files from files in the src directory.
424 %.o: $(TOP)/src/%.c $(HDR)
425 $(TCCX) -c $<
427 tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR)
428 $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
432 # Rules to build opcodes.c and opcodes.h
434 opcodes.c: opcodes.h $(TOP)/mkopcodec.awk
435 $(NAWK) -f $(TOP)/mkopcodec.awk opcodes.h >opcodes.c
437 opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
438 cat parse.h $(TOP)/src/vdbe.c | \
439 $(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h
441 # Rules to build parse.c and parse.h - the outputs of lemon.
443 parse.h: parse.c
445 parse.c: $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk
446 cp $(TOP)/src/parse.y .
447 rm -f parse.h
448 ./lemon $(OPTS) parse.y
449 mv parse.h parse.h.temp
450 $(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
452 sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION
453 tclsh $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
455 keywordhash.h: $(TOP)/tool/mkkeywordhash.c
456 $(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c
457 ./mkkeywordhash >keywordhash.h
461 # Rules to build the extension objects.
463 icu.o: $(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR)
464 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/icu/icu.c
466 fts2.o: $(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR)
467 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2.c
469 fts2_hash.o: $(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR)
470 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_hash.c
472 fts2_icu.o: $(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR)
473 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_icu.c
475 fts2_porter.o: $(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR)
476 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_porter.c
478 fts2_tokenizer.o: $(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR)
479 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c
481 fts2_tokenizer1.o: $(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR)
482 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c
484 fts3.o: $(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR)
485 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3.c
487 fts3_aux.o: $(TOP)/ext/fts3/fts3_aux.c $(HDR) $(EXTHDR)
488 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_aux.c
490 fts3_expr.o: $(TOP)/ext/fts3/fts3_expr.c $(HDR) $(EXTHDR)
491 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_expr.c
493 fts3_hash.o: $(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR)
494 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_hash.c
496 fts3_icu.o: $(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR)
497 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_icu.c
499 fts3_snippet.o: $(TOP)/ext/fts3/fts3_snippet.c $(HDR) $(EXTHDR)
500 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_snippet.c
502 fts3_porter.o: $(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR)
503 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_porter.c
505 fts3_tokenizer.o: $(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR)
506 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c
508 fts3_tokenizer1.o: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR)
509 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c
511 fts3_unicode.o: $(TOP)/ext/fts3/fts3_unicode.c $(HDR) $(EXTHDR)
512 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_unicode.c
514 fts3_unicode2.o: $(TOP)/ext/fts3/fts3_unicode2.c $(HDR) $(EXTHDR)
515 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_unicode2.c
517 fts3_write.o: $(TOP)/ext/fts3/fts3_write.c $(HDR) $(EXTHDR)
518 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_write.c
520 rtree.o: $(TOP)/ext/rtree/rtree.c $(HDR) $(EXTHDR)
521 $(TCCX) -DSQLITE_CORE -c $(TOP)/ext/rtree/rtree.c
524 # Rules for building test programs and for running tests
526 tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a
527 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \
528 $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB)
530 sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl
531 echo "#define TCLSH 2" > $@
532 cat sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c >> $@
533 echo "static const char *tclsh_main_loop(void){" >> $@
534 echo "static const char *zMainloop = " >> $@
535 $(NAWK) -f $(TOP)/tool/tostr.awk $(TOP)/tool/spaceanal.tcl >> $@
536 echo "; return zMainloop; }" >> $@
538 sqlite3_analyzer$(EXE): sqlite3_analyzer.c
539 $(TCCX) $(TCL_FLAGS) sqlite3_analyzer.c -o $@ $(LIBTCL) $(THREADLIB)
541 # Rules to build the 'testfixture' application.
543 TESTFIXTURE_FLAGS = -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
544 TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
546 testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c
547 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
548 $(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \
549 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) libsqlite3.a
551 amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c
552 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
553 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
554 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
556 fts3-testfixture$(EXE): sqlite3.c fts3amal.c $(TESTSRC) $(TOP)/src/tclsqlite.c
557 $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
558 -DSQLITE_ENABLE_FTS3=1 \
559 $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c fts3amal.c \
560 -o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
562 fulltest: testfixture$(EXE) sqlite3$(EXE)
563 ./testfixture$(EXE) $(TOP)/test/all.test
565 soaktest: testfixture$(EXE) sqlite3$(EXE)
566 ./testfixture$(EXE) $(TOP)/test/all.test -soak=1
568 test: testfixture$(EXE) sqlite3$(EXE)
569 ./testfixture$(EXE) $(TOP)/test/veryquick.test
571 # The next two rules are used to support the "threadtest" target. Building
572 # threadtest runs a few thread-safety tests that are implemented in C. This
573 # target is invoked by the releasetest.tcl script.
575 threadtest3$(EXE): sqlite3.o $(TOP)/test/threadtest3.c $(TOP)/test/tt3_checkpoint.c
576 $(TCCX) -O2 sqlite3.o $(TOP)/test/threadtest3.c \
577 -o threadtest3$(EXE) $(THREADLIB)
579 threadtest: threadtest3$(EXE)
580 ./threadtest3$(EXE)
582 TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO)
583 $(TEST_EXTENSION): $(TOP)/src/test_loadext.c
584 $(MKSHLIB) $(TOP)/src/test_loadext.c -o $(TEST_EXTENSION)
586 extensiontest: testfixture$(EXE) $(TEST_EXTENSION)
587 ./testfixture$(EXE) $(TOP)/test/loadext.test
589 # This target will fail if the SQLite amalgamation contains any exported
590 # symbols that do not begin with "sqlite3_". It is run as part of the
591 # releasetest.tcl script.
593 checksymbols: sqlite3.o
594 nm -g --defined-only sqlite3.o | grep -v " sqlite3_" ; test $$? -ne 0
597 # Standard install and cleanup targets
599 install: sqlite3 libsqlite3.a sqlite3.h
600 mv sqlite3 /usr/bin
601 mv libsqlite3.a /usr/lib
602 mv sqlite3.h /usr/include
604 clean:
605 rm -f *.o sqlite3 sqlite3.exe libsqlite3.a sqlite3.h opcodes.*
606 rm -f lemon lemon.exe lempar.c parse.* sqlite*.tar.gz
607 rm -f mkkeywordhash mkkeywordhash.exe keywordhash.h
608 rm -f $(PUBLISH)
609 rm -f *.da *.bb *.bbg gmon.out
610 rm -rf quota2a quota2b quota2c
611 rm -rf tsrc target_source
612 rm -f testloadext.dll libtestloadext.so
613 rm -f amalgamation-testfixture amalgamation-testfixture.exe
614 rm -f fts3-testfixture fts3-testfixture.exe
615 rm -f testfixture testfixture.exe
616 rm -f threadtest3 threadtest3.exe
617 rm -f sqlite3.c fts?amal.c tclsqlite3.c
618 rm -f sqlite3_analyzer sqlite3_analyzer.exe sqlite3_analyzer.c
619 rm -f sqlite-output.vsix