xref: /sqlite-3.40.0/Makefile.msc (revision dfe4e6bb)
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# <<mark>>
14# Set this non-0 to create and use the SQLite amalgamation file.
15#
16!IFNDEF USE_AMALGAMATION
17USE_AMALGAMATION = 1
18!ENDIF
19# <</mark>>
20
21# Set this non-0 to enable full warnings (-W4, etc) when compiling.
22#
23!IFNDEF USE_FULLWARN
24USE_FULLWARN = 0
25!ENDIF
26
27# Set this non-0 to enable full runtime error checks (-RTC1, etc).  This
28# has no effect if (any) optimizations are enabled.
29#
30!IFNDEF USE_RUNTIME_CHECKS
31USE_RUNTIME_CHECKS = 0
32!ENDIF
33
34# Set this non-0 to create a SQLite amalgamation file that excludes the
35# various built-in extensions.
36#
37!IFNDEF MINIMAL_AMALGAMATION
38MINIMAL_AMALGAMATION = 0
39!ENDIF
40
41# Set this non-0 to use "stdcall" calling convention for the core library
42# and shell executable.
43#
44!IFNDEF USE_STDCALL
45USE_STDCALL = 0
46!ENDIF
47
48# Set this non-0 to have the shell executable link against the core dynamic
49# link library.
50#
51!IFNDEF DYNAMIC_SHELL
52DYNAMIC_SHELL = 0
53!ENDIF
54
55# Set this non-0 to enable extra code that attempts to detect misuse of the
56# SQLite API.
57#
58!IFNDEF API_ARMOR
59API_ARMOR = 0
60!ENDIF
61
62# If necessary, create a list of harmless compiler warnings to disable when
63# compiling the various tools.  For the SQLite source code itself, warnings,
64# if any, will be disabled from within it.
65#
66!IFNDEF NO_WARN
67!IF $(USE_FULLWARN)!=0
68NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206
69NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4305 -wd4306 -wd4702 -wd4706
70!ENDIF
71!ENDIF
72
73# Set this non-0 to use the library paths and other options necessary for
74# Windows Phone 8.1.
75#
76!IFNDEF USE_WP81_OPTS
77USE_WP81_OPTS = 0
78!ENDIF
79
80# Set this non-0 to split the SQLite amalgamation file into chunks to
81# be used for debugging with Visual Studio.
82#
83!IFNDEF SPLIT_AMALGAMATION
84SPLIT_AMALGAMATION = 0
85!ENDIF
86
87# <<mark>>
88# Set this non-0 to use the International Components for Unicode (ICU).
89#
90!IFNDEF USE_ICU
91USE_ICU = 0
92!ENDIF
93# <</mark>>
94
95# Set this non-0 to dynamically link to the MSVC runtime library.
96#
97!IFNDEF USE_CRT_DLL
98USE_CRT_DLL = 0
99!ENDIF
100
101# Set this non-0 to link to the RPCRT4 library.
102#
103!IFNDEF USE_RPCRT4_LIB
104USE_RPCRT4_LIB = 0
105!ENDIF
106
107# Set this non-0 to generate assembly code listings for the source code
108# files.
109#
110!IFNDEF USE_LISTINGS
111USE_LISTINGS = 0
112!ENDIF
113
114# Set this non-0 to attempt setting the native compiler automatically
115# for cross-compiling the command line tools needed during the compilation
116# process.
117#
118!IFNDEF XCOMPILE
119XCOMPILE = 0
120!ENDIF
121
122# Set this non-0 to use the native libraries paths for cross-compiling
123# the command line tools needed during the compilation process.
124#
125!IFNDEF USE_NATIVE_LIBPATHS
126USE_NATIVE_LIBPATHS = 0
127!ENDIF
128
129# Set this 0 to skip the compiling and embedding of version resources.
130#
131!IFNDEF USE_RC
132USE_RC = 1
133!ENDIF
134
135# Set this non-0 to compile binaries suitable for the WinRT environment.
136# This setting does not apply to any binaries that require Tcl to operate
137# properly (i.e. the text fixture, etc).
138#
139!IFNDEF FOR_WINRT
140FOR_WINRT = 0
141!ENDIF
142
143# Set this non-0 to compile binaries suitable for the UWP environment.
144# This setting does not apply to any binaries that require Tcl to operate
145# properly (i.e. the text fixture, etc).
146#
147!IFNDEF FOR_UWP
148FOR_UWP = 0
149!ENDIF
150
151# Set this non-0 to compile binaries suitable for the Windows 10 platform.
152#
153!IFNDEF FOR_WIN10
154FOR_WIN10 = 0
155!ENDIF
156
157# <<mark>>
158# Set this non-0 to skip attempting to look for and/or link with the Tcl
159# runtime library.
160#
161!IFNDEF NO_TCL
162NO_TCL = 0
163!ENDIF
164# <</mark>>
165
166# Set this to non-0 to create and use PDBs.
167#
168!IFNDEF SYMBOLS
169SYMBOLS = 1
170!ENDIF
171
172# Set this to non-0 to use the SQLite debugging heap subsystem.
173#
174!IFNDEF MEMDEBUG
175MEMDEBUG = 0
176!ENDIF
177
178# Set this to non-0 to use the Win32 native heap subsystem.
179#
180!IFNDEF WIN32HEAP
181WIN32HEAP = 0
182!ENDIF
183
184# Set this to non-0 to enable OSTRACE() macros, which can be useful when
185# debugging.
186#
187!IFNDEF OSTRACE
188OSTRACE = 0
189!ENDIF
190
191# Set this to one of the following values to enable various debugging
192# features.  Each level includes the debugging options from the previous
193# levels.  Currently, the recognized values for DEBUG are:
194#
195# 0 == NDEBUG: Disables assert() and other runtime diagnostics.
196# 1 == SQLITE_ENABLE_API_ARMOR: extra attempts to detect misuse of the API.
197# 2 == Disables NDEBUG and all optimizations and then enables PDBs.
198# 3 == SQLITE_DEBUG: Enables various diagnostics messages and code.
199# 4 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call.
200# 5 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros.
201# 6 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros.
202#
203!IFNDEF DEBUG
204DEBUG = 0
205!ENDIF
206
207# Enable use of available compiler optimizations?  Normally, this should be
208# non-zero.  Setting this to zero, thus disabling all compiler optimizations,
209# can be useful for testing.
210#
211!IFNDEF OPTIMIZATIONS
212OPTIMIZATIONS = 2
213!ENDIF
214
215# Set this to non-0 to enable support for the session extension.
216#
217!IFNDEF SESSION
218SESSION = 0
219!ENDIF
220
221# Set the source code file to be used by executables and libraries when
222# they need the amalgamation.
223#
224!IFNDEF SQLITE3C
225!IF $(SPLIT_AMALGAMATION)!=0
226SQLITE3C = sqlite3-all.c
227!ELSE
228SQLITE3C = sqlite3.c
229!ENDIF
230!ENDIF
231
232# Set the include code file to be used by executables and libraries when
233# they need SQLite.
234#
235!IFNDEF SQLITE3H
236SQLITE3H = sqlite3.h
237!ENDIF
238
239# This is the name to use for the SQLite dynamic link library (DLL).
240#
241!IFNDEF SQLITE3DLL
242!IF $(FOR_WIN10)!=0
243SQLITE3DLL = winsqlite3.dll
244!ELSE
245SQLITE3DLL = sqlite3.dll
246!ENDIF
247!ENDIF
248
249# This is the name to use for the SQLite import library (LIB).
250#
251!IFNDEF SQLITE3LIB
252!IF $(FOR_WIN10)!=0
253SQLITE3LIB = winsqlite3.lib
254!ELSE
255SQLITE3LIB = sqlite3.lib
256!ENDIF
257!ENDIF
258
259# This is the name to use for the SQLite shell executable (EXE).
260#
261!IFNDEF SQLITE3EXE
262!IF $(FOR_WIN10)!=0
263SQLITE3EXE = winsqlite3shell.exe
264!ELSE
265SQLITE3EXE = sqlite3.exe
266!ENDIF
267!ENDIF
268
269# This is the argument used to set the program database (PDB) file for the
270# SQLite shell executable (EXE).
271#
272!IFNDEF SQLITE3EXEPDB
273!IF $(FOR_WIN10)!=0
274SQLITE3EXEPDB =
275!ELSE
276SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
277!ENDIF
278!ENDIF
279
280# <<mark>>
281# These are the names of the customized Tcl header files used by various parts
282# of this makefile when the stdcall calling convention is in use.  It is not
283# used for any other purpose.
284#
285!IFNDEF SQLITETCLH
286SQLITETCLH = sqlite_tcl.h
287!ENDIF
288
289!IFNDEF SQLITETCLDECLSH
290SQLITETCLDECLSH = sqlite_tclDecls.h
291!ENDIF
292
293# These are the additional targets that the targets that integrate with the
294# Tcl library should depend on when compiling, etc.
295#
296!IFNDEF SQLITE_TCL_DEP
297!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
298SQLITE_TCL_DEP = $(SQLITETCLDECLSH) $(SQLITETCLH)
299!ELSE
300SQLITE_TCL_DEP =
301!ENDIF
302!ENDIF
303# <</mark>>
304
305# These are the "standard" SQLite compilation options used when compiling for
306# the Windows platform.
307#
308!IFNDEF OPT_FEATURE_FLAGS
309!IF $(MINIMAL_AMALGAMATION)==0
310OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
311OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
312!ENDIF
313OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
314!ENDIF
315
316# Should the session extension be enabled?  If so, add compilation options
317# to enable it.
318#
319!IF $(SESSION)!=0
320OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
321OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
322!ENDIF
323
324# These are the "extended" SQLite compilation options used when compiling for
325# the Windows 10 platform.
326#
327!IFNDEF EXT_FEATURE_FLAGS
328!IF $(FOR_WIN10)!=0
329EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS4=1
330EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_SYSTEM_MALLOC=1
331EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_OMIT_LOCALTIME=1
332!ELSE
333EXT_FEATURE_FLAGS =
334!ENDIF
335!ENDIF
336
337###############################################################################
338############################### END OF OPTIONS ################################
339###############################################################################
340
341# When compiling for the Windows 10 platform, the PLATFORM macro must be set
342# to an appropriate value (e.g. x86, x64, arm, arm64, etc).
343#
344!IF $(FOR_WIN10)!=0
345!IFNDEF PLATFORM
346!ERROR Using the FOR_WIN10 option requires a value for PLATFORM.
347!ENDIF
348!ENDIF
349
350# This assumes that MSVC is always installed in 32-bit Program Files directory
351# and sets the variable for use in locating other 32-bit installs accordingly.
352#
353PROGRAMFILES_X86 = $(VCINSTALLDIR)\..\..
354PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)
355
356# Check for the predefined command macro CC.  This should point to the compiler
357# binary for the target platform.  If it is not defined, simply define it to
358# the legacy default value 'cl.exe'.
359#
360!IFNDEF CC
361CC = cl.exe
362!ENDIF
363
364# Check for the predefined command macro CSC.  This should point to a working
365# C Sharp compiler binary.  If it is not defined, simply define it to the
366# legacy default value 'csc.exe'.
367#
368!IFNDEF CSC
369CSC = csc.exe
370!ENDIF
371
372# Check for the command macro LD.  This should point to the linker binary for
373# the target platform.  If it is not defined, simply define it to the legacy
374# default value 'link.exe'.
375#
376!IFNDEF LD
377LD = link.exe
378!ENDIF
379
380# Check for the predefined command macro RC.  This should point to the resource
381# compiler binary for the target platform.  If it is not defined, simply define
382# it to the legacy default value 'rc.exe'.
383#
384!IFNDEF RC
385RC = rc.exe
386!ENDIF
387
388# Check for the MSVC runtime library path macro.  Otherwise, this value will
389# default to the 'lib' directory underneath the MSVC installation directory.
390#
391!IFNDEF CRTLIBPATH
392CRTLIBPATH = $(VCINSTALLDIR)\lib
393!ENDIF
394
395CRTLIBPATH = $(CRTLIBPATH:\\=\)
396
397# Check for the command macro NCC.  This should point to the compiler binary
398# for the platform the compilation process is taking place on.  If it is not
399# defined, simply define it to have the same value as the CC macro.  When
400# cross-compiling, it is suggested that this macro be modified via the command
401# line (since nmake itself does not provide a built-in method to guess it).
402# For example, to use the x86 compiler when cross-compiling for x64, a command
403# line similar to the following could be used (all on one line):
404#
405#     nmake /f Makefile.msc sqlite3.dll
406#           XCOMPILE=1 USE_NATIVE_LIBPATHS=1
407#
408# Alternatively, the full path and file name to the compiler binary for the
409# platform the compilation process is taking place may be specified (all on
410# one line):
411#
412#     nmake /f Makefile.msc sqlite3.dll
413#           "NCC=""%VCINSTALLDIR%\bin\cl.exe"""
414#           USE_NATIVE_LIBPATHS=1
415#
416!IFDEF NCC
417NCC = $(NCC:\\=\)
418!ELSEIF $(XCOMPILE)!=0
419NCC = "$(VCINSTALLDIR)\bin\$(CC)"
420NCC = $(NCC:\\=\)
421!ELSE
422NCC = $(CC)
423!ENDIF
424
425# Check for the MSVC native runtime library path macro.  Otherwise,
426# this value will default to the 'lib' directory underneath the MSVC
427# installation directory.
428#
429!IFNDEF NCRTLIBPATH
430NCRTLIBPATH = $(VCINSTALLDIR)\lib
431!ENDIF
432
433NCRTLIBPATH = $(NCRTLIBPATH:\\=\)
434
435# Check for the Platform SDK library path macro.  Otherwise, this
436# value will default to the 'lib' directory underneath the Windows
437# SDK installation directory (the environment variable used appears
438# to be available when using Visual C++ 2008 or later via the
439# command line).
440#
441!IFNDEF NSDKLIBPATH
442NSDKLIBPATH = $(WINDOWSSDKDIR)\lib
443!ENDIF
444
445NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
446
447# Check for the UCRT library path macro.  Otherwise, this value will
448# default to the version-specific, platform-specific 'lib' directory
449# underneath the Windows SDK installation directory.
450#
451!IFNDEF UCRTLIBPATH
452UCRTLIBPATH = $(WINDOWSSDKDIR)\lib\$(WINDOWSSDKLIBVERSION)\ucrt\$(PLATFORM)
453!ENDIF
454
455UCRTLIBPATH = $(UCRTLIBPATH:\\=\)
456
457# C compiler and options for use in building executables that
458# will run on the platform that is doing the build.
459#
460!IF $(USE_FULLWARN)!=0
461BCC = $(NCC) -nologo -W4 $(CCOPTS) $(BCCOPTS)
462!ELSE
463BCC = $(NCC) -nologo -W3 $(CCOPTS) $(BCCOPTS)
464!ENDIF
465
466# Check if assembly code listings should be generated for the source
467# code files to be compiled.
468#
469!IF $(USE_LISTINGS)!=0
470BCC = $(BCC) -FAcs
471!ENDIF
472
473# Check if the native library paths should be used when compiling
474# the command line tools used during the compilation process.  If
475# so, set the necessary macro now.
476#
477!IF $(USE_NATIVE_LIBPATHS)!=0
478NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
479
480!IFDEF NUCRTLIBPATH
481NUCRTLIBPATH = $(NUCRTLIBPATH:\\=\)
482NLTLIBPATHS = $(NLTLIBPATHS) "/LIBPATH:$(NUCRTLIBPATH)"
483!ENDIF
484!ENDIF
485
486# C compiler and options for use in building executables that
487# will run on the target platform.  (BCC and TCC are usually the
488# same unless your are cross-compiling.)
489#
490!IF $(USE_FULLWARN)!=0
491TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $(TCCOPTS)
492!ELSE
493TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)
494!ENDIF
495
496TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise
497RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src $(RCOPTS) $(RCCOPTS)
498
499# Check if we want to use the "stdcall" calling convention when compiling.
500# This is not supported by the compilers for non-x86 platforms.  It should
501# also be noted here that building any target with these "stdcall" options
502# will most likely fail if the Tcl library is also required.  This is due
503# to how the Tcl library functions are declared and exported (i.e. without
504# an explicit calling convention, which results in "cdecl").
505#
506!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
507!IF "$(PLATFORM)"=="x86"
508CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
509SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
510# <<mark>>
511TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl
512# <</mark>>
513!ELSE
514!IFNDEF PLATFORM
515CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
516SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
517# <<mark>>
518TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl
519# <</mark>>
520!ELSE
521CORE_CCONV_OPTS =
522SHELL_CCONV_OPTS =
523# <<mark>>
524TEST_CCONV_OPTS =
525# <</mark>>
526!ENDIF
527!ENDIF
528!ELSE
529CORE_CCONV_OPTS =
530SHELL_CCONV_OPTS =
531# <<mark>>
532TEST_CCONV_OPTS =
533# <</mark>>
534!ENDIF
535
536# These are additional compiler options used for the core library.
537#
538!IFNDEF CORE_COMPILE_OPTS
539!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
540CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)
541!ELSE
542CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
543!ENDIF
544!ENDIF
545
546# These are the additional targets that the core library should depend on
547# when linking.
548#
549!IFNDEF CORE_LINK_DEP
550!IF $(DYNAMIC_SHELL)!=0
551CORE_LINK_DEP =
552!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
553CORE_LINK_DEP = sqlite3.def
554!ELSE
555CORE_LINK_DEP =
556!ENDIF
557!ENDIF
558
559# These are additional linker options used for the core library.
560#
561!IFNDEF CORE_LINK_OPTS
562!IF $(DYNAMIC_SHELL)!=0
563CORE_LINK_OPTS =
564!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
565CORE_LINK_OPTS = /DEF:sqlite3.def
566!ELSE
567CORE_LINK_OPTS =
568!ENDIF
569!ENDIF
570
571# These are additional compiler options used for the shell executable.
572#
573!IFNDEF SHELL_COMPILE_OPTS
574!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
575SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)
576!ELSE
577SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)
578!ENDIF
579!ENDIF
580
581# This is the source code that the shell executable should be compiled
582# with.
583#
584!IFNDEF SHELL_CORE_SRC
585!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
586SHELL_CORE_SRC =
587!ELSE
588SHELL_CORE_SRC = $(SQLITE3C)
589!ENDIF
590!ENDIF
591
592# This is the core library that the shell executable should depend on.
593#
594!IFNDEF SHELL_CORE_DEP
595!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
596SHELL_CORE_DEP = $(SQLITE3DLL)
597!ELSE
598SHELL_CORE_DEP =
599!ENDIF
600!ENDIF
601
602# This is the core library that the shell executable should link with.
603#
604!IFNDEF SHELL_CORE_LIB
605!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
606SHELL_CORE_LIB = $(SQLITE3LIB)
607!ELSE
608SHELL_CORE_LIB =
609!ENDIF
610!ENDIF
611
612# These are additional linker options used for the shell executable.
613#
614!IFNDEF SHELL_LINK_OPTS
615SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
616!ENDIF
617
618# Check if assembly code listings should be generated for the source
619# code files to be compiled.
620#
621!IF $(USE_LISTINGS)!=0
622TCC = $(TCC) -FAcs
623!ENDIF
624
625# When compiling the library for use in the WinRT environment,
626# the following compile-time options must be used as well to
627# disable use of Win32 APIs that are not available and to enable
628# use of Win32 APIs that are specific to Windows 8 and/or WinRT.
629#
630!IF $(FOR_WINRT)!=0
631TCC = $(TCC) -DSQLITE_OS_WINRT=1
632RCC = $(RCC) -DSQLITE_OS_WINRT=1
633TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
634RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
635!ENDIF
636
637# C compiler options for the Windows 10 platform (needs MSVC 2015).
638#
639!IF $(FOR_WIN10)!=0
640TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
641BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
642!ENDIF
643
644# Also, we need to dynamically link to the correct MSVC runtime
645# when compiling for WinRT (e.g. debug or release) OR if the
646# USE_CRT_DLL option is set to force dynamically linking to the
647# MSVC runtime library.
648#
649!IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
650!IF $(DEBUG)>1
651TCC = $(TCC) -MDd
652BCC = $(BCC) -MDd
653!ELSE
654TCC = $(TCC) -MD
655BCC = $(BCC) -MD
656!ENDIF
657!ELSE
658!IF $(DEBUG)>1
659TCC = $(TCC) -MTd
660BCC = $(BCC) -MTd
661!ELSE
662TCC = $(TCC) -MT
663BCC = $(BCC) -MT
664!ENDIF
665!ENDIF
666
667# <<mark>>
668# The mksqlite3c.tcl and mksqlite3h.tcl scripts will pull in
669# any extension header files by default.  For non-amalgamation
670# builds, we need to make sure the compiler can find these.
671#
672!IF $(USE_AMALGAMATION)==0
673TCC = $(TCC) -I$(TOP)\ext\fts3
674RCC = $(RCC) -I$(TOP)\ext\fts3
675TCC = $(TCC) -I$(TOP)\ext\rtree
676RCC = $(RCC) -I$(TOP)\ext\rtree
677TCC = $(TCC) -I$(TOP)\ext\session
678RCC = $(RCC) -I$(TOP)\ext\session
679!ENDIF
680
681# The mksqlite3c.tcl script accepts some options on the command
682# line.  When compiling with debugging enabled, some of these
683# options are necessary in order to allow debugging symbols to
684# work correctly with Visual Studio when using the amalgamation.
685#
686!IFNDEF MKSQLITE3C_TOOL
687!IF $(MINIMAL_AMALGAMATION)!=0
688MKSQLITE3C_TOOL = $(TOP)\tool\mksqlite3c-noext.tcl
689!ELSE
690MKSQLITE3C_TOOL = $(TOP)\tool\mksqlite3c.tcl
691!ENDIF
692!ENDIF
693
694!IFNDEF MKSQLITE3C_ARGS
695!IF $(DEBUG)>1
696MKSQLITE3C_ARGS = --linemacros
697!ELSE
698MKSQLITE3C_ARGS =
699!ENDIF
700!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
701MKSQLITE3C_ARGS = $(MKSQLITE3C_ARGS) --useapicall
702!ENDIF
703!ENDIF
704
705# The mksqlite3h.tcl script accepts some options on the command line.
706# When compiling with stdcall support, some of these options are
707# necessary.
708#
709!IFNDEF MKSQLITE3H_ARGS
710!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
711MKSQLITE3H_ARGS = --useapicall
712!ELSE
713MKSQLITE3H_ARGS =
714!ENDIF
715!ENDIF
716# <</mark>>
717
718# Define -DNDEBUG to compile without debugging (i.e., for production usage)
719# Omitting the define will cause extra debugging code to be inserted and
720# includes extra comments when "EXPLAIN stmt" is used.
721#
722!IF $(DEBUG)==0
723TCC = $(TCC) -DNDEBUG
724BCC = $(BCC) -DNDEBUG
725RCC = $(RCC) -DNDEBUG
726!ENDIF
727
728!IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0
729TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1
730RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
731!ENDIF
732
733!IF $(DEBUG)>2
734TCC = $(TCC) -DSQLITE_DEBUG=1
735RCC = $(RCC) -DSQLITE_DEBUG=1
736!ENDIF
737
738!IF $(DEBUG)>4 || $(OSTRACE)!=0
739TCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
740RCC = $(RCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
741!ENDIF
742
743!IF $(DEBUG)>5
744TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE=1
745RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE=1
746!ENDIF
747
748# Prevent warnings about "insecure" MSVC runtime library functions
749# being used.
750#
751TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
752BCC = $(BCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
753RCC = $(RCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
754
755# Prevent warnings about "deprecated" POSIX functions being used.
756#
757TCC = $(TCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
758BCC = $(BCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
759RCC = $(RCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
760
761# Use the SQLite debugging heap subsystem?
762#
763!IF $(MEMDEBUG)!=0
764TCC = $(TCC) -DSQLITE_MEMDEBUG=1
765RCC = $(RCC) -DSQLITE_MEMDEBUG=1
766
767# Use native Win32 heap subsystem instead of malloc/free?
768#
769!ELSEIF $(WIN32HEAP)!=0
770TCC = $(TCC) -DSQLITE_WIN32_MALLOC=1
771RCC = $(RCC) -DSQLITE_WIN32_MALLOC=1
772
773# Validate the heap on every call into the native Win32 heap subsystem?
774#
775!IF $(DEBUG)>3
776TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
777RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
778!ENDIF
779!ENDIF
780
781# <<mark>>
782# The locations of the Tcl header and library files.  Also, the library that
783# non-stubs enabled programs using Tcl must link against.  These variables
784# (TCLINCDIR, TCLLIBDIR, and LIBTCL) may be overridden via the environment
785# prior to running nmake in order to match the actual installed location and
786# version on this machine.
787#
788!IFNDEF TCLINCDIR
789TCLINCDIR = c:\tcl\include
790!ENDIF
791
792!IFNDEF TCLLIBDIR
793TCLLIBDIR = c:\tcl\lib
794!ENDIF
795
796!IFNDEF LIBTCL
797LIBTCL = tcl85.lib
798!ENDIF
799
800!IFNDEF LIBTCLSTUB
801LIBTCLSTUB = tclstub85.lib
802!ENDIF
803
804!IFNDEF LIBTCLPATH
805LIBTCLPATH = c:\tcl\bin
806!ENDIF
807
808# The locations of the ICU header and library files.  These variables
809# (ICUINCDIR, ICULIBDIR, and LIBICU) may be overridden via the environment
810# prior to running nmake in order to match the actual installed location on
811# this machine.
812#
813!IFNDEF ICUINCDIR
814ICUINCDIR = c:\icu\include
815!ENDIF
816
817!IFNDEF ICULIBDIR
818ICULIBDIR = c:\icu\lib
819!ENDIF
820
821!IFNDEF LIBICU
822LIBICU = icuuc.lib icuin.lib
823!ENDIF
824
825# This is the command to use for tclsh - normally just "tclsh", but we may
826# know the specific version we want to use.  This variable (TCLSH_CMD) may be
827# overridden via the environment prior to running nmake in order to select a
828# specific Tcl shell to use.
829#
830!IFNDEF TCLSH_CMD
831TCLSH_CMD = tclsh85
832!ENDIF
833# <</mark>>
834
835# Compiler options needed for programs that use the readline() library.
836#
837!IFNDEF READLINE_FLAGS
838READLINE_FLAGS = -DHAVE_READLINE=0
839!ENDIF
840
841# The library that programs using readline() must link against.
842#
843!IFNDEF LIBREADLINE
844LIBREADLINE =
845!ENDIF
846
847# Should the database engine be compiled threadsafe
848#
849TCC = $(TCC) -DSQLITE_THREADSAFE=1
850RCC = $(RCC) -DSQLITE_THREADSAFE=1
851
852# Do threads override each others locks by default (1), or do we test (-1)
853#
854TCC = $(TCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
855RCC = $(RCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
856
857# Any target libraries which libsqlite must be linked against
858#
859!IFNDEF TLIBS
860TLIBS =
861!ENDIF
862
863# Flags controlling use of the in memory btree implementation
864#
865# SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
866# default to file, 2 to default to memory, and 3 to force temporary
867# tables to always be in memory.
868#
869TCC = $(TCC) -DSQLITE_TEMP_STORE=1
870RCC = $(RCC) -DSQLITE_TEMP_STORE=1
871
872# Enable/disable loadable extensions, and other optional features
873# based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).
874# The same set of OMIT and ENABLE flags should be passed to the
875# LEMON parser generator and the mkkeywordhash tool as well.
876
877# These are the required SQLite compilation options used when compiling for
878# the Windows platform.
879#
880REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=100
881
882# If we are linking to the RPCRT4 library, enable features that need it.
883#
884!IF $(USE_RPCRT4_LIB)!=0
885REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_WIN32_USE_UUID=1
886!ENDIF
887
888# Add the required and optional SQLite compilation options into the command
889# lines used to invoke the MSVC code and resource compilers.
890#
891TCC = $(TCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
892RCC = $(RCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
893
894# Add in any optional parameters specified on the commane line, e.g.
895# nmake /f Makefile.msc all "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1"
896#
897TCC = $(TCC) $(OPTS)
898RCC = $(RCC) $(OPTS)
899
900# If compiling for debugging, add some defines.
901#
902!IF $(DEBUG)>1
903TCC = $(TCC) -D_DEBUG
904BCC = $(BCC) -D_DEBUG
905RCC = $(RCC) -D_DEBUG
906!ENDIF
907
908# If optimizations are enabled or disabled (either implicitly or
909# explicitly), add the necessary flags.
910#
911!IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
912TCC = $(TCC) -Od
913BCC = $(BCC) -Od
914!IF $(USE_RUNTIME_CHECKS)!=0
915TCC = $(TCC) -RTC1
916BCC = $(BCC) -RTC1
917!ENDIF
918!ELSEIF $(OPTIMIZATIONS)>=3
919TCC = $(TCC) -Ox
920BCC = $(BCC) -Ox
921!ELSEIF $(OPTIMIZATIONS)==2
922TCC = $(TCC) -O2
923BCC = $(BCC) -O2
924!ELSEIF $(OPTIMIZATIONS)==1
925TCC = $(TCC) -O1
926BCC = $(BCC) -O1
927!ENDIF
928
929# If symbols are enabled (or compiling for debugging), enable PDBs.
930#
931!IF $(DEBUG)>1 || $(SYMBOLS)!=0
932TCC = $(TCC) -Zi
933BCC = $(BCC) -Zi
934!ENDIF
935
936# <<mark>>
937# If ICU support is enabled, add the compiler options for it.
938#
939!IF $(USE_ICU)!=0
940TCC = $(TCC) -DSQLITE_ENABLE_ICU=1
941RCC = $(RCC) -DSQLITE_ENABLE_ICU=1
942TCC = $(TCC) -I$(TOP)\ext\icu
943RCC = $(RCC) -I$(TOP)\ext\icu
944TCC = $(TCC) -I$(ICUINCDIR)
945RCC = $(RCC) -I$(ICUINCDIR)
946!ENDIF
947# <</mark>>
948
949# Command line prefixes for compiling code, compiling resources,
950# linking, etc.
951#
952LTCOMPILE = $(TCC) -Fo$@
953LTRCOMPILE = $(RCC) -r
954LTLIB = lib.exe
955LTLINK = $(TCC) -Fe$@
956
957# If requested, link to the RPCRT4 library.
958#
959!IF $(USE_RPCRT4_LIB)!=0
960LTLINK = $(LTLINK) rpcrt4.lib
961!ENDIF
962
963# If a platform was set, force the linker to target that.
964# Note that the vcvars*.bat family of batch files typically
965# set this for you.  Otherwise, the linker will attempt
966# to deduce the binary type based on the object files.
967!IFDEF PLATFORM
968LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
969LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
970!ELSE
971LTLINKOPTS = /NOLOGO
972LTLIBOPTS = /NOLOGO
973!ENDIF
974
975# When compiling for use in the WinRT environment, the following
976# linker option must be used to mark the executable as runnable
977# only in the context of an application container.
978#
979!IF $(FOR_WINRT)!=0
980LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
981!IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0"
982!IFNDEF STORELIBPATH
983!IF "$(PLATFORM)"=="x86"
984STORELIBPATH = $(CRTLIBPATH)\store
985!ELSEIF "$(PLATFORM)"=="x64"
986STORELIBPATH = $(CRTLIBPATH)\store\amd64
987!ELSEIF "$(PLATFORM)"=="ARM"
988STORELIBPATH = $(CRTLIBPATH)\store\arm
989!ELSE
990STORELIBPATH = $(CRTLIBPATH)\store
991!ENDIF
992!ENDIF
993STORELIBPATH = $(STORELIBPATH:\\=\)
994LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
995!ENDIF
996!ENDIF
997
998# When compiling for Windows Phone 8.1, an extra library path is
999# required.
1000#
1001!IF $(USE_WP81_OPTS)!=0
1002!IFNDEF WP81LIBPATH
1003!IF "$(PLATFORM)"=="x86"
1004WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
1005!ELSEIF "$(PLATFORM)"=="ARM"
1006WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM
1007!ELSE
1008WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
1009!ENDIF
1010!ENDIF
1011!ENDIF
1012
1013# When compiling for Windows Phone 8.1, some extra linker options
1014# are also required.
1015#
1016!IF $(USE_WP81_OPTS)!=0
1017!IFDEF WP81LIBPATH
1018LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
1019!ENDIF
1020LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
1021LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
1022LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
1023!ENDIF
1024
1025# When compiling for UWP or the Windows 10 platform, some extra linker
1026# options are also required.
1027#
1028!IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0
1029LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib
1030LTLINKOPTS = $(LTLINKOPTS) mincore.lib
1031!IFDEF PSDKLIBPATH
1032LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)"
1033!ENDIF
1034!ENDIF
1035
1036!IF $(FOR_WIN10)!=0
1037LTLINKOPTS = $(LTLINKOPTS) /guard:cf "/LIBPATH:$(UCRTLIBPATH)"
1038!IF $(DEBUG)>1
1039LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib
1040!ELSE
1041LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
1042!ENDIF
1043!ENDIF
1044
1045# If either debugging or symbols are enabled, enable PDBs.
1046#
1047!IF $(DEBUG)>1 || $(SYMBOLS)!=0
1048LDFLAGS = /DEBUG $(LDOPTS)
1049!ELSE
1050LDFLAGS = $(LDOPTS)
1051!ENDIF
1052
1053# <<mark>>
1054# Start with the Tcl related linker options.
1055#
1056!IF $(NO_TCL)==0
1057LTLIBPATHS = /LIBPATH:$(TCLLIBDIR)
1058LTLIBS = $(LIBTCL)
1059!ENDIF
1060
1061# If ICU support is enabled, add the linker options for it.
1062#
1063!IF $(USE_ICU)!=0
1064LTLIBPATHS = $(LTLIBPATHS) /LIBPATH:$(ICULIBDIR)
1065LTLIBS = $(LTLIBS) $(LIBICU)
1066!ENDIF
1067# <</mark>>
1068
1069# You should not have to change anything below this line
1070###############################################################################
1071
1072# <<mark>>
1073# Object files for the SQLite library (non-amalgamation).
1074#
1075LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \
1076         backup.lo bitvec.lo btmutex.lo btree.lo build.lo \
1077         callback.lo complete.lo ctime.lo date.lo dbstat.lo delete.lo \
1078         expr.lo fault.lo fkey.lo \
1079         fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo \
1080         fts3_porter.lo fts3_snippet.lo fts3_tokenizer.lo fts3_tokenizer1.lo \
1081         fts3_tokenize_vtab.lo fts3_unicode.lo fts3_unicode2.lo fts3_write.lo \
1082         fts5.lo \
1083         func.lo global.lo hash.lo \
1084         icu.lo insert.lo legacy.lo loadext.lo \
1085         main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
1086         memjournal.lo \
1087         mutex.lo mutex_noop.lo mutex_unix.lo mutex_w32.lo \
1088         notify.lo opcodes.lo os.lo os_unix.lo os_win.lo \
1089         pager.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
1090         random.lo resolve.lo rowset.lo rtree.lo \
1091         sqlite3session.lo select.lo sqlite3rbu.lo status.lo \
1092         table.lo threads.lo tokenize.lo treeview.lo trigger.lo \
1093         update.lo util.lo vacuum.lo \
1094         vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
1095         vdbetrace.lo wal.lo walker.lo where.lo wherecode.lo whereexpr.lo \
1096         utf.lo vtab.lo
1097# <</mark>>
1098
1099# Object files for the amalgamation.
1100#
1101LIBOBJS1 = sqlite3.lo
1102
1103# Determine the real value of LIBOBJ based on the 'configure' script
1104#
1105# <<mark>>
1106!IF $(USE_AMALGAMATION)==0
1107LIBOBJ = $(LIBOBJS0)
1108!ELSE
1109# <</mark>>
1110LIBOBJ = $(LIBOBJS1)
1111# <<mark>>
1112!ENDIF
1113# <</mark>>
1114
1115# Determine if embedded resource compilation and usage are enabled.
1116#
1117!IF $(USE_RC)!=0
1118LIBRESOBJS = sqlite3res.lo
1119!ELSE
1120LIBRESOBJS =
1121!ENDIF
1122
1123# <<mark>>
1124# Core source code files, part 1.
1125#
1126SRC00 = \
1127  $(TOP)\src\alter.c \
1128  $(TOP)\src\analyze.c \
1129  $(TOP)\src\attach.c \
1130  $(TOP)\src\auth.c \
1131  $(TOP)\src\backup.c \
1132  $(TOP)\src\bitvec.c \
1133  $(TOP)\src\btmutex.c \
1134  $(TOP)\src\btree.c \
1135  $(TOP)\src\build.c \
1136  $(TOP)\src\callback.c \
1137  $(TOP)\src\complete.c \
1138  $(TOP)\src\ctime.c \
1139  $(TOP)\src\date.c \
1140  $(TOP)\src\dbstat.c \
1141  $(TOP)\src\delete.c \
1142  $(TOP)\src\expr.c \
1143  $(TOP)\src\fault.c \
1144  $(TOP)\src\fkey.c \
1145  $(TOP)\src\func.c \
1146  $(TOP)\src\global.c \
1147  $(TOP)\src\hash.c \
1148  $(TOP)\src\insert.c \
1149  $(TOP)\src\legacy.c \
1150  $(TOP)\src\loadext.c \
1151  $(TOP)\src\main.c \
1152  $(TOP)\src\malloc.c \
1153  $(TOP)\src\mem0.c \
1154  $(TOP)\src\mem1.c \
1155  $(TOP)\src\mem2.c \
1156  $(TOP)\src\mem3.c \
1157  $(TOP)\src\mem5.c \
1158  $(TOP)\src\memjournal.c \
1159  $(TOP)\src\mutex.c \
1160  $(TOP)\src\mutex_noop.c \
1161  $(TOP)\src\mutex_unix.c \
1162  $(TOP)\src\mutex_w32.c \
1163  $(TOP)\src\notify.c \
1164  $(TOP)\src\os.c \
1165  $(TOP)\src\os_unix.c \
1166  $(TOP)\src\os_win.c
1167
1168# Core source code files, part 2.
1169#
1170SRC01 = \
1171  $(TOP)\src\pager.c \
1172  $(TOP)\src\pcache.c \
1173  $(TOP)\src\pcache1.c \
1174  $(TOP)\src\pragma.c \
1175  $(TOP)\src\prepare.c \
1176  $(TOP)\src\printf.c \
1177  $(TOP)\src\random.c \
1178  $(TOP)\src\resolve.c \
1179  $(TOP)\src\rowset.c \
1180  $(TOP)\src\select.c \
1181  $(TOP)\src\status.c \
1182  $(TOP)\src\table.c \
1183  $(TOP)\src\threads.c \
1184  $(TOP)\src\tclsqlite.c \
1185  $(TOP)\src\tokenize.c \
1186  $(TOP)\src\treeview.c \
1187  $(TOP)\src\trigger.c \
1188  $(TOP)\src\utf.c \
1189  $(TOP)\src\update.c \
1190  $(TOP)\src\util.c \
1191  $(TOP)\src\vacuum.c \
1192  $(TOP)\src\vdbe.c \
1193  $(TOP)\src\vdbeapi.c \
1194  $(TOP)\src\vdbeaux.c \
1195  $(TOP)\src\vdbeblob.c \
1196  $(TOP)\src\vdbemem.c \
1197  $(TOP)\src\vdbesort.c \
1198  $(TOP)\src\vdbetrace.c \
1199  $(TOP)\src\vtab.c \
1200  $(TOP)\src\wal.c \
1201  $(TOP)\src\walker.c \
1202  $(TOP)\src\where.c \
1203  $(TOP)\src\wherecode.c \
1204  $(TOP)\src\whereexpr.c
1205
1206# Shell source code files.
1207#
1208SRC02 = \
1209  $(TOP)\src\shell.c
1210
1211# Core miscellaneous files.
1212#
1213SRC03 = \
1214  $(TOP)\src\parse.y
1215
1216# Core header files, part 1.
1217#
1218SRC04 = \
1219  $(TOP)\src\btree.h \
1220  $(TOP)\src\btreeInt.h \
1221  $(TOP)\src\hash.h \
1222  $(TOP)\src\hwtime.h \
1223  $(TOP)\src\msvc.h \
1224  $(TOP)\src\mutex.h \
1225  $(TOP)\src\os.h \
1226  $(TOP)\src\os_common.h \
1227  $(TOP)\src\os_setup.h \
1228  $(TOP)\src\os_win.h
1229
1230# Core header files, part 2.
1231#
1232SRC05 = \
1233  $(TOP)\src\pager.h \
1234  $(TOP)\src\pcache.h \
1235  $(TOP)\src\pragma.h \
1236  $(TOP)\src\sqlite.h.in \
1237  $(TOP)\src\sqlite3ext.h \
1238  $(TOP)\src\sqliteInt.h \
1239  $(TOP)\src\sqliteLimit.h \
1240  $(TOP)\src\vdbe.h \
1241  $(TOP)\src\vdbeInt.h \
1242  $(TOP)\src\vxworks.h \
1243  $(TOP)\src\wal.h \
1244  $(TOP)\src\whereInt.h
1245
1246# Extension source code files, part 1.
1247#
1248SRC06 = \
1249  $(TOP)\ext\fts1\fts1.c \
1250  $(TOP)\ext\fts1\fts1_hash.c \
1251  $(TOP)\ext\fts1\fts1_porter.c \
1252  $(TOP)\ext\fts1\fts1_tokenizer1.c \
1253  $(TOP)\ext\fts2\fts2.c \
1254  $(TOP)\ext\fts2\fts2_hash.c \
1255  $(TOP)\ext\fts2\fts2_icu.c \
1256  $(TOP)\ext\fts2\fts2_porter.c \
1257  $(TOP)\ext\fts2\fts2_tokenizer.c \
1258  $(TOP)\ext\fts2\fts2_tokenizer1.c
1259
1260# Extension source code files, part 2.
1261#
1262SRC07 = \
1263  $(TOP)\ext\fts3\fts3.c \
1264  $(TOP)\ext\fts3\fts3_aux.c \
1265  $(TOP)\ext\fts3\fts3_expr.c \
1266  $(TOP)\ext\fts3\fts3_hash.c \
1267  $(TOP)\ext\fts3\fts3_icu.c \
1268  $(TOP)\ext\fts3\fts3_porter.c \
1269  $(TOP)\ext\fts3\fts3_snippet.c \
1270  $(TOP)\ext\fts3\fts3_tokenizer.c \
1271  $(TOP)\ext\fts3\fts3_tokenizer1.c \
1272  $(TOP)\ext\fts3\fts3_tokenize_vtab.c \
1273  $(TOP)\ext\fts3\fts3_unicode.c \
1274  $(TOP)\ext\fts3\fts3_unicode2.c \
1275  $(TOP)\ext\fts3\fts3_write.c \
1276  $(TOP)\ext\icu\icu.c \
1277  $(TOP)\ext\rtree\rtree.c \
1278  $(TOP)\ext\session\sqlite3session.c \
1279  $(TOP)\ext\rbu\sqlite3rbu.c \
1280  $(TOP)\ext\misc\json1.c
1281
1282# Extension header files, part 1.
1283#
1284SRC08 = \
1285  $(TOP)\ext\fts1\fts1.h \
1286  $(TOP)\ext\fts1\fts1_hash.h \
1287  $(TOP)\ext\fts1\fts1_tokenizer.h \
1288  $(TOP)\ext\fts2\fts2.h \
1289  $(TOP)\ext\fts2\fts2_hash.h \
1290  $(TOP)\ext\fts2\fts2_tokenizer.h
1291
1292# Extension header files, part 2.
1293#
1294SRC09 = \
1295  $(TOP)\ext\fts3\fts3.h \
1296  $(TOP)\ext\fts3\fts3Int.h \
1297  $(TOP)\ext\fts3\fts3_hash.h \
1298  $(TOP)\ext\fts3\fts3_tokenizer.h \
1299  $(TOP)\ext\icu\sqliteicu.h \
1300  $(TOP)\ext\rtree\rtree.h \
1301  $(TOP)\ext\rbu\sqlite3rbu.h \
1302  $(TOP)\ext\session\sqlite3session.h
1303
1304# Generated source code files
1305#
1306SRC10 = \
1307  opcodes.c \
1308  parse.c
1309
1310# Generated header files
1311#
1312SRC11 = \
1313  keywordhash.h \
1314  opcodes.h \
1315  parse.h \
1316  $(SQLITE3H)
1317
1318# Generated Tcl header files
1319#
1320!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
1321SRC12 = \
1322  $(SQLITETCLH) \
1323  $(SQLITETCLDECLSH)
1324!ELSE
1325SRC12 =
1326!ENDIF
1327
1328# All source code files.
1329#
1330SRC = $(SRC00) $(SRC01) $(SRC02) $(SRC03) $(SRC04) $(SRC05) $(SRC06) $(SRC07) $(SRC08) $(SRC09) $(SRC10) $(SRC11)
1331
1332# Source code to the test files.
1333#
1334TESTSRC = \
1335  $(TOP)\src\test1.c \
1336  $(TOP)\src\test2.c \
1337  $(TOP)\src\test3.c \
1338  $(TOP)\src\test4.c \
1339  $(TOP)\src\test5.c \
1340  $(TOP)\src\test6.c \
1341  $(TOP)\src\test7.c \
1342  $(TOP)\src\test8.c \
1343  $(TOP)\src\test9.c \
1344  $(TOP)\src\test_autoext.c \
1345  $(TOP)\src\test_async.c \
1346  $(TOP)\src\test_backup.c \
1347  $(TOP)\src\test_bestindex.c \
1348  $(TOP)\src\test_blob.c \
1349  $(TOP)\src\test_btree.c \
1350  $(TOP)\src\test_config.c \
1351  $(TOP)\src\test_delete.c \
1352  $(TOP)\src\test_demovfs.c \
1353  $(TOP)\src\test_devsym.c \
1354  $(TOP)\src\test_fs.c \
1355  $(TOP)\src\test_func.c \
1356  $(TOP)\src\test_hexio.c \
1357  $(TOP)\src\test_init.c \
1358  $(TOP)\src\test_intarray.c \
1359  $(TOP)\src\test_journal.c \
1360  $(TOP)\src\test_malloc.c \
1361  $(TOP)\src\test_multiplex.c \
1362  $(TOP)\src\test_mutex.c \
1363  $(TOP)\src\test_onefile.c \
1364  $(TOP)\src\test_osinst.c \
1365  $(TOP)\src\test_pcache.c \
1366  $(TOP)\src\test_quota.c \
1367  $(TOP)\src\test_rtree.c \
1368  $(TOP)\src\test_schema.c \
1369  $(TOP)\src\test_server.c \
1370  $(TOP)\src\test_superlock.c \
1371  $(TOP)\src\test_syscall.c \
1372  $(TOP)\src\test_tclvar.c \
1373  $(TOP)\src\test_thread.c \
1374  $(TOP)\src\test_vfs.c \
1375  $(TOP)\src\test_windirent.c \
1376  $(TOP)\src\test_wsd.c \
1377  $(TOP)\ext\fts3\fts3_term.c \
1378  $(TOP)\ext\fts3\fts3_test.c \
1379  $(TOP)\ext\rbu\test_rbu.c \
1380  $(TOP)\ext\session\test_session.c
1381
1382# Statically linked extensions.
1383#
1384TESTEXT = \
1385  $(TOP)\ext\misc\amatch.c \
1386  $(TOP)\ext\misc\carray.c \
1387  $(TOP)\ext\misc\closure.c \
1388  $(TOP)\ext\misc\csv.c \
1389  $(TOP)\ext\misc\eval.c \
1390  $(TOP)\ext\misc\fileio.c \
1391  $(TOP)\ext\misc\fuzzer.c \
1392  $(TOP)\ext\fts5\fts5_tcl.c \
1393  $(TOP)\ext\fts5\fts5_test_mi.c \
1394  $(TOP)\ext\fts5\fts5_test_tok.c \
1395  $(TOP)\ext\misc\ieee754.c \
1396  $(TOP)\ext\misc\nextchar.c \
1397  $(TOP)\ext\misc\percentile.c \
1398  $(TOP)\ext\misc\regexp.c \
1399  $(TOP)\ext\misc\series.c \
1400  $(TOP)\ext\misc\spellfix.c \
1401  $(TOP)\ext\misc\totype.c \
1402  $(TOP)\ext\misc\wholenumber.c
1403
1404# Source code to the library files needed by the test fixture
1405# (non-amalgamation)
1406#
1407TESTSRC2 = \
1408  $(SRC00) \
1409  $(SRC01) \
1410  $(SRC06) \
1411  $(SRC07) \
1412  $(SRC10) \
1413  $(TOP)\ext\async\sqlite3async.c
1414
1415# Header files used by all library source files.
1416#
1417HDR = \
1418   $(TOP)\src\btree.h \
1419   $(TOP)\src\btreeInt.h \
1420   $(TOP)\src\hash.h \
1421   $(TOP)\src\hwtime.h \
1422   keywordhash.h \
1423   $(TOP)\src\msvc.h \
1424   $(TOP)\src\mutex.h \
1425   opcodes.h \
1426   $(TOP)\src\os.h \
1427   $(TOP)\src\os_common.h \
1428   $(TOP)\src\os_setup.h \
1429   $(TOP)\src\os_win.h \
1430   $(TOP)\src\pager.h \
1431   $(TOP)\src\pcache.h \
1432   parse.h \
1433   $(TOP)\src\pragma.h \
1434   $(SQLITE3H) \
1435   sqlite3ext.h \
1436   $(TOP)\src\sqliteInt.h \
1437   $(TOP)\src\sqliteLimit.h \
1438   $(TOP)\src\vdbe.h \
1439   $(TOP)\src\vdbeInt.h \
1440   $(TOP)\src\vxworks.h \
1441   $(TOP)\src\whereInt.h
1442
1443# Header files used by extensions
1444#
1445EXTHDR = $(EXTHDR) \
1446  $(TOP)\ext\fts1\fts1.h \
1447  $(TOP)\ext\fts1\fts1_hash.h \
1448  $(TOP)\ext\fts1\fts1_tokenizer.h
1449EXTHDR = $(EXTHDR) \
1450  $(TOP)\ext\fts2\fts2.h \
1451  $(TOP)\ext\fts2\fts2_hash.h \
1452  $(TOP)\ext\fts2\fts2_tokenizer.h
1453EXTHDR = $(EXTHDR) \
1454  $(TOP)\ext\fts3\fts3.h \
1455  $(TOP)\ext\fts3\fts3Int.h \
1456  $(TOP)\ext\fts3\fts3_hash.h \
1457  $(TOP)\ext\fts3\fts3_tokenizer.h
1458EXTHDR = $(EXTHDR) \
1459  $(TOP)\ext\rtree\rtree.h
1460EXTHDR = $(EXTHDR) \
1461  $(TOP)\ext\icu\sqliteicu.h
1462EXTHDR = $(EXTHDR) \
1463  $(TOP)\ext\rtree\sqlite3rtree.h
1464EXTHDR = $(EXTHDR) \
1465  $(TOP)\ext\session\sqlite3session.h
1466
1467# executables needed for testing
1468#
1469TESTPROGS = \
1470  testfixture.exe \
1471  $(SQLITE3EXE) \
1472  sqlite3_analyzer.exe \
1473  sqldiff.exe \
1474  dbhash.exe
1475
1476# Databases containing fuzzer test cases
1477#
1478FUZZDATA = \
1479  $(TOP)\test\fuzzdata1.db \
1480  $(TOP)\test\fuzzdata2.db \
1481  $(TOP)\test\fuzzdata3.db \
1482  $(TOP)\test\fuzzdata4.db
1483# <</mark>>
1484
1485# Additional compiler options for the shell.  These are only effective
1486# when the shell is not being dynamically linked.
1487#
1488!IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0
1489SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS
1490!ENDIF
1491
1492# <<mark>>
1493# Extra compiler options for various test tools.
1494#
1495MPTESTER_COMPILE_OPTS = -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS5
1496FUZZERSHELL_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1
1497FUZZCHECK_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5
1498
1499# Standard options to testfixture.
1500#
1501TESTOPTS = --verbose=file --output=test-out.txt
1502
1503# Extra targets for the "all" target that require Tcl.
1504#
1505!IF $(NO_TCL)==0
1506ALL_TCL_TARGETS = libtclsqlite3.lib
1507!ELSE
1508ALL_TCL_TARGETS =
1509!ENDIF
1510# <</mark>>
1511
1512# This is the default Makefile target.  The objects listed here
1513# are what get build when you type just "make" with no arguments.
1514#
1515all:	dll libsqlite3.lib shell $(ALL_TCL_TARGETS)
1516
1517# Dynamic link library section.
1518#
1519dll:	$(SQLITE3DLL)
1520
1521# Shell executable.
1522#
1523shell:	$(SQLITE3EXE)
1524
1525# <<mark>>
1526libsqlite3.lib:	$(LIBOBJ)
1527	$(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
1528
1529libtclsqlite3.lib:	tclsqlite.lo libsqlite3.lib
1530	$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCLSTUB) $(TLIBS)
1531# <</mark>>
1532
1533$(SQLITE3DLL):	$(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
1534	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
1535
1536# <<block2>>
1537sqlite3.def:	libsqlite3.lib
1538	echo EXPORTS > sqlite3.def
1539	dumpbin /all libsqlite3.lib \
1540		| $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3_[^@]*)(?:@\d+)?$$" \1 \
1541		| sort >> sqlite3.def
1542# <</block2>>
1543
1544$(SQLITE3EXE):	$(TOP)\src\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
1545	$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\src\shell.c $(SHELL_CORE_SRC) \
1546		/link $(SQLITE3EXEPDB) $(LDFLAGS) $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
1547
1548# <<mark>>
1549sqldiff.exe:	$(TOP)\tool\sqldiff.c $(SQLITE3C) $(SQLITE3H)
1550	$(LTLINK) $(NO_WARN) $(TOP)\tool\sqldiff.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
1551
1552dbhash.exe:	$(TOP)\tool\dbhash.c $(SQLITE3C) $(SQLITE3H)
1553	$(LTLINK) $(NO_WARN) $(TOP)\tool\dbhash.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
1554
1555scrub.exe:	$(TOP)\ext\misc\scrub.c $(SQLITE3C) $(SQLITE3H)
1556	$(LTLINK) $(NO_WARN) $(TOP)\ext\misc\scrub.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
1557
1558srcck1.exe:	$(TOP)\tool\srcck1.c
1559	$(BCC) $(NO_WARN) -Fe$@ $(TOP)\tool\srcck1.c
1560
1561sourcetest:	srcck1.exe sqlite3.c
1562	srcck1.exe sqlite3.c
1563
1564fuzzershell.exe:	$(TOP)\tool\fuzzershell.c $(SQLITE3C) $(SQLITE3H)
1565	$(LTLINK) $(NO_WARN) $(FUZZERSHELL_COMPILE_OPTS) $(TOP)\tool\fuzzershell.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
1566
1567fuzzcheck.exe:	$(TOP)\test\fuzzcheck.c $(SQLITE3C) $(SQLITE3H)
1568	$(LTLINK) $(NO_WARN) $(FUZZCHECK_COMPILE_OPTS) $(TOP)\test\fuzzcheck.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
1569
1570mptester.exe:	$(TOP)\mptest\mptest.c $(SQLITE3C) $(SQLITE3H)
1571	$(LTLINK) $(NO_WARN) $(MPTESTER_COMPILE_OPTS) $(TOP)\mptest\mptest.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
1572
1573MPTEST1 = mptester mptest.db $(TOP)\mptest\crash01.test --repeat 20
1574MPTEST2 = mptester mptest.db $(TOP)\mptest\multiwrite01.test --repeat 20
1575
1576mptest:	mptester.exe
1577	del /Q mptest.db 2>NUL
1578	$(MPTEST1) --journalmode DELETE
1579	$(MPTEST2) --journalmode WAL
1580	$(MPTEST1) --journalmode WAL
1581	$(MPTEST2) --journalmode PERSIST
1582	$(MPTEST1) --journalmode PERSIST
1583	$(MPTEST2) --journalmode TRUNCATE
1584	$(MPTEST1) --journalmode TRUNCATE
1585	$(MPTEST2) --journalmode DELETE
1586
1587# This target creates a directory named "tsrc" and fills it with
1588# copies of all of the C source code and header files needed to
1589# build on the target system.  Some of the C source code and header
1590# files are automatically generated.  This target takes care of
1591# all that automatic generation.
1592#
1593.target_source:	$(SRC) $(TOP)\tool\vdbe-compress.tcl fts5.c $(SQLITE_TCL_DEP)
1594	-rmdir /Q/S tsrc 2>NUL
1595	-mkdir tsrc
1596	for %i in ($(SRC00)) do copy /Y %i tsrc
1597	for %i in ($(SRC01)) do copy /Y %i tsrc
1598	for %i in ($(SRC02)) do copy /Y %i tsrc
1599	for %i in ($(SRC03)) do copy /Y %i tsrc
1600	for %i in ($(SRC04)) do copy /Y %i tsrc
1601	for %i in ($(SRC05)) do copy /Y %i tsrc
1602	for %i in ($(SRC06)) do copy /Y %i tsrc
1603	for %i in ($(SRC07)) do copy /Y %i tsrc
1604	for %i in ($(SRC08)) do copy /Y %i tsrc
1605	for %i in ($(SRC09)) do copy /Y %i tsrc
1606	for %i in ($(SRC10)) do copy /Y %i tsrc
1607	for %i in ($(SRC11)) do copy /Y %i tsrc
1608	for %i in ($(SRC12)) do copy /Y %i tsrc
1609	copy /Y fts5.c tsrc
1610	copy /Y fts5.h tsrc
1611	del /Q tsrc\sqlite.h.in tsrc\parse.y 2>NUL
1612	$(TCLSH_CMD) $(TOP)\tool\vdbe-compress.tcl $(OPTS) < tsrc\vdbe.c > vdbe.new
1613	move vdbe.new tsrc\vdbe.c
1614	echo > .target_source
1615
1616sqlite3.c:	.target_source sqlite3ext.h $(MKSQLITE3C_TOOL)
1617	$(TCLSH_CMD) $(MKSQLITE3C_TOOL) $(MKSQLITE3C_ARGS)
1618	copy tsrc\shell.c .
1619	copy $(TOP)\ext\session\sqlite3session.h .
1620
1621sqlite3-all.c:	sqlite3.c $(TOP)\tool\split-sqlite3c.tcl
1622	$(TCLSH_CMD) $(TOP)\tool\split-sqlite3c.tcl
1623# <</mark>>
1624
1625# Rule to build the amalgamation
1626#
1627sqlite3.lo:	$(SQLITE3C)
1628	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C)
1629
1630# <<mark>>
1631# Rules to build the LEMON compiler generator
1632#
1633lempar.c:	$(TOP)\tool\lempar.c
1634	copy $(TOP)\tool\lempar.c .
1635
1636lemon.exe:	$(TOP)\tool\lemon.c lempar.c
1637	$(BCC) $(NO_WARN) -Daccess=_access \
1638		-Fe$@ $(TOP)\tool\lemon.c /link $(LDFLAGS) $(NLTLINKOPTS) $(NLTLIBPATHS)
1639
1640# Rules to build individual *.lo files from generated *.c files. This
1641# applies to:
1642#
1643#     parse.lo
1644#     opcodes.lo
1645#
1646parse.lo:	parse.c $(HDR)
1647	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c parse.c
1648
1649opcodes.lo:	opcodes.c
1650	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c opcodes.c
1651# <</mark>>
1652
1653# Rule to build the Win32 resources object file.
1654#
1655!IF $(USE_RC)!=0
1656# <<block1>>
1657$(LIBRESOBJS):	$(TOP)\src\sqlite3.rc $(SQLITE3H)
1658	echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
1659	for /F %%V in ('type "$(TOP)\VERSION"') do ( \
1660		echo #define SQLITE_RESOURCE_VERSION %%V \
1661			| $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact . ^, >> sqlite3rc.h \
1662	)
1663	echo #endif >> sqlite3rc.h
1664	$(LTRCOMPILE) -fo $(LIBRESOBJS) $(TOP)\src\sqlite3.rc
1665# <</block1>>
1666!ENDIF
1667
1668# <<mark>>
1669# Rules to build individual *.lo files from files in the src directory.
1670#
1671alter.lo:	$(TOP)\src\alter.c $(HDR)
1672	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\alter.c
1673
1674analyze.lo:	$(TOP)\src\analyze.c $(HDR)
1675	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\analyze.c
1676
1677attach.lo:	$(TOP)\src\attach.c $(HDR)
1678	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\attach.c
1679
1680auth.lo:	$(TOP)\src\auth.c $(HDR)
1681	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\auth.c
1682
1683backup.lo:	$(TOP)\src\backup.c $(HDR)
1684	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\backup.c
1685
1686bitvec.lo:	$(TOP)\src\bitvec.c $(HDR)
1687	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\bitvec.c
1688
1689btmutex.lo:	$(TOP)\src\btmutex.c $(HDR)
1690	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\btmutex.c
1691
1692btree.lo:	$(TOP)\src\btree.c $(HDR) $(TOP)\src\pager.h
1693	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\btree.c
1694
1695build.lo:	$(TOP)\src\build.c $(HDR)
1696	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\build.c
1697
1698callback.lo:	$(TOP)\src\callback.c $(HDR)
1699	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\callback.c
1700
1701complete.lo:	$(TOP)\src\complete.c $(HDR)
1702	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c
1703
1704ctime.lo:	$(TOP)\src\ctime.c $(HDR)
1705	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\ctime.c
1706
1707date.lo:	$(TOP)\src\date.c $(HDR)
1708	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\date.c
1709
1710dbstat.lo:	$(TOP)\src\date.c $(HDR)
1711	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\dbstat.c
1712
1713delete.lo:	$(TOP)\src\delete.c $(HDR)
1714	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\delete.c
1715
1716expr.lo:	$(TOP)\src\expr.c $(HDR)
1717	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\expr.c
1718
1719fault.lo:	$(TOP)\src\fault.c $(HDR)
1720	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\fault.c
1721
1722fkey.lo:	$(TOP)\src\fkey.c $(HDR)
1723	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\fkey.c
1724
1725func.lo:	$(TOP)\src\func.c $(HDR)
1726	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\func.c
1727
1728global.lo:	$(TOP)\src\global.c $(HDR)
1729	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\global.c
1730
1731hash.lo:	$(TOP)\src\hash.c $(HDR)
1732	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\hash.c
1733
1734insert.lo:	$(TOP)\src\insert.c $(HDR)
1735	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\insert.c
1736
1737legacy.lo:	$(TOP)\src\legacy.c $(HDR)
1738	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\legacy.c
1739
1740loadext.lo:	$(TOP)\src\loadext.c $(HDR)
1741	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\loadext.c
1742
1743main.lo:	$(TOP)\src\main.c $(HDR)
1744	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\main.c
1745
1746malloc.lo:	$(TOP)\src\malloc.c $(HDR)
1747	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\malloc.c
1748
1749mem0.lo:	$(TOP)\src\mem0.c $(HDR)
1750	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem0.c
1751
1752mem1.lo:	$(TOP)\src\mem1.c $(HDR)
1753	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem1.c
1754
1755mem2.lo:	$(TOP)\src\mem2.c $(HDR)
1756	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem2.c
1757
1758mem3.lo:	$(TOP)\src\mem3.c $(HDR)
1759	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem3.c
1760
1761mem5.lo:	$(TOP)\src\mem5.c $(HDR)
1762	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem5.c
1763
1764memjournal.lo:	$(TOP)\src\memjournal.c $(HDR)
1765	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\memjournal.c
1766
1767mutex.lo:	$(TOP)\src\mutex.c $(HDR)
1768	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex.c
1769
1770mutex_noop.lo:	$(TOP)\src\mutex_noop.c $(HDR)
1771	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_noop.c
1772
1773mutex_unix.lo:	$(TOP)\src\mutex_unix.c $(HDR)
1774	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_unix.c
1775
1776mutex_w32.lo:	$(TOP)\src\mutex_w32.c $(HDR)
1777	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_w32.c
1778
1779notify.lo:	$(TOP)\src\notify.c $(HDR)
1780	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\notify.c
1781
1782pager.lo:	$(TOP)\src\pager.c $(HDR) $(TOP)\src\pager.h
1783	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pager.c
1784
1785pcache.lo:	$(TOP)\src\pcache.c $(HDR) $(TOP)\src\pcache.h
1786	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pcache.c
1787
1788pcache1.lo:	$(TOP)\src\pcache1.c $(HDR) $(TOP)\src\pcache.h
1789	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pcache1.c
1790
1791os.lo:	$(TOP)\src\os.c $(HDR)
1792	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os.c
1793
1794os_unix.lo:	$(TOP)\src\os_unix.c $(HDR)
1795	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os_unix.c
1796
1797os_win.lo:	$(TOP)\src\os_win.c $(HDR)
1798	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os_win.c
1799
1800pragma.lo:	$(TOP)\src\pragma.c $(HDR)
1801	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pragma.c
1802
1803prepare.lo:	$(TOP)\src\prepare.c $(HDR)
1804	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\prepare.c
1805
1806printf.lo:	$(TOP)\src\printf.c $(HDR)
1807	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\printf.c
1808
1809random.lo:	$(TOP)\src\random.c $(HDR)
1810	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\random.c
1811
1812resolve.lo:	$(TOP)\src\resolve.c $(HDR)
1813	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\resolve.c
1814
1815rowset.lo:	$(TOP)\src\rowset.c $(HDR)
1816	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\rowset.c
1817
1818select.lo:	$(TOP)\src\select.c $(HDR)
1819	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\select.c
1820
1821status.lo:	$(TOP)\src\status.c $(HDR)
1822	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\status.c
1823
1824table.lo:	$(TOP)\src\table.c $(HDR)
1825	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\table.c
1826
1827threads.lo:	$(TOP)\src\threads.c $(HDR)
1828	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\threads.c
1829
1830tokenize.lo:	$(TOP)\src\tokenize.c keywordhash.h $(HDR)
1831	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\tokenize.c
1832
1833treeview.lo:	$(TOP)\src\treeview.c $(HDR)
1834	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\treeview.c
1835
1836trigger.lo:	$(TOP)\src\trigger.c $(HDR)
1837	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\trigger.c
1838
1839update.lo:	$(TOP)\src\update.c $(HDR)
1840	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\update.c
1841
1842utf.lo:	$(TOP)\src\utf.c $(HDR)
1843	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\utf.c
1844
1845util.lo:	$(TOP)\src\util.c $(HDR)
1846	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\util.c
1847
1848vacuum.lo:	$(TOP)\src\vacuum.c $(HDR)
1849	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vacuum.c
1850
1851vdbe.lo:	$(TOP)\src\vdbe.c $(HDR)
1852	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbe.c
1853
1854vdbeapi.lo:	$(TOP)\src\vdbeapi.c $(HDR)
1855	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeapi.c
1856
1857vdbeaux.lo:	$(TOP)\src\vdbeaux.c $(HDR)
1858	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeaux.c
1859
1860vdbeblob.lo:	$(TOP)\src\vdbeblob.c $(HDR)
1861	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeblob.c
1862
1863vdbemem.lo:	$(TOP)\src\vdbemem.c $(HDR)
1864	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbemem.c
1865
1866vdbesort.lo:	$(TOP)\src\vdbesort.c $(HDR)
1867	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbesort.c
1868
1869vdbetrace.lo:	$(TOP)\src\vdbetrace.c $(HDR)
1870	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbetrace.c
1871
1872vtab.lo:	$(TOP)\src\vtab.c $(HDR)
1873	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vtab.c
1874
1875wal.lo:	$(TOP)\src\wal.c $(HDR)
1876	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\wal.c
1877
1878walker.lo:	$(TOP)\src\walker.c $(HDR)
1879	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\walker.c
1880
1881where.lo:	$(TOP)\src\where.c $(HDR)
1882	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\where.c
1883
1884wherecode.lo:	$(TOP)\src\wherecode.c $(HDR)
1885	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\wherecode.c
1886
1887whereexpr.lo:	$(TOP)\src\whereexpr.c $(HDR)
1888	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\whereexpr.c
1889
1890tclsqlite.lo:	$(TOP)\src\tclsqlite.c $(HDR) $(SQLITE_TCL_DEP)
1891	$(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
1892
1893tclsqlite-shell.lo:	$(TOP)\src\tclsqlite.c $(HDR) $(SQLITE_TCL_DEP)
1894	$(LTCOMPILE) $(NO_WARN) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
1895
1896tclsqlite3.exe:	tclsqlite-shell.lo $(SQLITE3C) $(SQLITE3H) $(LIBRESOBJS)
1897	$(LTLINK) $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite-shell.lo $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
1898
1899# Rules to build opcodes.c and opcodes.h
1900#
1901opcodes.c:	opcodes.h $(TOP)\tool\mkopcodec.tcl
1902	$(TCLSH_CMD) $(TOP)\tool\mkopcodec.tcl opcodes.h > opcodes.c
1903
1904opcodes.h:	parse.h $(TOP)\src\vdbe.c $(TOP)\tool\mkopcodeh.tcl
1905	type parse.h $(TOP)\src\vdbe.c | $(TCLSH_CMD) $(TOP)\tool\mkopcodeh.tcl > opcodes.h
1906
1907# Rules to build parse.c and parse.h - the outputs of lemon.
1908#
1909parse.h:	parse.c
1910
1911parse.c:	$(TOP)\src\parse.y lemon.exe $(TOP)\tool\addopcodes.tcl
1912	del /Q parse.y parse.h parse.h.temp 2>NUL
1913	copy $(TOP)\src\parse.y .
1914	.\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) $(OPTS) parse.y
1915	move parse.h parse.h.temp
1916	$(TCLSH_CMD) $(TOP)\tool\addopcodes.tcl parse.h.temp > parse.h
1917
1918$(SQLITE3H):	$(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION
1919	$(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > $(SQLITE3H) $(MKSQLITE3H_ARGS)
1920
1921sqlite3ext.h:	.target_source
1922!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
1923	type tsrc\sqlite3ext.h | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*\)" "(SQLITE_CALLBACK *)" \
1924		| $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*" "(SQLITE_APICALL *" > sqlite3ext.h
1925	copy /Y sqlite3ext.h tsrc\sqlite3ext.h
1926!ELSE
1927	copy /Y tsrc\sqlite3ext.h sqlite3ext.h
1928!ENDIF
1929
1930mkkeywordhash.exe:	$(TOP)\tool\mkkeywordhash.c
1931	$(BCC) $(NO_WARN) -Fe$@ $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) $(OPTS) \
1932		$(TOP)\tool\mkkeywordhash.c /link $(LDFLAGS) $(NLTLINKOPTS) $(NLTLIBPATHS)
1933
1934keywordhash.h:	$(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe
1935	.\mkkeywordhash.exe > keywordhash.h
1936
1937
1938
1939# Rules to build the extension objects.
1940#
1941icu.lo:	$(TOP)\ext\icu\icu.c $(HDR) $(EXTHDR)
1942	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\icu\icu.c
1943
1944fts2.lo:	$(TOP)\ext\fts2\fts2.c $(HDR) $(EXTHDR)
1945	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2.c
1946
1947fts2_hash.lo:	$(TOP)\ext\fts2\fts2_hash.c $(HDR) $(EXTHDR)
1948	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_hash.c
1949
1950fts2_icu.lo:	$(TOP)\ext\fts2\fts2_icu.c $(HDR) $(EXTHDR)
1951	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_icu.c
1952
1953fts2_porter.lo:	$(TOP)\ext\fts2\fts2_porter.c $(HDR) $(EXTHDR)
1954	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_porter.c
1955
1956fts2_tokenizer.lo:	$(TOP)\ext\fts2\fts2_tokenizer.c $(HDR) $(EXTHDR)
1957	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer.c
1958
1959fts2_tokenizer1.lo:	$(TOP)\ext\fts2\fts2_tokenizer1.c $(HDR) $(EXTHDR)
1960	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer1.c
1961
1962fts3.lo:	$(TOP)\ext\fts3\fts3.c $(HDR) $(EXTHDR)
1963	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3.c
1964
1965fts3_aux.lo:	$(TOP)\ext\fts3\fts3_aux.c $(HDR) $(EXTHDR)
1966	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_aux.c
1967
1968fts3_expr.lo:	$(TOP)\ext\fts3\fts3_expr.c $(HDR) $(EXTHDR)
1969	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_expr.c
1970
1971fts3_hash.lo:	$(TOP)\ext\fts3\fts3_hash.c $(HDR) $(EXTHDR)
1972	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_hash.c
1973
1974fts3_icu.lo:	$(TOP)\ext\fts3\fts3_icu.c $(HDR) $(EXTHDR)
1975	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_icu.c
1976
1977fts3_snippet.lo:	$(TOP)\ext\fts3\fts3_snippet.c $(HDR) $(EXTHDR)
1978	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_snippet.c
1979
1980fts3_porter.lo:	$(TOP)\ext\fts3\fts3_porter.c $(HDR) $(EXTHDR)
1981	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_porter.c
1982
1983fts3_tokenizer.lo:	$(TOP)\ext\fts3\fts3_tokenizer.c $(HDR) $(EXTHDR)
1984	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer.c
1985
1986fts3_tokenizer1.lo:	$(TOP)\ext\fts3\fts3_tokenizer1.c $(HDR) $(EXTHDR)
1987	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer1.c
1988
1989fts3_tokenize_vtab.lo:	$(TOP)\ext\fts3\fts3_tokenize_vtab.c $(HDR) $(EXTHDR)
1990	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenize_vtab.c
1991
1992fts3_unicode.lo:	$(TOP)\ext\fts3\fts3_unicode.c $(HDR) $(EXTHDR)
1993	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode.c
1994
1995fts3_unicode2.lo:	$(TOP)\ext\fts3\fts3_unicode2.c $(HDR) $(EXTHDR)
1996	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode2.c
1997
1998fts3_write.lo:	$(TOP)\ext\fts3\fts3_write.c $(HDR) $(EXTHDR)
1999	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_write.c
2000
2001rtree.lo:	$(TOP)\ext\rtree\rtree.c $(HDR) $(EXTHDR)
2002	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\rtree\rtree.c
2003
2004sqlite3session.lo:	$(TOP)\ext\session\sqlite3session.c $(HDR) $(EXTHDR)
2005	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\session\sqlite3session.c
2006
2007# FTS5 things
2008#
2009FTS5_SRC = \
2010   $(TOP)\ext\fts5\fts5.h \
2011   $(TOP)\ext\fts5\fts5Int.h \
2012   $(TOP)\ext\fts5\fts5_aux.c \
2013   $(TOP)\ext\fts5\fts5_buffer.c \
2014   $(TOP)\ext\fts5\fts5_main.c \
2015   $(TOP)\ext\fts5\fts5_config.c \
2016   $(TOP)\ext\fts5\fts5_expr.c \
2017   $(TOP)\ext\fts5\fts5_hash.c \
2018   $(TOP)\ext\fts5\fts5_index.c \
2019   fts5parse.c fts5parse.h \
2020   $(TOP)\ext\fts5\fts5_storage.c \
2021   $(TOP)\ext\fts5\fts5_tokenize.c \
2022   $(TOP)\ext\fts5\fts5_unicode2.c \
2023   $(TOP)\ext\fts5\fts5_varint.c \
2024   $(TOP)\ext\fts5\fts5_vocab.c
2025
2026fts5parse.c:	$(TOP)\ext\fts5\fts5parse.y lemon.exe
2027	copy $(TOP)\ext\fts5\fts5parse.y .
2028	del /Q fts5parse.h 2>NUL
2029	.\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) $(OPTS) fts5parse.y
2030
2031fts5parse.h:	fts5parse.c
2032
2033fts5.c:	$(FTS5_SRC)
2034	$(TCLSH_CMD) $(TOP)\ext\fts5\tool\mkfts5c.tcl
2035	copy $(TOP)\ext\fts5\fts5.h .
2036
2037fts5.lo:	fts5.c $(HDR) $(EXTHDR)
2038	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c fts5.c
2039
2040fts5_ext.lo:	fts5.c $(HDR) $(EXTHDR)
2041	$(LTCOMPILE) $(NO_WARN) -c fts5.c
2042
2043fts5.dll:	fts5_ext.lo
2044	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ fts5_ext.lo
2045
2046sqlite3rbu.lo:	$(TOP)\ext\rbu\sqlite3rbu.c $(HDR) $(EXTHDR)
2047	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\rbu\sqlite3rbu.c
2048
2049# Rules to build the 'testfixture' application.
2050#
2051# If using the amalgamation, use sqlite3.c directly to build the test
2052# fixture.  Otherwise link against libsqlite3.lib.  (This distinction is
2053# necessary because the test fixture requires non-API symbols which are
2054# hidden when the library is built via the amalgamation).
2055#
2056TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
2057TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE=""
2058TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN)
2059TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
2060TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024
2061TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) $(TEST_CCONV_OPTS)
2062
2063TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2)
2064TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C)
2065!IF $(USE_AMALGAMATION)==0
2066TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
2067!ELSE
2068TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)
2069!ENDIF
2070
2071!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
2072sqlite_tclDecls.h:
2073	echo #ifndef SQLITE_TCLAPI > $(SQLITETCLDECLSH)
2074	echo #  define SQLITE_TCLAPI >> $(SQLITETCLDECLSH)
2075	echo #endif >> $(SQLITETCLDECLSH)
2076	type "$(TCLINCDIR)\tclDecls.h" \
2077		| $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "^(EXTERN(?: CONST\d+?)?\s+?[^\(]*?\s+?)Tcl_" "\1 SQLITE_TCLAPI Tcl_" \
2078		| $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "^(EXTERN\s+?(?:void|VOID)\s+?)TclFreeObj" "\1 SQLITE_TCLAPI TclFreeObj" \
2079		| $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*tcl_" "(SQLITE_TCLAPI *tcl_" \
2080		| $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*tclFreeObj" "(SQLITE_TCLAPI *tclFreeObj" \
2081		| $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*" "(SQLITE_TCLAPI *" >> $(SQLITETCLDECLSH)
2082
2083sqlite_tcl.h:
2084	type "$(TCLINCDIR)\tcl.h" | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact tclDecls.h sqlite_tclDecls.h \
2085		| $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "typedef (.*?)\(Tcl_" "typedef \1 (SQLITE_TCLAPI Tcl_" \
2086		| $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "void (*freeProc)" "void (SQLITE_TCLAPI *freeProc)" \
2087		| $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "Tcl_HashEntry *(*findProc)" "Tcl_HashEntry *(SQLITE_TCLAPI *findProc)" \
2088		| $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "Tcl_HashEntry *(*createProc)" "Tcl_HashEntry *(SQLITE_TCLAPI *createProc)" >> $(SQLITETCLH)
2089!ENDIF
2090
2091testfixture.exe:	$(TESTFIXTURE_SRC) $(SQLITE3H) $(LIBRESOBJS) $(HDR) $(SQLITE_TCL_DEP)
2092	$(LTLINK) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
2093		-DBUILD_sqlite -I$(TCLINCDIR) \
2094		$(TESTFIXTURE_SRC) \
2095		/link $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
2096
2097extensiontest:	testfixture.exe testloadext.dll
2098	@set PATH=$(LIBTCLPATH);$(PATH)
2099	.\testfixture.exe $(TOP)\test\loadext.test $(TESTOPTS)
2100
2101fulltest:	$(TESTPROGS) fuzztest
2102	@set PATH=$(LIBTCLPATH);$(PATH)
2103	.\testfixture.exe $(TOP)\test\all.test $(TESTOPTS)
2104
2105soaktest:	$(TESTPROGS)
2106	@set PATH=$(LIBTCLPATH);$(PATH)
2107	.\testfixture.exe $(TOP)\test\all.test -soak=1 $(TESTOPTS)
2108
2109fulltestonly:	$(TESTPROGS) fuzztest
2110	@set PATH=$(LIBTCLPATH);$(PATH)
2111	.\testfixture.exe $(TOP)\test\full.test
2112
2113queryplantest:	testfixture.exe shell
2114	@set PATH=$(LIBTCLPATH);$(PATH)
2115	.\testfixture.exe $(TOP)\test\permutations.test queryplanner $(TESTOPTS)
2116
2117fuzztest:	fuzzcheck.exe
2118	.\fuzzcheck.exe $(FUZZDATA)
2119
2120fastfuzztest:	fuzzcheck.exe
2121	.\fuzzcheck.exe --limit-mem 100M $(FUZZDATA)
2122
2123# Minimal testing that runs in less than 3 minutes (on a fast machine)
2124#
2125quicktest:	testfixture.exe sourcetest
2126	@set PATH=$(LIBTCLPATH);$(PATH)
2127	.\testfixture.exe $(TOP)\test\extraquick.test $(TESTOPTS)
2128
2129# This is the common case.  Run many tests that do not take too long,
2130# including fuzzcheck, sqlite3_analyzer, and sqldiff tests.
2131#
2132test:	$(TESTPROGS) sourcetest fastfuzztest
2133	@set PATH=$(LIBTCLPATH);$(PATH)
2134	.\testfixture.exe $(TOP)\test\veryquick.test $(TESTOPTS)
2135
2136smoketest:	$(TESTPROGS)
2137	@set PATH=$(LIBTCLPATH);$(PATH)
2138	.\testfixture.exe $(TOP)\test\main.test $(TESTOPTS)
2139
2140sqlite3_analyzer.c:	$(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl $(SQLITE_TCL_DEP)
2141	echo #define TCLSH 2 > $@
2142	echo #define SQLITE_ENABLE_DBSTAT_VTAB 1 >> $@
2143	copy $@ + $(SQLITE3C) + $(TOP)\src\tclsqlite.c $@
2144	echo static const char *tclsh_main_loop(void){ >> $@
2145	echo static const char *zMainloop = >> $@
2146	$(TCLSH_CMD) $(TOP)\tool\tostr.tcl $(TOP)\tool\spaceanal.tcl >> $@
2147	echo ; return zMainloop; } >> $@
2148
2149sqlite3_analyzer.exe:	sqlite3_analyzer.c $(LIBRESOBJS)
2150	$(LTLINK) $(NO_WARN) -DBUILD_sqlite -I$(TCLINCDIR) sqlite3_analyzer.c \
2151		/link $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
2152
2153testloadext.lo:	$(TOP)\src\test_loadext.c
2154	$(LTCOMPILE) $(NO_WARN) -c $(TOP)\src\test_loadext.c
2155
2156testloadext.dll:	testloadext.lo
2157	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ testloadext.lo
2158
2159showdb.exe:	$(TOP)\tool\showdb.c $(SQLITE3C) $(SQLITE3H)
2160	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
2161		$(TOP)\tool\showdb.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
2162
2163showstat4.exe:	$(TOP)\tool\showstat4.c $(SQLITE3C) $(SQLITE3H)
2164	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
2165		$(TOP)\tool\showstat4.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
2166
2167showjournal.exe:	$(TOP)\tool\showjournal.c $(SQLITE3C) $(SQLITE3H)
2168	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
2169		$(TOP)\tool\showjournal.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
2170
2171showwal.exe:	$(TOP)\tool\showwal.c $(SQLITE3C) $(SQLITE3H)
2172	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
2173		$(TOP)\tool\showwal.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
2174
2175changeset.exe:	$(TOP)\ext\session\changeset.c $(SQLITE3C)
2176	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
2177		$(TOP)\ext\session\changeset.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
2178
2179fts3view.exe:	$(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C) $(SQLITE3H)
2180	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
2181		$(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
2182
2183rollback-test.exe:	$(TOP)\tool\rollback-test.c $(SQLITE3C) $(SQLITE3H)
2184	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
2185		$(TOP)\tool\rollback-test.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
2186
2187LogEst.exe:	$(TOP)\tool\logest.c $(SQLITE3H)
2188	$(LTLINK) $(NO_WARN) -Fe$@ $(TOP)\tool\LogEst.c /link $(LDFLAGS) $(LTLINKOPTS)
2189
2190wordcount.exe:	$(TOP)\test\wordcount.c $(SQLITE3C) $(SQLITE3H)
2191	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
2192		$(TOP)\test\wordcount.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
2193
2194speedtest1.exe:	$(TOP)\test\speedtest1.c $(SQLITE3C) $(SQLITE3H)
2195	$(LTLINK) $(NO_WARN) -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
2196		$(TOP)\test\speedtest1.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
2197
2198rbu.exe:	$(TOP)\ext\rbu\rbu.c $(TOP)\ext\rbu\sqlite3rbu.c $(SQLITE3C) $(SQLITE3H)
2199	$(LTLINK) $(NO_WARN) -DSQLITE_ENABLE_RBU -Fe$@ \
2200		$(TOP)\ext\rbu\rbu.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
2201
2202moreclean:	clean
2203	del /Q $(SQLITE3C) $(SQLITE3H) 2>NUL
2204# <</mark>>
2205
2206clean:
2207	del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
2208	del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
2209	del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL
2210# <<mark>>
2211	del /Q sqlite3.c sqlite3.h 2>NUL
2212	del /Q opcodes.c opcodes.h 2>NUL
2213	del /Q lemon.* lempar.c parse.* 2>NUL
2214	del /Q mkkeywordhash.* keywordhash.h 2>NUL
2215	del /Q notasharedlib.* 2>NUL
2216	-rmdir /Q/S .deps 2>NUL
2217	-rmdir /Q/S .libs 2>NUL
2218	-rmdir /Q/S tsrc 2>NUL
2219	del /Q .target_source 2>NUL
2220	del /Q tclsqlite3.exe $(SQLITETCLH) $(SQLITETCLDECLSH) 2>NUL
2221	del /Q testloadext.dll 2>NUL
2222	del /Q testfixture.exe test.db 2>NUL
2223	del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe 2>NUL
2224	del /Q changeset.exe 2>NUL
2225	del /Q showjournal.exe showstat4.exe showwal.exe speedtest1.exe 2>NUL
2226	del /Q mptester.exe wordcount.exe rbu.exe srcck1.exe 2>NUL
2227	del /Q sqlite3.c sqlite3-*.c 2>NUL
2228	del /Q sqlite3rc.h 2>NUL
2229	del /Q shell.c sqlite3ext.h sqlite3session.h 2>NUL
2230	del /Q sqlite3_analyzer.exe sqlite3_analyzer.c 2>NUL
2231	del /Q sqlite-*-output.vsix 2>NUL
2232	del /Q fuzzershell.exe fuzzcheck.exe sqldiff.exe dbhash.exe 2>NUL
2233	del /Q fts5.* fts5parse.* 2>NUL
2234# <</mark>>
2235