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