xref: /sqlite-3.40.0/Makefile.msc (revision eb48b062)
1#
2# nmake Makefile for SQLite
3#
4###############################################################################
5############################## START OF OPTIONS ###############################
6###############################################################################
7
8# The toplevel directory of the source tree.  This is the directory
9# that contains this "Makefile.msc".
10#
11TOP = .
12
13# Set this non-0 to create and use the SQLite amalgamation file.
14#
15!IFNDEF USE_AMALGAMATION
16USE_AMALGAMATION = 1
17!ENDIF
18
19# Set this non-0 to enable full warnings (-W4, etc) when compiling.
20#
21!IFNDEF USE_FULLWARN
22USE_FULLWARN = 0
23!ENDIF
24
25# Set this non-0 to use "stdcall" calling convention for the core library
26# and shell executable.
27#
28!IFNDEF USE_STDCALL
29USE_STDCALL = 0
30!ENDIF
31
32# Set this non-0 to have the shell executable link against the core dynamic
33# link library.
34#
35!IFNDEF DYNAMIC_SHELL
36DYNAMIC_SHELL = 0
37!ENDIF
38
39# If necessary, create a list of harmless compiler warnings to disable when
40# compiling the various tools.  For the SQLite source code itself, warnings,
41# if any, will be disabled from within it.
42#
43!IFNDEF NO_WARN
44!IF $(USE_FULLWARN)!=0
45NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4152 -wd4189 -wd4206 -wd4210
46NO_WARN = $(NO_WARN) -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
47!ENDIF
48!ENDIF
49
50# Set this non-0 to use the library paths and other options necessary for
51# Windows Phone 8.1.
52#
53!IFNDEF USE_WP81_OPTS
54USE_WP81_OPTS = 0
55!ENDIF
56
57# Set this non-0 to split the SQLite amalgamation file into chunks to
58# be used for debugging with Visual Studio.
59#
60!IFNDEF SPLIT_AMALGAMATION
61SPLIT_AMALGAMATION = 0
62!ENDIF
63
64# Set this non-0 to use the International Components for Unicode (ICU).
65#
66!IFNDEF USE_ICU
67USE_ICU = 0
68!ENDIF
69
70# Set this non-0 to dynamically link to the MSVC runtime library.
71#
72!IFNDEF USE_CRT_DLL
73USE_CRT_DLL = 0
74!ENDIF
75
76# Set this non-0 to link to the RPCRT4 library.
77#
78!IFNDEF USE_RPCRT4_LIB
79USE_RPCRT4_LIB = 0
80!ENDIF
81
82# Set this non-0 to generate assembly code listings for the source code
83# files.
84#
85!IFNDEF USE_LISTINGS
86USE_LISTINGS = 0
87!ENDIF
88
89# Set this non-0 to attempt setting the native compiler automatically
90# for cross-compiling the command line tools needed during the compilation
91# process.
92#
93!IFNDEF XCOMPILE
94XCOMPILE = 0
95!ENDIF
96
97# Set this non-0 to use the native libraries paths for cross-compiling
98# the command line tools needed during the compilation process.
99#
100!IFNDEF USE_NATIVE_LIBPATHS
101USE_NATIVE_LIBPATHS = 0
102!ENDIF
103
104# Set this 0 to skip the compiling and embedding of version resources.
105#
106!IFNDEF USE_RC
107USE_RC = 1
108!ENDIF
109
110# Set this non-0 to compile binaries suitable for the WinRT environment.
111# This setting does not apply to any binaries that require Tcl to operate
112# properly (i.e. the text fixture, etc).
113#
114!IFNDEF FOR_WINRT
115FOR_WINRT = 0
116!ENDIF
117
118# Set this non-0 to skip attempting to look for and/or link with the Tcl
119# runtime library.
120#
121!IFNDEF NO_TCL
122NO_TCL = 0
123!ENDIF
124
125# Set this to non-0 to create and use PDBs.
126#
127!IFNDEF SYMBOLS
128SYMBOLS = 1
129!ENDIF
130
131# Set this to non-0 to use the SQLite debugging heap subsystem.
132#
133!IFNDEF MEMDEBUG
134MEMDEBUG = 0
135!ENDIF
136
137# Set this to non-0 to use the Win32 native heap subsystem.
138#
139!IFNDEF WIN32HEAP
140WIN32HEAP = 0
141!ENDIF
142
143# Set this to one of the following values to enable various debugging
144# features.  Each level includes the debugging options from the previous
145# levels.  Currently, the recognized values for DEBUG are:
146#
147# 0 == NDEBUG: Disables assert() and other runtime diagnostics.
148# 1 == SQLITE_ENABLE_API_ARMOR: extra attempts to detect misuse of the API.
149# 2 == Disables NDEBUG and all optimizations and then enables PDBs.
150# 3 == SQLITE_DEBUG: Enables various diagnostics messages and code.
151# 4 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call.
152# 5 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros.
153# 6 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros.
154#
155!IFNDEF DEBUG
156DEBUG = 0
157!ENDIF
158
159# Enable use of available compiler optimizations?  Normally, this should be
160# non-zero.  Setting this to zero, thus disabling all compiler optimizations,
161# can be useful for testing.
162#
163!IFNDEF OPTIMIZATIONS
164OPTIMIZATIONS = 2
165!ENDIF
166
167# These are the "standard" SQLite compilation options used when compiling for
168# the Windows platform.
169#
170!IFNDEF OPT_FEATURE_FLAGS
171OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
172OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
173OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
174!ENDIF
175
176###############################################################################
177############################### END OF OPTIONS ################################
178###############################################################################
179
180# This assumes that MSVC is always installed in 32-bit Program Files directory
181# and sets the variable for use in locating other 32-bit installs accordingly.
182#
183PROGRAMFILES_X86 = $(VCINSTALLDIR)\..\..
184PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)
185
186# Check for the predefined command macro CC.  This should point to the compiler
187# binary for the target platform.  If it is not defined, simply define it to
188# the legacy default value 'cl.exe'.
189#
190!IFNDEF CC
191CC = cl.exe
192!ENDIF
193
194# Check for the command macro LD.  This should point to the linker binary for
195# the target platform.  If it is not defined, simply define it to the legacy
196# default value 'link.exe'.
197#
198!IFNDEF LD
199LD = link.exe
200!ENDIF
201
202# Check for the predefined command macro RC.  This should point to the resource
203# compiler binary for the target platform.  If it is not defined, simply define
204# it to the legacy default value 'rc.exe'.
205#
206!IFNDEF RC
207RC = rc.exe
208!ENDIF
209
210# Check for the MSVC runtime library path macro.  Othertise, this value will
211# default to the 'lib' directory underneath the MSVC installation directory.
212#
213!IFNDEF CRTLIBPATH
214CRTLIBPATH = $(VCINSTALLDIR)\lib
215!ENDIF
216
217CRTLIBPATH = $(CRTLIBPATH:\\=\)
218
219# Check for the command macro NCC.  This should point to the compiler binary
220# for the platform the compilation process is taking place on.  If it is not
221# defined, simply define it to have the same value as the CC macro.  When
222# cross-compiling, it is suggested that this macro be modified via the command
223# line (since nmake itself does not provide a built-in method to guess it).
224# For example, to use the x86 compiler when cross-compiling for x64, a command
225# line similar to the following could be used (all on one line):
226#
227#     nmake /f Makefile.msc sqlite3.dll
228#           XCOMPILE=1 USE_NATIVE_LIBPATHS=1
229#
230# Alternatively, the full path and file name to the compiler binary for the
231# platform the compilation process is taking place may be specified (all on
232# one line):
233#
234#     nmake /f Makefile.msc sqlite3.dll
235#           "NCC=""%VCINSTALLDIR%\bin\cl.exe"""
236#           USE_NATIVE_LIBPATHS=1
237#
238!IFDEF NCC
239NCC = $(NCC:\\=\)
240!ELSEIF $(XCOMPILE)!=0
241NCC = "$(VCINSTALLDIR)\bin\$(CC)"
242NCC = $(NCC:\\=\)
243!ELSE
244NCC = $(CC)
245!ENDIF
246
247# Check for the MSVC native runtime library path macro.  Othertise,
248# this value will default to the 'lib' directory underneath the MSVC
249# installation directory.
250#
251!IFNDEF NCRTLIBPATH
252NCRTLIBPATH = $(VCINSTALLDIR)\lib
253!ENDIF
254
255NCRTLIBPATH = $(NCRTLIBPATH:\\=\)
256
257# Check for the Platform SDK library path macro.  Othertise, this
258# value will default to the 'lib' directory underneath the Windows
259# SDK installation directory (the environment variable used appears
260# to be available when using Visual C++ 2008 or later via the
261# command line).
262#
263!IFNDEF NSDKLIBPATH
264NSDKLIBPATH = $(WINDOWSSDKDIR)\lib
265!ENDIF
266
267NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
268
269# C compiler and options for use in building executables that
270# will run on the platform that is doing the build.
271#
272!IF $(USE_FULLWARN)!=0
273BCC = $(NCC) -nologo -W4
274!ELSE
275BCC = $(NCC) -nologo -W3
276!ENDIF
277
278# Check if assembly code listings should be generated for the source
279# code files to be compiled.
280#
281!IF $(USE_LISTINGS)!=0
282BCC = $(BCC) -FAcs
283!ENDIF
284
285# Check if the native library paths should be used when compiling
286# the command line tools used during the compilation process.  If
287# so, set the necessary macro now.
288#
289!IF $(USE_NATIVE_LIBPATHS)!=0
290NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
291!ENDIF
292
293# C compiler and options for use in building executables that
294# will run on the target platform.  (BCC and TCC are usually the
295# same unless your are cross-compiling.)
296#
297!IF $(USE_FULLWARN)!=0
298TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1
299!ELSE
300TCC = $(CC) -nologo -W3
301!ENDIF
302
303TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise
304RCC = $(RC) -DSQLITE_OS_WIN=1 -I$(TOP) -I$(TOP)\src
305
306# Check if we want to use the "stdcall" calling convention when compiling.
307# This is not supported by the compilers for non-x86 platforms.  It should
308# also be noted here that building any target with these "stdcall" options
309# will most likely fail if the Tcl library is also required.  This is due
310# to how the Tcl library functions are declared and exported (i.e. without
311# an explicit calling convention, which results in "cdecl").
312#
313!IF $(USE_STDCALL)!=0
314!IF "$(PLATFORM)"=="x86"
315CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
316SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
317!ELSE
318!IFNDEF PLATFORM
319CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
320SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
321!ELSE
322CORE_CCONV_OPTS =
323SHELL_CCONV_OPTS =
324!ENDIF
325!ENDIF
326!ELSE
327CORE_CCONV_OPTS =
328SHELL_CCONV_OPTS =
329!ENDIF
330
331# These are additional compiler options used for the core library.
332#
333!IFNDEF CORE_COMPILE_OPTS
334!IF $(DYNAMIC_SHELL)!=0
335CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)
336!ELSE
337CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
338!ENDIF
339!ENDIF
340
341# These are the additional targets that the core library should depend on
342# when linking.
343#
344!IFNDEF CORE_LINK_DEP
345!IF $(DYNAMIC_SHELL)!=0
346CORE_LINK_DEP =
347!ELSE
348CORE_LINK_DEP = sqlite3.def
349!ENDIF
350!ENDIF
351
352# These are additional linker options used for the core library.
353#
354!IFNDEF CORE_LINK_OPTS
355!IF $(DYNAMIC_SHELL)!=0
356CORE_LINK_OPTS =
357!ELSE
358CORE_LINK_OPTS = /DEF:sqlite3.def
359!ENDIF
360!ENDIF
361
362# These are additional compiler options used for the shell executable.
363#
364!IFNDEF SHELL_COMPILE_OPTS
365!IF $(DYNAMIC_SHELL)!=0
366SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)
367!ELSE
368SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)
369!ENDIF
370!ENDIF
371
372# This is the core library that the shell executable should depend on.
373#
374!IFNDEF SHELL_CORE_DEP
375!IF $(DYNAMIC_SHELL)!=0
376SHELL_CORE_DEP = sqlite3.dll
377!ELSE
378SHELL_CORE_DEP = libsqlite3.lib
379!ENDIF
380!ENDIF
381
382# This is the core library that the shell executable should link with.
383#
384!IFNDEF SHELL_CORE_LIB
385!IF $(DYNAMIC_SHELL)!=0
386SHELL_CORE_LIB = sqlite3.lib
387!ELSE
388SHELL_CORE_LIB = libsqlite3.lib
389!ENDIF
390!ENDIF
391
392# These are additional linker options used for the shell executable.
393#
394!IFNDEF SHELL_LINK_OPTS
395SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
396!ENDIF
397
398# Check if assembly code listings should be generated for the source
399# code files to be compiled.
400#
401!IF $(USE_LISTINGS)!=0
402TCC = $(TCC) -FAcs
403!ENDIF
404
405# When compiling the library for use in the WinRT environment,
406# the following compile-time options must be used as well to
407# disable use of Win32 APIs that are not available and to enable
408# use of Win32 APIs that are specific to Windows 8 and/or WinRT.
409#
410!IF $(FOR_WINRT)!=0
411TCC = $(TCC) -DSQLITE_OS_WINRT=1
412RCC = $(RCC) -DSQLITE_OS_WINRT=1
413TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
414RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
415!ENDIF
416
417# Also, we need to dynamically link to the correct MSVC runtime
418# when compiling for WinRT (e.g. debug or release) OR if the
419# USE_CRT_DLL option is set to force dynamically linking to the
420# MSVC runtime library.
421#
422!IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
423!IF $(DEBUG)>1
424TCC = $(TCC) -MDd
425BCC = $(BCC) -MDd
426!ELSE
427TCC = $(TCC) -MD
428BCC = $(BCC) -MD
429!ENDIF
430!ELSE
431!IF $(DEBUG)>1
432TCC = $(TCC) -MTd
433BCC = $(BCC) -MTd
434!ELSE
435TCC = $(TCC) -MT
436BCC = $(BCC) -MT
437!ENDIF
438!ENDIF
439
440# The mksqlite3c.tcl and mksqlite3h.tcl scripts will pull in
441# any extension header files by default.  For non-amalgamation
442# builds, we need to make sure the compiler can find these.
443#
444!IF $(USE_AMALGAMATION)==0
445TCC = $(TCC) -I$(TOP)\ext\fts3
446RCC = $(RCC) -I$(TOP)\ext\fts3
447TCC = $(TCC) -I$(TOP)\ext\rtree
448RCC = $(RCC) -I$(TOP)\ext\rtree
449!ENDIF
450
451# The mksqlite3c.tcl script accepts some options on the command
452# line.  When compiling with debugging enabled, some of these
453# options are necessary in order to allow debugging symbols to
454# work correctly with Visual Studio when using the amalgamation.
455#
456!IF $(DEBUG)>1
457MKSQLITE3C_ARGS = --linemacros
458!ELSE
459MKSQLITE3C_ARGS =
460!ENDIF
461
462# Define -DNDEBUG to compile without debugging (i.e., for production usage)
463# Omitting the define will cause extra debugging code to be inserted and
464# includes extra comments when "EXPLAIN stmt" is used.
465#
466!IF $(DEBUG)==0
467TCC = $(TCC) -DNDEBUG
468BCC = $(BCC) -DNDEBUG
469RCC = $(RCC) -DNDEBUG
470!ENDIF
471
472!IF $(DEBUG)>0
473TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR
474RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR
475!ENDIF
476
477!IF $(DEBUG)>2
478TCC = $(TCC) -DSQLITE_DEBUG
479RCC = $(RCC) -DSQLITE_DEBUG
480!ENDIF
481
482!IF $(DEBUG)>4
483TCC = $(TCC) -DSQLITE_DEBUG_OS_TRACE=1 -DSQLITE_FORCE_OS_TRACE=1
484RCC = $(RCC) -DSQLITE_DEBUG_OS_TRACE=1 -DSQLITE_FORCE_OS_TRACE=1
485!ENDIF
486
487!IF $(DEBUG)>5
488TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE
489RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE
490!ENDIF
491
492# Prevent warnings about "insecure" MSVC runtime library functions
493# being used.
494#
495TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
496BCC = $(BCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
497RCC = $(RCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
498
499# Prevent warnings about "deprecated" POSIX functions being used.
500#
501TCC = $(TCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
502BCC = $(BCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
503RCC = $(RCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
504
505# Use the SQLite debugging heap subsystem?
506#
507!IF $(MEMDEBUG)!=0
508TCC = $(TCC) -DSQLITE_MEMDEBUG=1
509RCC = $(RCC) -DSQLITE_MEMDEBUG=1
510
511# Use native Win32 heap subsystem instead of malloc/free?
512#
513!ELSEIF $(WIN32HEAP)!=0
514TCC = $(TCC) -DSQLITE_WIN32_MALLOC=1
515RCC = $(RCC) -DSQLITE_WIN32_MALLOC=1
516
517# Validate the heap on every call into the native Win32 heap subsystem?
518#
519!IF $(DEBUG)>3
520TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
521RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
522!ENDIF
523!ENDIF
524
525# The locations of the Tcl header and library files.  Also, the library that
526# non-stubs enabled programs using Tcl must link against.  These variables
527# (TCLINCDIR, TCLLIBDIR, and LIBTCL) may be overridden via the environment
528# prior to running nmake in order to match the actual installed location and
529# version on this machine.
530#
531!IFNDEF TCLINCDIR
532TCLINCDIR = c:\tcl\include
533!ENDIF
534
535!IFNDEF TCLLIBDIR
536TCLLIBDIR = c:\tcl\lib
537!ENDIF
538
539!IFNDEF LIBTCL
540LIBTCL = tcl85.lib
541!ENDIF
542
543# The locations of the ICU header and library files.  These variables
544# (ICUINCDIR, ICULIBDIR, and LIBICU) may be overridden via the environment
545# prior to running nmake in order to match the actual installed location on
546# this machine.
547#
548!IFNDEF ICUINCDIR
549ICUINCDIR = c:\icu\include
550!ENDIF
551
552!IFNDEF ICULIBDIR
553ICULIBDIR = c:\icu\lib
554!ENDIF
555
556!IFNDEF LIBICU
557LIBICU = icuuc.lib icuin.lib
558!ENDIF
559
560# This is the command to use for tclsh - normally just "tclsh", but we may
561# know the specific version we want to use.  This variable (TCLSH_CMD) may be
562# overridden via the environment prior to running nmake in order to select a
563# specific Tcl shell to use.
564#
565!IFNDEF TCLSH_CMD
566TCLSH_CMD = tclsh85
567!ENDIF
568
569# Compiler options needed for programs that use the readline() library.
570#
571!IFNDEF READLINE_FLAGS
572READLINE_FLAGS = -DHAVE_READLINE=0
573!ENDIF
574
575# The library that programs using readline() must link against.
576#
577!IFNDEF LIBREADLINE
578LIBREADLINE =
579!ENDIF
580
581# Should the database engine be compiled threadsafe
582#
583TCC = $(TCC) -DSQLITE_THREADSAFE=1
584RCC = $(RCC) -DSQLITE_THREADSAFE=1
585
586# Do threads override each others locks by default (1), or do we test (-1)
587#
588TCC = $(TCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
589RCC = $(RCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
590
591# Any target libraries which libsqlite must be linked against
592#
593!IFNDEF TLIBS
594TLIBS =
595!ENDIF
596
597# Flags controlling use of the in memory btree implementation
598#
599# SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
600# default to file, 2 to default to memory, and 3 to force temporary
601# tables to always be in memory.
602#
603TCC = $(TCC) -DSQLITE_TEMP_STORE=1
604RCC = $(RCC) -DSQLITE_TEMP_STORE=1
605
606# Enable/disable loadable extensions, and other optional features
607# based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).
608# The same set of OMIT and ENABLE flags should be passed to the
609# LEMON parser generator and the mkkeywordhash tool as well.
610
611# These are the required SQLite compilation options used when compiling for
612# the Windows platform.
613#
614REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=100
615
616# If we are linking to the RPCRT4 library, enable features that need it.
617#
618!IF $(USE_RPCRT4_LIB)!=0
619REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_WIN32_USE_UUID=1
620!ENDIF
621
622# Add the required and optional SQLite compilation options into the command
623# lines used to invoke the MSVC code and resource compilers.
624#
625TCC = $(TCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS)
626RCC = $(RCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS)
627
628# Add in any optional parameters specified on the commane line, e.g.
629# nmake /f Makefile.msc all "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1"
630#
631TCC = $(TCC) $(OPTS)
632RCC = $(RCC) $(OPTS)
633
634# If compiling for debugging, add some defines.
635#
636!IF $(DEBUG)>1
637TCC = $(TCC) -D_DEBUG
638BCC = $(BCC) -D_DEBUG
639RCC = $(RCC) -D_DEBUG
640!ENDIF
641
642# If optimizations are enabled or disabled (either implicitly or
643# explicitly), add the necessary flags.
644#
645!IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
646TCC = $(TCC) -Od
647BCC = $(BCC) -Od
648!ELSEIF $(OPTIMIZATIONS)>=3
649TCC = $(TCC) -Ox
650BCC = $(BCC) -Ox
651!ELSEIF $(OPTIMIZATIONS)==2
652TCC = $(TCC) -O2
653BCC = $(BCC) -O2
654!ELSEIF $(OPTIMIZATIONS)==1
655TCC = $(TCC) -O1
656BCC = $(BCC) -O1
657!ENDIF
658
659# If symbols are enabled (or compiling for debugging), enable PDBs.
660#
661!IF $(DEBUG)>1 || $(SYMBOLS)!=0
662TCC = $(TCC) -Zi
663BCC = $(BCC) -Zi
664!ENDIF
665
666# If ICU support is enabled, add the compiler options for it.
667#
668!IF $(USE_ICU)!=0
669TCC = $(TCC) -DSQLITE_ENABLE_ICU=1
670RCC = $(RCC) -DSQLITE_ENABLE_ICU=1
671TCC = $(TCC) -I$(TOP)\ext\icu
672RCC = $(RCC) -I$(TOP)\ext\icu
673TCC = $(TCC) -I$(ICUINCDIR)
674RCC = $(RCC) -I$(ICUINCDIR)
675!ENDIF
676
677# Command line prefixes for compiling code, compiling resources,
678# linking, etc.
679#
680LTCOMPILE = $(TCC) -Fo$@
681LTRCOMPILE = $(RCC) -r
682LTLIB = lib.exe
683LTLINK = $(TCC) -Fe$@
684
685# If requested, link to the RPCRT4 library.
686#
687!IF $(USE_RPCRT4_LIB)!=0
688LTLINK = $(LTLINK) rpcrt4.lib
689!ENDIF
690
691# If a platform was set, force the linker to target that.
692# Note that the vcvars*.bat family of batch files typically
693# set this for you.  Otherwise, the linker will attempt
694# to deduce the binary type based on the object files.
695!IFDEF PLATFORM
696LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
697LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
698!ELSE
699LTLINKOPTS = /NOLOGO
700LTLIBOPTS = /NOLOGO
701!ENDIF
702
703# When compiling for use in the WinRT environment, the following
704# linker option must be used to mark the executable as runnable
705# only in the context of an application container.
706#
707!IF $(FOR_WINRT)!=0
708LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
709!IF "$(VISUALSTUDIOVERSION)"=="12.0"
710!IFNDEF STORELIBPATH
711!IF "$(PLATFORM)"=="x86"
712STORELIBPATH = $(CRTLIBPATH)\store
713!ELSEIF "$(PLATFORM)"=="x64"
714STORELIBPATH = $(CRTLIBPATH)\store\amd64
715!ELSEIF "$(PLATFORM)"=="ARM"
716STORELIBPATH = $(CRTLIBPATH)\store\arm
717!ELSE
718STORELIBPATH = $(CRTLIBPATH)\store
719!ENDIF
720!ENDIF
721STORELIBPATH = $(STORELIBPATH:\\=\)
722LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
723!ENDIF
724!ENDIF
725
726# When compiling for Windows Phone 8.1, an extra library path is
727# required.
728#
729!IF $(USE_WP81_OPTS)!=0
730!IFNDEF WP81LIBPATH
731!IF "$(PLATFORM)"=="x86"
732WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
733!ELSEIF "$(PLATFORM)"=="ARM"
734WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM
735!ELSE
736WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
737!ENDIF
738!ENDIF
739!ENDIF
740
741# When compiling for Windows Phone 8.1, some extra linker options
742# are also required.
743#
744!IF $(USE_WP81_OPTS)!=0
745!IFDEF WP81LIBPATH
746LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
747!ENDIF
748LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
749LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
750LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
751!ENDIF
752
753# If either debugging or symbols are enabled, enable PDBs.
754#
755!IF $(DEBUG)>1 || $(SYMBOLS)!=0
756LDFLAGS = /DEBUG
757!ENDIF
758
759# Start with the Tcl related linker options.
760#
761!IF $(NO_TCL)==0
762LTLIBPATHS = /LIBPATH:$(TCLLIBDIR)
763LTLIBS = $(LIBTCL)
764!ENDIF
765
766# If ICU support is enabled, add the linker options for it.
767#
768!IF $(USE_ICU)!=0
769LTLIBPATHS = $(LTLIBPATHS) /LIBPATH:$(ICULIBDIR)
770LTLIBS = $(LTLIBS) $(LIBICU)
771!ENDIF
772
773# nawk compatible awk.
774#
775!IFNDEF NAWK
776NAWK = gawk.exe
777!ENDIF
778
779# You should not have to change anything below this line
780###############################################################################
781
782# Object files for the SQLite library (non-amalgamation).
783#
784LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \
785         backup.lo bitvec.lo btmutex.lo btree.lo build.lo \
786         callback.lo complete.lo ctime.lo date.lo delete.lo \
787         expr.lo fault.lo fkey.lo \
788         fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo \
789         fts3_porter.lo fts3_snippet.lo fts3_tokenizer.lo fts3_tokenizer1.lo \
790         fts3_tokenize_vtab.lo fts3_unicode.lo fts3_unicode2.lo fts3_write.lo \
791         func.lo global.lo hash.lo \
792         icu.lo insert.lo journal.lo legacy.lo loadext.lo \
793         main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
794         memjournal.lo \
795         mutex.lo mutex_noop.lo mutex_unix.lo mutex_w32.lo \
796         notify.lo opcodes.lo os.lo os_unix.lo os_win.lo \
797         pager.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
798         random.lo resolve.lo rowset.lo rtree.lo select.lo status.lo \
799         table.lo threads.lo tokenize.lo trigger.lo \
800         update.lo util.lo vacuum.lo \
801         vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
802         vdbetrace.lo wal.lo walker.lo where.lo utf.lo vtab.lo
803
804# Object files for the amalgamation.
805#
806LIBOBJS1 = sqlite3.lo
807
808# Determine the real value of LIBOBJ based on the 'configure' script
809#
810!IF $(USE_AMALGAMATION)==0
811LIBOBJ = $(LIBOBJS0)
812!ELSE
813LIBOBJ = $(LIBOBJS1)
814!ENDIF
815
816# Determine if embedded resource compilation and usage are enabled.
817#
818!IF $(USE_RC)!=0
819LIBRESOBJS = sqlite3res.lo
820!ELSE
821LIBRESOBJS =
822!ENDIF
823
824# All of the source code files.
825#
826SRC1 = \
827  $(TOP)\src\alter.c \
828  $(TOP)\src\analyze.c \
829  $(TOP)\src\attach.c \
830  $(TOP)\src\auth.c \
831  $(TOP)\src\backup.c \
832  $(TOP)\src\bitvec.c \
833  $(TOP)\src\btmutex.c \
834  $(TOP)\src\btree.c \
835  $(TOP)\src\btree.h \
836  $(TOP)\src\btreeInt.h \
837  $(TOP)\src\build.c \
838  $(TOP)\src\callback.c \
839  $(TOP)\src\complete.c \
840  $(TOP)\src\ctime.c \
841  $(TOP)\src\date.c \
842  $(TOP)\src\delete.c \
843  $(TOP)\src\expr.c \
844  $(TOP)\src\fault.c \
845  $(TOP)\src\fkey.c \
846  $(TOP)\src\func.c \
847  $(TOP)\src\global.c \
848  $(TOP)\src\hash.c \
849  $(TOP)\src\hash.h \
850  $(TOP)\src\hwtime.h \
851  $(TOP)\src\insert.c \
852  $(TOP)\src\journal.c \
853  $(TOP)\src\legacy.c \
854  $(TOP)\src\loadext.c \
855  $(TOP)\src\main.c \
856  $(TOP)\src\malloc.c \
857  $(TOP)\src\mem0.c \
858  $(TOP)\src\mem1.c \
859  $(TOP)\src\mem2.c \
860  $(TOP)\src\mem3.c \
861  $(TOP)\src\mem5.c \
862  $(TOP)\src\memjournal.c \
863  $(TOP)\src\msvc.h \
864  $(TOP)\src\mutex.c \
865  $(TOP)\src\mutex.h \
866  $(TOP)\src\mutex_noop.c \
867  $(TOP)\src\mutex_unix.c \
868  $(TOP)\src\mutex_w32.c \
869  $(TOP)\src\notify.c \
870  $(TOP)\src\os.c \
871  $(TOP)\src\os.h \
872  $(TOP)\src\os_common.h \
873  $(TOP)\src\os_setup.h \
874  $(TOP)\src\os_unix.c \
875  $(TOP)\src\os_win.c \
876  $(TOP)\src\os_win.h
877SRC2 = \
878  $(TOP)\src\pager.c \
879  $(TOP)\src\pager.h \
880  $(TOP)\src\parse.y \
881  $(TOP)\src\pcache.c \
882  $(TOP)\src\pcache.h \
883  $(TOP)\src\pcache1.c \
884  $(TOP)\src\pragma.c \
885  $(TOP)\src\pragma.h \
886  $(TOP)\src\prepare.c \
887  $(TOP)\src\printf.c \
888  $(TOP)\src\random.c \
889  $(TOP)\src\resolve.c \
890  $(TOP)\src\rowset.c \
891  $(TOP)\src\select.c \
892  $(TOP)\src\status.c \
893  $(TOP)\src\shell.c \
894  $(TOP)\src\sqlite.h.in \
895  $(TOP)\src\sqlite3ext.h \
896  $(TOP)\src\sqliteInt.h \
897  $(TOP)\src\sqliteLimit.h \
898  $(TOP)\src\table.c \
899  $(TOP)\src\threads.c \
900  $(TOP)\src\tclsqlite.c \
901  $(TOP)\src\tokenize.c \
902  $(TOP)\src\trigger.c \
903  $(TOP)\src\utf.c \
904  $(TOP)\src\update.c \
905  $(TOP)\src\util.c \
906  $(TOP)\src\vacuum.c \
907  $(TOP)\src\vdbe.c \
908  $(TOP)\src\vdbe.h \
909  $(TOP)\src\vdbeapi.c \
910  $(TOP)\src\vdbeaux.c \
911  $(TOP)\src\vdbeblob.c \
912  $(TOP)\src\vdbemem.c \
913  $(TOP)\src\vdbesort.c \
914  $(TOP)\src\vdbetrace.c \
915  $(TOP)\src\vdbeInt.h \
916  $(TOP)\src\vtab.c \
917  $(TOP)\src\vxworks.h \
918  $(TOP)\src\wal.c \
919  $(TOP)\src\wal.h \
920  $(TOP)\src\walker.c \
921  $(TOP)\src\where.c \
922  $(TOP)\src\whereInt.h
923
924# Source code for extensions
925#
926SRC3 = \
927  $(TOP)\ext\fts1\fts1.c \
928  $(TOP)\ext\fts1\fts1.h \
929  $(TOP)\ext\fts1\fts1_hash.c \
930  $(TOP)\ext\fts1\fts1_hash.h \
931  $(TOP)\ext\fts1\fts1_porter.c \
932  $(TOP)\ext\fts1\fts1_tokenizer.h \
933  $(TOP)\ext\fts1\fts1_tokenizer1.c \
934  $(TOP)\ext\fts2\fts2.c \
935  $(TOP)\ext\fts2\fts2.h \
936  $(TOP)\ext\fts2\fts2_hash.c \
937  $(TOP)\ext\fts2\fts2_hash.h \
938  $(TOP)\ext\fts2\fts2_icu.c \
939  $(TOP)\ext\fts2\fts2_porter.c \
940  $(TOP)\ext\fts2\fts2_tokenizer.h \
941  $(TOP)\ext\fts2\fts2_tokenizer.c \
942  $(TOP)\ext\fts2\fts2_tokenizer1.c
943SRC4 = \
944  $(TOP)\ext\fts3\fts3.c \
945  $(TOP)\ext\fts3\fts3.h \
946  $(TOP)\ext\fts3\fts3Int.h \
947  $(TOP)\ext\fts3\fts3_aux.c \
948  $(TOP)\ext\fts3\fts3_expr.c \
949  $(TOP)\ext\fts3\fts3_hash.c \
950  $(TOP)\ext\fts3\fts3_hash.h \
951  $(TOP)\ext\fts3\fts3_icu.c \
952  $(TOP)\ext\fts3\fts3_porter.c \
953  $(TOP)\ext\fts3\fts3_snippet.c \
954  $(TOP)\ext\fts3\fts3_tokenizer.h \
955  $(TOP)\ext\fts3\fts3_tokenizer.c \
956  $(TOP)\ext\fts3\fts3_tokenizer1.c \
957  $(TOP)\ext\fts3\fts3_tokenize_vtab.c \
958  $(TOP)\ext\fts3\fts3_unicode.c \
959  $(TOP)\ext\fts3\fts3_unicode2.c \
960  $(TOP)\ext\fts3\fts3_write.c \
961  $(TOP)\ext\icu\sqliteicu.h \
962  $(TOP)\ext\icu\icu.c \
963  $(TOP)\ext\rtree\rtree.h \
964  $(TOP)\ext\rtree\rtree.c
965
966
967# Generated source code files
968#
969SRC5 = \
970  keywordhash.h \
971  opcodes.c \
972  opcodes.h \
973  parse.c \
974  parse.h \
975  sqlite3.h
976
977# All source code files.
978#
979SRC = $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5)
980
981# Source code to the test files.
982#
983TESTSRC = \
984  $(TOP)\src\test1.c \
985  $(TOP)\src\test2.c \
986  $(TOP)\src\test3.c \
987  $(TOP)\src\test4.c \
988  $(TOP)\src\test5.c \
989  $(TOP)\src\test6.c \
990  $(TOP)\src\test7.c \
991  $(TOP)\src\test8.c \
992  $(TOP)\src\test9.c \
993  $(TOP)\src\test_autoext.c \
994  $(TOP)\src\test_async.c \
995  $(TOP)\src\test_backup.c \
996  $(TOP)\src\test_blob.c \
997  $(TOP)\src\test_btree.c \
998  $(TOP)\src\test_config.c \
999  $(TOP)\src\test_demovfs.c \
1000  $(TOP)\src\test_devsym.c \
1001  $(TOP)\src\test_fs.c \
1002  $(TOP)\src\test_func.c \
1003  $(TOP)\src\test_hexio.c \
1004  $(TOP)\src\test_init.c \
1005  $(TOP)\src\test_intarray.c \
1006  $(TOP)\src\test_journal.c \
1007  $(TOP)\src\test_malloc.c \
1008  $(TOP)\src\test_multiplex.c \
1009  $(TOP)\src\test_mutex.c \
1010  $(TOP)\src\test_onefile.c \
1011  $(TOP)\src\test_osinst.c \
1012  $(TOP)\src\test_pcache.c \
1013  $(TOP)\src\test_quota.c \
1014  $(TOP)\src\test_rtree.c \
1015  $(TOP)\src\test_schema.c \
1016  $(TOP)\src\test_server.c \
1017  $(TOP)\src\test_superlock.c \
1018  $(TOP)\src\test_syscall.c \
1019  $(TOP)\src\test_stat.c \
1020  $(TOP)\src\test_tclvar.c \
1021  $(TOP)\src\test_thread.c \
1022  $(TOP)\src\test_vfs.c \
1023  $(TOP)\src\test_wsd.c \
1024  $(TOP)\ext\fts3\fts3_term.c \
1025  $(TOP)\ext\fts3\fts3_test.c
1026
1027# Statically linked extensions
1028#
1029TESTEXT = \
1030  $(TOP)\ext\misc\amatch.c \
1031  $(TOP)\ext\misc\closure.c \
1032  $(TOP)\ext\misc\eval.c \
1033  $(TOP)\ext\misc\fileio.c \
1034  $(TOP)\ext\misc\fuzzer.c \
1035  $(TOP)\ext\misc\ieee754.c \
1036  $(TOP)\ext\misc\nextchar.c \
1037  $(TOP)\ext\misc\percentile.c \
1038  $(TOP)\ext\misc\regexp.c \
1039  $(TOP)\ext\misc\spellfix.c \
1040  $(TOP)\ext\misc\totype.c \
1041  $(TOP)\ext\misc\wholenumber.c
1042
1043
1044# Source code to the library files needed by the test fixture
1045#
1046TESTSRC2 = \
1047  $(TOP)\src\attach.c \
1048  $(TOP)\src\backup.c \
1049  $(TOP)\src\bitvec.c \
1050  $(TOP)\src\btree.c \
1051  $(TOP)\src\build.c \
1052  $(TOP)\src\ctime.c \
1053  $(TOP)\src\date.c \
1054  $(TOP)\src\expr.c \
1055  $(TOP)\src\func.c \
1056  $(TOP)\src\insert.c \
1057  $(TOP)\src\wal.c \
1058  $(TOP)\src\main.c \
1059  $(TOP)\src\mem5.c \
1060  $(TOP)\src\os.c \
1061  $(TOP)\src\os_unix.c \
1062  $(TOP)\src\os_win.c \
1063  $(TOP)\src\pager.c \
1064  $(TOP)\src\pragma.c \
1065  $(TOP)\src\prepare.c \
1066  $(TOP)\src\printf.c \
1067  $(TOP)\src\random.c \
1068  $(TOP)\src\pcache.c \
1069  $(TOP)\src\pcache1.c \
1070  $(TOP)\src\select.c \
1071  $(TOP)\src\tokenize.c \
1072  $(TOP)\src\utf.c \
1073  $(TOP)\src\util.c \
1074  $(TOP)\src\vdbeapi.c \
1075  $(TOP)\src\vdbeaux.c \
1076  $(TOP)\src\vdbe.c \
1077  $(TOP)\src\vdbemem.c \
1078  $(TOP)\src\vdbesort.c \
1079  $(TOP)\src\vdbetrace.c \
1080  $(TOP)\src\where.c \
1081  parse.c \
1082  $(TOP)\ext\fts3\fts3.c \
1083  $(TOP)\ext\fts3\fts3_aux.c \
1084  $(TOP)\ext\fts3\fts3_expr.c \
1085  $(TOP)\ext\fts3\fts3_tokenizer.c \
1086  $(TOP)\ext\fts3\fts3_tokenize_vtab.c \
1087  $(TOP)\ext\fts3\fts3_unicode.c \
1088  $(TOP)\ext\fts3\fts3_unicode2.c \
1089  $(TOP)\ext\fts3\fts3_write.c \
1090  $(TOP)\ext\async\sqlite3async.c
1091
1092# Header files used by all library source files.
1093#
1094HDR = \
1095   $(TOP)\src\btree.h \
1096   $(TOP)\src\btreeInt.h \
1097   $(TOP)\src\hash.h \
1098   $(TOP)\src\hwtime.h \
1099   keywordhash.h \
1100   $(TOP)\src\msvc.h \
1101   $(TOP)\src\mutex.h \
1102   opcodes.h \
1103   $(TOP)\src\os.h \
1104   $(TOP)\src\os_common.h \
1105   $(TOP)\src\os_setup.h \
1106   $(TOP)\src\os_win.h \
1107   $(TOP)\src\pager.h \
1108   $(TOP)\src\pcache.h \
1109   parse.h \
1110   $(TOP)\src\pragma.h \
1111   sqlite3.h \
1112   $(TOP)\src\sqlite3ext.h \
1113   $(TOP)\src\sqliteInt.h \
1114   $(TOP)\src\sqliteLimit.h \
1115   $(TOP)\src\vdbe.h \
1116   $(TOP)\src\vdbeInt.h \
1117   $(TOP)\src\vxworks.h \
1118   $(TOP)\src\whereInt.h
1119
1120# Header files used by extensions
1121#
1122EXTHDR = $(EXTHDR) \
1123  $(TOP)\ext\fts1\fts1.h \
1124  $(TOP)\ext\fts1\fts1_hash.h \
1125  $(TOP)\ext\fts1\fts1_tokenizer.h
1126EXTHDR = $(EXTHDR) \
1127  $(TOP)\ext\fts2\fts2.h \
1128  $(TOP)\ext\fts2\fts2_hash.h \
1129  $(TOP)\ext\fts2\fts2_tokenizer.h
1130EXTHDR = $(EXTHDR) \
1131  $(TOP)\ext\fts3\fts3.h \
1132  $(TOP)\ext\fts3\fts3Int.h \
1133  $(TOP)\ext\fts3\fts3_hash.h \
1134  $(TOP)\ext\fts3\fts3_tokenizer.h
1135EXTHDR = $(EXTHDR) \
1136  $(TOP)\ext\rtree\rtree.h
1137EXTHDR = $(EXTHDR) \
1138  $(TOP)\ext\icu\sqliteicu.h
1139EXTHDR = $(EXTHDR) \
1140  $(TOP)\ext\rtree\sqlite3rtree.h
1141
1142# This is the default Makefile target.  The objects listed here
1143# are what get build when you type just "make" with no arguments.
1144#
1145all:	dll libsqlite3.lib sqlite3.exe libtclsqlite3.lib
1146
1147libsqlite3.lib:	$(LIBOBJ)
1148	$(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
1149
1150libtclsqlite3.lib:	tclsqlite.lo libsqlite3.lib
1151	$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCL:tcl=tclstub) $(TLIBS)
1152
1153sqlite3.exe:	$(TOP)\src\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
1154	$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\src\shell.c \
1155		/link /pdb:sqlite3sh.pdb $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
1156
1157mptester.exe:	$(TOP)\mptest\mptest.c $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
1158	$(LTLINK) $(SHELL_COMPILE_OPTS) $(TOP)\mptest\mptest.c \
1159		/link $(LTLINKOPTS) $(LTLIBPATHS) $(SHELL_LINK_OPTS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
1160
1161MPTEST1 = mptester mptest.db $(TOP)\mptest\crash01.test --repeat 20
1162MPTEST2 = mptester mptest.db $(TOP)\mptest\multiwrite01.test --repeat 20
1163
1164mptest:	mptester.exe
1165	del /Q mptest.db 2>NUL
1166	$(MPTEST1) --journalmode DELETE
1167	$(MPTEST2) --journalmode WAL
1168	$(MPTEST1) --journalmode WAL
1169	$(MPTEST2) --journalmode PERSIST
1170	$(MPTEST1) --journalmode PERSIST
1171	$(MPTEST2) --journalmode TRUNCATE
1172	$(MPTEST1) --journalmode TRUNCATE
1173	$(MPTEST2) --journalmode DELETE
1174
1175# This target creates a directory named "tsrc" and fills it with
1176# copies of all of the C source code and header files needed to
1177# build on the target system.  Some of the C source code and header
1178# files are automatically generated.  This target takes care of
1179# all that automatic generation.
1180#
1181.target_source:	$(SRC) $(TOP)\tool\vdbe-compress.tcl
1182	-rmdir /Q/S tsrc 2>NUL
1183	-mkdir tsrc
1184	for %i in ($(SRC1)) do copy /Y %i tsrc
1185	for %i in ($(SRC2)) do copy /Y %i tsrc
1186	for %i in ($(SRC3)) do copy /Y %i tsrc
1187	for %i in ($(SRC4)) do copy /Y %i tsrc
1188	for %i in ($(SRC5)) do copy /Y %i tsrc
1189	del /Q tsrc\sqlite.h.in tsrc\parse.y 2>NUL
1190	$(TCLSH_CMD) $(TOP)\tool\vdbe-compress.tcl $(OPTS) < tsrc\vdbe.c > vdbe.new
1191	move vdbe.new tsrc\vdbe.c
1192	echo > .target_source
1193
1194sqlite3.c:	.target_source $(TOP)\tool\mksqlite3c.tcl
1195	$(TCLSH_CMD) $(TOP)\tool\mksqlite3c.tcl $(MKSQLITE3C_ARGS)
1196	copy tsrc\shell.c .
1197	copy tsrc\sqlite3ext.h .
1198
1199sqlite3-all.c:	sqlite3.c $(TOP)\tool\split-sqlite3c.tcl
1200	$(TCLSH_CMD) $(TOP)\tool\split-sqlite3c.tcl
1201
1202# Set the source code file to be used by executables and libraries when
1203# they need the amalgamation.
1204#
1205!IF $(SPLIT_AMALGAMATION)!=0
1206SQLITE3C = sqlite3-all.c
1207!ELSE
1208SQLITE3C = sqlite3.c
1209!ENDIF
1210
1211# Rule to build the amalgamation
1212#
1213sqlite3.lo:	$(SQLITE3C)
1214	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C)
1215
1216# Rules to build the LEMON compiler generator
1217#
1218lempar.c:	$(TOP)\src\lempar.c
1219	copy $(TOP)\src\lempar.c .
1220
1221lemon.exe:	$(TOP)\tool\lemon.c lempar.c
1222	$(BCC) $(NO_WARN) -Daccess=_access \
1223		-Fe$@ $(TOP)\tool\lemon.c /link $(NLTLINKOPTS) $(NLTLIBPATHS)
1224
1225# Rules to build individual *.lo files from generated *.c files. This
1226# applies to:
1227#
1228#     parse.lo
1229#     opcodes.lo
1230#
1231parse.lo:	parse.c $(HDR)
1232	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c parse.c
1233
1234opcodes.lo:	opcodes.c
1235	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c opcodes.c
1236
1237# Rule to build the Win32 resources object file.
1238#
1239!IF $(USE_RC)!=0
1240$(LIBRESOBJS):	$(TOP)\src\sqlite3.rc $(HDR)
1241	echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
1242	for /F %%V in ('type "$(TOP)\VERSION"') do ( \
1243		echo #define SQLITE_RESOURCE_VERSION %%V \
1244			| $(NAWK) "/.*/ { gsub(/[.]/,\",\");print }" >> sqlite3rc.h \
1245	)
1246	echo #endif >> sqlite3rc.h
1247	$(LTRCOMPILE) -fo $(LIBRESOBJS) $(TOP)\src\sqlite3.rc
1248!ENDIF
1249
1250# Rules to build individual *.lo files from files in the src directory.
1251#
1252alter.lo:	$(TOP)\src\alter.c $(HDR)
1253	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\alter.c
1254
1255analyze.lo:	$(TOP)\src\analyze.c $(HDR)
1256	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\analyze.c
1257
1258attach.lo:	$(TOP)\src\attach.c $(HDR)
1259	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\attach.c
1260
1261auth.lo:	$(TOP)\src\auth.c $(HDR)
1262	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\auth.c
1263
1264backup.lo:	$(TOP)\src\backup.c $(HDR)
1265	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\backup.c
1266
1267bitvec.lo:	$(TOP)\src\bitvec.c $(HDR)
1268	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\bitvec.c
1269
1270btmutex.lo:	$(TOP)\src\btmutex.c $(HDR)
1271	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\btmutex.c
1272
1273btree.lo:	$(TOP)\src\btree.c $(HDR) $(TOP)\src\pager.h
1274	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\btree.c
1275
1276build.lo:	$(TOP)\src\build.c $(HDR)
1277	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\build.c
1278
1279callback.lo:	$(TOP)\src\callback.c $(HDR)
1280	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\callback.c
1281
1282complete.lo:	$(TOP)\src\complete.c $(HDR)
1283	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c
1284
1285ctime.lo:	$(TOP)\src\ctime.c $(HDR)
1286	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\ctime.c
1287
1288date.lo:	$(TOP)\src\date.c $(HDR)
1289	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\date.c
1290
1291delete.lo:	$(TOP)\src\delete.c $(HDR)
1292	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\delete.c
1293
1294expr.lo:	$(TOP)\src\expr.c $(HDR)
1295	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\expr.c
1296
1297fault.lo:	$(TOP)\src\fault.c $(HDR)
1298	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\fault.c
1299
1300fkey.lo:	$(TOP)\src\fkey.c $(HDR)
1301	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\fkey.c
1302
1303func.lo:	$(TOP)\src\func.c $(HDR)
1304	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\func.c
1305
1306global.lo:	$(TOP)\src\global.c $(HDR)
1307	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\global.c
1308
1309hash.lo:	$(TOP)\src\hash.c $(HDR)
1310	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\hash.c
1311
1312insert.lo:	$(TOP)\src\insert.c $(HDR)
1313	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\insert.c
1314
1315journal.lo:	$(TOP)\src\journal.c $(HDR)
1316	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\journal.c
1317
1318legacy.lo:	$(TOP)\src\legacy.c $(HDR)
1319	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\legacy.c
1320
1321loadext.lo:	$(TOP)\src\loadext.c $(HDR)
1322	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\loadext.c
1323
1324main.lo:	$(TOP)\src\main.c $(HDR)
1325	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\main.c
1326
1327malloc.lo:	$(TOP)\src\malloc.c $(HDR)
1328	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\malloc.c
1329
1330mem0.lo:	$(TOP)\src\mem0.c $(HDR)
1331	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem0.c
1332
1333mem1.lo:	$(TOP)\src\mem1.c $(HDR)
1334	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem1.c
1335
1336mem2.lo:	$(TOP)\src\mem2.c $(HDR)
1337	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem2.c
1338
1339mem3.lo:	$(TOP)\src\mem3.c $(HDR)
1340	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem3.c
1341
1342mem5.lo:	$(TOP)\src\mem5.c $(HDR)
1343	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem5.c
1344
1345memjournal.lo:	$(TOP)\src\memjournal.c $(HDR)
1346	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\memjournal.c
1347
1348mutex.lo:	$(TOP)\src\mutex.c $(HDR)
1349	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex.c
1350
1351mutex_noop.lo:	$(TOP)\src\mutex_noop.c $(HDR)
1352	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_noop.c
1353
1354mutex_unix.lo:	$(TOP)\src\mutex_unix.c $(HDR)
1355	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_unix.c
1356
1357mutex_w32.lo:	$(TOP)\src\mutex_w32.c $(HDR)
1358	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_w32.c
1359
1360notify.lo:	$(TOP)\src\notify.c $(HDR)
1361	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\notify.c
1362
1363pager.lo:	$(TOP)\src\pager.c $(HDR) $(TOP)\src\pager.h
1364	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pager.c
1365
1366pcache.lo:	$(TOP)\src\pcache.c $(HDR) $(TOP)\src\pcache.h
1367	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pcache.c
1368
1369pcache1.lo:	$(TOP)\src\pcache1.c $(HDR) $(TOP)\src\pcache.h
1370	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pcache1.c
1371
1372os.lo:	$(TOP)\src\os.c $(HDR)
1373	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os.c
1374
1375os_unix.lo:	$(TOP)\src\os_unix.c $(HDR)
1376	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os_unix.c
1377
1378os_win.lo:	$(TOP)\src\os_win.c $(HDR)
1379	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os_win.c
1380
1381pragma.lo:	$(TOP)\src\pragma.c $(HDR)
1382	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pragma.c
1383
1384prepare.lo:	$(TOP)\src\prepare.c $(HDR)
1385	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\prepare.c
1386
1387printf.lo:	$(TOP)\src\printf.c $(HDR)
1388	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\printf.c
1389
1390random.lo:	$(TOP)\src\random.c $(HDR)
1391	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\random.c
1392
1393resolve.lo:	$(TOP)\src\resolve.c $(HDR)
1394	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\resolve.c
1395
1396rowset.lo:	$(TOP)\src\rowset.c $(HDR)
1397	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\rowset.c
1398
1399select.lo:	$(TOP)\src\select.c $(HDR)
1400	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\select.c
1401
1402status.lo:	$(TOP)\src\status.c $(HDR)
1403	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\status.c
1404
1405table.lo:	$(TOP)\src\table.c $(HDR)
1406	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\table.c
1407
1408threads.lo:	$(TOP)\src\threads.c $(HDR)
1409	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\threads.c
1410
1411tokenize.lo:	$(TOP)\src\tokenize.c keywordhash.h $(HDR)
1412	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\tokenize.c
1413
1414trigger.lo:	$(TOP)\src\trigger.c $(HDR)
1415	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\trigger.c
1416
1417update.lo:	$(TOP)\src\update.c $(HDR)
1418	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\update.c
1419
1420utf.lo:	$(TOP)\src\utf.c $(HDR)
1421	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\utf.c
1422
1423util.lo:	$(TOP)\src\util.c $(HDR)
1424	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\util.c
1425
1426vacuum.lo:	$(TOP)\src\vacuum.c $(HDR)
1427	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vacuum.c
1428
1429vdbe.lo:	$(TOP)\src\vdbe.c $(HDR)
1430	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbe.c
1431
1432vdbeapi.lo:	$(TOP)\src\vdbeapi.c $(HDR)
1433	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeapi.c
1434
1435vdbeaux.lo:	$(TOP)\src\vdbeaux.c $(HDR)
1436	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeaux.c
1437
1438vdbeblob.lo:	$(TOP)\src\vdbeblob.c $(HDR)
1439	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeblob.c
1440
1441vdbemem.lo:	$(TOP)\src\vdbemem.c $(HDR)
1442	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbemem.c
1443
1444vdbesort.lo:	$(TOP)\src\vdbesort.c $(HDR)
1445	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbesort.c
1446
1447vdbetrace.lo:	$(TOP)\src\vdbetrace.c $(HDR)
1448	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbetrace.c
1449
1450vtab.lo:	$(TOP)\src\vtab.c $(HDR)
1451	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vtab.c
1452
1453wal.lo:	$(TOP)\src\wal.c $(HDR)
1454	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\wal.c
1455
1456walker.lo:	$(TOP)\src\walker.c $(HDR)
1457	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\walker.c
1458
1459where.lo:	$(TOP)\src\where.c $(HDR)
1460	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\where.c
1461
1462tclsqlite.lo:	$(TOP)\src\tclsqlite.c $(HDR)
1463	$(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
1464
1465tclsqlite-shell.lo:	$(TOP)\src\tclsqlite.c $(HDR)
1466	$(LTCOMPILE) $(NO_WARN) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
1467
1468tclsqlite3.exe:	tclsqlite-shell.lo $(SQLITE3C) $(LIBRESOBJS)
1469	$(LTLINK) $(SQLITE3C) /link $(LTLINKOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite-shell.lo $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
1470
1471# Rules to build opcodes.c and opcodes.h
1472#
1473opcodes.c:	opcodes.h $(TOP)\mkopcodec.awk
1474	$(NAWK) -f $(TOP)\mkopcodec.awk opcodes.h > opcodes.c
1475
1476opcodes.h:	parse.h $(TOP)\src\vdbe.c $(TOP)\mkopcodeh.awk
1477	type parse.h $(TOP)\src\vdbe.c | $(NAWK) -f $(TOP)\mkopcodeh.awk > opcodes.h
1478
1479# Rules to build parse.c and parse.h - the outputs of lemon.
1480#
1481parse.h:	parse.c
1482
1483parse.c:	$(TOP)\src\parse.y lemon.exe $(TOP)\addopcodes.awk
1484	del /Q parse.y parse.h parse.h.temp 2>NUL
1485	copy $(TOP)\src\parse.y .
1486	.\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) parse.y
1487	move parse.h parse.h.temp
1488	$(NAWK) -f $(TOP)\addopcodes.awk parse.h.temp > parse.h
1489
1490sqlite3.h:	$(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION
1491	$(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > sqlite3.h
1492
1493mkkeywordhash.exe:	$(TOP)\tool\mkkeywordhash.c
1494	$(BCC) $(NO_WARN) -Fe$@ $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) \
1495		$(TOP)\tool\mkkeywordhash.c /link $(NLTLINKOPTS) $(NLTLIBPATHS)
1496
1497keywordhash.h:	$(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe
1498	.\mkkeywordhash.exe > keywordhash.h
1499
1500
1501
1502# Rules to build the extension objects.
1503#
1504icu.lo:	$(TOP)\ext\icu\icu.c $(HDR) $(EXTHDR)
1505	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\icu\icu.c
1506
1507fts2.lo:	$(TOP)\ext\fts2\fts2.c $(HDR) $(EXTHDR)
1508	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2.c
1509
1510fts2_hash.lo:	$(TOP)\ext\fts2\fts2_hash.c $(HDR) $(EXTHDR)
1511	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_hash.c
1512
1513fts2_icu.lo:	$(TOP)\ext\fts2\fts2_icu.c $(HDR) $(EXTHDR)
1514	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_icu.c
1515
1516fts2_porter.lo:	$(TOP)\ext\fts2\fts2_porter.c $(HDR) $(EXTHDR)
1517	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_porter.c
1518
1519fts2_tokenizer.lo:	$(TOP)\ext\fts2\fts2_tokenizer.c $(HDR) $(EXTHDR)
1520	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer.c
1521
1522fts2_tokenizer1.lo:	$(TOP)\ext\fts2\fts2_tokenizer1.c $(HDR) $(EXTHDR)
1523	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer1.c
1524
1525fts3.lo:	$(TOP)\ext\fts3\fts3.c $(HDR) $(EXTHDR)
1526	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3.c
1527
1528fts3_aux.lo:	$(TOP)\ext\fts3\fts3_aux.c $(HDR) $(EXTHDR)
1529	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_aux.c
1530
1531fts3_expr.lo:	$(TOP)\ext\fts3\fts3_expr.c $(HDR) $(EXTHDR)
1532	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_expr.c
1533
1534fts3_hash.lo:	$(TOP)\ext\fts3\fts3_hash.c $(HDR) $(EXTHDR)
1535	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_hash.c
1536
1537fts3_icu.lo:	$(TOP)\ext\fts3\fts3_icu.c $(HDR) $(EXTHDR)
1538	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_icu.c
1539
1540fts3_snippet.lo:	$(TOP)\ext\fts3\fts3_snippet.c $(HDR) $(EXTHDR)
1541	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_snippet.c
1542
1543fts3_porter.lo:	$(TOP)\ext\fts3\fts3_porter.c $(HDR) $(EXTHDR)
1544	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_porter.c
1545
1546fts3_tokenizer.lo:	$(TOP)\ext\fts3\fts3_tokenizer.c $(HDR) $(EXTHDR)
1547	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer.c
1548
1549fts3_tokenizer1.lo:	$(TOP)\ext\fts3\fts3_tokenizer1.c $(HDR) $(EXTHDR)
1550	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer1.c
1551
1552fts3_tokenize_vtab.lo:	$(TOP)\ext\fts3\fts3_tokenize_vtab.c $(HDR) $(EXTHDR)
1553	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenize_vtab.c
1554
1555fts3_unicode.lo:	$(TOP)\ext\fts3\fts3_unicode.c $(HDR) $(EXTHDR)
1556	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode.c
1557
1558fts3_unicode2.lo:	$(TOP)\ext\fts3\fts3_unicode2.c $(HDR) $(EXTHDR)
1559	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode2.c
1560
1561fts3_write.lo:	$(TOP)\ext\fts3\fts3_write.c $(HDR) $(EXTHDR)
1562	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_write.c
1563
1564rtree.lo:	$(TOP)\ext\rtree\rtree.c $(HDR) $(EXTHDR)
1565	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\rtree\rtree.c
1566
1567
1568# Rules to build the 'testfixture' application.
1569#
1570# If using the amalgamation, use sqlite3.c directly to build the test
1571# fixture.  Otherwise link against libsqlite3.lib.  (This distinction is
1572# necessary because the test fixture requires non-API symbols which are
1573# hidden when the library is built via the amalgamation).
1574#
1575TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
1576TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE=""
1577TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN)
1578
1579TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) $(SHELL_CORE_DEP)
1580TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C)
1581!IF $(USE_AMALGAMATION)==0
1582TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
1583!ELSE
1584TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)
1585!ENDIF
1586
1587testfixture.exe:	$(TESTFIXTURE_SRC) $(LIBRESOBJS) $(HDR)
1588	$(LTLINK) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
1589		-DBUILD_sqlite -I$(TCLINCDIR) \
1590		$(TESTFIXTURE_SRC) \
1591		/link $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
1592
1593extensiontest: testfixture.exe testloadext.dll
1594	.\testfixture.exe $(TOP)\test\loadext.test
1595
1596fulltest:	testfixture.exe sqlite3.exe
1597	.\testfixture.exe $(TOP)\test\all.test
1598
1599soaktest:	testfixture.exe sqlite3.exe
1600	.\testfixture.exe $(TOP)\test\all.test -soak=1
1601
1602fulltestonly:	testfixture.exe sqlite3.exe
1603	.\testfixture.exe $(TOP)\test\full.test
1604
1605queryplantest:	testfixture.exe sqlite3.exe
1606	.\testfixture.exe $(TOP)\test\permutations.test queryplanner
1607
1608test:	testfixture.exe sqlite3.exe
1609	.\testfixture.exe $(TOP)\test\veryquick.test
1610
1611sqlite3_analyzer.c: $(SQLITE3C) $(TOP)\src\test_stat.c $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl
1612	copy $(SQLITE3C) + $(TOP)\src\test_stat.c + $(TOP)\src\tclsqlite.c $@
1613	echo static const char *tclsh_main_loop(void){ >> $@
1614	echo static const char *zMainloop = >> $@
1615	$(NAWK) -f $(TOP)\tool\tostr.awk $(TOP)\tool\spaceanal.tcl >> $@
1616	echo ; return zMainloop; } >> $@
1617
1618sqlite3_analyzer.exe:	sqlite3_analyzer.c $(LIBRESOBJS)
1619	$(LTLINK) $(NO_WARN) -DBUILD_sqlite -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \
1620		/link $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
1621
1622testloadext.lo:	$(TOP)\src\test_loadext.c
1623	$(LTCOMPILE) $(NO_WARN) -c $(TOP)\src\test_loadext.c
1624
1625testloadext.dll: testloadext.lo
1626	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ testloadext.lo
1627
1628showdb.exe:	$(TOP)\tool\showdb.c $(SQLITE3C)
1629	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
1630		$(TOP)\tool\showdb.c $(SQLITE3C)
1631
1632showstat4.exe:	$(TOP)\tool\showstat4.c $(SQLITE3C)
1633	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
1634		$(TOP)\tool\showstat4.c $(SQLITE3C)
1635
1636showjournal.exe:	$(TOP)\tool\showjournal.c $(SQLITE3C)
1637	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
1638		$(TOP)\tool\showjournal.c $(SQLITE3C)
1639
1640showwal.exe:	$(TOP)\tool\showwal.c $(SQLITE3C)
1641	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
1642		$(TOP)\tool\showwal.c $(SQLITE3C)
1643
1644fts3view.exe:	$(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C)
1645	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
1646		$(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C)
1647
1648rollback-test.exe:	$(TOP)\tool\rollback-test.c $(SQLITE3C)
1649	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
1650		$(TOP)\tool\rollback-test.c $(SQLITE3C)
1651
1652LogEst.exe:	$(TOP)\tool\logest.c sqlite3.h
1653	$(LTLINK) $(NO_WARN) -Fe$@ $(TOP)\tool\LogEst.c
1654
1655wordcount.exe:	$(TOP)\test\wordcount.c $(SQLITE3C)
1656	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
1657		$(TOP)\test\wordcount.c $(SQLITE3C)
1658
1659speedtest1.exe:	$(TOP)\test\speedtest1.c $(SQLITE3C)
1660	$(LTLINK) $(NO_WARN) -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
1661		$(TOP)\test\speedtest1.c $(SQLITE3C)
1662
1663clean:
1664	del /Q *.exp *.lo *.ilk *.lib *.obj *.pdb 2>NUL
1665	del /Q *.cod *.da *.bb *.bbg gmon.out 2>NUL
1666	del /Q sqlite3.h opcodes.c opcodes.h 2>NUL
1667	del /Q lemon.* lempar.c parse.* 2>NUL
1668	del /Q mkkeywordhash.* keywordhash.h 2>NUL
1669	del /Q notasharedlib.* 2>NUL
1670	-rmdir /Q/S .deps 2>NUL
1671	-rmdir /Q/S .libs 2>NUL
1672	-rmdir /Q/S quota2a 2>NUL
1673	-rmdir /Q/S quota2b 2>NUL
1674	-rmdir /Q/S quota2c 2>NUL
1675	-rmdir /Q/S tsrc 2>NUL
1676	del /Q .target_source 2>NUL
1677	del /Q tclsqlite3.exe 2>NUL
1678	del /Q testloadext.dll 2>NUL
1679	del /Q testfixture.exe test.db 2>NUL
1680	del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe 2>NUL
1681	del /Q showjournal.exe showstat4.exe showwal.exe speedtest1.exe 2>NUL
1682	del /Q mptester.exe wordcount.exe 2>NUL
1683	del /Q sqlite3.exe sqlite3.dll sqlite3.def 2>NUL
1684	del /Q sqlite3.c sqlite3-*.c 2>NUL
1685	del /Q sqlite3rc.h 2>NUL
1686	del /Q shell.c sqlite3ext.h 2>NUL
1687	del /Q sqlite3_analyzer.exe sqlite3_analyzer.c 2>NUL
1688	del /Q sqlite-*-output.vsix 2>NUL
1689
1690# Dynamic link library section.
1691#
1692dll: sqlite3.dll
1693
1694sqlite3.def: libsqlite3.lib
1695	echo EXPORTS > sqlite3.def
1696	dumpbin /all libsqlite3.lib \
1697		| $(NAWK) "/ 1 _?sqlite3_/ { sub(/^.* _?/,\"\");print }" \
1698		| sort >> sqlite3.def
1699
1700sqlite3.dll: $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
1701	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
1702