1#!/usr/make
2#
3# Makefile for SQLITE
4#
5# This makefile is suppose to be configured automatically using the
6# autoconf.  But if that does not work for you, you can configure
7# the makefile manually.  Just set the parameters below to values that
8# work well for your system.
9#
10# If the configure script does not work out-of-the-box, you might
11# be able to get it to work by giving it some hints.  See the comment
12# at the beginning of configure.in for additional information.
13#
14
15# The toplevel directory of the source tree.  This is the directory
16# that contains this "Makefile.in" and the "configure.in" script.
17#
18TOP = @srcdir@
19
20# C Compiler and options for use in building executables that
21# will run on the platform that is doing the build.
22#
23BCC = @BUILD_CC@ @BUILD_CFLAGS@
24
25# C Compile and options for use in building executables that 
26# will run on the target platform.  (BCC and TCC are usually the
27# same unless your are cross-compiling.)
28#
29TCC = @CC@ @CPPFLAGS@ @CFLAGS@ -I. -I${TOP}/src -I${TOP}/ext/rtree
30
31# Define this for the autoconf-based build, so that the code knows it can
32# include the generated config.h
33# 
34TCC += -D_HAVE_SQLITE_CONFIG_H
35
36# Define -DNDEBUG to compile without debugging (i.e., for production usage)
37# Omitting the define will cause extra debugging code to be inserted and
38# includes extra comments when "EXPLAIN stmt" is used.
39#
40TCC += @TARGET_DEBUG@ @XTHREADCONNECT@
41
42# Compiler options needed for programs that use the TCL library.
43#
44TCC += @TCL_INCLUDE_SPEC@
45
46# The library that programs using TCL must link against.
47#
48LIBTCL = @TCL_LIB_SPEC@ @TCL_LIBS@
49
50# Compiler options needed for programs that use the readline() library.
51#
52READLINE_FLAGS = -DHAVE_READLINE=@TARGET_HAVE_READLINE@ @TARGET_READLINE_INC@
53
54# The library that programs using readline() must link against.
55#
56LIBREADLINE = @TARGET_READLINE_LIBS@
57
58# Should the database engine be compiled threadsafe
59#
60TCC += -DSQLITE_THREADSAFE=@SQLITE_THREADSAFE@
61
62# Any target libraries which libsqlite must be linked against
63# 
64TLIBS = @LIBS@
65
66# Flags controlling use of the in memory btree implementation
67#
68# SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
69# default to file, 2 to default to memory, and 3 to force temporary
70# tables to always be in memory.
71#
72TEMP_STORE = -DSQLITE_TEMP_STORE=@TEMP_STORE@
73
74# Enable/disable loadable extensions, and other optional features
75# based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).  
76# The same set of OMIT and ENABLE flags should be passed to the 
77# LEMON parser generator and the mkkeywordhash tool as well.
78OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@
79
80TCC += $(OPT_FEATURE_FLAGS)
81
82# Add in any optional parameters specified on the make commane line
83# ie.  make "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1".
84TCC += $(OPTS)
85
86# Version numbers and release number for the SQLite being compiled.
87#
88VERSION = @VERSION@
89VERSION_NUMBER = @VERSION_NUMBER@
90RELEASE = @RELEASE@
91
92# Filename extensions
93#
94BEXE = @BUILD_EXEEXT@
95TEXE = @TARGET_EXEEXT@
96
97# The following variable is "1" if the configure script was able to locate
98# the tclConfig.sh file.  It is an empty string otherwise.  When this
99# variable is "1", the TCL extension library (libtclsqlite3.so) is built
100# and installed.
101#
102HAVE_TCL = @HAVE_TCL@
103
104# This is the command to use for tclsh - normally just "tclsh", but we may
105# know the specific version we want to use
106#
107TCLSH_CMD = @TCLSH_CMD@
108
109# Where do we want to install the tcl plugin
110#
111TCLLIBDIR = @TCLLIBDIR@
112
113# The suffix used on shared libraries.  Ex:  ".dll", ".so", ".dylib"
114#
115SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
116
117# If gcov support was enabled by the configure script, add the appropriate
118# flags here.  It's not always as easy as just having the user add the right
119# CFLAGS / LDFLAGS, because libtool wants to use CFLAGS when linking, which
120# causes build errors with -fprofile-arcs -ftest-coverage with some GCCs.  
121# Supposedly GCC does the right thing if you use --coverage, but in 
122# practice it still fails.  See:
123#
124# http://www.mail-archive.com/debian-gcc@lists.debian.org/msg26197.html
125#
126# for more info.
127#
128GCOV_CFLAGS1 = -DSQLITE_COVERAGE_TEST=1 -fprofile-arcs -ftest-coverage
129GCOV_LDFLAGS1 = -lgcov
130USE_GCOV = @USE_GCOV@
131LTCOMPILE_EXTRAS += $(GCOV_CFLAGS$(USE_GCOV))
132LTLINK_EXTRAS += $(GCOV_LDFLAGS$(USE_GCOV))
133
134
135# The directory into which to store package information for
136
137# Some standard variables and programs
138#
139prefix = @prefix@
140exec_prefix = @exec_prefix@
141libdir = @libdir@
142pkgconfigdir = $(libdir)/pkgconfig
143bindir = @bindir@
144includedir = @includedir@
145INSTALL = @INSTALL@
146LIBTOOL = ./libtool
147ALLOWRELEASE = @ALLOWRELEASE@
148
149# libtool compile/link/install
150LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(TCC) $(LTCOMPILE_EXTRAS)
151LTLINK = $(LIBTOOL) --mode=link $(TCC) $(LTCOMPILE_EXTRAS) @LDFLAGS@ $(LTLINK_EXTRAS)
152LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
153
154# nawk compatible awk.
155NAWK = @AWK@
156
157# You should not have to change anything below this line
158###############################################################################
159
160USE_AMALGAMATION = @USE_AMALGAMATION@
161
162# Object files for the SQLite library (non-amalgamation).
163#
164LIBOBJS0 = alter.lo analyze.lo attach.lo auth.lo \
165         backup.lo bitvec.lo btmutex.lo btree.lo build.lo \
166         callback.lo complete.lo ctime.lo date.lo delete.lo \
167         expr.lo fault.lo fkey.lo \
168         fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo fts3_porter.lo \
169         fts3_snippet.lo fts3_tokenizer.lo fts3_tokenizer1.lo fts3_write.lo \
170         func.lo global.lo hash.lo \
171         icu.lo insert.lo journal.lo legacy.lo loadext.lo \
172         main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
173         memjournal.lo \
174         mutex.lo mutex_noop.lo mutex_os2.lo mutex_unix.lo mutex_w32.lo \
175         notify.lo opcodes.lo os.lo os_os2.lo os_unix.lo os_win.lo \
176         pager.lo parse.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
177         random.lo resolve.lo rowset.lo rtree.lo select.lo status.lo \
178         table.lo tokenize.lo trigger.lo \
179         update.lo util.lo vacuum.lo \
180         vdbe.lo vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbetrace.lo \
181         wal.lo walker.lo where.lo utf.lo vtab.lo
182
183# Object files for the amalgamation.
184#
185LIBOBJS1 = sqlite3.lo
186
187# Determine the real value of LIBOBJ based on the 'configure' script
188#
189LIBOBJ = $(LIBOBJS$(USE_AMALGAMATION))
190
191
192# All of the source code files.
193#
194SRC = \
195  $(TOP)/src/alter.c \
196  $(TOP)/src/analyze.c \
197  $(TOP)/src/attach.c \
198  $(TOP)/src/auth.c \
199  $(TOP)/src/backup.c \
200  $(TOP)/src/bitvec.c \
201  $(TOP)/src/btmutex.c \
202  $(TOP)/src/btree.c \
203  $(TOP)/src/btree.h \
204  $(TOP)/src/btreeInt.h \
205  $(TOP)/src/build.c \
206  $(TOP)/src/callback.c \
207  $(TOP)/src/complete.c \
208  $(TOP)/src/ctime.c \
209  $(TOP)/src/date.c \
210  $(TOP)/src/delete.c \
211  $(TOP)/src/expr.c \
212  $(TOP)/src/fault.c \
213  $(TOP)/src/fkey.c \
214  $(TOP)/src/func.c \
215  $(TOP)/src/global.c \
216  $(TOP)/src/hash.c \
217  $(TOP)/src/hash.h \
218  $(TOP)/src/hwtime.h \
219  $(TOP)/src/insert.c \
220  $(TOP)/src/journal.c \
221  $(TOP)/src/legacy.c \
222  $(TOP)/src/loadext.c \
223  $(TOP)/src/main.c \
224  $(TOP)/src/malloc.c \
225  $(TOP)/src/mem0.c \
226  $(TOP)/src/mem1.c \
227  $(TOP)/src/mem2.c \
228  $(TOP)/src/mem3.c \
229  $(TOP)/src/mem5.c \
230  $(TOP)/src/memjournal.c \
231  $(TOP)/src/mutex.c \
232  $(TOP)/src/mutex.h \
233  $(TOP)/src/mutex_noop.c \
234  $(TOP)/src/mutex_os2.c \
235  $(TOP)/src/mutex_unix.c \
236  $(TOP)/src/mutex_w32.c \
237  $(TOP)/src/notify.c \
238  $(TOP)/src/os.c \
239  $(TOP)/src/os.h \
240  $(TOP)/src/os_common.h \
241  $(TOP)/src/os_os2.c \
242  $(TOP)/src/os_unix.c \
243  $(TOP)/src/os_win.c \
244  $(TOP)/src/pager.c \
245  $(TOP)/src/pager.h \
246  $(TOP)/src/parse.y \
247  $(TOP)/src/pcache.c \
248  $(TOP)/src/pcache.h \
249  $(TOP)/src/pcache1.c \
250  $(TOP)/src/pragma.c \
251  $(TOP)/src/prepare.c \
252  $(TOP)/src/printf.c \
253  $(TOP)/src/random.c \
254  $(TOP)/src/recover.c \
255  $(TOP)/src/resolve.c \
256  $(TOP)/src/rowset.c \
257  $(TOP)/src/select.c \
258  $(TOP)/src/status.c \
259  $(TOP)/src/shell.c \
260  $(TOP)/src/sqlite.h.in \
261  $(TOP)/src/sqlite3ext.h \
262  $(TOP)/src/sqliteInt.h \
263  $(TOP)/src/sqliteLimit.h \
264  $(TOP)/src/table.c \
265  $(TOP)/src/tclsqlite.c \
266  $(TOP)/src/tokenize.c \
267  $(TOP)/src/trigger.c \
268  $(TOP)/src/utf.c \
269  $(TOP)/src/update.c \
270  $(TOP)/src/util.c \
271  $(TOP)/src/vacuum.c \
272  $(TOP)/src/vdbe.c \
273  $(TOP)/src/vdbe.h \
274  $(TOP)/src/vdbeapi.c \
275  $(TOP)/src/vdbeaux.c \
276  $(TOP)/src/vdbeblob.c \
277  $(TOP)/src/vdbemem.c \
278  $(TOP)/src/vdbetrace.c \
279  $(TOP)/src/vdbeInt.h \
280  $(TOP)/src/vtab.c \
281  $(TOP)/src/wal.c \
282  $(TOP)/src/wal.h \
283  $(TOP)/src/walker.c \
284  $(TOP)/src/where.c
285
286# Source code for extensions
287#
288SRC += \
289  $(TOP)/ext/fts1/fts1.c \
290  $(TOP)/ext/fts1/fts1.h \
291  $(TOP)/ext/fts1/fts1_hash.c \
292  $(TOP)/ext/fts1/fts1_hash.h \
293  $(TOP)/ext/fts1/fts1_porter.c \
294  $(TOP)/ext/fts1/fts1_tokenizer.h \
295  $(TOP)/ext/fts1/fts1_tokenizer1.c
296SRC += \
297  $(TOP)/ext/fts2/fts2.c \
298  $(TOP)/ext/fts2/fts2.h \
299  $(TOP)/ext/fts2/fts2_hash.c \
300  $(TOP)/ext/fts2/fts2_hash.h \
301  $(TOP)/ext/fts2/fts2_icu.c \
302  $(TOP)/ext/fts2/fts2_porter.c \
303  $(TOP)/ext/fts2/fts2_tokenizer.h \
304  $(TOP)/ext/fts2/fts2_tokenizer.c \
305  $(TOP)/ext/fts2/fts2_tokenizer1.c
306SRC += \
307  $(TOP)/ext/fts3/fts3.c \
308  $(TOP)/ext/fts3/fts3.h \
309  $(TOP)/ext/fts3/fts3Int.h \
310  $(TOP)/ext/fts3/fts3_aux.c \
311  $(TOP)/ext/fts3/fts3_expr.c \
312  $(TOP)/ext/fts3/fts3_hash.c \
313  $(TOP)/ext/fts3/fts3_hash.h \
314  $(TOP)/ext/fts3/fts3_icu.c \
315  $(TOP)/ext/fts3/fts3_porter.c \
316  $(TOP)/ext/fts3/fts3_snippet.c \
317  $(TOP)/ext/fts3/fts3_tokenizer.h \
318  $(TOP)/ext/fts3/fts3_tokenizer.c \
319  $(TOP)/ext/fts3/fts3_tokenizer1.c \
320  $(TOP)/ext/fts3/fts3_write.c
321SRC += \
322  $(TOP)/ext/icu/sqliteicu.h \
323  $(TOP)/ext/icu/icu.c
324SRC += \
325  $(TOP)/ext/rtree/rtree.h \
326  $(TOP)/ext/rtree/rtree.c
327
328
329# Generated source code files
330#
331SRC += \
332  keywordhash.h \
333  opcodes.c \
334  opcodes.h \
335  parse.c \
336  parse.h \
337  config.h \
338  sqlite3.h
339
340# Source code to the test files.
341#
342TESTSRC = \
343  $(TOP)/src/test1.c \
344  $(TOP)/src/test2.c \
345  $(TOP)/src/test3.c \
346  $(TOP)/src/test4.c \
347  $(TOP)/src/test5.c \
348  $(TOP)/src/test6.c \
349  $(TOP)/src/test7.c \
350  $(TOP)/src/test8.c \
351  $(TOP)/src/test9.c \
352  $(TOP)/src/test_autoext.c \
353  $(TOP)/src/test_async.c \
354  $(TOP)/src/test_backup.c \
355  $(TOP)/src/test_btree.c \
356  $(TOP)/src/test_config.c \
357  $(TOP)/src/test_demovfs.c \
358  $(TOP)/src/test_devsym.c \
359  $(TOP)/src/test_func.c \
360  $(TOP)/src/test_fuzzer.c \
361  $(TOP)/src/test_hexio.c \
362  $(TOP)/src/test_init.c \
363  $(TOP)/src/test_intarray.c \
364  $(TOP)/src/test_journal.c \
365  $(TOP)/src/test_malloc.c \
366  $(TOP)/src/test_multiplex.c \
367  $(TOP)/src/test_mutex.c \
368  $(TOP)/src/test_onefile.c \
369  $(TOP)/src/test_osinst.c \
370  $(TOP)/src/test_pcache.c \
371  $(TOP)/src/test_quota.c \
372  $(TOP)/src/test_rtree.c \
373  $(TOP)/src/test_schema.c \
374  $(TOP)/src/test_server.c \
375  $(TOP)/src/test_superlock.c \
376  $(TOP)/src/test_syscall.c \
377  $(TOP)/src/test_stat.c \
378  $(TOP)/src/test_tclvar.c \
379  $(TOP)/src/test_thread.c \
380  $(TOP)/src/test_vfs.c \
381  $(TOP)/src/test_wholenumber.c \
382  $(TOP)/src/test_wsd.c
383
384# Source code to the library files needed by the test fixture
385#
386TESTSRC2 = \
387  $(TOP)/src/attach.c \
388  $(TOP)/src/backup.c \
389  $(TOP)/src/bitvec.c \
390  $(TOP)/src/btree.c \
391  $(TOP)/src/build.c \
392  $(TOP)/src/ctime.c \
393  $(TOP)/src/date.c \
394  $(TOP)/src/expr.c \
395  $(TOP)/src/func.c \
396  $(TOP)/src/insert.c \
397  $(TOP)/src/wal.c \
398  $(TOP)/src/mem5.c \
399  $(TOP)/src/os.c \
400  $(TOP)/src/os_os2.c \
401  $(TOP)/src/os_unix.c \
402  $(TOP)/src/os_win.c \
403  $(TOP)/src/pager.c \
404  $(TOP)/src/pragma.c \
405  $(TOP)/src/prepare.c \
406  $(TOP)/src/printf.c \
407  $(TOP)/src/random.c \
408  $(TOP)/src/pcache.c \
409  $(TOP)/src/pcache1.c \
410  $(TOP)/src/select.c \
411  $(TOP)/src/tokenize.c \
412  $(TOP)/src/utf.c \
413  $(TOP)/src/util.c \
414  $(TOP)/src/vdbeapi.c \
415  $(TOP)/src/vdbeaux.c \
416  $(TOP)/src/vdbe.c \
417  $(TOP)/src/vdbemem.c \
418  $(TOP)/src/vdbetrace.c \
419  $(TOP)/src/where.c \
420  parse.c \
421  $(TOP)/ext/fts3/fts3.c \
422  $(TOP)/ext/fts3/fts3_aux.c \
423  $(TOP)/ext/fts3/fts3_expr.c \
424  $(TOP)/ext/fts3/fts3_tokenizer.c \
425  $(TOP)/ext/fts3/fts3_write.c \
426  $(TOP)/ext/async/sqlite3async.c
427
428# Header files used by all library source files.
429#
430HDR = \
431   $(TOP)/src/btree.h \
432   $(TOP)/src/btreeInt.h \
433   $(TOP)/src/hash.h \
434   $(TOP)/src/hwtime.h \
435   keywordhash.h \
436   $(TOP)/src/mutex.h \
437   opcodes.h \
438   $(TOP)/src/os.h \
439   $(TOP)/src/os_common.h \
440   $(TOP)/src/pager.h \
441   $(TOP)/src/pcache.h \
442   parse.h  \
443   sqlite3.h  \
444   $(TOP)/src/sqlite3ext.h \
445   $(TOP)/src/sqliteInt.h  \
446   $(TOP)/src/sqliteLimit.h \
447   $(TOP)/src/vdbe.h \
448   $(TOP)/src/vdbeInt.h \
449   config.h
450
451# Header files used by extensions
452#
453EXTHDR += \
454  $(TOP)/ext/fts1/fts1.h \
455  $(TOP)/ext/fts1/fts1_hash.h \
456  $(TOP)/ext/fts1/fts1_tokenizer.h
457EXTHDR += \
458  $(TOP)/ext/fts2/fts2.h \
459  $(TOP)/ext/fts2/fts2_hash.h \
460  $(TOP)/ext/fts2/fts2_tokenizer.h
461EXTHDR += \
462  $(TOP)/ext/fts3/fts3.h \
463  $(TOP)/ext/fts3/fts3Int.h \
464  $(TOP)/ext/fts3/fts3_hash.h \
465  $(TOP)/ext/fts3/fts3_tokenizer.h
466EXTHDR += \
467  $(TOP)/ext/rtree/rtree.h
468EXTHDR += \
469  $(TOP)/ext/icu/sqliteicu.h
470EXTHDR += \
471  $(TOP)/ext/rtree/sqlite3rtree.h
472
473# This is the default Makefile target.  The objects listed here
474# are what get build when you type just "make" with no arguments.
475#
476all:	sqlite3.h libsqlite3.la sqlite3$(TEXE) $(HAVE_TCL:1=libtclsqlite3.la)
477
478Makefile: $(TOP)/Makefile.in
479	./config.status
480
481sqlite3.pc: $(TOP)/sqlite3.pc.in
482	./config.status
483
484libsqlite3.la:	$(LIBOBJ)
485	$(LTLINK) -o $@ $(LIBOBJ) $(TLIBS) \
486		${ALLOWRELEASE} -rpath "$(libdir)" -version-info "8:6:8"
487
488libtclsqlite3.la:	tclsqlite.lo libsqlite3.la
489	$(LTLINK) -o $@ tclsqlite.lo \
490		libsqlite3.la @TCL_STUB_LIB_SPEC@ $(TLIBS) \
491		-rpath "$(TCLLIBDIR)" \
492		-version-info "8:6:8" \
493		-avoid-version
494
495sqlite3$(TEXE):	$(TOP)/src/shell.c libsqlite3.la sqlite3.h
496	$(LTLINK) $(READLINE_FLAGS) \
497		-o $@ $(TOP)/src/shell.c libsqlite3.la \
498		$(LIBREADLINE) $(TLIBS) -rpath "$(libdir)"
499
500# This target creates a directory named "tsrc" and fills it with
501# copies of all of the C source code and header files needed to
502# build on the target system.  Some of the C source code and header
503# files are automatically generated.  This target takes care of
504# all that automatic generation.
505#
506.target_source:	$(SRC) $(TOP)/tool/vdbe-compress.tcl
507	rm -rf tsrc
508	mkdir tsrc
509	cp -f $(SRC) tsrc
510	rm tsrc/sqlite.h.in tsrc/parse.y
511	$(TCLSH_CMD) $(TOP)/tool/vdbe-compress.tcl <tsrc/vdbe.c >vdbe.new
512	mv vdbe.new tsrc/vdbe.c
513	touch .target_source
514
515sqlite3.c:	.target_source $(TOP)/tool/mksqlite3c.tcl
516	$(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl
517
518# Rule to build the amalgamation
519#
520sqlite3.lo:	sqlite3.c
521	$(LTCOMPILE) $(TEMP_STORE) -c sqlite3.c
522
523# Rules to build the LEMON compiler generator
524#
525lemon$(BEXE):	$(TOP)/tool/lemon.c $(TOP)/src/lempar.c
526	$(BCC) -o $@ $(TOP)/tool/lemon.c
527	cp $(TOP)/src/lempar.c .
528
529# Rules to build individual *.o files from generated *.c files. This
530# applies to:
531#
532#     parse.o
533#     opcodes.o
534#
535parse.lo:	parse.c $(HDR)
536	$(LTCOMPILE) $(TEMP_STORE) -c parse.c
537
538opcodes.lo:	opcodes.c
539	$(LTCOMPILE) $(TEMP_STORE) -c opcodes.c
540
541# Rules to build individual *.o files from files in the src directory.
542#
543alter.lo:	$(TOP)/src/alter.c $(HDR)
544	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/alter.c
545
546analyze.lo:	$(TOP)/src/analyze.c $(HDR)
547	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/analyze.c
548
549attach.lo:	$(TOP)/src/attach.c $(HDR)
550	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/attach.c
551
552auth.lo:	$(TOP)/src/auth.c $(HDR)
553	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/auth.c
554
555backup.lo:	$(TOP)/src/backup.c $(HDR)
556	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/backup.c
557
558bitvec.lo:	$(TOP)/src/bitvec.c $(HDR)
559	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/bitvec.c
560
561btmutex.lo:	$(TOP)/src/btmutex.c $(HDR)
562	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/btmutex.c
563
564btree.lo:	$(TOP)/src/btree.c $(HDR) $(TOP)/src/pager.h
565	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/btree.c
566
567build.lo:	$(TOP)/src/build.c $(HDR)
568	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/build.c
569
570callback.lo:	$(TOP)/src/callback.c $(HDR)
571	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/callback.c
572
573complete.lo:	$(TOP)/src/complete.c $(HDR)
574	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/complete.c
575
576ctime.lo:	$(TOP)/src/ctime.c $(HDR)
577	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/ctime.c
578
579date.lo:	$(TOP)/src/date.c $(HDR)
580	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/date.c
581
582delete.lo:	$(TOP)/src/delete.c $(HDR)
583	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/delete.c
584
585expr.lo:	$(TOP)/src/expr.c $(HDR)
586	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/expr.c
587
588fault.lo:	$(TOP)/src/fault.c $(HDR)
589	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/fault.c
590
591fkey.lo:	$(TOP)/src/fkey.c $(HDR)
592	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/fkey.c
593
594func.lo:	$(TOP)/src/func.c $(HDR)
595	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/func.c
596
597global.lo:	$(TOP)/src/global.c $(HDR)
598	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/global.c
599
600hash.lo:	$(TOP)/src/hash.c $(HDR)
601	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/hash.c
602
603insert.lo:	$(TOP)/src/insert.c $(HDR)
604	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/insert.c
605
606journal.lo:	$(TOP)/src/journal.c $(HDR)
607	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/journal.c
608
609legacy.lo:	$(TOP)/src/legacy.c $(HDR)
610	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/legacy.c
611
612loadext.lo:	$(TOP)/src/loadext.c $(HDR)
613	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/loadext.c
614
615main.lo:	$(TOP)/src/main.c $(HDR)
616	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/main.c
617
618malloc.lo:	$(TOP)/src/malloc.c $(HDR)
619	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/malloc.c
620
621mem0.lo:	$(TOP)/src/mem0.c $(HDR)
622	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem0.c
623
624mem1.lo:	$(TOP)/src/mem1.c $(HDR)
625	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem1.c
626
627mem2.lo:	$(TOP)/src/mem2.c $(HDR)
628	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem2.c
629
630mem3.lo:	$(TOP)/src/mem3.c $(HDR)
631	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem3.c
632
633mem5.lo:	$(TOP)/src/mem5.c $(HDR)
634	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem5.c
635
636memjournal.lo:	$(TOP)/src/memjournal.c $(HDR)
637	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/memjournal.c
638
639mutex.lo:	$(TOP)/src/mutex.c $(HDR)
640	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex.c
641
642mutex_noop.lo:	$(TOP)/src/mutex_noop.c $(HDR)
643	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex_noop.c
644
645mutex_os2.lo:	$(TOP)/src/mutex_os2.c $(HDR)
646	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex_os2.c
647
648mutex_unix.lo:	$(TOP)/src/mutex_unix.c $(HDR)
649	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex_unix.c
650
651mutex_w32.lo:	$(TOP)/src/mutex_w32.c $(HDR)
652	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex_w32.c
653
654notify.lo:	$(TOP)/src/notify.c $(HDR)
655	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/notify.c
656
657pager.lo:	$(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h
658	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/pager.c
659
660pcache.lo:	$(TOP)/src/pcache.c $(HDR) $(TOP)/src/pcache.h
661	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/pcache.c
662
663pcache1.lo:	$(TOP)/src/pcache1.c $(HDR) $(TOP)/src/pcache.h
664	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/pcache1.c
665
666os.lo:	$(TOP)/src/os.c $(HDR)
667	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os.c
668
669os_unix.lo:	$(TOP)/src/os_unix.c $(HDR)
670	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os_unix.c
671
672os_win.lo:	$(TOP)/src/os_win.c $(HDR)
673	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os_win.c
674
675os_os2.lo:	$(TOP)/src/os_os2.c $(HDR)
676	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os_os2.c
677
678pragma.lo:	$(TOP)/src/pragma.c $(HDR)
679	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/pragma.c
680
681prepare.lo:	$(TOP)/src/prepare.c $(HDR)
682	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/prepare.c
683
684printf.lo:	$(TOP)/src/printf.c $(HDR)
685	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/printf.c
686
687random.lo:	$(TOP)/src/random.c $(HDR)
688	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/random.c
689
690resolve.lo:	$(TOP)/src/resolve.c $(HDR)
691	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/resolve.c
692
693rowset.lo:	$(TOP)/src/rowset.c $(HDR)
694	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/rowset.c
695
696select.lo:	$(TOP)/src/select.c $(HDR)
697	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/select.c
698
699status.lo:	$(TOP)/src/status.c $(HDR)
700	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/status.c
701
702table.lo:	$(TOP)/src/table.c $(HDR)
703	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/table.c
704
705tokenize.lo:	$(TOP)/src/tokenize.c keywordhash.h $(HDR)
706	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/tokenize.c
707
708trigger.lo:	$(TOP)/src/trigger.c $(HDR)
709	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/trigger.c
710
711update.lo:	$(TOP)/src/update.c $(HDR)
712	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/update.c
713
714utf.lo:	$(TOP)/src/utf.c $(HDR)
715	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/utf.c
716
717util.lo:	$(TOP)/src/util.c $(HDR)
718	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/util.c
719
720vacuum.lo:	$(TOP)/src/vacuum.c $(HDR)
721	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vacuum.c
722
723vdbe.lo:	$(TOP)/src/vdbe.c $(HDR)
724	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbe.c
725
726vdbeapi.lo:	$(TOP)/src/vdbeapi.c $(HDR)
727	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbeapi.c
728
729vdbeaux.lo:	$(TOP)/src/vdbeaux.c $(HDR)
730	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbeaux.c
731
732vdbeblob.lo:	$(TOP)/src/vdbeblob.c $(HDR)
733	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbeblob.c
734
735vdbemem.lo:	$(TOP)/src/vdbemem.c $(HDR)
736	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbemem.c
737
738vdbetrace.lo:	$(TOP)/src/vdbetrace.c $(HDR)
739	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbetrace.c
740
741vtab.lo:	$(TOP)/src/vtab.c $(HDR)
742	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vtab.c
743
744wal.lo:	$(TOP)/src/wal.c $(HDR)
745	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/wal.c
746
747walker.lo:	$(TOP)/src/walker.c $(HDR)
748	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/walker.c
749
750where.lo:	$(TOP)/src/where.c $(HDR)
751	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/where.c
752
753tclsqlite.lo:	$(TOP)/src/tclsqlite.c $(HDR)
754	$(LTCOMPILE) -DUSE_TCL_STUBS=1 -c $(TOP)/src/tclsqlite.c
755
756tclsqlite-shell.lo:	$(TOP)/src/tclsqlite.c $(HDR)
757	$(LTCOMPILE) -DTCLSH=1 -o $@ -c $(TOP)/src/tclsqlite.c
758
759tclsqlite-stubs.lo:	$(TOP)/src/tclsqlite.c $(HDR)
760	$(LTCOMPILE) -DUSE_TCL_STUBS=1 -o $@ -c $(TOP)/src/tclsqlite.c
761
762tclsqlite3$(TEXE):	tclsqlite-shell.lo libsqlite3.la
763	$(LTLINK) -o $@ tclsqlite-shell.lo \
764		 libsqlite3.la $(LIBTCL)
765
766# Rules to build opcodes.c and opcodes.h
767#
768opcodes.c:	opcodes.h $(TOP)/mkopcodec.awk
769	sort -n -b -k 3 opcodes.h | $(NAWK) -f $(TOP)/mkopcodec.awk >opcodes.c
770
771opcodes.h:	parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
772	cat parse.h $(TOP)/src/vdbe.c | $(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h
773
774# Rules to build parse.c and parse.h - the outputs of lemon.
775#
776parse.h:	parse.c
777
778parse.c:	$(TOP)/src/parse.y lemon$(BEXE) $(TOP)/addopcodes.awk
779	cp $(TOP)/src/parse.y .
780	rm -f parse.h
781	./lemon$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) parse.y
782	mv parse.h parse.h.temp
783	$(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
784
785sqlite3.h:	$(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION
786	tclsh $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
787
788keywordhash.h:	$(TOP)/tool/mkkeywordhash.c
789	$(BCC) -o mkkeywordhash$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)/tool/mkkeywordhash.c
790	./mkkeywordhash$(BEXE) >keywordhash.h
791
792
793
794# Rules to build the extension objects.
795#
796icu.lo:	$(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR)
797	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/icu/icu.c
798
799fts2.lo:	$(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR)
800	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2.c
801
802fts2_hash.lo:	$(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR)
803	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_hash.c
804
805fts2_icu.lo:	$(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR)
806	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_icu.c
807
808fts2_porter.lo:	$(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR)
809	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_porter.c
810
811fts2_tokenizer.lo:	$(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR)
812	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c
813
814fts2_tokenizer1.lo:	$(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR)
815	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c
816
817fts3.lo:	$(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR)
818	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3.c
819
820fts3_aux.lo:	$(TOP)/ext/fts3/fts3_aux.c $(HDR) $(EXTHDR)
821	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_aux.c
822
823fts3_expr.lo:	$(TOP)/ext/fts3/fts3_expr.c $(HDR) $(EXTHDR)
824	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_expr.c
825
826fts3_hash.lo:	$(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR)
827	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_hash.c
828
829fts3_icu.lo:	$(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR)
830	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_icu.c
831
832fts3_snippet.lo:	$(TOP)/ext/fts3/fts3_snippet.c $(HDR) $(EXTHDR)
833	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_snippet.c
834
835fts3_porter.lo:	$(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR)
836	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_porter.c
837
838fts3_tokenizer.lo:	$(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR)
839	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c
840
841fts3_tokenizer1.lo:	$(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR)
842	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c
843
844fts3_write.lo:	$(TOP)/ext/fts3/fts3_write.c $(HDR) $(EXTHDR)
845	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_write.c
846
847rtree.lo:	$(TOP)/ext/rtree/rtree.c $(HDR) $(EXTHDR)
848	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/rtree/rtree.c
849
850
851# Rules to build the 'testfixture' application.
852#
853# If using the amalgamation, use sqlite3.c directly to build the test
854# fixture.  Otherwise link against libsqlite3.la.  (This distinction is
855# necessary because the test fixture requires non-API symbols which are
856# hidden when the library is built via the amalgamation).
857#
858TESTFIXTURE_FLAGS  = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
859TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE 
860
861TESTFIXTURE_SRC0 = $(TESTSRC2) libsqlite3.la
862TESTFIXTURE_SRC1 = sqlite3.c
863TESTFIXTURE_SRC = $(TESTSRC) $(TOP)/src/tclsqlite.c $(TESTFIXTURE_SRC$(USE_AMALGAMATION))
864
865testfixture$(TEXE):	$(TESTFIXTURE_SRC)
866	$(LTLINK) -DSQLITE_NO_SYNC=1 $(TEMP_STORE) $(TESTFIXTURE_FLAGS) \
867		-o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS)
868
869
870fulltest:	testfixture$(TEXE) sqlite3$(TEXE)
871	./testfixture$(TEXE) $(TOP)/test/all.test
872
873soaktest:	testfixture$(TEXE) sqlite3$(TEXE)
874	./testfixture$(TEXE) $(TOP)/test/all.test -soak=1
875
876test:	testfixture$(TEXE) sqlite3$(TEXE)
877	./testfixture$(TEXE) $(TOP)/test/veryquick.test
878
879sqlite3_analyzer$(TEXE):	$(TESTFIXTURE_SRC) $(TOP)/tool/spaceanal.tcl
880	sed \
881	  -e '/^#/d' \
882	  -e 's,\\,\\\\,g' \
883	  -e 's,",\\",g' \
884	  -e 's,^,",' \
885	  -e 's,$$,\\n",' \
886	  $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
887	$(LTLINK) -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 \
888		-DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE \
889		$(TEMP_STORE) -o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS)
890
891
892# Standard install and cleanup targets
893#
894lib_install:	libsqlite3.la
895	$(INSTALL) -d $(DESTDIR)$(libdir)
896	$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
897	
898install:	sqlite3$(BEXE) lib_install sqlite3.h sqlite3.pc ${HAVE_TCL:1=tcl_install}
899	$(INSTALL) -d $(DESTDIR)$(bindir)
900	$(LTINSTALL) sqlite3$(BEXE) $(DESTDIR)$(bindir)
901	$(INSTALL) -d $(DESTDIR)$(includedir)
902	$(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(includedir)
903	$(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(includedir)
904	$(INSTALL) -d $(DESTDIR)$(pkgconfigdir)
905	$(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(pkgconfigdir)
906
907pkgIndex.tcl:
908	echo 'package ifneeded sqlite3 $(RELEASE) [list load $(TCLLIBDIR)/libtclsqlite3.so sqlite3]' > $@
909tcl_install:	lib_install libtclsqlite3.la pkgIndex.tcl
910	$(INSTALL) -d $(DESTDIR)$(TCLLIBDIR)
911	$(LTINSTALL) libtclsqlite3.la $(DESTDIR)$(TCLLIBDIR)
912	rm -f $(DESTDIR)$(TCLLIBDIR)/libtclsqlite3.la $(DESTDIR)$(TCLLIBDIR)/libtclsqlite3.a
913	$(INSTALL) -m 0644 pkgIndex.tcl $(DESTDIR)$(TCLLIBDIR)
914
915clean:	
916	rm -f *.lo *.la *.o sqlite3$(TEXE) libsqlite3.la
917	rm -f sqlite3.h opcodes.*
918	rm -rf .libs .deps
919	rm -f lemon$(BEXE) lempar.c parse.* sqlite*.tar.gz
920	rm -f mkkeywordhash$(BEXE) keywordhash.h
921	rm -f $(PUBLISH)
922	rm -f *.da *.bb *.bbg gmon.out
923	rm -rf tsrc .target_source
924	rm -f testfixture$(TEXE) test.db
925	rm -f sqlite3.dll sqlite3.lib sqlite3.def
926	rm -f sqlite3.c
927
928distclean:	clean
929	rm -f config.log config.status libtool Makefile sqlite3.pc
930
931#
932# Windows section
933#
934dll: sqlite3.dll
935
936REAL_LIBOBJ = $(LIBOBJ:%.lo=.libs/%.o)
937
938$(REAL_LIBOBJ): $(LIBOBJ)
939
940sqlite3.def: $(REAL_LIBOBJ)
941	echo 'EXPORTS' >sqlite3.def
942	nm $(REAL_LIBOBJ) | grep ' T ' | grep ' _sqlite3_' \
943		| sed 's/^.* _//' >>sqlite3.def
944
945sqlite3.dll: $(REAL_LIBOBJ) sqlite3.def
946	$(TCC) -shared -o $@ sqlite3.def \
947		-Wl,"--strip-all" $(REAL_LIBOBJ)
948