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