xref: /sqlite-3.40.0/Makefile.in (revision 71b65e88)
175897234Sdrh#!/usr/make
275897234Sdrh#
375897234Sdrh# Makefile for SQLITE
43543b3e0Sdrh#
53543b3e0Sdrh# This makefile is suppose to be configured automatically using the
63543b3e0Sdrh# autoconf.  But if that does not work for you, you can configure
73543b3e0Sdrh# the makefile manually.  Just set the parameters below to values that
83543b3e0Sdrh# work well for your system.
93543b3e0Sdrh#
103543b3e0Sdrh# If the configure script does not work out-of-the-box, you might
113543b3e0Sdrh# be able to get it to work by giving it some hints.  See the comment
123543b3e0Sdrh# at the beginning of configure.in for additional information.
133543b3e0Sdrh#
1475897234Sdrh
153543b3e0Sdrh# The toplevel directory of the source tree.  This is the directory
163543b3e0Sdrh# that contains this "Makefile.in" and the "configure.in" script.
1775897234Sdrh#
18b43be55eSdrhTOP = @abs_srcdir@
1975897234Sdrh
2075897234Sdrh# C Compiler and options for use in building executables that
2175897234Sdrh# will run on the platform that is doing the build.
2275897234Sdrh#
2375897234SdrhBCC = @BUILD_CC@ @BUILD_CFLAGS@
2475897234Sdrh
25149735d9Sdrh# TCC is the C Compile and options for use in building executables that
263543b3e0Sdrh# will run on the target platform.  (BCC and TCC are usually the
27149735d9Sdrh# same unless your are cross-compiling.)  Separate CC and CFLAGS macros
28149735d9Sdrh# are provide so that these aspects of the build process can be changed
29149735d9Sdrh# on the "make" command-line.  Ex:  "make CC=clang CFLAGS=-fsanitize=undefined"
3075897234Sdrh#
31149735d9SdrhCC = @CC@
32149735d9SdrhCFLAGS = @CPPFLAGS@ @CFLAGS@
33f7af7a17SdrhTCC = ${CC} ${CFLAGS} -I. -I${TOP}/src -I${TOP}/ext/rtree -I${TOP}/ext/icu
34498dcae0SdrhTCC += -I${TOP}/ext/fts3 -I${TOP}/ext/async -I${TOP}/ext/session
3549f6a0d8SdanTCC += -I${TOP}/ext/userauth
369d9f76c0Stpoindex
371e12d43bSmlcreech# Define this for the autoconf-based build, so that the code knows it can
38a4b2f419Sdrh# include the generated sqlite_cfg.h
391e12d43bSmlcreech#
401b904bf7SmistachkinTCC += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite
411e12d43bSmlcreech
429d9f76c0Stpoindex# Define -DNDEBUG to compile without debugging (i.e., for production usage)
439d9f76c0Stpoindex# Omitting the define will cause extra debugging code to be inserted and
449d9f76c0Stpoindex# includes extra comments when "EXPLAIN stmt" is used.
459d9f76c0Stpoindex#
4605c7e0bdSdrhTCC += @TARGET_DEBUG@
4775897234Sdrh
48348784efSdrh# Compiler options needed for programs that use the TCL library.
49348784efSdrh#
5093468367SdrhTCC += @TCL_INCLUDE_SPEC@
51348784efSdrh
52348784efSdrh# The library that programs using TCL must link against.
53348784efSdrh#
54f344a5e7SmistachkinLIBTCL = @TCL_LIB_SPEC@
55348784efSdrh
5675897234Sdrh# Compiler options needed for programs that use the readline() library.
5775897234Sdrh#
5875897234SdrhREADLINE_FLAGS = -DHAVE_READLINE=@TARGET_HAVE_READLINE@ @TARGET_READLINE_INC@
59e44b835eSdrhREADLINE_FLAGS += -DHAVE_EDITLINE=@TARGET_HAVE_EDITLINE@
6075897234Sdrh
6175897234Sdrh# The library that programs using readline() must link against.
6275897234Sdrh#
6375897234SdrhLIBREADLINE = @TARGET_READLINE_LIBS@
6475897234Sdrh
650f290bf7Sdougcurrie# Should the database engine be compiled threadsafe
663543b3e0Sdrh#
675a3032b3SdrhTCC += -DSQLITE_THREADSAFE=@SQLITE_THREADSAFE@
683543b3e0Sdrh
69c658b0ffSmlcreech# Any target libraries which libsqlite must be linked against
70c658b0ffSmlcreech#
7145fac889SdrhTLIBS = @LIBS@ $(LIBS)
72f1878b4aSdrh
73b0208ccaSpaul# Flags controlling use of the in memory btree implementation
7413bff815Sdrh#
75b06a0b67Sdanielk1977# SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
762dc96f9eSpaul# default to file, 2 to default to memory, and 3 to force temporary
7713bff815Sdrh# tables to always be in memory.
7813bff815Sdrh#
79b06a0b67Sdanielk1977TEMP_STORE = -DSQLITE_TEMP_STORE=@TEMP_STORE@
80b0208ccaSpaul
81fbededefSshane# Enable/disable loadable extensions, and other optional features
82b1cd7308Sshane# based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).
83b1cd7308Sshane# The same set of OMIT and ENABLE flags should be passed to the
84b1cd7308Sshane# LEMON parser generator and the mkkeywordhash tool as well.
85fbededefSshaneOPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@
86fbededefSshane
87fbededefSshaneTCC += $(OPT_FEATURE_FLAGS)
88a4edab0eSmlcreech
89b1cd7308Sshane# Add in any optional parameters specified on the make commane line
90b1cd7308Sshane# ie.  make "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1".
91b1cd7308SshaneTCC += $(OPTS)
92b1cd7308Sshane
9356c9311cSdrh# Add in compile-time options for some libraries used by extensions
9456c9311cSdrhTCC += @HAVE_ZLIB@
9556c9311cSdrh
964b2266aeSdrh# Version numbers and release number for the SQLite being compiled.
974b2266aeSdrh#
984b2266aeSdrhVERSION = @VERSION@
9999ba19eaSdanielk1977VERSION_NUMBER = @VERSION_NUMBER@
1004b2266aeSdrhRELEASE = @RELEASE@
1014b2266aeSdrh
1027b5717e1Sdrh# Filename extensions
1037b5717e1Sdrh#
1047b5717e1SdrhBEXE = @BUILD_EXEEXT@
1057b5717e1SdrhTEXE = @TARGET_EXEEXT@
1067b5717e1Sdrh
1074b2266aeSdrh# The following variable is "1" if the configure script was able to locate
1084b2266aeSdrh# the tclConfig.sh file.  It is an empty string otherwise.  When this
1094b2266aeSdrh# variable is "1", the TCL extension library (libtclsqlite3.so) is built
1104b2266aeSdrh# and installed.
1117b5717e1Sdrh#
1127b5717e1SdrhHAVE_TCL = @HAVE_TCL@
1137b5717e1Sdrh
114ab1c47b0Smlcreech# This is the command to use for tclsh - normally just "tclsh", but we may
115ab1c47b0Smlcreech# know the specific version we want to use
116ab1c47b0Smlcreech#
117ab1c47b0SmlcreechTCLSH_CMD = @TCLSH_CMD@
118ab1c47b0Smlcreech
1196d120f39Svapier# Where do we want to install the tcl plugin
1206d120f39Svapier#
1216d120f39SvapierTCLLIBDIR = @TCLLIBDIR@
1226d120f39Svapier
1234b2266aeSdrh# The suffix used on shared libraries.  Ex:  ".dll", ".so", ".dylib"
1244b2266aeSdrh#
1254b2266aeSdrhSHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
1264b2266aeSdrh
127aac7b93eSmlcreech# If gcov support was enabled by the configure script, add the appropriate
128aac7b93eSmlcreech# flags here.  It's not always as easy as just having the user add the right
129aac7b93eSmlcreech# CFLAGS / LDFLAGS, because libtool wants to use CFLAGS when linking, which
130aac7b93eSmlcreech# causes build errors with -fprofile-arcs -ftest-coverage with some GCCs.
131aac7b93eSmlcreech# Supposedly GCC does the right thing if you use --coverage, but in
132aac7b93eSmlcreech# practice it still fails.  See:
133aac7b93eSmlcreech#
134aac7b93eSmlcreech# http://www.mail-archive.com/[email protected]/msg26197.html
135aac7b93eSmlcreech#
136aac7b93eSmlcreech# for more info.
137aac7b93eSmlcreech#
138b1cd7308SshaneGCOV_CFLAGS1 = -DSQLITE_COVERAGE_TEST=1 -fprofile-arcs -ftest-coverage
139aac7b93eSmlcreechGCOV_LDFLAGS1 = -lgcov
140aac7b93eSmlcreechUSE_GCOV = @USE_GCOV@
141aac7b93eSmlcreechLTCOMPILE_EXTRAS += $(GCOV_CFLAGS$(USE_GCOV))
142aac7b93eSmlcreechLTLINK_EXTRAS += $(GCOV_LDFLAGS$(USE_GCOV))
143aac7b93eSmlcreech
144aac7b93eSmlcreech
1454b2266aeSdrh# The directory into which to store package information for
1464b2266aeSdrh
1474b2266aeSdrh# Some standard variables and programs
1484b2266aeSdrh#
1493c080bc6Smlcreechprefix = @prefix@
1503c080bc6Smlcreechexec_prefix = @exec_prefix@
1514b2266aeSdrhlibdir = @libdir@
15294bdf894Sdanielk1977pkgconfigdir = $(libdir)/pkgconfig
153c55771f3Smlcreechbindir = @bindir@
154c55771f3Smlcreechincludedir = @includedir@
1554b2266aeSdrhINSTALL = @INSTALL@
1564b2266aeSdrhLIBTOOL = ./libtool
1574b2266aeSdrhALLOWRELEASE = @ALLOWRELEASE@
1584b2266aeSdrh
1594b2266aeSdrh# libtool compile/link/install
160aac7b93eSmlcreechLTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(TCC) $(LTCOMPILE_EXTRAS)
161b0650c26SshaneLTLINK = $(LIBTOOL) --mode=link $(TCC) $(LTCOMPILE_EXTRAS) @LDFLAGS@ $(LTLINK_EXTRAS)
1624b2266aeSdrhLTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
1634b2266aeSdrh
1643543b3e0Sdrh# You should not have to change anything below this line
1653543b3e0Sdrh###############################################################################
1664b2266aeSdrh
16718607058SshanehUSE_AMALGAMATION = @USE_AMALGAMATION@
168696555d7SmistachkinAMALGAMATION_LINE_MACROS = @AMALGAMATION_LINE_MACROS@
16918607058Sshaneh
17094984910Smlcreech# Object files for the SQLite library (non-amalgamation).
17175897234Sdrh#
17218607058SshanehLIBOBJS0 = alter.lo analyze.lo attach.lo auth.lo \
17318607058Sshaneh         backup.lo bitvec.lo btmutex.lo btree.lo build.lo \
174a43c8c8aSdrh         callback.lo complete.lo ctime.lo \
175a43c8c8aSdrh         date.lo dbpage.lo dbstat.lo delete.lo \
1763edd8a55Sdrh         expr.lo fault.lo fkey.lo \
177d97f3d7aSdrh         fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo \
178d97f3d7aSdrh         fts3_porter.lo fts3_snippet.lo fts3_tokenizer.lo fts3_tokenizer1.lo \
179d7a959c6Sdan         fts3_tokenize_vtab.lo \
180d97f3d7aSdrh         fts3_unicode.lo fts3_unicode2.lo fts3_write.lo \
1813e65f89eSdan	 fts5.lo \
18218607058Sshaneh         func.lo global.lo hash.lo \
1839dbf96bdSdrh         icu.lo insert.lo json.lo legacy.lo loadext.lo \
184d1370b6dSdrh         main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
185ac442f41Sdrh         memdb.lo memjournal.lo \
18683905c90Sdrh         mutex.lo mutex_noop.lo mutex_unix.lo mutex_w32.lo \
1877585f49aSdrh         notify.lo opcodes.lo os.lo os_kv.lo os_unix.lo os_win.lo \
188bc2ca9ebSdanielk1977         pager.lo parse.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
189498dcae0Sdrh         random.lo resolve.lo rowset.lo rtree.lo \
190c6603af7Sdrh         sqlite3session.lo select.lo sqlite3rbu.lo status.lo stmt.lo \
19138b4149cSdrh         table.lo threads.lo tokenize.lo treeview.lo trigger.lo \
19249f6a0d8Sdan         update.lo userauth.lo upsert.lo util.lo vacuum.lo \
193a9f39fdeSdan         vdbe.lo vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
19451f1c6f3Sdrh         vdbetrace.lo vdbevtab.lo \
195691b5c54Sdrh         wal.lo walker.lo where.lo wherecode.lo whereexpr.lo \
196d31e7addSdan         window.lo utf.lo vtab.lo
197b0208ccaSpaul
19894984910Smlcreech# Object files for the amalgamation.
19994984910Smlcreech#
20018607058SshanehLIBOBJS1 = sqlite3.lo
20194984910Smlcreech
20294984910Smlcreech# Determine the real value of LIBOBJ based on the 'configure' script
20394984910Smlcreech#
20418607058SshanehLIBOBJ = $(LIBOBJS$(USE_AMALGAMATION))
20594984910Smlcreech
20694984910Smlcreech
207bed8690fSdrh# All of the source code files.
208bed8690fSdrh#
209bed8690fSdrhSRC = \
210d0e4a6c1Sdrh  $(TOP)/src/alter.c \
2119f18e8a0Sdrh  $(TOP)/src/analyze.c \
212c11d4f93Sdrh  $(TOP)/src/attach.c \
213ed6c8671Sdrh  $(TOP)/src/auth.c \
2140410302eSdanielk1977  $(TOP)/src/backup.c \
215e0414bbcSmlcreech  $(TOP)/src/bitvec.c \
216900b31efSdrh  $(TOP)/src/btmutex.c \
2175c4d9703Sdrh  $(TOP)/src/btree.c \
218be0072d2Sdrh  $(TOP)/src/btree.h \
219eb6dc140Smlcreech  $(TOP)/src/btreeInt.h \
220bed8690fSdrh  $(TOP)/src/build.c \
221fd9a0a45Sdanielk1977  $(TOP)/src/callback.c \
222a2b902d6Sdrh  $(TOP)/src/complete.c \
223dc97a8cdSshaneh  $(TOP)/src/ctime.c \
2247014aff3Sdrh  $(TOP)/src/date.c \
225a43c8c8aSdrh  $(TOP)/src/dbpage.c \
2261a4a680aSdrh  $(TOP)/src/dbstat.c \
227bed8690fSdrh  $(TOP)/src/delete.c \
228bed8690fSdrh  $(TOP)/src/expr.c \
229643167ffSdrh  $(TOP)/src/fault.c \
2303be7d6ebSdan  $(TOP)/src/fkey.c \
23170a8ca3cSdrh  $(TOP)/src/func.c \
23240257ffdSdrh  $(TOP)/src/global.c \
233beae3194Sdrh  $(TOP)/src/hash.c \
2348f619ccdSdrh  $(TOP)/src/hash.h \
2359bcbdad2Sshane  $(TOP)/src/hwtime.h \
236bed8690fSdrh  $(TOP)/src/insert.c \
2379dbf96bdSdrh  $(TOP)/src/json.c \
238829512baSdrh  $(TOP)/src/legacy.c \
2391e397f8fSdrh  $(TOP)/src/loadext.c \
240bed8690fSdrh  $(TOP)/src/main.c \
2419e91c756Sdrh  $(TOP)/src/malloc.c \
242d1370b6dSdrh  $(TOP)/src/mem0.c \
2434bfc8a97Sdrh  $(TOP)/src/mem1.c \
2444bfc8a97Sdrh  $(TOP)/src/mem2.c \
2459c7a60dfSdrh  $(TOP)/src/mem3.c \
246fcfe27d6Smlcreech  $(TOP)/src/mem5.c \
247ac442f41Sdrh  $(TOP)/src/memdb.c \
2486553c5c8Sdanielk1977  $(TOP)/src/memjournal.c \
2492318d338Smistachkin  $(TOP)/src/msvc.h \
2504bfc8a97Sdrh  $(TOP)/src/mutex.c \
251eb6dc140Smlcreech  $(TOP)/src/mutex.h \
25218472fa7Sdrh  $(TOP)/src/mutex_noop.c \
253437b9013Sdrh  $(TOP)/src/mutex_unix.c \
254437b9013Sdrh  $(TOP)/src/mutex_w32.c \
255d52acb3bSdanielk1977  $(TOP)/src/notify.c \
256054889ecSdrh  $(TOP)/src/os.c \
257eb6dc140Smlcreech  $(TOP)/src/os.h \
258eb6dc140Smlcreech  $(TOP)/src/os_common.h \
259f74b9e09Smistachkin  $(TOP)/src/os_setup.h \
2607585f49aSdrh  $(TOP)/src/os_kv.c \
261829512baSdrh  $(TOP)/src/os_unix.c \
262829512baSdrh  $(TOP)/src/os_win.c \
2638bc52629Smistachkin  $(TOP)/src/os_win.h \
2645c4d9703Sdrh  $(TOP)/src/pager.c \
265be0072d2Sdrh  $(TOP)/src/pager.h \
266bed8690fSdrh  $(TOP)/src/parse.y \
2678c0a791aSdanielk1977  $(TOP)/src/pcache.c \
2688c0a791aSdanielk1977  $(TOP)/src/pcache.h \
269bc2ca9ebSdanielk1977  $(TOP)/src/pcache1.c \
270c11d4f93Sdrh  $(TOP)/src/pragma.c \
27167e65e55Sdrh  $(TOP)/src/pragma.h \
272fa256a33Sdanielk1977  $(TOP)/src/prepare.c \
273a18c5681Sdrh  $(TOP)/src/printf.c \
274ae85dc8bSdrh  $(TOP)/src/random.c \
2757d10d5a6Sdrh  $(TOP)/src/resolve.c \
2763d4501e5Sdrh  $(TOP)/src/rowset.c \
277bed8690fSdrh  $(TOP)/src/select.c \
278f7141990Sdrh  $(TOP)/src/status.c \
279aa62d2e4Sdrh  $(TOP)/src/shell.c.in \
280303aaa78Sdrh  $(TOP)/src/sqlite.h.in \
281eb6dc140Smlcreech  $(TOP)/src/sqlite3ext.h \
282bed8690fSdrh  $(TOP)/src/sqliteInt.h \
283eb6dc140Smlcreech  $(TOP)/src/sqliteLimit.h \
284e371033dSdrh  $(TOP)/src/table.c \
285bed8690fSdrh  $(TOP)/src/tclsqlite.c \
28645fac889Sdrh  $(TOP)/src/threads.c \
287bed8690fSdrh  $(TOP)/src/tokenize.c \
28838b4149cSdrh  $(TOP)/src/treeview.c \
2898f619ccdSdrh  $(TOP)/src/trigger.c \
290829512baSdrh  $(TOP)/src/utf.c \
291bed8690fSdrh  $(TOP)/src/update.c \
292fcfd756fSdrh  $(TOP)/src/upsert.c \
293bed8690fSdrh  $(TOP)/src/util.c \
294e1051c65Sdrh  $(TOP)/src/vacuum.c \
295bed8690fSdrh  $(TOP)/src/vdbe.c \
296bed8690fSdrh  $(TOP)/src/vdbe.h \
297829512baSdrh  $(TOP)/src/vdbeapi.c \
298829512baSdrh  $(TOP)/src/vdbeaux.c \
2996338c762Sdanielk1977  $(TOP)/src/vdbeblob.c \
300829512baSdrh  $(TOP)/src/vdbemem.c \
301a9f39fdeSdan  $(TOP)/src/vdbesort.c \
302c7bc4fdeSdrh  $(TOP)/src/vdbetrace.c \
303691b5c54Sdrh  $(TOP)/src/vdbevtab.c \
304829512baSdrh  $(TOP)/src/vdbeInt.h \
305b9bb7c18Sdrh  $(TOP)/src/vtab.c \
3068cd5b254Sdrh  $(TOP)/src/vxworks.h \
307c438efd6Sdrh  $(TOP)/src/wal.c \
308c438efd6Sdrh  $(TOP)/src/wal.h \
3097d10d5a6Sdrh  $(TOP)/src/walker.c \
310e54df42dSdrh  $(TOP)/src/where.c \
3116f82e85aSdrh  $(TOP)/src/wherecode.c \
3126c1f4ef2Sdrh  $(TOP)/src/whereexpr.c \
313d31e7addSdan  $(TOP)/src/whereInt.h \
314d31e7addSdan  $(TOP)/src/window.c
315bed8690fSdrh
3160c97940dSdrh# Source code for extensions
3170c97940dSdrh#
3180c97940dSdrhSRC += \
3190c97940dSdrh  $(TOP)/ext/fts1/fts1.c \
3200c97940dSdrh  $(TOP)/ext/fts1/fts1.h \
3210c97940dSdrh  $(TOP)/ext/fts1/fts1_hash.c \
3220c97940dSdrh  $(TOP)/ext/fts1/fts1_hash.h \
3230c97940dSdrh  $(TOP)/ext/fts1/fts1_porter.c \
3240c97940dSdrh  $(TOP)/ext/fts1/fts1_tokenizer.h \
3250c97940dSdrh  $(TOP)/ext/fts1/fts1_tokenizer1.c
32647524b8cSmlcreechSRC += \
32747524b8cSmlcreech  $(TOP)/ext/fts2/fts2.c \
32847524b8cSmlcreech  $(TOP)/ext/fts2/fts2.h \
32947524b8cSmlcreech  $(TOP)/ext/fts2/fts2_hash.c \
33047524b8cSmlcreech  $(TOP)/ext/fts2/fts2_hash.h \
33147524b8cSmlcreech  $(TOP)/ext/fts2/fts2_icu.c \
33247524b8cSmlcreech  $(TOP)/ext/fts2/fts2_porter.c \
33347524b8cSmlcreech  $(TOP)/ext/fts2/fts2_tokenizer.h \
33447524b8cSmlcreech  $(TOP)/ext/fts2/fts2_tokenizer.c \
33547524b8cSmlcreech  $(TOP)/ext/fts2/fts2_tokenizer1.c
33647524b8cSmlcreechSRC += \
33747524b8cSmlcreech  $(TOP)/ext/fts3/fts3.c \
33847524b8cSmlcreech  $(TOP)/ext/fts3/fts3.h \
33916708c4aSdan  $(TOP)/ext/fts3/fts3Int.h \
340d01f9cb2Sshaneh  $(TOP)/ext/fts3/fts3_aux.c \
3415df7c0f9Sshane  $(TOP)/ext/fts3/fts3_expr.c \
34247524b8cSmlcreech  $(TOP)/ext/fts3/fts3_hash.c \
34347524b8cSmlcreech  $(TOP)/ext/fts3/fts3_hash.h \
34447524b8cSmlcreech  $(TOP)/ext/fts3/fts3_icu.c \
34547524b8cSmlcreech  $(TOP)/ext/fts3/fts3_porter.c \
34616708c4aSdan  $(TOP)/ext/fts3/fts3_snippet.c \
34747524b8cSmlcreech  $(TOP)/ext/fts3/fts3_tokenizer.h \
34847524b8cSmlcreech  $(TOP)/ext/fts3/fts3_tokenizer.c \
34916708c4aSdan  $(TOP)/ext/fts3/fts3_tokenizer1.c \
350d7a959c6Sdan  $(TOP)/ext/fts3/fts3_tokenize_vtab.c \
351d97f3d7aSdrh  $(TOP)/ext/fts3/fts3_unicode.c \
352d97f3d7aSdrh  $(TOP)/ext/fts3/fts3_unicode2.c \
35316708c4aSdan  $(TOP)/ext/fts3/fts3_write.c
35447524b8cSmlcreechSRC += \
3551c826650Sdanielk1977  $(TOP)/ext/icu/sqliteicu.h \
35647524b8cSmlcreech  $(TOP)/ext/icu/icu.c
357ca57b87eSshaneSRC += \
358ca57b87eSshane  $(TOP)/ext/rtree/rtree.h \
359748b8fdaSdrh  $(TOP)/ext/rtree/rtree.c \
360748b8fdaSdrh  $(TOP)/ext/rtree/geopoly.c
361498dcae0SdrhSRC += \
362498dcae0Sdrh  $(TOP)/ext/session/sqlite3session.c \
363498dcae0Sdrh  $(TOP)/ext/session/sqlite3session.h
364adf3bf58SdrhSRC += \
36549f6a0d8Sdan  $(TOP)/ext/userauth/userauth.c \
36649f6a0d8Sdan  $(TOP)/ext/userauth/sqlite3userauth.h
36749f6a0d8SdanSRC += \
368cfb8f8d6Sdrh  $(TOP)/ext/rbu/sqlite3rbu.h \
369cfb8f8d6Sdrh  $(TOP)/ext/rbu/sqlite3rbu.c
37050065656SdrhSRC += \
371c6603af7Sdrh  $(TOP)/ext/misc/stmt.c
372969b2cd7Smlcreech
37318607058Sshaneh# Generated source code files
37418607058Sshaneh#
37518607058SshanehSRC += \
37618607058Sshaneh  keywordhash.h \
37718607058Sshaneh  opcodes.c \
37818607058Sshaneh  opcodes.h \
37918607058Sshaneh  parse.c \
38018607058Sshaneh  parse.h \
381a4b2f419Sdrh  sqlite_cfg.h \
382aa62d2e4Sdrh  shell.c \
38318607058Sshaneh  sqlite3.h
38418607058Sshaneh
38518607058Sshaneh# Source code to the test files.
386969b2cd7Smlcreech#
387969b2cd7SmlcreechTESTSRC = \
388d9b0257aSdrh  $(TOP)/src/test1.c \
3895c4d9703Sdrh  $(TOP)/src/test2.c \
3905c4d9703Sdrh  $(TOP)/src/test3.c \
3915202560eSdrh  $(TOP)/src/test4.c \
392829512baSdrh  $(TOP)/src/test5.c \
3939c06c953Sdrh  $(TOP)/src/test6.c \
3947910e76dSdrh  $(TOP)/src/test7.c \
395b9bb7c18Sdrh  $(TOP)/src/test8.c \
396a713f2c3Sdanielk1977  $(TOP)/src/test9.c \
3971409be69Sdrh  $(TOP)/src/test_autoext.c \
3987910e76dSdrh  $(TOP)/src/test_async.c \
3990410302eSdanielk1977  $(TOP)/src/test_backup.c \
400ddebf16fSdrh  $(TOP)/src/test_bestindex.c \
4015de7d966Sdrh  $(TOP)/src/test_blob.c \
40216a9b836Sdrh  $(TOP)/src/test_btree.c \
403c797d4dcSdrh  $(TOP)/src/test_config.c \
404000f95b1Sdan  $(TOP)/src/test_delete.c \
40584aab397Sshaneh  $(TOP)/src/test_demovfs.c \
406bf260978Sdanielk1977  $(TOP)/src/test_devsym.c \
4077015698bSdrh  $(TOP)/src/test_fs.c \
408984bfaa4Sdrh  $(TOP)/src/test_func.c \
40915926590Sdrh  $(TOP)/src/test_hexio.c \
4108e283794Sshane  $(TOP)/src/test_init.c \
411522efc62Sdrh  $(TOP)/src/test_intarray.c \
412f3107512Sdanielk1977  $(TOP)/src/test_journal.c \
4134bfc8a97Sdrh  $(TOP)/src/test_malloc.c \
414c318f730Sdrh  $(TOP)/src/test_md5.c \
4155af3ebd0Sdrh  $(TOP)/src/test_multiplex.c \
416c6f66c53Sshane  $(TOP)/src/test_mutex.c \
41720e987a1Sdanielk1977  $(TOP)/src/test_onefile.c \
418ede26276Smlcreech  $(TOP)/src/test_osinst.c \
419b232c232Sdrh  $(TOP)/src/test_pcache.c \
42051e79a7aSdrh  $(TOP)/src/test_quota.c \
4219508daa9Sdan  $(TOP)/src/test_rtree.c \
422954ce99cSdanielk1977  $(TOP)/src/test_schema.c \
4232d02a67dSdrh  $(TOP)/src/test_server.c \
42401a109e5Sdrh  $(TOP)/src/test_superlock.c \
4258689bc30Sdrh  $(TOP)/src/test_syscall.c \
426c318f730Sdrh  $(TOP)/src/test_tclsh.c \
4274be8b51eSdrh  $(TOP)/src/test_tclvar.c \
4288e283794Sshane  $(TOP)/src/test_thread.c \
4291d07f1d8Sdan  $(TOP)/src/test_vdbecov.c \
43084aab397Sshaneh  $(TOP)/src/test_vfs.c \
43192af1ebcSmistachkin  $(TOP)/src/test_windirent.c \
432660af939Sdan  $(TOP)/src/test_window.c \
433807d0fcaSdan  $(TOP)/src/test_wsd.c       \
43499ebad90Sdan  $(TOP)/ext/fts3/fts3_term.c \
435498dcae0Sdrh  $(TOP)/ext/fts3/fts3_test.c  \
436adf3bf58Sdrh  $(TOP)/ext/session/test_session.c \
4376fa0a11cSdan  $(TOP)/ext/recover/sqlite3recover.c \
438361fb98bSdan  $(TOP)/ext/recover/dbdata.c \
4396fa0a11cSdan  $(TOP)/ext/recover/test_recover.c \
440d73ade7dSdan  $(TOP)/ext/rbu/test_rbu.c
441d9b0257aSdrh
442e50db1c5Sdrh# Statically linked extensions
443e50db1c5Sdrh#
444e50db1c5SdrhTESTSRC += \
445138bd6dfSdrh  $(TOP)/ext/expert/sqlite3expert.c \
446138bd6dfSdrh  $(TOP)/ext/expert/test_expert.c \
4478416fc7fSdrh  $(TOP)/ext/misc/amatch.c \
4481b22ad8aSlarrybr  $(TOP)/ext/misc/appendvfs.c \
4492e3f87aeSdrh  $(TOP)/ext/misc/carray.c \
450c30b78f6Sdan  $(TOP)/ext/misc/cksumvfs.c \
4518416fc7fSdrh  $(TOP)/ext/misc/closure.c \
45235db31b2Sdrh  $(TOP)/ext/misc/csv.c \
453beb9def0Sdrh  $(TOP)/ext/misc/decimal.c \
4541728bcb0Sdrh  $(TOP)/ext/misc/eval.c \
4559b84f035Sdrh  $(TOP)/ext/misc/explain.c \
45651ed2983Sdrh  $(TOP)/ext/misc/fileio.c \
457e50db1c5Sdrh  $(TOP)/ext/misc/fuzzer.c \
4583e65f89eSdan  $(TOP)/ext/fts5/fts5_tcl.c \
459d3789c00Sdan  $(TOP)/ext/fts5/fts5_test_mi.c \
4602cfe049fSdan  $(TOP)/ext/fts5/fts5_test_tok.c \
4618416fc7fSdrh  $(TOP)/ext/misc/ieee754.c \
462460f1fa5Sdan  $(TOP)/ext/misc/mmapwarm.c \
463ea41dc44Sdrh  $(TOP)/ext/misc/nextchar.c \
46491694dbdSdrh  $(TOP)/ext/misc/normalize.c \
465def3367eSdrh  $(TOP)/ext/misc/percentile.c \
4669c039d9fSdan  $(TOP)/ext/misc/prefixes.c \
46782801a5bSdrh  $(TOP)/ext/misc/qpvtab.c \
468e50db1c5Sdrh  $(TOP)/ext/misc/regexp.c \
4696bada272Sdrh  $(TOP)/ext/misc/remember.c \
470398f872dSdrh  $(TOP)/ext/misc/series.c \
471b7045ab2Sdrh  $(TOP)/ext/misc/spellfix.c \
4725f8cdac6Sdrh  $(TOP)/ext/misc/totype.c \
473d8ecefa5Sdan  $(TOP)/ext/misc/unionvtab.c \
474411dfd4eSdrh  $(TOP)/ext/misc/wholenumber.c \
47549f6a0d8Sdan  $(TOP)/ext/misc/zipfile.c \
47601ed72f2Sdan  $(TOP)/ext/userauth/userauth.c \
47701ed72f2Sdan  $(TOP)/ext/rtree/test_rtreedoc.c
478e50db1c5Sdrh
47918607058Sshaneh# Source code to the library files needed by the test fixture
48018607058Sshaneh#
48118607058SshanehTESTSRC2 = \
48218607058Sshaneh  $(TOP)/src/attach.c \
48318607058Sshaneh  $(TOP)/src/backup.c \
48418607058Sshaneh  $(TOP)/src/bitvec.c \
48518607058Sshaneh  $(TOP)/src/btree.c \
48618607058Sshaneh  $(TOP)/src/build.c \
48718607058Sshaneh  $(TOP)/src/ctime.c \
48818607058Sshaneh  $(TOP)/src/date.c \
489a43c8c8aSdrh  $(TOP)/src/dbpage.c \
4901a4a680aSdrh  $(TOP)/src/dbstat.c \
49118607058Sshaneh  $(TOP)/src/expr.c \
49218607058Sshaneh  $(TOP)/src/func.c \
493eea8eb6dSdrh  $(TOP)/src/global.c \
49418607058Sshaneh  $(TOP)/src/insert.c \
49518607058Sshaneh  $(TOP)/src/wal.c \
49606006633Smistachkin  $(TOP)/src/main.c \
49718607058Sshaneh  $(TOP)/src/mem5.c \
49818607058Sshaneh  $(TOP)/src/os.c \
4997585f49aSdrh  $(TOP)/src/os_kv.c \
50018607058Sshaneh  $(TOP)/src/os_unix.c \
50118607058Sshaneh  $(TOP)/src/os_win.c \
50218607058Sshaneh  $(TOP)/src/pager.c \
50318607058Sshaneh  $(TOP)/src/pragma.c \
50418607058Sshaneh  $(TOP)/src/prepare.c \
50518607058Sshaneh  $(TOP)/src/printf.c \
50618607058Sshaneh  $(TOP)/src/random.c \
50718607058Sshaneh  $(TOP)/src/pcache.c \
50818607058Sshaneh  $(TOP)/src/pcache1.c \
50918607058Sshaneh  $(TOP)/src/select.c \
51018607058Sshaneh  $(TOP)/src/tokenize.c \
5118d48e30bSdan  $(TOP)/src/treeview.c \
51218607058Sshaneh  $(TOP)/src/utf.c \
51318607058Sshaneh  $(TOP)/src/util.c \
51418607058Sshaneh  $(TOP)/src/vdbeapi.c \
51518607058Sshaneh  $(TOP)/src/vdbeaux.c \
51618607058Sshaneh  $(TOP)/src/vdbe.c \
51718607058Sshaneh  $(TOP)/src/vdbemem.c \
51818607058Sshaneh  $(TOP)/src/vdbetrace.c \
519691b5c54Sdrh  $(TOP)/src/vdbevtab.c \
52018607058Sshaneh  $(TOP)/src/where.c \
5216f82e85aSdrh  $(TOP)/src/wherecode.c \
5226c1f4ef2Sdrh  $(TOP)/src/whereexpr.c \
523d31e7addSdan  $(TOP)/src/window.c \
52418607058Sshaneh  parse.c \
52518607058Sshaneh  $(TOP)/ext/fts3/fts3.c \
526d01f9cb2Sshaneh  $(TOP)/ext/fts3/fts3_aux.c \
52718607058Sshaneh  $(TOP)/ext/fts3/fts3_expr.c \
528671b5224Sshaneh  $(TOP)/ext/fts3/fts3_term.c \
52918607058Sshaneh  $(TOP)/ext/fts3/fts3_tokenizer.c \
53018607058Sshaneh  $(TOP)/ext/fts3/fts3_write.c \
531498dcae0Sdrh  $(TOP)/ext/async/sqlite3async.c \
532380c7ce4Sdan  $(TOP)/ext/session/sqlite3session.c \
533d73ade7dSdan  $(TOP)/ext/misc/stmt.c \
534d73ade7dSdan  fts5.c
53518607058Sshaneh
5368f619ccdSdrh# Header files used by all library source files.
5378f619ccdSdrh#
5388f619ccdSdrhHDR = \
5398f619ccdSdrh   $(TOP)/src/btree.h \
540a3152895Sdrh   $(TOP)/src/btreeInt.h \
5418f619ccdSdrh   $(TOP)/src/hash.h \
5429bcbdad2Sshane   $(TOP)/src/hwtime.h \
54318607058Sshaneh   keywordhash.h \
5442318d338Smistachkin   $(TOP)/src/msvc.h \
545437b9013Sdrh   $(TOP)/src/mutex.h \
5468f619ccdSdrh   opcodes.h \
5478f619ccdSdrh   $(TOP)/src/os.h \
548829512baSdrh   $(TOP)/src/os_common.h \
549f74b9e09Smistachkin   $(TOP)/src/os_setup.h \
5508bc52629Smistachkin   $(TOP)/src/os_win.h \
55118607058Sshaneh   $(TOP)/src/pager.h \
55218607058Sshaneh   $(TOP)/src/pcache.h \
55318607058Sshaneh   parse.h  \
55467e65e55Sdrh   $(TOP)/src/pragma.h \
55518607058Sshaneh   sqlite3.h  \
5561e397f8fSdrh   $(TOP)/src/sqlite3ext.h \
5578f619ccdSdrh   $(TOP)/src/sqliteInt.h  \
55818607058Sshaneh   $(TOP)/src/sqliteLimit.h \
5598f619ccdSdrh   $(TOP)/src/vdbe.h \
560eb6dc140Smlcreech   $(TOP)/src/vdbeInt.h \
5618cd5b254Sdrh   $(TOP)/src/vxworks.h \
562e54df42dSdrh   $(TOP)/src/whereInt.h \
563a4b2f419Sdrh   sqlite_cfg.h
5648f619ccdSdrh
5650c97940dSdrh# Header files used by extensions
5660c97940dSdrh#
56718607058SshanehEXTHDR += \
5680c97940dSdrh  $(TOP)/ext/fts1/fts1.h \
5690c97940dSdrh  $(TOP)/ext/fts1/fts1_hash.h \
5700c97940dSdrh  $(TOP)/ext/fts1/fts1_tokenizer.h
57118607058SshanehEXTHDR += \
57247524b8cSmlcreech  $(TOP)/ext/fts2/fts2.h \
57347524b8cSmlcreech  $(TOP)/ext/fts2/fts2_hash.h \
57447524b8cSmlcreech  $(TOP)/ext/fts2/fts2_tokenizer.h
57518607058SshanehEXTHDR += \
57647524b8cSmlcreech  $(TOP)/ext/fts3/fts3.h \
57716708c4aSdan  $(TOP)/ext/fts3/fts3Int.h \
57847524b8cSmlcreech  $(TOP)/ext/fts3/fts3_hash.h \
57947524b8cSmlcreech  $(TOP)/ext/fts3/fts3_tokenizer.h
58018607058SshanehEXTHDR += \
581748b8fdaSdrh  $(TOP)/ext/rtree/rtree.h \
582748b8fdaSdrh  $(TOP)/ext/rtree/geopoly.c
58318607058SshanehEXTHDR += \
5841c826650Sdanielk1977  $(TOP)/ext/icu/sqliteicu.h
5859508daa9SdanEXTHDR += \
5869508daa9Sdan  $(TOP)/ext/rtree/sqlite3rtree.h
58749f6a0d8SdanEXTHDR += \
58849f6a0d8Sdan  $(TOP)/ext/userauth/sqlite3userauth.h
5890c97940dSdrh
590d4ab1034Smistachkin# executables needed for testing
591f4375446Sdrh#
592f4375446SdrhTESTPROGS = \
593f4375446Sdrh  testfixture$(TEXE) \
594f4375446Sdrh  sqlite3$(TEXE) \
595f4375446Sdrh  sqlite3_analyzer$(TEXE) \
596290fcaa2Sdrh  sqldiff$(TEXE) \
597dd2a43a2Sdrh  dbhash$(TEXE) \
598dd2a43a2Sdrh  sqltclsh$(TEXE)
599f4375446Sdrh
600ea93c700Sdrh# Databases containing fuzzer test cases
601ea93c700Sdrh#
602ea93c700SdrhFUZZDATA = \
603ea93c700Sdrh  $(TOP)/test/fuzzdata1.db \
604ea93c700Sdrh  $(TOP)/test/fuzzdata2.db \
60564ff56f9Sdrh  $(TOP)/test/fuzzdata3.db \
606362b66f0Sdrh  $(TOP)/test/fuzzdata4.db \
6075ecf9039Sdrh  $(TOP)/test/fuzzdata5.db \
60805209e90Sdrh  $(TOP)/test/fuzzdata6.db \
609a47e709eSdrh  $(TOP)/test/fuzzdata7.db \
610a47e709eSdrh  $(TOP)/test/fuzzdata8.db
611f4375446Sdrh
612905da63aSdrh# Standard options to testfixture
613905da63aSdrh#
614905da63aSdrhTESTOPTS = --verbose=file --output=test-out.txt
615905da63aSdrh
61650065656Sdrh# Extra compiler options for various shell tools
61750065656Sdrh#
618dedd51aeSdrhSHELL_OPT = -DSQLITE_ENABLE_FTS4
619cc15313cSdrh#SHELL_OPT += -DSQLITE_ENABLE_FTS5
620d99c7b7bSdrhSHELL_OPT += -DSQLITE_ENABLE_RTREE
62174cf74abSdrhSHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS
622cc15313cSdrhSHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
623c6603af7SdrhSHELL_OPT += -DSQLITE_ENABLE_STMTVTAB
624ca5cf122SdrhSHELL_OPT += -DSQLITE_ENABLE_DBPAGE_VTAB
625ca5cf122SdrhSHELL_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
626691b5c54SdrhSHELL_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB
627092457b1SdrhSHELL_OPT += -DSQLITE_ENABLE_OFFSET_SQL_FUNC
628dedd51aeSdrhFUZZERSHELL_OPT =
629*71b65e88SdrhFUZZCHECK_OPT += -I$(TOP)/test
630*71b65e88SdrhFUZZCHECK_OPT += -I$(TOP)/ext/recover
631*71b65e88SdrhFUZZCHECK_OPT += -DSQLITE_OMIT_LOAD_EXTENSION
632*71b65e88SdrhFUZZCHECK_OPT += -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ
633a6bf20b5SdrhFUZZCHECK_OPT += -DSQLITE_MAX_MEMORY=50000000
634cc398969SdrhFUZZCHECK_OPT += -DSQLITE_PRINTF_PRECISION_LIMIT=1000
635a47e709eSdrhFUZZCHECK_OPT += -DSQLITE_ENABLE_FTS4
636856408abSdrhFUZZCHECK_OPT += -DSQLITE_ENABLE_FTS3_PARENTHESIS
63795888784SdrhFUZZCHECK_OPT += -DSQLITE_ENABLE_FTS5
638a47e709eSdrhFUZZCHECK_OPT += -DSQLITE_ENABLE_RTREE
639a47e709eSdrhFUZZCHECK_OPT += -DSQLITE_ENABLE_GEOPOLY
640a47e709eSdrhFUZZCHECK_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
641691b5c54SdrhFUZZCHECK_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB
642*71b65e88SdrhFUZZCHECK_SRC += $(TOP)/test/fuzzcheck.c
643*71b65e88SdrhFUZZCHECK_SRC += $(TOP)/test/ossfuzz.c
644*71b65e88SdrhFUZZCHECK_SRC += $(TOP)/test/fuzzinvariants.c
645*71b65e88SdrhFUZZCHECK_SRC += $(TOP)/ext/recover/dbdata.c
646*71b65e88SdrhFUZZCHECK_SRC += $(TOP)/ext/recover/sqlite3recover.c
647*71b65e88SdrhFUZZCHECK_SRC += $(TOP)/test/vt02.c
6486918e2f9SdrhDBFUZZ_OPT =
649d6555726SstephanST_OPT = -DSQLITE_OS_KV_OPTIONAL
65050065656Sdrh
65175897234Sdrh# This is the default Makefile target.  The objects listed here
65275897234Sdrh# are what get build when you type just "make" with no arguments.
65375897234Sdrh#
6547b5717e1Sdrhall:	sqlite3.h libsqlite3.la sqlite3$(TEXE) $(HAVE_TCL:1=libtclsqlite3.la)
65575897234Sdrh
656a8804c82SdougcurrieMakefile: $(TOP)/Makefile.in
6577972e32aSa.rottmann	./config.status
6587972e32aSa.rottmann
6592574da5fSvapiersqlite3.pc: $(TOP)/sqlite3.pc.in
6602574da5fSvapier	./config.status
6612574da5fSvapier
662829512baSdrhlibsqlite3.la:	$(LIBOBJ)
663691d4c99Smistachkin	$(LTLINK) -no-undefined -o $@ $(LIBOBJ) $(TLIBS) \
664289234ceSmlcreech		${ALLOWRELEASE} -rpath "$(libdir)" -version-info "8:6:8"
66575897234Sdrh
666829512baSdrhlibtclsqlite3.la:	tclsqlite.lo libsqlite3.la
667691d4c99Smistachkin	$(LTLINK) -no-undefined -o $@ tclsqlite.lo \
6680fcf237aSdrh		libsqlite3.la @TCL_STUB_LIB_SPEC@ $(TLIBS) \
6696d120f39Svapier		-rpath "$(TCLLIBDIR)" \
6706d120f39Svapier		-version-info "8:6:8" \
6716d120f39Svapier		-avoid-version
67271eb93eaSdrh
673aa62d2e4Sdrhsqlite3$(TEXE):	shell.c sqlite3.c
67450065656Sdrh	$(LTLINK) $(READLINE_FLAGS) $(SHELL_OPT) -o $@ \
675aa62d2e4Sdrh		shell.c sqlite3.c \
676289234ceSmlcreech		$(LIBREADLINE) $(TLIBS) -rpath "$(libdir)"
677c9a67a8cSdrh
678be11ade7Sdrhsqldiff$(TEXE):	$(TOP)/tool/sqldiff.c sqlite3.lo sqlite3.h
679be11ade7Sdrh	$(LTLINK) -o $@ $(TOP)/tool/sqldiff.c sqlite3.lo $(TLIBS)
680d62c0f4cSdrh
681be11ade7Sdrhdbhash$(TEXE):	$(TOP)/tool/dbhash.c sqlite3.lo sqlite3.h
682be11ade7Sdrh	$(LTLINK) -o $@ $(TOP)/tool/dbhash.c sqlite3.lo $(TLIBS)
683290fcaa2Sdrh
684be11ade7Sdrhscrub$(TEXE):	$(TOP)/ext/misc/scrub.c sqlite3.lo
685da110bfeSdrh	$(LTLINK) -o $@ -I. -DSCRUB_STANDALONE \
686be11ade7Sdrh		$(TOP)/ext/misc/scrub.c sqlite3.lo $(TLIBS)
687da110bfeSdrh
688cc5f8a46Sdrhsrcck1$(BEXE):	$(TOP)/tool/srcck1.c
689cc5f8a46Sdrh	$(BCC) -o srcck1$(BEXE) $(TOP)/tool/srcck1.c
690cc5f8a46Sdrh
691cc5f8a46Sdrhsourcetest:	srcck1$(BEXE) sqlite3.c
692cc5f8a46Sdrh	./srcck1 sqlite3.c
693cc5f8a46Sdrh
69450065656Sdrhfuzzershell$(TEXE):	$(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h
69550065656Sdrh	$(LTLINK) -o $@ $(FUZZERSHELL_OPT) \
69650065656Sdrh	  $(TOP)/tool/fuzzershell.c sqlite3.c $(TLIBS)
697268e72f9Sdrh
698*71b65e88Sdrhfuzzcheck$(TEXE):	$(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP)
699362b66f0Sdrh	$(LTLINK) -o $@ $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) sqlite3.c $(TLIBS)
700362b66f0Sdrh
701362b66f0Sdrhossshell$(TEXE):	$(TOP)/test/ossfuzz.c $(TOP)/test/ossshell.c sqlite3.c sqlite3.h
70259d705abSdrh	$(LTLINK) -o $@ $(FUZZCHECK_OPT) $(TOP)/test/ossshell.c \
70359d705abSdrh             $(TOP)/test/ossfuzz.c sqlite3.c $(TLIBS)
7041573dc3bSdrh
705f94c1902Sdrhsessionfuzz$(TEXE):	$(TOP)/test/sessionfuzz.c sqlite3.c sqlite3.h
706bc1be957Sdrh	$(LTLINK) -o $@ $(TOP)/test/sessionfuzz.c $(TLIBS)
707f94c1902Sdrh
7086918e2f9Sdrhdbfuzz$(TEXE):	$(TOP)/test/dbfuzz.c sqlite3.c sqlite3.h
7096918e2f9Sdrh	$(LTLINK) -o $@ $(DBFUZZ_OPT) $(TOP)/test/dbfuzz.c sqlite3.c $(TLIBS)
7106918e2f9Sdrh
711977e5dcdSdrhDBFUZZ2_OPTS = \
712977e5dcdSdrh  -DSQLITE_THREADSAFE=0 \
713977e5dcdSdrh  -DSQLITE_OMIT_LOAD_EXTENSION \
714977e5dcdSdrh  -DSQLITE_DEBUG \
715977e5dcdSdrh  -DSQLITE_ENABLE_DBSTAT_VTAB \
716691b5c54Sdrh  -DSQLITE_ENABLE_BYTECODE_VTAB \
717977e5dcdSdrh  -DSQLITE_ENABLE_RTREE \
718977e5dcdSdrh  -DSQLITE_ENABLE_FTS4 \
719e65b9c6aSdrh  -DSQLITE_ENABLE_FTS5
720977e5dcdSdrh
721e65b9c6aSdrhdbfuzz2$(TEXE):	$(TOP)/test/dbfuzz2.c sqlite3.c sqlite3.h
722e65b9c6aSdrh	$(CC) $(OPT_FEATURE_FLAGS) $(OPTS) -I. -g -O0 \
723e65b9c6aSdrh		-DSTANDALONE -o dbfuzz2 \
724e65b9c6aSdrh		$(DBFUZZ2_OPTS) $(TOP)/test/dbfuzz2.c sqlite3.c $(TLIBS)
725e65b9c6aSdrh	mkdir -p dbfuzz2-dir
726e65b9c6aSdrh	cp $(TOP)/test/dbfuzz2-seed* dbfuzz2-dir
727e65b9c6aSdrh
728e65b9c6aSdrhdbfuzz2-asan:	$(TOP)/test/dbfuzz2.c sqlite3.c sqlite3.h
72969a66a7bSdrh	clang-6.0 $(OPT_FEATURE_FLAGS) $(OPTS) -I. -g -O0 \
730e65b9c6aSdrh		-fsanitize=fuzzer,undefined,address -o dbfuzz2-asan \
731e65b9c6aSdrh		$(DBFUZZ2_OPTS) $(TOP)/test/dbfuzz2.c sqlite3.c $(TLIBS)
732e65b9c6aSdrh	mkdir -p dbfuzz2-dir
733e65b9c6aSdrh	cp $(TOP)/test/dbfuzz2-seed* dbfuzz2-dir
734e65b9c6aSdrh
735e65b9c6aSdrhdbfuzz2-msan:	$(TOP)/test/dbfuzz2.c sqlite3.c sqlite3.h
736e65b9c6aSdrh	clang-6.0 $(OPT_FEATURE_FLAGS) $(OPTS) -I. -g -O0 \
737e65b9c6aSdrh		-fsanitize=fuzzer,undefined,memory -o dbfuzz2-msan \
738e65b9c6aSdrh		$(DBFUZZ2_OPTS) $(TOP)/test/dbfuzz2.c sqlite3.c $(TLIBS)
739977e5dcdSdrh	mkdir -p dbfuzz2-dir
740977e5dcdSdrh	cp $(TOP)/test/dbfuzz2-seed* dbfuzz2-dir
741977e5dcdSdrh
742be11ade7Sdrhmptester$(TEXE):	sqlite3.lo $(TOP)/mptest/mptest.c
743be11ade7Sdrh	$(LTLINK) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.lo \
744bc94dbb6Sdrh		$(TLIBS) -rpath "$(libdir)"
745bc94dbb6Sdrh
746b6750b10SdrhMPTEST1=./mptester$(TEXE) mptest.db $(TOP)/mptest/crash01.test --repeat 20
747b6750b10SdrhMPTEST2=./mptester$(TEXE) mptest.db $(TOP)/mptest/multiwrite01.test --repeat 20
748b6750b10Sdrhmptest:	mptester$(TEXE)
749cc285c5aSdrh	rm -f mptest.db
750cc285c5aSdrh	$(MPTEST1) --journalmode DELETE
751cc285c5aSdrh	$(MPTEST2) --journalmode WAL
752cc285c5aSdrh	$(MPTEST1) --journalmode WAL
753cc285c5aSdrh	$(MPTEST2) --journalmode PERSIST
754cc285c5aSdrh	$(MPTEST1) --journalmode PERSIST
755cc285c5aSdrh	$(MPTEST2) --journalmode TRUNCATE
756cc285c5aSdrh	$(MPTEST1) --journalmode TRUNCATE
757cc285c5aSdrh	$(MPTEST2) --journalmode DELETE
758cc285c5aSdrh
759bc94dbb6Sdrh
7608f619ccdSdrh# This target creates a directory named "tsrc" and fills it with
7618f619ccdSdrh# copies of all of the C source code and header files needed to
7628f619ccdSdrh# build on the target system.  Some of the C source code and header
7638f619ccdSdrh# files are automatically generated.  This target takes care of
7648f619ccdSdrh# all that automatic generation.
7658f619ccdSdrh#
76650065656Sdrh.target_source:	$(SRC) $(TOP)/tool/vdbe-compress.tcl fts5.c
7678f619ccdSdrh	rm -rf tsrc
76818607058Sshaneh	mkdir tsrc
76918607058Sshaneh	cp -f $(SRC) tsrc
7708f619ccdSdrh	rm tsrc/sqlite.h.in tsrc/parse.y
7712dc0648aSdrh	$(TCLSH_CMD) $(TOP)/tool/vdbe-compress.tcl $(OPTS) <tsrc/vdbe.c >vdbe.new
772856c1037Sdrh	mv vdbe.new tsrc/vdbe.c
77350065656Sdrh	cp fts5.c fts5.h tsrc
77494984910Smlcreech	touch .target_source
7758f619ccdSdrh
77694984910Smlcreechsqlite3.c:	.target_source $(TOP)/tool/mksqlite3c.tcl
777696555d7Smistachkin	$(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_LINE_MACROS)
7786f099107Sdrh	cp tsrc/sqlite3ext.h .
779e191e2c6Sdrh	cp $(TOP)/ext/session/sqlite3session.h .
78093d57531Sdrh
7812f20e13bSdrhsqlite3ext.h:	.target_source
7822f20e13bSdrh	cp tsrc/sqlite3ext.h .
7832f20e13bSdrh
784f4fd9ed3Sdrhtclsqlite3.c:	sqlite3.c
785f4fd9ed3Sdrh	echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c
786f4fd9ed3Sdrh	cat sqlite3.c >>tclsqlite3.c
787f4fd9ed3Sdrh	echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite3.c
788f4fd9ed3Sdrh	cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
789f4fd9ed3Sdrh
79007516dd5Sdrhsqlite3-all.c:	sqlite3.c $(TOP)/tool/split-sqlite3c.tcl
79107516dd5Sdrh	$(TCLSH_CMD) $(TOP)/tool/split-sqlite3c.tcl
79207516dd5Sdrh
79318607058Sshaneh# Rule to build the amalgamation
79418607058Sshaneh#
79518607058Sshanehsqlite3.lo:	sqlite3.c
79618607058Sshaneh	$(LTCOMPILE) $(TEMP_STORE) -c sqlite3.c
79718607058Sshaneh
79875897234Sdrh# Rules to build the LEMON compiler generator
79975897234Sdrh#
80082415f2dSdrhlemon$(BEXE):	$(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
8011428b374Smlcreech	$(BCC) -o $@ $(TOP)/tool/lemon.c
80282415f2dSdrh	cp $(TOP)/tool/lempar.c .
80375897234Sdrh
804f39e0ed4Sdrh# Rules to build the program that generates the source-id
805f39e0ed4Sdrh#
806f39e0ed4Sdrhmksourceid$(BEXE):	$(TOP)/tool/mksourceid.c
807f39e0ed4Sdrh	$(BCC) -o $@ $(TOP)/tool/mksourceid.c
808f39e0ed4Sdrh
80918607058Sshaneh# Rules to build individual *.o files from generated *.c files. This
81018607058Sshaneh# applies to:
81194984910Smlcreech#
81218607058Sshaneh#     parse.o
81318607058Sshaneh#     opcodes.o
81418607058Sshaneh#
81518607058Sshanehparse.lo:	parse.c $(HDR)
81618607058Sshaneh	$(LTCOMPILE) $(TEMP_STORE) -c parse.c
81794984910Smlcreech
81818607058Sshanehopcodes.lo:	opcodes.c
81918607058Sshaneh	$(LTCOMPILE) $(TEMP_STORE) -c opcodes.c
82018607058Sshaneh
82118607058Sshaneh# Rules to build individual *.o files from files in the src directory.
822829512baSdrh#
823d0e4a6c1Sdrhalter.lo:	$(TOP)/src/alter.c $(HDR)
8248b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/alter.c
825d0e4a6c1Sdrh
8269f18e8a0Sdrhanalyze.lo:	$(TOP)/src/analyze.c $(HDR)
8278b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/analyze.c
8289f18e8a0Sdrh
829829512baSdrhattach.lo:	$(TOP)/src/attach.c $(HDR)
8308b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/attach.c
831829512baSdrh
832829512baSdrhauth.lo:	$(TOP)/src/auth.c $(HDR)
8338b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/auth.c
834829512baSdrh
835973402e5Srsebackup.lo:	$(TOP)/src/backup.c $(HDR)
836973402e5Srse	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/backup.c
837973402e5Srse
8385b9d8678Smlcreechbitvec.lo:	$(TOP)/src/bitvec.c $(HDR)
8398b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/bitvec.c
8405b9d8678Smlcreech
841900b31efSdrhbtmutex.lo:	$(TOP)/src/btmutex.c $(HDR)
8428b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/btmutex.c
843900b31efSdrh
84471eb93eaSdrhbtree.lo:	$(TOP)/src/btree.c $(HDR) $(TOP)/src/pager.h
8458b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/btree.c
8465c4d9703Sdrh
84771eb93eaSdrhbuild.lo:	$(TOP)/src/build.c $(HDR)
8488b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/build.c
84975897234Sdrh
850fd9a0a45Sdanielk1977callback.lo:	$(TOP)/src/callback.c $(HDR)
8518b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/callback.c
852fd9a0a45Sdanielk1977
853a2b902d6Sdrhcomplete.lo:	$(TOP)/src/complete.c $(HDR)
8548b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/complete.c
855a2b902d6Sdrh
856dc97a8cdSshanehctime.lo:	$(TOP)/src/ctime.c $(HDR)
857dc97a8cdSshaneh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/ctime.c
858dc97a8cdSshaneh
8597014aff3Sdrhdate.lo:	$(TOP)/src/date.c $(HDR)
8608b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/date.c
8617014aff3Sdrh
862a43c8c8aSdrhdbpage.lo:	$(TOP)/src/dbpage.c $(HDR)
863a43c8c8aSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/dbpage.c
864a43c8c8aSdrh
8651a4a680aSdrhdbstat.lo:	$(TOP)/src/dbstat.c $(HDR)
8661a4a680aSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/dbstat.c
8671a4a680aSdrh
86871eb93eaSdrhdelete.lo:	$(TOP)/src/delete.c $(HDR)
8698b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/delete.c
870cce7d176Sdrh
87171eb93eaSdrhexpr.lo:	$(TOP)/src/expr.c $(HDR)
8728b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/expr.c
873cce7d176Sdrh
874643167ffSdrhfault.lo:	$(TOP)/src/fault.c $(HDR)
8758b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/fault.c
876643167ffSdrh
8773be7d6ebSdanfkey.lo:	$(TOP)/src/fkey.c $(HDR)
8783be7d6ebSdan	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/fkey.c
8793be7d6ebSdan
88070a8ca3cSdrhfunc.lo:	$(TOP)/src/func.c $(HDR)
8818b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/func.c
882dc04c583Sdrh
88340257ffdSdrhglobal.lo:	$(TOP)/src/global.c $(HDR)
8848b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/global.c
88540257ffdSdrh
88671eb93eaSdrhhash.lo:	$(TOP)/src/hash.c $(HDR)
8878b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/hash.c
888beae3194Sdrh
88971eb93eaSdrhinsert.lo:	$(TOP)/src/insert.c $(HDR)
8908b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/insert.c
891cce7d176Sdrh
892b0b734d1Sdrhjson.lo:	$(TOP)/src/json.c $(HDR)
8939dbf96bdSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/json.c
8949dbf96bdSdrh
895829512baSdrhlegacy.lo:	$(TOP)/src/legacy.c $(HDR)
8968b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/legacy.c
897ae85dc8bSdrh
8981e397f8fSdrhloadext.lo:	$(TOP)/src/loadext.c $(HDR)
8998b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/loadext.c
9001e397f8fSdrh
901829512baSdrhmain.lo:	$(TOP)/src/main.c $(HDR)
9020f290bf7Sdougcurrie	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/main.c
903cce7d176Sdrh
904a3152895Sdrhmalloc.lo:	$(TOP)/src/malloc.c $(HDR)
905a3152895Sdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/malloc.c
906a3152895Sdrh
907d1370b6dSdrhmem0.lo:	$(TOP)/src/mem0.c $(HDR)
908d1370b6dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem0.c
909d1370b6dSdrh
9104bfc8a97Sdrhmem1.lo:	$(TOP)/src/mem1.c $(HDR)
9114bfc8a97Sdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem1.c
9124bfc8a97Sdrh
9134bfc8a97Sdrhmem2.lo:	$(TOP)/src/mem2.c $(HDR)
9144bfc8a97Sdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem2.c
9154bfc8a97Sdrh
9169c7a60dfSdrhmem3.lo:	$(TOP)/src/mem3.c $(HDR)
9179c7a60dfSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem3.c
9189c7a60dfSdrh
919fcfe27d6Smlcreechmem5.lo:	$(TOP)/src/mem5.c $(HDR)
920fcfe27d6Smlcreech	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mem5.c
921fcfe27d6Smlcreech
922ac442f41Sdrhmemdb.lo:	$(TOP)/src/memdb.c $(HDR)
923ac442f41Sdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/memdb.c
924ac442f41Sdrh
9256553c5c8Sdanielk1977memjournal.lo:	$(TOP)/src/memjournal.c $(HDR)
9268b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/memjournal.c
9276553c5c8Sdanielk1977
9284bfc8a97Sdrhmutex.lo:	$(TOP)/src/mutex.c $(HDR)
9294bfc8a97Sdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex.c
9304bfc8a97Sdrh
93118472fa7Sdrhmutex_noop.lo:	$(TOP)/src/mutex_noop.c $(HDR)
93218472fa7Sdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex_noop.c
93318472fa7Sdrh
934437b9013Sdrhmutex_unix.lo:	$(TOP)/src/mutex_unix.c $(HDR)
935437b9013Sdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex_unix.c
936437b9013Sdrh
937437b9013Sdrhmutex_w32.lo:	$(TOP)/src/mutex_w32.c $(HDR)
938437b9013Sdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/mutex_w32.c
939437b9013Sdrh
940d52acb3bSdanielk1977notify.lo:	$(TOP)/src/notify.c $(HDR)
941d52acb3bSdanielk1977	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/notify.c
942d52acb3bSdanielk1977
943829512baSdrhpager.lo:	$(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h
9448b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/pager.c
945e371033dSdrh
9468c0a791aSdanielk1977pcache.lo:	$(TOP)/src/pcache.c $(HDR) $(TOP)/src/pcache.h
9478b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/pcache.c
9488c0a791aSdanielk1977
949bc2ca9ebSdanielk1977pcache1.lo:	$(TOP)/src/pcache1.c $(HDR) $(TOP)/src/pcache.h
9508b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/pcache1.c
951bc2ca9ebSdanielk1977
952054889ecSdrhos.lo:	$(TOP)/src/os.c $(HDR)
9538b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os.c
954054889ecSdrh
9557585f49aSdrhos_kv.lo:	$(TOP)/src/os_kv.c $(HDR)
9567585f49aSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os_kv.c
9577585f49aSdrh
958829512baSdrhos_unix.lo:	$(TOP)/src/os_unix.c $(HDR)
9598b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os_unix.c
960829512baSdrh
961829512baSdrhos_win.lo:	$(TOP)/src/os_win.c $(HDR)
9628b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os_win.c
963829512baSdrh
964c11d4f93Sdrhpragma.lo:	$(TOP)/src/pragma.c $(HDR)
9658b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/pragma.c
966c11d4f93Sdrh
967fa256a33Sdanielk1977prepare.lo:	$(TOP)/src/prepare.c $(HDR)
968fa256a33Sdanielk1977	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/prepare.c
969fa256a33Sdanielk1977
97071eb93eaSdrhprintf.lo:	$(TOP)/src/printf.c $(HDR)
9718b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/printf.c
972348784efSdrh
973829512baSdrhrandom.lo:	$(TOP)/src/random.c $(HDR)
9748b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/random.c
975c11d4f93Sdrh
9767d10d5a6Sdrhresolve.lo:	$(TOP)/src/resolve.c $(HDR)
9778b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/resolve.c
9787d10d5a6Sdrh
9793d4501e5Sdrhrowset.lo:	$(TOP)/src/rowset.c $(HDR)
9808b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/rowset.c
9813d4501e5Sdrh
982829512baSdrhselect.lo:	$(TOP)/src/select.c $(HDR)
9838b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/select.c
984829512baSdrh
985f7141990Sdrhstatus.lo:	$(TOP)/src/status.c $(HDR)
9868b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/status.c
987f7141990Sdrh
988829512baSdrhtable.lo:	$(TOP)/src/table.c $(HDR)
9898b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/table.c
990829512baSdrh
991f51446a3Sdrhthreads.lo:	$(TOP)/src/threads.c $(HDR)
992f51446a3Sdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/threads.c
993f51446a3Sdrh
99473b211abSdrhtokenize.lo:	$(TOP)/src/tokenize.c keywordhash.h $(HDR)
9958b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/tokenize.c
996829512baSdrh
99738b4149cSdrhtreeview.lo:	$(TOP)/src/treeview.c $(HDR)
99838b4149cSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/treeview.c
99938b4149cSdrh
1000829512baSdrhtrigger.lo:	$(TOP)/src/trigger.c $(HDR)
10018b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/trigger.c
1002829512baSdrh
1003829512baSdrhupdate.lo:	$(TOP)/src/update.c $(HDR)
10048b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/update.c
1005829512baSdrh
1006fcfd756fSdrhupsert.lo:	$(TOP)/src/upsert.c $(HDR)
1007fcfd756fSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/upsert.c
1008fcfd756fSdrh
1009829512baSdrhutf.lo:	$(TOP)/src/utf.c $(HDR)
10108b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/utf.c
1011829512baSdrh
1012829512baSdrhutil.lo:	$(TOP)/src/util.c $(HDR)
10138b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/util.c
1014829512baSdrh
1015829512baSdrhvacuum.lo:	$(TOP)/src/vacuum.c $(HDR)
10168b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vacuum.c
1017829512baSdrh
1018eb6dc140Smlcreechvdbe.lo:	$(TOP)/src/vdbe.c $(HDR)
10198b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbe.c
1020829512baSdrh
1021eb6dc140Smlcreechvdbeapi.lo:	$(TOP)/src/vdbeapi.c $(HDR)
10228b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbeapi.c
1023829512baSdrh
1024eb6dc140Smlcreechvdbeaux.lo:	$(TOP)/src/vdbeaux.c $(HDR)
10258b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbeaux.c
1026829512baSdrh
1027eb6dc140Smlcreechvdbeblob.lo:	$(TOP)/src/vdbeblob.c $(HDR)
10288b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbeblob.c
10296338c762Sdanielk1977
1030eb6dc140Smlcreechvdbemem.lo:	$(TOP)/src/vdbemem.c $(HDR)
10318b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbemem.c
1032829512baSdrh
1033a9f39fdeSdanvdbesort.lo:	$(TOP)/src/vdbesort.c $(HDR)
1034a9f39fdeSdan	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbesort.c
1035a9f39fdeSdan
1036c7bc4fdeSdrhvdbetrace.lo:	$(TOP)/src/vdbetrace.c $(HDR)
1037c7bc4fdeSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbetrace.c
1038c7bc4fdeSdrh
1039691b5c54Sdrhvdbevtab.lo:	$(TOP)/src/vdbevtab.c $(HDR)
1040691b5c54Sdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vdbevtab.c
1041691b5c54Sdrh
1042eb6dc140Smlcreechvtab.lo:	$(TOP)/src/vtab.c $(HDR)
10438b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/vtab.c
1044b9bb7c18Sdrh
1045c438efd6Sdrhwal.lo:	$(TOP)/src/wal.c $(HDR)
1046c438efd6Sdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/wal.c
1047c438efd6Sdrh
10487d10d5a6Sdrhwalker.lo:	$(TOP)/src/walker.c $(HDR)
10498b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/walker.c
10507d10d5a6Sdrh
1051829512baSdrhwhere.lo:	$(TOP)/src/where.c $(HDR)
10528b72747dSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/where.c
1053ed6c8671Sdrh
10546f82e85aSdrhwherecode.lo:	$(TOP)/src/wherecode.c $(HDR)
10556f82e85aSdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/wherecode.c
10566f82e85aSdrh
10576c1f4ef2Sdrhwhereexpr.lo:	$(TOP)/src/whereexpr.c $(HDR)
10586c1f4ef2Sdrh	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/whereexpr.c
10596c1f4ef2Sdrh
1060d31e7addSdanwindow.lo:	$(TOP)/src/window.c $(HDR)
1061d31e7addSdan	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/window.c
1062d31e7addSdan
106318607058Sshanehtclsqlite.lo:	$(TOP)/src/tclsqlite.c $(HDR)
106418607058Sshaneh	$(LTCOMPILE) -DUSE_TCL_STUBS=1 -c $(TOP)/src/tclsqlite.c
106518607058Sshaneh
10667b5717e1Sdrhtclsqlite-shell.lo:	$(TOP)/src/tclsqlite.c $(HDR)
106796a206faSdrh	$(LTCOMPILE) -DTCLSH -o $@ -c $(TOP)/src/tclsqlite.c
1068964dbb1eSa.rottmann
10697b5717e1Sdrhtclsqlite-stubs.lo:	$(TOP)/src/tclsqlite.c $(HDR)
10708128bb29Sshaneh	$(LTCOMPILE) -DUSE_TCL_STUBS=1 -o $@ -c $(TOP)/src/tclsqlite.c
10717b5717e1Sdrh
10721428b374Smlcreechtclsqlite3$(TEXE):	tclsqlite-shell.lo libsqlite3.la
10731428b374Smlcreech	$(LTLINK) -o $@ tclsqlite-shell.lo \
1074829512baSdrh		 libsqlite3.la $(LIBTCL)
1075348784efSdrh
107618607058Sshaneh# Rules to build opcodes.c and opcodes.h
107718607058Sshaneh#
10787651e0a4Sdrhopcodes.c:	opcodes.h $(TOP)/tool/mkopcodec.tcl
10797651e0a4Sdrh	$(TCLSH_CMD) $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c
108018607058Sshaneh
1081b15393b8Sdrhopcodes.h:	parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl
1082b15393b8Sdrh	cat parse.h $(TOP)/src/vdbe.c | $(TCLSH_CMD) $(TOP)/tool/mkopcodeh.tcl >opcodes.h
108318607058Sshaneh
108418607058Sshaneh# Rules to build parse.c and parse.h - the outputs of lemon.
108518607058Sshaneh#
108618607058Sshanehparse.h:	parse.c
108718607058Sshaneh
1088f1722baaSdrhparse.c:	$(TOP)/src/parse.y lemon$(BEXE)
108918607058Sshaneh	cp $(TOP)/src/parse.y .
1090fe03dac2Sdrh	./lemon$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) -S parse.y
109118607058Sshaneh
1092f39e0ed4Sdrhsqlite3.h:	$(TOP)/src/sqlite.h.in $(TOP)/manifest mksourceid$(BEXE) $(TOP)/VERSION
109316b92eefSdrh	$(TCLSH_CMD) $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
109418607058Sshaneh
10957cff0e34Smistachkinsqlite3rc.h:	$(TOP)/src/sqlite3.rc $(TOP)/VERSION
10967cff0e34Smistachkin	echo '#ifndef SQLITE_RESOURCE_VERSION' >$@
10977cff0e34Smistachkin	echo -n '#define SQLITE_RESOURCE_VERSION ' >>$@
10987cff0e34Smistachkin	cat $(TOP)/VERSION | $(TCLSH_CMD) $(TOP)/tool/replace.tcl exact . , >>$@
10997cff0e34Smistachkin	echo '#endif' >>sqlite3rc.h
11007cff0e34Smistachkin
110118607058Sshanehkeywordhash.h:	$(TOP)/tool/mkkeywordhash.c
110218607058Sshaneh	$(BCC) -o mkkeywordhash$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)/tool/mkkeywordhash.c
110318607058Sshaneh	./mkkeywordhash$(BEXE) >keywordhash.h
110418607058Sshaneh
1105aa62d2e4Sdrh# Source files that go into making shell.c
1106aa62d2e4SdrhSHELL_SRC = \
1107aa62d2e4Sdrh	$(TOP)/src/shell.c.in \
11088682e121Sdrh        $(TOP)/ext/misc/appendvfs.c \
11098cda77d4Sdrh	$(TOP)/ext/misc/completion.c \
1110beb9def0Sdrh        $(TOP)/ext/misc/decimal.c \
1111aa62d2e4Sdrh	$(TOP)/ext/misc/fileio.c \
11128cda77d4Sdrh        $(TOP)/ext/misc/ieee754.c \
111350dce5e8Sdrh        $(TOP)/ext/misc/regexp.c \
1114d36f588fSdrh        $(TOP)/ext/misc/series.c \
11158cda77d4Sdrh	$(TOP)/ext/misc/shathree.c \
1116c9320336Sdrh	$(TOP)/ext/misc/sqlar.c \
1117f05dd03aSdrh        $(TOP)/ext/misc/uint.c \
1118c9320336Sdrh	$(TOP)/ext/expert/sqlite3expert.c \
1119c9320336Sdrh	$(TOP)/ext/expert/sqlite3expert.h \
1120c9320336Sdrh	$(TOP)/ext/misc/zipfile.c \
112150b910a8Sdrh	$(TOP)/ext/misc/memtrace.c \
1122361fb98bSdan	$(TOP)/ext/recover/dbdata.c \
11236fa0a11cSdan	$(TOP)/ext/recover/sqlite3recover.c \
11246fa0a11cSdan	$(TOP)/ext/recover/sqlite3recover.h \
1125c9320336Sdrh        $(TOP)/src/test_windirent.c
1126aa62d2e4Sdrh
1127aa62d2e4Sdrhshell.c:	$(SHELL_SRC) $(TOP)/tool/mkshellc.tcl
1128aa62d2e4Sdrh	$(TCLSH_CMD) $(TOP)/tool/mkshellc.tcl >shell.c
1129aa62d2e4Sdrh
1130aa62d2e4Sdrh
113118607058Sshaneh
113218607058Sshaneh
113318607058Sshaneh# Rules to build the extension objects.
113418607058Sshaneh#
113518607058Sshanehicu.lo:	$(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR)
113618607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/icu/icu.c
113718607058Sshaneh
113818607058Sshanehfts2.lo:	$(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR)
113918607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2.c
114018607058Sshaneh
114118607058Sshanehfts2_hash.lo:	$(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR)
114218607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_hash.c
114318607058Sshaneh
114418607058Sshanehfts2_icu.lo:	$(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR)
114518607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_icu.c
114618607058Sshaneh
114718607058Sshanehfts2_porter.lo:	$(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR)
114818607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_porter.c
114918607058Sshaneh
115018607058Sshanehfts2_tokenizer.lo:	$(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR)
115118607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c
115218607058Sshaneh
115318607058Sshanehfts2_tokenizer1.lo:	$(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR)
115418607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c
115518607058Sshaneh
115618607058Sshanehfts3.lo:	$(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR)
115718607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3.c
115818607058Sshaneh
1159d01f9cb2Sshanehfts3_aux.lo:	$(TOP)/ext/fts3/fts3_aux.c $(HDR) $(EXTHDR)
1160d01f9cb2Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_aux.c
1161d01f9cb2Sshaneh
116218607058Sshanehfts3_expr.lo:	$(TOP)/ext/fts3/fts3_expr.c $(HDR) $(EXTHDR)
116318607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_expr.c
116418607058Sshaneh
116518607058Sshanehfts3_hash.lo:	$(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR)
116618607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_hash.c
116718607058Sshaneh
116818607058Sshanehfts3_icu.lo:	$(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR)
116918607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_icu.c
117018607058Sshaneh
1171671b5224Sshanehfts3_porter.lo:	$(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR)
1172671b5224Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_porter.c
1173671b5224Sshaneh
117418607058Sshanehfts3_snippet.lo:	$(TOP)/ext/fts3/fts3_snippet.c $(HDR) $(EXTHDR)
117518607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_snippet.c
117618607058Sshaneh
117718607058Sshanehfts3_tokenizer.lo:	$(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR)
117818607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c
117918607058Sshaneh
118018607058Sshanehfts3_tokenizer1.lo:	$(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR)
118118607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c
118218607058Sshaneh
1183cf5db44aSdanfts3_tokenize_vtab.lo:	$(TOP)/ext/fts3/fts3_tokenize_vtab.c $(HDR) $(EXTHDR)
1184cf5db44aSdan	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenize_vtab.c
1185d7a959c6Sdan
11864b8213d9Sdanfts3_unicode.lo:	$(TOP)/ext/fts3/fts3_unicode.c $(HDR) $(EXTHDR)
11874b8213d9Sdan	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_unicode.c
11884b8213d9Sdan
11894b8213d9Sdanfts3_unicode2.lo:	$(TOP)/ext/fts3/fts3_unicode2.c $(HDR) $(EXTHDR)
11904b8213d9Sdan	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_unicode2.c
11914b8213d9Sdan
119218607058Sshanehfts3_write.lo:	$(TOP)/ext/fts3/fts3_write.c $(HDR) $(EXTHDR)
119318607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_write.c
119418607058Sshaneh
119518607058Sshanehrtree.lo:	$(TOP)/ext/rtree/rtree.c $(HDR) $(EXTHDR)
119618607058Sshaneh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/rtree/rtree.c
119718607058Sshaneh
119837f6ffb8Sdrhuserauth.lo:	$(TOP)/ext/userauth/userauth.c $(HDR) $(EXTHDR)
119949f6a0d8Sdan	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/userauth/userauth.c
120049f6a0d8Sdan
120137f6ffb8Sdrhsqlite3session.lo:	$(TOP)/ext/session/sqlite3session.c $(HDR) $(EXTHDR)
1202498dcae0Sdrh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/session/sqlite3session.c
1203498dcae0Sdrh
1204c6603af7Sdrhstmt.lo:	$(TOP)/ext/misc/stmt.c
1205c6603af7Sdrh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/misc/stmt.c
1206f00f530bSdrh
12073e65f89eSdan# FTS5 things
12083e65f89eSdan#
12093e65f89eSdanFTS5_SRC = \
12103e65f89eSdan   $(TOP)/ext/fts5/fts5.h \
12113e65f89eSdan   $(TOP)/ext/fts5/fts5Int.h \
12123e65f89eSdan   $(TOP)/ext/fts5/fts5_aux.c \
12133e65f89eSdan   $(TOP)/ext/fts5/fts5_buffer.c \
12143e65f89eSdan   $(TOP)/ext/fts5/fts5_main.c \
12153e65f89eSdan   $(TOP)/ext/fts5/fts5_config.c \
12163e65f89eSdan   $(TOP)/ext/fts5/fts5_expr.c \
12173e65f89eSdan   $(TOP)/ext/fts5/fts5_hash.c \
12183e65f89eSdan   $(TOP)/ext/fts5/fts5_index.c \
12193e65f89eSdan   fts5parse.c fts5parse.h \
12203e65f89eSdan   $(TOP)/ext/fts5/fts5_storage.c \
12213e65f89eSdan   $(TOP)/ext/fts5/fts5_tokenize.c \
12223e65f89eSdan   $(TOP)/ext/fts5/fts5_unicode2.c \
12233e65f89eSdan   $(TOP)/ext/fts5/fts5_varint.c \
12243e65f89eSdan   $(TOP)/ext/fts5/fts5_vocab.c  \
12253e65f89eSdan
1226fa532847Sdrhfts5parse.c:	$(TOP)/ext/fts5/fts5parse.y lemon$(BEXE)
122708e7199fSdan	cp $(TOP)/ext/fts5/fts5parse.y .
122808e7199fSdan	rm -f fts5parse.h
1229fe03dac2Sdrh	./lemon$(BEXE) $(OPTS) -S fts5parse.y
123008e7199fSdan
123108e7199fSdanfts5parse.h: fts5parse.c
123208e7199fSdan
12333e65f89eSdanfts5.c: $(FTS5_SRC)
12343e65f89eSdan	$(TCLSH_CMD) $(TOP)/ext/fts5/tool/mkfts5c.tcl
1235a153bbc4Sdan	cp $(TOP)/ext/fts5/fts5.h .
12363e65f89eSdan
12373e65f89eSdanfts5.lo:	fts5.c $(HDR) $(EXTHDR)
12383e65f89eSdan	$(LTCOMPILE) -DSQLITE_CORE -c fts5.c
12393e65f89eSdan
12407647377fSdrhsqlite3rbu.lo:	$(TOP)/ext/rbu/sqlite3rbu.c $(HDR) $(EXTHDR)
12417647377fSdrh	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/rbu/sqlite3rbu.c
12427647377fSdrh
124318607058Sshaneh
124418607058Sshaneh# Rules to build the 'testfixture' application.
124518607058Sshaneh#
124618607058Sshaneh# If using the amalgamation, use sqlite3.c directly to build the test
124718607058Sshaneh# fixture.  Otherwise link against libsqlite3.la.  (This distinction is
124818607058Sshaneh# necessary because the test fixture requires non-API symbols which are
124918607058Sshaneh# hidden when the library is built via the amalgamation).
125018607058Sshaneh#
125196a206faSdrhTESTFIXTURE_FLAGS  = -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
125296a206faSdrhTESTFIXTURE_FLAGS += -DTCLSH_INIT_PROC=sqlite3TestInit
125318607058SshanehTESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
12540bab6c3eSdrhTESTFIXTURE_FLAGS += -DBUILD_sqlite
1255dbc49161SdrhTESTFIXTURE_FLAGS += -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
12569878fefdSdrhTESTFIXTURE_FLAGS += -DSQLITE_DEFAULT_PAGE_SIZE=1024
1257c6603af7SdrhTESTFIXTURE_FLAGS += -DSQLITE_ENABLE_STMTVTAB
12581df6470dSdrhTESTFIXTURE_FLAGS += -DSQLITE_ENABLE_DBPAGE_VTAB
1259691b5c54SdrhTESTFIXTURE_FLAGS += -DSQLITE_ENABLE_BYTECODE_VTAB
1260c30b78f6SdanTESTFIXTURE_FLAGS += -DSQLITE_CKSUMVFS_STATIC
126118607058Sshaneh
126218607058SshanehTESTFIXTURE_SRC0 = $(TESTSRC2) libsqlite3.la
126318607058SshanehTESTFIXTURE_SRC1 = sqlite3.c
1264e191e2c6SdrhTESTFIXTURE_SRC = $(TESTSRC) $(TOP)/src/tclsqlite.c
1265e191e2c6SdrhTESTFIXTURE_SRC += $(TESTFIXTURE_SRC$(USE_AMALGAMATION))
126618607058Sshaneh
1267969b2cd7Smlcreechtestfixture$(TEXE):	$(TESTFIXTURE_SRC)
126818607058Sshaneh	$(LTLINK) -DSQLITE_NO_SYNC=1 $(TEMP_STORE) $(TESTFIXTURE_FLAGS) \
1269866108f8Sdrh		-o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS)
1270d1bf3512Sdrh
12718bee11a4Smistachkincoretestprogs:	$(TESTPROGS)
12728bee11a4Smistachkin
12738bee11a4Smistachkintestprogs:	coretestprogs srcck1$(BEXE) fuzzcheck$(TEXE) sessionfuzz$(TEXE)
12748bee11a4Smistachkin
12755bfff9d2Sdrh# A very detailed test running most or all test cases
1276867bc4deSdanfulltest:	alltest fuzztest
1277867bc4deSdan
1278867bc4deSdan# Run most or all tcl test cases
1279867bc4deSdanalltest:	$(TESTPROGS)
1280905da63aSdrh	./testfixture$(TEXE) $(TOP)/test/all.test $(TESTOPTS)
1281348784efSdrh
12825bfff9d2Sdrh# Really really long testing
1283ea93c700Sdrhsoaktest:	$(TESTPROGS)
1284905da63aSdrh	./testfixture$(TEXE) $(TOP)/test/all.test -soak=1 $(TESTOPTS)
128518607058Sshaneh
1286d4ab1034Smistachkin# Do extra testing but not everything.
1287a523e31aSdrhfulltestonly:	$(TESTPROGS) fuzztest
1288c60941f8Smistachkin	./testfixture$(TEXE) $(TOP)/test/full.test
1289c60941f8Smistachkin
1290e1a71a58Sdrh# Fuzz testing
1291f94c1902Sdrhfuzztest:	fuzzcheck$(TEXE) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuzz-data1.db
1292ea93c700Sdrh	./fuzzcheck$(TEXE) $(FUZZDATA)
1293f94c1902Sdrh	./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db
1294f332071bSdrh
1295f94c1902Sdrhvalgrindfuzz:	fuzzcheck$(TEXT) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuzz-data1.db
12960bff34aeSdan	valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M $(FUZZDATA)
1297f94c1902Sdrh	valgrind ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db
1298d1f2f9b9Sdrh
1299c06e5434Sdrh# The veryquick.test TCL tests.
1300c06e5434Sdrh#
1301c06e5434Sdrhtcltest:	./testfixture$(TEXE)
1302c06e5434Sdrh	./testfixture$(TEXE) $(TOP)/test/veryquick.test $(TESTOPTS)
1303362b66f0Sdrh
13042a7b27f1Sdrh# Runs all the same tests cases as the "tcltest" target but uses
13052a7b27f1Sdrh# the testrunner.tcl script to run them in multiple cores
13062a7b27f1Sdrh# concurrently.
13072a7b27f1Sdrhtestrunner:	testfixture$(TEXE)
13082a7b27f1Sdrh	./testfixture$(TEXE) $(TOP)/test/testrunner.tcl
13092a7b27f1Sdrh
1310905da63aSdrh# Minimal testing that runs in less than 3 minutes
1311905da63aSdrh#
1312905da63aSdrhquicktest:	./testfixture$(TEXE)
1313905da63aSdrh	./testfixture$(TEXE) $(TOP)/test/extraquick.test $(TESTOPTS)
1314905da63aSdrh
1315905da63aSdrh# This is the common case.  Run many tests that do not take too long,
1316905da63aSdrh# including fuzzcheck, sqlite3_analyzer, and sqldiff tests.
13175bfff9d2Sdrh#
1318c0efa4d3Sdrhtest:	fuzztest sourcetest $(TESTPROGS) tcltest
1319b19a2bc6Sdrh
13205bfff9d2Sdrh# Run a test using valgrind.  This can take a really long time
13215bfff9d2Sdrh# because valgrind is so much slower than a native machine.
13225bfff9d2Sdrh#
1323d1f2f9b9Sdrhvalgrindtest:	$(TESTPROGS) valgrindfuzz
1324905da63aSdrh	OMIT_MISUSE=1 valgrind -v ./testfixture$(TEXE) $(TOP)/test/permutations.test valgrind $(TESTOPTS)
13258a2a0f56Sdrh
13265bfff9d2Sdrh# A very fast test that checks basic sanity.  The name comes from
13275bfff9d2Sdrh# the 60s-era electronics testing:  "Turn it on and see if smoke
13285bfff9d2Sdrh# comes out."
13295bfff9d2Sdrh#
1330ea93c700Sdrhsmoketest:	$(TESTPROGS) fuzzcheck$(TEXE)
1331905da63aSdrh	./testfixture$(TEXE) $(TOP)/test/main.test $(TESTOPTS)
13325bfff9d2Sdrh
13339776784fSdrhshelltest: $(TESTPROGS)
13349776784fSdrh	./testfixture$(TEXT) $(TOP)/test/permutations.test shell
13359776784fSdrh
1336903b2302Sdrhsqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in
1337903b2302Sdrh	$(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c
1338305cea69Sdrh
13398d43aa10Sdrhsqlite3_analyzer$(TEXE): sqlite3_analyzer.c
1340c42cdce5Sdrh	$(LTLINK) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS)
1341cefc92b8Sdrh
1342dd2a43a2Sdrhsqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in
1343dd2a43a2Sdrh	$(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in >sqltclsh.c
1344dd2a43a2Sdrh
1345dd2a43a2Sdrhsqltclsh$(TEXE): sqltclsh.c
1346dd2a43a2Sdrh	$(LTLINK) sqltclsh.c -o $@ $(LIBTCL) $(TLIBS)
1347dd2a43a2Sdrh
1348138bd6dfSdrhsqlite3_expert$(TEXE): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c
1349138bd6dfSdrh	$(LTLINK)	$(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c -o sqlite3_expert $(TLIBS)
1350138bd6dfSdrh
13512737fa03SdrhCHECKER_DEPS =\
13522737fa03Sdrh  $(TOP)/tool/mkccode.tcl \
13532737fa03Sdrh  sqlite3.c \
13542737fa03Sdrh  $(TOP)/src/tclsqlite.c \
13552737fa03Sdrh  $(TOP)/ext/repair/sqlite3_checker.tcl \
13562737fa03Sdrh  $(TOP)/ext/repair/checkindex.c \
1357927dd51fSdrh  $(TOP)/ext/repair/checkfreelist.c \
13582737fa03Sdrh  $(TOP)/ext/misc/btreeinfo.c \
13592737fa03Sdrh  $(TOP)/ext/repair/sqlite3_checker.c.in
13602737fa03Sdrh
13612737fa03Sdrhsqlite3_checker.c:	$(CHECKER_DEPS)
13622737fa03Sdrh	$(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/ext/repair/sqlite3_checker.c.in >$@
13632737fa03Sdrh
13642737fa03Sdrhsqlite3_checker$(TEXE):	sqlite3_checker.c
13652737fa03Sdrh	$(LTLINK) sqlite3_checker.c -o $@ $(LIBTCL) $(TLIBS)
13662737fa03Sdrh
1367688633cbSdrhdbdump$(TEXE): $(TOP)/ext/misc/dbdump.c sqlite3.lo
1368688633cbSdrh	$(LTLINK) -DDBDUMP_STANDALONE -o $@ \
1369688633cbSdrh           $(TOP)/ext/misc/dbdump.c sqlite3.lo $(TLIBS)
1370688633cbSdrh
137133746485Sdrhdbtotxt$(TEXE): $(TOP)/tool/dbtotxt.c
137233746485Sdrh	$(LTLINK)-o $@ $(TOP)/tool/dbtotxt.c
137333746485Sdrh
13744bb77ecaSdrhshowdb$(TEXE):	$(TOP)/tool/showdb.c sqlite3.lo
13754bb77ecaSdrh	$(LTLINK) -o $@ $(TOP)/tool/showdb.c sqlite3.lo $(TLIBS)
13764bb77ecaSdrh
13774bb77ecaSdrhshowstat4$(TEXE):	$(TOP)/tool/showstat4.c sqlite3.lo
13784bb77ecaSdrh	$(LTLINK) -o $@ $(TOP)/tool/showstat4.c sqlite3.lo $(TLIBS)
13794bb77ecaSdrh
13804bb77ecaSdrhshowjournal$(TEXE):	$(TOP)/tool/showjournal.c sqlite3.lo
13814bb77ecaSdrh	$(LTLINK) -o $@ $(TOP)/tool/showjournal.c sqlite3.lo $(TLIBS)
13824bb77ecaSdrh
13834bb77ecaSdrhshowwal$(TEXE):	$(TOP)/tool/showwal.c sqlite3.lo
13844bb77ecaSdrh	$(LTLINK) -o $@ $(TOP)/tool/showwal.c sqlite3.lo $(TLIBS)
13854bb77ecaSdrh
1386666fb691Sdrhshowshm$(TEXE):	$(TOP)/tool/showshm.c
1387666fb691Sdrh	$(LTLINK) -o $@ $(TOP)/tool/showshm.c
1388666fb691Sdrh
1389731dd6ebSdrhindex_usage$(TEXE): $(TOP)/tool/index_usage.c sqlite3.lo
13905a9c6bccSdrh	$(LTLINK) $(SHELL_OPT) -o $@ $(TOP)/tool/index_usage.c sqlite3.lo $(TLIBS)
1391731dd6ebSdrh
13929f674f26Sdrhchangeset$(TEXE):	$(TOP)/ext/session/changeset.c sqlite3.lo
13939f674f26Sdrh	$(LTLINK) -o $@ $(TOP)/ext/session/changeset.c sqlite3.lo $(TLIBS)
13949f674f26Sdrh
1395f095a1afSdanchangesetfuzz$(TEXE):	$(TOP)/ext/session/changesetfuzz.c sqlite3.lo
1396f095a1afSdan	$(LTLINK) -o $@ $(TOP)/ext/session/changesetfuzz.c sqlite3.lo $(TLIBS)
1397f095a1afSdan
13984bb77ecaSdrhrollback-test$(TEXE):	$(TOP)/tool/rollback-test.c sqlite3.lo
13994bb77ecaSdrh	$(LTLINK) -o $@ $(TOP)/tool/rollback-test.c sqlite3.lo $(TLIBS)
14009ac3c1eaSdrh
1401355f2e02Sdrhatrc$(TEXX): $(TOP)/test/atrc.c sqlite3.lo
1402355f2e02Sdrh	$(LTLINK) -o $@ $(TOP)/test/atrc.c sqlite3.lo $(TLIBS)
1403355f2e02Sdrh
1404267a13fdSdrhLogEst$(TEXE):	$(TOP)/tool/logest.c sqlite3.h
1405267a13fdSdrh	$(LTLINK) -I. -o $@ $(TOP)/tool/logest.c
14069ac3c1eaSdrh
1407be11ade7Sdrhwordcount$(TEXE):	$(TOP)/test/wordcount.c sqlite3.lo
1408be11ade7Sdrh	$(LTLINK) -o $@ $(TOP)/test/wordcount.c sqlite3.lo $(TLIBS)
14099ac3c1eaSdrh
1410d6555726Sstephanspeedtest1$(TEXE):	$(TOP)/test/speedtest1.c sqlite3.c Makefile
1411d1b2566bSdrh	$(LTLINK) $(ST_OPT) -o $@ $(TOP)/test/speedtest1.c sqlite3.c $(TLIBS)
1412d1b2566bSdrh
141333e1ec22Sdrhstartup$(TEXE):	$(TOP)/test/startup.c sqlite3.c
1414266f0f45Sdrh	$(CC) -Os -g -DSQLITE_THREADSAFE=0 -o $@ $(TOP)/test/startup.c sqlite3.c $(TLIBS)
141533e1ec22Sdrh
1416d1b2566bSdrhKV_OPT += -DSQLITE_DIRECT_OVERFLOW_READ
1417d1b2566bSdrh
1418d1b2566bSdrhkvtest$(TEXE):	$(TOP)/test/kvtest.c sqlite3.c
1419d1b2566bSdrh	$(LTLINK) $(KV_OPT) -o $@ $(TOP)/test/kvtest.c sqlite3.c $(TLIBS)
1420ad1ca9a7Sdrh
14217647377fSdrhrbu$(EXE): $(TOP)/ext/rbu/rbu.c $(TOP)/ext/rbu/sqlite3rbu.c sqlite3.lo
14227647377fSdrh	$(LTLINK) -I. -o $@ $(TOP)/ext/rbu/rbu.c sqlite3.lo $(TLIBS)
14237647377fSdrh
14247647377fSdrhloadfts$(EXE): $(TOP)/tool/loadfts.c libsqlite3.la
14257647377fSdrh	$(LTLINK) $(TOP)/tool/loadfts.c libsqlite3.la -o $@ $(TLIBS)
14267647377fSdrh
142700fa334aSdrh# This target will fail if the SQLite amalgamation contains any exported
142800fa334aSdrh# symbols that do not begin with "sqlite3_". It is run as part of the
142900fa334aSdrh# releasetest.tcl script.
143000fa334aSdrh#
1431b283a0cdSdrhVALIDIDS=' sqlite3(changeset|changegroup|session)?_'
1432579d41dcSdanchecksymbols: sqlite3.o
1433579d41dcSdan	nm -g --defined-only sqlite3.o
1434579d41dcSdan	nm -g --defined-only sqlite3.o | egrep -v $(VALIDIDS); test $$? -ne 0
1435277b4e44Sdrh	echo '0 errors out of 1 tests'
143600fa334aSdrh
143707f76568Sdrh# Build the amalgamation-autoconf package.  The amalamgation-tarball target builds
143807f76568Sdrh# a tarball named for the version number.  Ex:  sqlite-autoconf-3110000.tar.gz.
143907f76568Sdrh# The snapshot-tarball target builds a tarball named by the SHA1 hash
1440b43be55eSdrh#
14417cff0e34Smistachkinamalgamation-tarball: sqlite3.c sqlite3rc.h
144207f76568Sdrh	TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh --normal
144307f76568Sdrh
14447cff0e34Smistachkinsnapshot-tarball: sqlite3.c sqlite3rc.h
144507f76568Sdrh	TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh --snapshot
1446b43be55eSdrh
1447069b8f2cSdrh# The next two rules are used to support the "threadtest" target. Building
1448069b8f2cSdrh# threadtest runs a few thread-safety tests that are implemented in C. This
1449069b8f2cSdrh# target is invoked by the releasetest.tcl script.
1450069b8f2cSdrh#
1451069b8f2cSdrhTHREADTEST3_SRC = $(TOP)/test/threadtest3.c    \
1452069b8f2cSdrh                  $(TOP)/test/tt3_checkpoint.c \
1453069b8f2cSdrh                  $(TOP)/test/tt3_index.c      \
1454069b8f2cSdrh                  $(TOP)/test/tt3_vacuum.c      \
1455069b8f2cSdrh                  $(TOP)/test/tt3_stress.c      \
1456069b8f2cSdrh                  $(TOP)/test/tt3_lookaside1.c
1457069b8f2cSdrh
14584d03a381Smistachkinthreadtest3$(TEXE): sqlite3.lo $(THREADTEST3_SRC)
14595fcc1ba4Sdan	$(LTLINK) $(TOP)/test/threadtest3.c $(TOP)/src/test_multiplex.c sqlite3.lo -o $@ $(TLIBS)
1460069b8f2cSdrh
1461069b8f2cSdrhthreadtest: threadtest3$(TEXE)
1462069b8f2cSdrh	./threadtest3$(TEXE)
1463069b8f2cSdrh
146485ffcae1Sdrhthreadtest5: sqlite3.c $(TOP)/test/threadtest5.c
146585ffcae1Sdrh	$(LTLINK) $(TOP)/test/threadtest5.c sqlite3.c -o $@ $(TLIBS)
146685ffcae1Sdrh
1467a7c432c2Sdrhreleasetest:
1468a7c432c2Sdrh	$(TCLSH_CMD) $(TOP)/test/releasetest.tcl
1469a7c432c2Sdrh
147018607058Sshaneh# Standard install and cleanup targets
147118607058Sshaneh#
1472afea9748Svapierlib_install:	libsqlite3.la
14738d45ec07Sdrh	$(INSTALL) -d $(DESTDIR)$(libdir)
14748d45ec07Sdrh	$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
1475afea9748Svapier
1476153d3e91Smistachkininstall:	sqlite3$(TEXE) lib_install sqlite3.h sqlite3.pc ${HAVE_TCL:1=tcl_install}
1477c55771f3Smlcreech	$(INSTALL) -d $(DESTDIR)$(bindir)
1478153d3e91Smistachkin	$(LTINSTALL) sqlite3$(TEXE) $(DESTDIR)$(bindir)
1479c55771f3Smlcreech	$(INSTALL) -d $(DESTDIR)$(includedir)
1480c55771f3Smlcreech	$(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(includedir)
1481c55771f3Smlcreech	$(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(includedir)
148294bdf894Sdanielk1977	$(INSTALL) -d $(DESTDIR)$(pkgconfigdir)
148394bdf894Sdanielk1977	$(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(pkgconfigdir)
148464bde80aSdrh
14856d120f39SvapierpkgIndex.tcl:
14869ebe59d6Sdrh	echo 'package ifneeded sqlite3 $(RELEASE) [list load [file join $$dir libtclsqlite3[info sharedlibextension]] sqlite3]' > $@
1487afea9748Svapiertcl_install:	lib_install libtclsqlite3.la pkgIndex.tcl
14886d120f39Svapier	$(INSTALL) -d $(DESTDIR)$(TCLLIBDIR)
14896d120f39Svapier	$(LTINSTALL) libtclsqlite3.la $(DESTDIR)$(TCLLIBDIR)
14906d120f39Svapier	rm -f $(DESTDIR)$(TCLLIBDIR)/libtclsqlite3.la $(DESTDIR)$(TCLLIBDIR)/libtclsqlite3.a
14916d120f39Svapier	$(INSTALL) -m 0644 pkgIndex.tcl $(DESTDIR)$(TCLLIBDIR)
14924b2266aeSdrh
149375897234Sdrhclean:
14947b5717e1Sdrh	rm -f *.lo *.la *.o sqlite3$(TEXE) libsqlite3.la
1495829512baSdrh	rm -f sqlite3.h opcodes.*
149618607058Sshaneh	rm -rf .libs .deps
149752fb6d71Sdrh	rm -f lemon$(BEXE) lempar.c parse.* sqlite*.tar.gz
149873b211abSdrh	rm -f mkkeywordhash$(BEXE) keywordhash.h
1499f7415736Sstephan	rm -f mksourceid$(BEXE)
15008be51133Sdrh	rm -f *.da *.bb *.bbg gmon.out
150118607058Sshaneh	rm -rf tsrc .target_source
15029a55e31fSmistachkin	rm -f tclsqlite3$(TEXE)
15037b5717e1Sdrh	rm -f testfixture$(TEXE) test.db
15043a046c6cSmistachkin	rm -f LogEst$(TEXE) fts3view$(TEXE) rollback-test$(TEXE) showdb$(TEXE)
15053a046c6cSmistachkin	rm -f showjournal$(TEXE) showstat4$(TEXE) showwal$(TEXE) speedtest1$(TEXE)
15069f674f26Sdrh	rm -f wordcount$(TEXE) changeset$(TEXE)
15079a55e31fSmistachkin	rm -f sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def
150818607058Sshaneh	rm -f sqlite3.c
1509fde3b1c7Smistachkin	rm -f sqlite3rc.h
1510fde3b1c7Smistachkin	rm -f shell.c sqlite3ext.h
15119a55e31fSmistachkin	rm -f sqlite3_analyzer$(TEXE) sqlite3_analyzer.c
151229b75bd0Smistachkin	rm -f sqlite-*-output.vsix
151321c9b6bdSmistachkin	rm -f mptester mptester.exe
1514b5a5a23eSmistachkin	rm -f rbu rbu.exe
151527b6997eSmistachkin	rm -f srcck1 srcck1.exe
1516d4ab1034Smistachkin	rm -f fuzzershell fuzzershell.exe
15177a94e6b0Smistachkin	rm -f fuzzcheck fuzzcheck.exe
1518d4ab1034Smistachkin	rm -f sqldiff sqldiff.exe
1519290fcaa2Sdrh	rm -f dbhash dbhash.exe
1520bc50bb7fSmistachkin	rm -f fts5.* fts5parse.*
152185ffcae1Sdrh	rm -f threadtest5
15226194a5fbSdougcurrie
152374e24cd0Sdrhdistclean:	clean
1524a4b2f419Sdrh	rm -f sqlite_cfg.h config.log config.status libtool Makefile sqlite3.pc \
1525f7415736Sstephan		$(TESTPROGS)
152679dc6691Sdrh
152779dc6691Sdrh#
152879dc6691Sdrh# Windows section
152979dc6691Sdrh#
153079dc6691Sdrhdll: sqlite3.dll
153179dc6691Sdrh
153279dc6691SdrhREAL_LIBOBJ = $(LIBOBJ:%.lo=.libs/%.o)
153379dc6691Sdrh
153479dc6691Sdrh$(REAL_LIBOBJ): $(LIBOBJ)
153579dc6691Sdrh
153679dc6691Sdrhsqlite3.def: $(REAL_LIBOBJ)
153779dc6691Sdrh	echo 'EXPORTS' >sqlite3.def
153879dc6691Sdrh	nm $(REAL_LIBOBJ) | grep ' T ' | grep ' _sqlite3_' \
153979dc6691Sdrh		| sed 's/^.* _//' >>sqlite3.def
154079dc6691Sdrh
154179dc6691Sdrhsqlite3.dll: $(REAL_LIBOBJ) sqlite3.def
15421428b374Smlcreech	$(TCC) -shared -o $@ sqlite3.def \
154379dc6691Sdrh		-Wl,"--strip-all" $(REAL_LIBOBJ)
1544f8cd3d2bSstephan
1545f8cd3d2bSstephan#
15464bc2f6b4Sstephan# Fiddle app
1547f8cd3d2bSstephan#
15484bc2f6b4Sstephanfiddle: sqlite3.c shell.c
15494831f4e0Sstephan	make -C ext/wasm fiddle emcc_opt=-Os
1550