xref: /sqlite-3.40.0/Makefile.msc (revision 3d403c71)
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#
12USE_AMALGAMATION = 1
13
14# Set this non-0 to use the International Components for Unicode (ICU).
15#
16USE_ICU = 0
17
18# Set this to non-0 to create and use PDBs.
19#
20SYMBOLS = 1
21
22# Set this to one of the following values to enable various debugging
23# features.  Each level includes the debugging options from the previous
24# levels.  Currently, the recognized values for DEBUG are:
25#
26# 0 == NDEBUG: Disables assert() and other runtime diagnostics.
27# 1 == Disables NDEBUG and all optimizations and then enables PDBs.
28# 2 == SQLITE_DEBUG: Enables various diagnostics messages and code.
29# 3 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call.
30# 4 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros.
31# 5 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros.
32#
33DEBUG = 0
34
35# Version numbers and release number for the SQLite being compiled.
36#
37VERSION = 3.7
38VERSION_NUMBER = 3007009
39RELEASE = 3.7.9
40
41# C Compiler and options for use in building executables that
42# will run on the platform that is doing the build.
43#
44BCC = cl.exe
45
46# C Compile and options for use in building executables that
47# will run on the target platform.  (BCC and TCC are usually the
48# same unless your are cross-compiling.)
49#
50TCC = cl.exe -W3 -DSQLITE_OS_WIN=1 -I. -I$(TOP)\src -fp:precise
51
52# The mksqlite3c.tcl and mksqlite3h.tcl scripts will pull in
53# any extension header files by default.  For non-amalgamation
54# builds, we need to make sure the compiler can find these.
55#
56!IF $(USE_AMALGAMATION)==0
57TCC = $(TCC) -I$(TOP)\ext\fts3
58TCC = $(TCC) -I$(TOP)\ext\rtree
59!ENDIF
60
61# Define -DNDEBUG to compile without debugging (i.e., for production usage)
62# Omitting the define will cause extra debugging code to be inserted and
63# includes extra comments when "EXPLAIN stmt" is used.
64#
65!IF $(DEBUG)==0
66TCC = $(TCC) -DNDEBUG
67!ENDIF
68
69!IF $(DEBUG)>1
70TCC = $(TCC) -DSQLITE_DEBUG
71!ENDIF
72
73!IF $(DEBUG)>3
74TCC = $(TCC) -DSQLITE_DEBUG_OS_TRACE=1
75!ENDIF
76
77!IF $(DEBUG)>4
78TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE
79!ENDIF
80
81#
82# Prevent warnings about "insecure" runtime library functions being used.
83#
84TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
85
86#
87# Use native Win32 heap instead of malloc/free?
88#
89# TCC = $(TCC) -DSQLITE_WIN32_MALLOC=1
90
91#
92# Validate the heap on every call into the native Win32 heap subsystem?
93#
94!IF $(DEBUG)>2
95TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
96!ENDIF
97
98# The locations of the Tcl header and library files.  Also, the library that
99# non-stubs enabled programs using Tcl must link against.  These variables
100# (TCLINCDIR, TCLLIBDIR, and LIBTCL) may be overridden via the environment
101# prior to running nmake in order to match the actual installed location and
102# version on this machine.
103#
104!if "$(TCLINCDIR)" == ""
105TCLINCDIR = c:\tcl\include
106!endif
107
108!if "$(TCLLIBDIR)" == ""
109TCLLIBDIR = c:\tcl\lib
110!endif
111
112!if "$(LIBTCL)" == ""
113LIBTCL = tcl85.lib
114!endif
115
116# The locations of the ICU header and library files.  These variables
117# (ICUINCDIR, ICULIBDIR, and LIBICU) may be overridden via the environment
118# prior to running nmake in order to match the actual installed location on
119# this machine.
120#
121!if "$(ICUINCDIR)" == ""
122ICUINCDIR = c:\icu\include
123!endif
124
125!if "$(ICULIBDIR)" == ""
126ICULIBDIR = c:\icu\lib
127!endif
128
129!if "$(LIBICU)" == ""
130LIBICU = icuuc.lib icuin.lib
131!endif
132
133# This is the command to use for tclsh - normally just "tclsh", but we may
134# know the specific version we want to use.  This variable (TCLSH_CMD) may be
135# overridden via the environment prior to running nmake in order to select a
136# specific Tcl shell to use.
137#
138!if "$(TCLSH_CMD)" == ""
139TCLSH_CMD = tclsh85
140!endif
141
142# Compiler options needed for programs that use the readline() library.
143#
144READLINE_FLAGS = -DHAVE_READLINE=0
145
146# The library that programs using readline() must link against.
147#
148LIBREADLINE =
149
150# Should the database engine be compiled threadsafe
151#
152TCC = $(TCC) -DSQLITE_THREADSAFE=1
153
154# Do threads override each others locks by default (1), or do we test (-1)
155#
156TCC = $(TCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
157
158# Any target libraries which libsqlite must be linked against
159#
160!if "$(TLIBS)" == ""
161TLIBS =
162!endif
163
164# Flags controlling use of the in memory btree implementation
165#
166# SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
167# default to file, 2 to default to memory, and 3 to force temporary
168# tables to always be in memory.
169#
170TCC = $(TCC) -DSQLITE_TEMP_STORE=1
171
172# Enable/disable loadable extensions, and other optional features
173# based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).
174# The same set of OMIT and ENABLE flags should be passed to the
175# LEMON parser generator and the mkkeywordhash tool as well.
176
177# BEGIN standard options
178OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
179OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
180OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
181# END standard options
182
183# BEGIN required Windows option
184OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=100
185# END required Windows option
186
187TCC = $(TCC) $(OPT_FEATURE_FLAGS)
188
189# Add in any optional parameters specified on the make commane line
190# ie.  make "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1".
191TCC = $(TCC) $(OPTS)
192
193# If symbols are enabled, enable PDBs.
194# If debugging is enabled, disable all optimizations and enable PDBs.
195!IF $(DEBUG)>0
196TCC = $(TCC) -Od -D_DEBUG
197!ELSE
198TCC = $(TCC) -O2
199!ENDIF
200
201!IF $(DEBUG)>0 || $(SYMBOLS)!=0
202TCC = $(TCC) -Zi
203!ENDIF
204
205# If ICU support is enabled, add the compiler options for it.
206!IF $(USE_ICU)!=0
207TCC = $(TCC) -DSQLITE_ENABLE_ICU=1
208TCC = $(TCC) -I$(TOP)\ext\icu
209TCC = $(TCC) -I$(ICUINCDIR)
210!ENDIF
211
212# libtool compile/link
213LTCOMPILE = $(TCC) -Fo$@
214LTLIB = lib.exe
215LTLINK = $(TCC) -Fe$@
216
217# If a platform was set, force the linker to target that.
218# Note that the vcvars*.bat family of batch files typically
219# set this for you.  Otherwise, the linker will attempt
220# to deduce the binary type based on the object files.
221!IF "$(PLATFORM)"!=""
222LTLINKOPTS = /MACHINE:$(PLATFORM)
223LTLIBOPTS = /MACHINE:$(PLATFORM)
224!ENDIF
225
226# If debugging is enabled, enable PDBs.
227!IF $(DEBUG)>0 || $(SYMBOLS)!=0
228LTLINKOPTS = $(LTLINKOPTS) /DEBUG
229!ENDIF
230
231# Start with the Tcl related linker options.
232LTLIBPATHS = /LIBPATH:$(TCLLIBDIR)
233LTLIBS = $(LIBTCL)
234
235# If ICU support is enabled, add the linker options for it.
236!IF $(USE_ICU)!=0
237LTLIBPATHS = $(LTLIBPATHS) /LIBPATH:$(ICULIBDIR)
238LTLIBS = $(LTLIBS) $(LIBICU)
239!ENDIF
240
241# nawk compatible awk.
242NAWK = gawk.exe
243
244# You should not have to change anything below this line
245###############################################################################
246
247# Object files for the SQLite library (non-amalgamation).
248#
249LIBOBJS0 = alter.lo analyze.lo attach.lo auth.lo \
250         backup.lo bitvec.lo btmutex.lo btree.lo build.lo \
251         callback.lo complete.lo ctime.lo date.lo delete.lo \
252         expr.lo fault.lo fkey.lo \
253         fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo fts3_porter.lo \
254         fts3_snippet.lo fts3_tokenizer.lo fts3_tokenizer1.lo fts3_write.lo \
255         func.lo global.lo hash.lo \
256         icu.lo insert.lo journal.lo legacy.lo loadext.lo \
257         main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
258         memjournal.lo \
259         mutex.lo mutex_noop.lo mutex_os2.lo mutex_unix.lo mutex_w32.lo \
260         notify.lo opcodes.lo os.lo os_os2.lo os_unix.lo os_win.lo \
261         pager.lo parse.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
262         random.lo resolve.lo rowset.lo rtree.lo select.lo status.lo \
263         table.lo tokenize.lo trigger.lo \
264         update.lo util.lo vacuum.lo \
265         vdbe.lo vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
266         vdbetrace.lo wal.lo walker.lo where.lo utf.lo vtab.lo
267
268# Object files for the amalgamation.
269#
270LIBOBJS1 = sqlite3.lo
271
272# Determine the real value of LIBOBJ based on the 'configure' script
273#
274!IF $(USE_AMALGAMATION)==0
275LIBOBJ = $(LIBOBJS0)
276!ELSE
277LIBOBJ = $(LIBOBJS1)
278!ENDIF
279
280# All of the source code files.
281#
282SRC = \
283  $(TOP)\src\alter.c \
284  $(TOP)\src\analyze.c \
285  $(TOP)\src\attach.c \
286  $(TOP)\src\auth.c \
287  $(TOP)\src\backup.c \
288  $(TOP)\src\bitvec.c \
289  $(TOP)\src\btmutex.c \
290  $(TOP)\src\btree.c \
291  $(TOP)\src\btree.h \
292  $(TOP)\src\btreeInt.h \
293  $(TOP)\src\build.c \
294  $(TOP)\src\callback.c \
295  $(TOP)\src\complete.c \
296  $(TOP)\src\ctime.c \
297  $(TOP)\src\date.c \
298  $(TOP)\src\delete.c \
299  $(TOP)\src\expr.c \
300  $(TOP)\src\fault.c \
301  $(TOP)\src\fkey.c \
302  $(TOP)\src\func.c \
303  $(TOP)\src\global.c \
304  $(TOP)\src\hash.c \
305  $(TOP)\src\hash.h \
306  $(TOP)\src\hwtime.h \
307  $(TOP)\src\insert.c \
308  $(TOP)\src\journal.c \
309  $(TOP)\src\legacy.c \
310  $(TOP)\src\loadext.c \
311  $(TOP)\src\main.c \
312  $(TOP)\src\malloc.c \
313  $(TOP)\src\mem0.c \
314  $(TOP)\src\mem1.c \
315  $(TOP)\src\mem2.c \
316  $(TOP)\src\mem3.c \
317  $(TOP)\src\mem5.c \
318  $(TOP)\src\memjournal.c \
319  $(TOP)\src\mutex.c \
320  $(TOP)\src\mutex.h \
321  $(TOP)\src\mutex_noop.c \
322  $(TOP)\src\mutex_os2.c \
323  $(TOP)\src\mutex_unix.c \
324  $(TOP)\src\mutex_w32.c \
325  $(TOP)\src\notify.c \
326  $(TOP)\src\os.c \
327  $(TOP)\src\os.h \
328  $(TOP)\src\os_common.h \
329  $(TOP)\src\os_os2.c \
330  $(TOP)\src\os_unix.c \
331  $(TOP)\src\os_win.c \
332  $(TOP)\src\pager.c \
333  $(TOP)\src\pager.h \
334  $(TOP)\src\parse.y \
335  $(TOP)\src\pcache.c \
336  $(TOP)\src\pcache.h \
337  $(TOP)\src\pcache1.c \
338  $(TOP)\src\pragma.c \
339  $(TOP)\src\prepare.c \
340  $(TOP)\src\printf.c \
341  $(TOP)\src\random.c \
342  $(TOP)\src\resolve.c \
343  $(TOP)\src\rowset.c \
344  $(TOP)\src\select.c \
345  $(TOP)\src\status.c \
346  $(TOP)\src\shell.c \
347  $(TOP)\src\sqlite.h.in \
348  $(TOP)\src\sqlite3ext.h \
349  $(TOP)\src\sqliteInt.h \
350  $(TOP)\src\sqliteLimit.h \
351  $(TOP)\src\table.c \
352  $(TOP)\src\tclsqlite.c \
353  $(TOP)\src\tokenize.c \
354  $(TOP)\src\trigger.c \
355  $(TOP)\src\utf.c \
356  $(TOP)\src\update.c \
357  $(TOP)\src\util.c \
358  $(TOP)\src\vacuum.c \
359  $(TOP)\src\vdbe.c \
360  $(TOP)\src\vdbe.h \
361  $(TOP)\src\vdbeapi.c \
362  $(TOP)\src\vdbeaux.c \
363  $(TOP)\src\vdbeblob.c \
364  $(TOP)\src\vdbemem.c \
365  $(TOP)\src\vdbesort.c \
366  $(TOP)\src\vdbetrace.c \
367  $(TOP)\src\vdbeInt.h \
368  $(TOP)\src\vtab.c \
369  $(TOP)\src\wal.c \
370  $(TOP)\src\wal.h \
371  $(TOP)\src\walker.c \
372  $(TOP)\src\where.c
373
374# Source code for extensions
375#
376SRC = $(SRC) \
377  $(TOP)\ext\fts1\fts1.c \
378  $(TOP)\ext\fts1\fts1.h \
379  $(TOP)\ext\fts1\fts1_hash.c \
380  $(TOP)\ext\fts1\fts1_hash.h \
381  $(TOP)\ext\fts1\fts1_porter.c \
382  $(TOP)\ext\fts1\fts1_tokenizer.h \
383  $(TOP)\ext\fts1\fts1_tokenizer1.c
384SRC = $(SRC) \
385  $(TOP)\ext\fts2\fts2.c \
386  $(TOP)\ext\fts2\fts2.h \
387  $(TOP)\ext\fts2\fts2_hash.c \
388  $(TOP)\ext\fts2\fts2_hash.h \
389  $(TOP)\ext\fts2\fts2_icu.c \
390  $(TOP)\ext\fts2\fts2_porter.c \
391  $(TOP)\ext\fts2\fts2_tokenizer.h \
392  $(TOP)\ext\fts2\fts2_tokenizer.c \
393  $(TOP)\ext\fts2\fts2_tokenizer1.c
394SRC = $(SRC) \
395  $(TOP)\ext\fts3\fts3.c \
396  $(TOP)\ext\fts3\fts3.h \
397  $(TOP)\ext\fts3\fts3Int.h \
398  $(TOP)\ext\fts3\fts3_aux.c \
399  $(TOP)\ext\fts3\fts3_expr.c \
400  $(TOP)\ext\fts3\fts3_hash.c \
401  $(TOP)\ext\fts3\fts3_hash.h \
402  $(TOP)\ext\fts3\fts3_icu.c \
403  $(TOP)\ext\fts3\fts3_porter.c \
404  $(TOP)\ext\fts3\fts3_snippet.c \
405  $(TOP)\ext\fts3\fts3_tokenizer.h \
406  $(TOP)\ext\fts3\fts3_tokenizer.c \
407  $(TOP)\ext\fts3\fts3_tokenizer1.c \
408  $(TOP)\ext\fts3\fts3_write.c
409SRC = $(SRC) \
410  $(TOP)\ext\icu\sqliteicu.h \
411  $(TOP)\ext\icu\icu.c
412SRC = $(SRC) \
413  $(TOP)\ext\rtree\rtree.h \
414  $(TOP)\ext\rtree\rtree.c
415
416
417# Generated source code files
418#
419SRC = $(SRC) \
420  keywordhash.h \
421  opcodes.c \
422  opcodes.h \
423  parse.c \
424  parse.h \
425  sqlite3.h
426
427# Source code to the test files.
428#
429TESTSRC = \
430  $(TOP)\src\test1.c \
431  $(TOP)\src\test2.c \
432  $(TOP)\src\test3.c \
433  $(TOP)\src\test4.c \
434  $(TOP)\src\test5.c \
435  $(TOP)\src\test6.c \
436  $(TOP)\src\test7.c \
437  $(TOP)\src\test8.c \
438  $(TOP)\src\test9.c \
439  $(TOP)\src\test_autoext.c \
440  $(TOP)\src\test_async.c \
441  $(TOP)\src\test_backup.c \
442  $(TOP)\src\test_btree.c \
443  $(TOP)\src\test_config.c \
444  $(TOP)\src\test_demovfs.c \
445  $(TOP)\src\test_devsym.c \
446  $(TOP)\src\test_func.c \
447  $(TOP)\src\test_fuzzer.c \
448  $(TOP)\src\test_hexio.c \
449  $(TOP)\src\test_init.c \
450  $(TOP)\src\test_intarray.c \
451  $(TOP)\src\test_journal.c \
452  $(TOP)\src\test_malloc.c \
453  $(TOP)\src\test_multiplex.c \
454  $(TOP)\src\test_mutex.c \
455  $(TOP)\src\test_onefile.c \
456  $(TOP)\src\test_osinst.c \
457  $(TOP)\src\test_pcache.c \
458  $(TOP)\src\test_quota.c \
459  $(TOP)\src\test_rtree.c \
460  $(TOP)\src\test_schema.c \
461  $(TOP)\src\test_server.c \
462  $(TOP)\src\test_superlock.c \
463  $(TOP)\src\test_syscall.c \
464  $(TOP)\src\test_stat.c \
465  $(TOP)\src\test_tclvar.c \
466  $(TOP)\src\test_thread.c \
467  $(TOP)\src\test_vfs.c \
468  $(TOP)\src\test_wholenumber.c \
469  $(TOP)\src\test_wsd.c \
470  $(TOP)\ext\fts3\fts3_term.c \
471  $(TOP)\ext\fts3\fts3_test.c
472
473# Source code to the library files needed by the test fixture
474#
475TESTSRC2 = \
476  $(TOP)\src\attach.c \
477  $(TOP)\src\backup.c \
478  $(TOP)\src\bitvec.c \
479  $(TOP)\src\btree.c \
480  $(TOP)\src\build.c \
481  $(TOP)\src\ctime.c \
482  $(TOP)\src\date.c \
483  $(TOP)\src\expr.c \
484  $(TOP)\src\func.c \
485  $(TOP)\src\insert.c \
486  $(TOP)\src\wal.c \
487  $(TOP)\src\mem5.c \
488  $(TOP)\src\os.c \
489  $(TOP)\src\os_os2.c \
490  $(TOP)\src\os_unix.c \
491  $(TOP)\src\os_win.c \
492  $(TOP)\src\pager.c \
493  $(TOP)\src\pragma.c \
494  $(TOP)\src\prepare.c \
495  $(TOP)\src\printf.c \
496  $(TOP)\src\random.c \
497  $(TOP)\src\pcache.c \
498  $(TOP)\src\pcache1.c \
499  $(TOP)\src\select.c \
500  $(TOP)\src\tokenize.c \
501  $(TOP)\src\utf.c \
502  $(TOP)\src\util.c \
503  $(TOP)\src\vdbeapi.c \
504  $(TOP)\src\vdbeaux.c \
505  $(TOP)\src\vdbe.c \
506  $(TOP)\src\vdbemem.c \
507  $(TOP)\src\vdbesort.c \
508  $(TOP)\src\vdbetrace.c \
509  $(TOP)\src\where.c \
510  parse.c \
511  $(TOP)\ext\fts3\fts3.c \
512  $(TOP)\ext\fts3\fts3_aux.c \
513  $(TOP)\ext\fts3\fts3_expr.c \
514  $(TOP)\ext\fts3\fts3_tokenizer.c \
515  $(TOP)\ext\fts3\fts3_write.c \
516  $(TOP)\ext\async\sqlite3async.c
517
518# Header files used by all library source files.
519#
520HDR = \
521   $(TOP)\src\btree.h \
522   $(TOP)\src\btreeInt.h \
523   $(TOP)\src\hash.h \
524   $(TOP)\src\hwtime.h \
525   keywordhash.h \
526   $(TOP)\src\mutex.h \
527   opcodes.h \
528   $(TOP)\src\os.h \
529   $(TOP)\src\os_common.h \
530   $(TOP)\src\pager.h \
531   $(TOP)\src\pcache.h \
532   parse.h \
533   sqlite3.h \
534   $(TOP)\src\sqlite3ext.h \
535   $(TOP)\src\sqliteInt.h \
536   $(TOP)\src\sqliteLimit.h \
537   $(TOP)\src\vdbe.h \
538   $(TOP)\src\vdbeInt.h
539
540# Header files used by extensions
541#
542EXTHDR = $(EXTHDR) \
543  $(TOP)\ext\fts1\fts1.h \
544  $(TOP)\ext\fts1\fts1_hash.h \
545  $(TOP)\ext\fts1\fts1_tokenizer.h
546EXTHDR = $(EXTHDR) \
547  $(TOP)\ext\fts2\fts2.h \
548  $(TOP)\ext\fts2\fts2_hash.h \
549  $(TOP)\ext\fts2\fts2_tokenizer.h
550EXTHDR = $(EXTHDR) \
551  $(TOP)\ext\fts3\fts3.h \
552  $(TOP)\ext\fts3\fts3Int.h \
553  $(TOP)\ext\fts3\fts3_hash.h \
554  $(TOP)\ext\fts3\fts3_tokenizer.h
555EXTHDR = $(EXTHDR) \
556  $(TOP)\ext\rtree\rtree.h
557EXTHDR = $(EXTHDR) \
558  $(TOP)\ext\icu\sqliteicu.h
559EXTHDR = $(EXTHDR) \
560  $(TOP)\ext\rtree\sqlite3rtree.h
561
562# This is the default Makefile target.  The objects listed here
563# are what get build when you type just "make" with no arguments.
564#
565all:	dll libsqlite3.lib sqlite3.exe libtclsqlite3.lib
566
567libsqlite3.lib:	$(LIBOBJ)
568	$(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
569
570libtclsqlite3.lib:	tclsqlite.lo libsqlite3.lib
571	$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCL:tcl=tclstub) $(TLIBS)
572
573sqlite3.exe:	$(TOP)\src\shell.c libsqlite3.lib sqlite3.h
574	$(LTLINK) $(READLINE_FLAGS) \
575		$(TOP)\src\shell.c \
576		/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBREADLINE) $(LTLIBS) $(TLIBS)
577
578# This target creates a directory named "tsrc" and fills it with
579# copies of all of the C source code and header files needed to
580# build on the target system.  Some of the C source code and header
581# files are automatically generated.  This target takes care of
582# all that automatic generation.
583#
584.target_source:	$(SRC) $(TOP)\tool\vdbe-compress.tcl
585	-rmdir /S/Q tsrc
586	-mkdir tsrc
587	for %i in ($(SRC)) do copy /Y %i tsrc
588	del /Q tsrc\sqlite.h.in tsrc\parse.y
589	$(TCLSH_CMD) $(TOP)\tool\vdbe-compress.tcl < tsrc\vdbe.c > vdbe.new
590	move vdbe.new tsrc\vdbe.c
591	echo > .target_source
592
593sqlite3.c:	.target_source $(TOP)\tool\mksqlite3c.tcl
594	$(TCLSH_CMD) $(TOP)\tool\mksqlite3c.tcl
595
596sqlite3-all.c:	sqlite3.c $(TOP)/tool/split-sqlite3c.tcl
597	$(TCLSH_CMD) $(TOP)/tool/split-sqlite3c.tcl
598
599# Rule to build the amalgamation
600#
601sqlite3.lo:	sqlite3.c
602	$(LTCOMPILE) -c sqlite3.c
603
604# Rules to build the LEMON compiler generator
605#
606lempar.c:	$(TOP)\src\lempar.c
607	copy $(TOP)\src\lempar.c .
608
609lemon.exe:	$(TOP)\tool\lemon.c lempar.c
610	$(BCC) -Fe$@ $(TOP)\tool\lemon.c
611
612# Rules to build individual *.lo files from generated *.c files. This
613# applies to:
614#
615#     parse.lo
616#     opcodes.lo
617#
618parse.lo:	parse.c $(HDR)
619	$(LTCOMPILE) -c parse.c
620
621opcodes.lo:	opcodes.c
622	$(LTCOMPILE) -c opcodes.c
623
624# Rules to build individual *.lo files from files in the src directory.
625#
626alter.lo:	$(TOP)\src\alter.c $(HDR)
627	$(LTCOMPILE) -c $(TOP)\src\alter.c
628
629analyze.lo:	$(TOP)\src\analyze.c $(HDR)
630	$(LTCOMPILE) -c $(TOP)\src\analyze.c
631
632attach.lo:	$(TOP)\src\attach.c $(HDR)
633	$(LTCOMPILE) -c $(TOP)\src\attach.c
634
635auth.lo:	$(TOP)\src\auth.c $(HDR)
636	$(LTCOMPILE) -c $(TOP)\src\auth.c
637
638backup.lo:	$(TOP)\src\backup.c $(HDR)
639	$(LTCOMPILE) -c $(TOP)\src\backup.c
640
641bitvec.lo:	$(TOP)\src\bitvec.c $(HDR)
642	$(LTCOMPILE) -c $(TOP)\src\bitvec.c
643
644btmutex.lo:	$(TOP)\src\btmutex.c $(HDR)
645	$(LTCOMPILE) -c $(TOP)\src\btmutex.c
646
647btree.lo:	$(TOP)\src\btree.c $(HDR) $(TOP)\src\pager.h
648	$(LTCOMPILE) -c $(TOP)\src\btree.c
649
650build.lo:	$(TOP)\src\build.c $(HDR)
651	$(LTCOMPILE) -c $(TOP)\src\build.c
652
653callback.lo:	$(TOP)\src\callback.c $(HDR)
654	$(LTCOMPILE) -c $(TOP)\src\callback.c
655
656complete.lo:	$(TOP)\src\complete.c $(HDR)
657	$(LTCOMPILE) -c $(TOP)\src\complete.c
658
659ctime.lo:	$(TOP)\src\ctime.c $(HDR)
660	$(LTCOMPILE) -c $(TOP)\src\ctime.c
661
662date.lo:	$(TOP)\src\date.c $(HDR)
663	$(LTCOMPILE) -c $(TOP)\src\date.c
664
665delete.lo:	$(TOP)\src\delete.c $(HDR)
666	$(LTCOMPILE) -c $(TOP)\src\delete.c
667
668expr.lo:	$(TOP)\src\expr.c $(HDR)
669	$(LTCOMPILE) -c $(TOP)\src\expr.c
670
671fault.lo:	$(TOP)\src\fault.c $(HDR)
672	$(LTCOMPILE) -c $(TOP)\src\fault.c
673
674fkey.lo:	$(TOP)\src\fkey.c $(HDR)
675	$(LTCOMPILE) -c $(TOP)\src\fkey.c
676
677func.lo:	$(TOP)\src\func.c $(HDR)
678	$(LTCOMPILE) -c $(TOP)\src\func.c
679
680global.lo:	$(TOP)\src\global.c $(HDR)
681	$(LTCOMPILE) -c $(TOP)\src\global.c
682
683hash.lo:	$(TOP)\src\hash.c $(HDR)
684	$(LTCOMPILE) -c $(TOP)\src\hash.c
685
686insert.lo:	$(TOP)\src\insert.c $(HDR)
687	$(LTCOMPILE) -c $(TOP)\src\insert.c
688
689journal.lo:	$(TOP)\src\journal.c $(HDR)
690	$(LTCOMPILE) -c $(TOP)\src\journal.c
691
692legacy.lo:	$(TOP)\src\legacy.c $(HDR)
693	$(LTCOMPILE) -c $(TOP)\src\legacy.c
694
695loadext.lo:	$(TOP)\src\loadext.c $(HDR)
696	$(LTCOMPILE) -c $(TOP)\src\loadext.c
697
698main.lo:	$(TOP)\src\main.c $(HDR)
699	$(LTCOMPILE) -c $(TOP)\src\main.c
700
701malloc.lo:	$(TOP)\src\malloc.c $(HDR)
702	$(LTCOMPILE) -c $(TOP)\src\malloc.c
703
704mem0.lo:	$(TOP)\src\mem0.c $(HDR)
705	$(LTCOMPILE) -c $(TOP)\src\mem0.c
706
707mem1.lo:	$(TOP)\src\mem1.c $(HDR)
708	$(LTCOMPILE) -c $(TOP)\src\mem1.c
709
710mem2.lo:	$(TOP)\src\mem2.c $(HDR)
711	$(LTCOMPILE) -c $(TOP)\src\mem2.c
712
713mem3.lo:	$(TOP)\src\mem3.c $(HDR)
714	$(LTCOMPILE) -c $(TOP)\src\mem3.c
715
716mem5.lo:	$(TOP)\src\mem5.c $(HDR)
717	$(LTCOMPILE) -c $(TOP)\src\mem5.c
718
719memjournal.lo:	$(TOP)\src\memjournal.c $(HDR)
720	$(LTCOMPILE) -c $(TOP)\src\memjournal.c
721
722mutex.lo:	$(TOP)\src\mutex.c $(HDR)
723	$(LTCOMPILE) -c $(TOP)\src\mutex.c
724
725mutex_noop.lo:	$(TOP)\src\mutex_noop.c $(HDR)
726	$(LTCOMPILE) -c $(TOP)\src\mutex_noop.c
727
728mutex_os2.lo:	$(TOP)\src\mutex_os2.c $(HDR)
729	$(LTCOMPILE) -c $(TOP)\src\mutex_os2.c
730
731mutex_unix.lo:	$(TOP)\src\mutex_unix.c $(HDR)
732	$(LTCOMPILE) -c $(TOP)\src\mutex_unix.c
733
734mutex_w32.lo:	$(TOP)\src\mutex_w32.c $(HDR)
735	$(LTCOMPILE) -c $(TOP)\src\mutex_w32.c
736
737notify.lo:	$(TOP)\src\notify.c $(HDR)
738	$(LTCOMPILE) -c $(TOP)\src\notify.c
739
740pager.lo:	$(TOP)\src\pager.c $(HDR) $(TOP)\src\pager.h
741	$(LTCOMPILE) -c $(TOP)\src\pager.c
742
743pcache.lo:	$(TOP)\src\pcache.c $(HDR) $(TOP)\src\pcache.h
744	$(LTCOMPILE) -c $(TOP)\src\pcache.c
745
746pcache1.lo:	$(TOP)\src\pcache1.c $(HDR) $(TOP)\src\pcache.h
747	$(LTCOMPILE) -c $(TOP)\src\pcache1.c
748
749os.lo:	$(TOP)\src\os.c $(HDR)
750	$(LTCOMPILE) -c $(TOP)\src\os.c
751
752os_unix.lo:	$(TOP)\src\os_unix.c $(HDR)
753	$(LTCOMPILE) -c $(TOP)\src\os_unix.c
754
755os_win.lo:	$(TOP)\src\os_win.c $(HDR)
756	$(LTCOMPILE) -c $(TOP)\src\os_win.c
757
758os_os2.lo:	$(TOP)\src\os_os2.c $(HDR)
759	$(LTCOMPILE) -c $(TOP)\src\os_os2.c
760
761pragma.lo:	$(TOP)\src\pragma.c $(HDR)
762	$(LTCOMPILE) -c $(TOP)\src\pragma.c
763
764prepare.lo:	$(TOP)\src\prepare.c $(HDR)
765	$(LTCOMPILE) -c $(TOP)\src\prepare.c
766
767printf.lo:	$(TOP)\src\printf.c $(HDR)
768	$(LTCOMPILE) -c $(TOP)\src\printf.c
769
770random.lo:	$(TOP)\src\random.c $(HDR)
771	$(LTCOMPILE) -c $(TOP)\src\random.c
772
773resolve.lo:	$(TOP)\src\resolve.c $(HDR)
774	$(LTCOMPILE) -c $(TOP)\src\resolve.c
775
776rowset.lo:	$(TOP)\src\rowset.c $(HDR)
777	$(LTCOMPILE) -c $(TOP)\src\rowset.c
778
779select.lo:	$(TOP)\src\select.c $(HDR)
780	$(LTCOMPILE) -c $(TOP)\src\select.c
781
782status.lo:	$(TOP)\src\status.c $(HDR)
783	$(LTCOMPILE) -c $(TOP)\src\status.c
784
785table.lo:	$(TOP)\src\table.c $(HDR)
786	$(LTCOMPILE) -c $(TOP)\src\table.c
787
788tokenize.lo:	$(TOP)\src\tokenize.c keywordhash.h $(HDR)
789	$(LTCOMPILE) -c $(TOP)\src\tokenize.c
790
791trigger.lo:	$(TOP)\src\trigger.c $(HDR)
792	$(LTCOMPILE) -c $(TOP)\src\trigger.c
793
794update.lo:	$(TOP)\src\update.c $(HDR)
795	$(LTCOMPILE) -c $(TOP)\src\update.c
796
797utf.lo:	$(TOP)\src\utf.c $(HDR)
798	$(LTCOMPILE) -c $(TOP)\src\utf.c
799
800util.lo:	$(TOP)\src\util.c $(HDR)
801	$(LTCOMPILE) -c $(TOP)\src\util.c
802
803vacuum.lo:	$(TOP)\src\vacuum.c $(HDR)
804	$(LTCOMPILE) -c $(TOP)\src\vacuum.c
805
806vdbe.lo:	$(TOP)\src\vdbe.c $(HDR)
807	$(LTCOMPILE) -c $(TOP)\src\vdbe.c
808
809vdbeapi.lo:	$(TOP)\src\vdbeapi.c $(HDR)
810	$(LTCOMPILE) -c $(TOP)\src\vdbeapi.c
811
812vdbeaux.lo:	$(TOP)\src\vdbeaux.c $(HDR)
813	$(LTCOMPILE) -c $(TOP)\src\vdbeaux.c
814
815vdbeblob.lo:	$(TOP)\src\vdbeblob.c $(HDR)
816	$(LTCOMPILE) -c $(TOP)\src\vdbeblob.c
817
818vdbemem.lo:	$(TOP)\src\vdbemem.c $(HDR)
819	$(LTCOMPILE) -c $(TOP)\src\vdbemem.c
820
821vdbesort.lo:	$(TOP)\src\vdbesort.c $(HDR)
822	$(LTCOMPILE) -c $(TOP)\src\vdbesort.c
823
824vdbetrace.lo:	$(TOP)\src\vdbetrace.c $(HDR)
825	$(LTCOMPILE) -c $(TOP)\src\vdbetrace.c
826
827vtab.lo:	$(TOP)\src\vtab.c $(HDR)
828	$(LTCOMPILE) -c $(TOP)\src\vtab.c
829
830wal.lo:	$(TOP)\src\wal.c $(HDR)
831	$(LTCOMPILE) -c $(TOP)\src\wal.c
832
833walker.lo:	$(TOP)\src\walker.c $(HDR)
834	$(LTCOMPILE) -c $(TOP)\src\walker.c
835
836where.lo:	$(TOP)\src\where.c $(HDR)
837	$(LTCOMPILE) -c $(TOP)\src\where.c
838
839tclsqlite.lo:	$(TOP)\src\tclsqlite.c $(HDR)
840	$(LTCOMPILE) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
841
842tclsqlite-shell.lo:	$(TOP)\src\tclsqlite.c $(HDR)
843	$(LTCOMPILE) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
844
845tclsqlite3.exe:	tclsqlite-shell.lo libsqlite3.lib
846	$(LTLINK) tclsqlite-shell.lo \
847		/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LTLIBS) $(TLIBS)
848
849# Rules to build opcodes.c and opcodes.h
850#
851opcodes.c:	opcodes.h $(TOP)\mkopcodec.awk
852	$(NAWK) -f $(TOP)\mkopcodec.awk opcodes.h > opcodes.c
853
854opcodes.h:	parse.h $(TOP)\src\vdbe.c $(TOP)\mkopcodeh.awk
855	type parse.h $(TOP)\src\vdbe.c | $(NAWK) -f $(TOP)\mkopcodeh.awk > opcodes.h
856
857# Rules to build parse.c and parse.h - the outputs of lemon.
858#
859parse.h:	parse.c
860
861parse.c:	$(TOP)\src\parse.y lemon.exe $(TOP)\addopcodes.awk
862	del /Q parse.y parse.h parse.h.temp
863	copy $(TOP)\src\parse.y .
864	.\lemon.exe $(OPT_FEATURE_FLAGS) $(OPTS) parse.y
865	move parse.h parse.h.temp
866	$(NAWK) -f $(TOP)\addopcodes.awk parse.h.temp > parse.h
867
868sqlite3.h:	$(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION
869	$(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP) > sqlite3.h
870
871mkkeywordhash.exe:	$(TOP)\tool\mkkeywordhash.c
872	$(BCC) -Femkkeywordhash.exe $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)\tool\mkkeywordhash.c
873
874keywordhash.h:	$(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe
875	.\mkkeywordhash.exe > keywordhash.h
876
877
878
879# Rules to build the extension objects.
880#
881icu.lo:	$(TOP)\ext\icu\icu.c $(HDR) $(EXTHDR)
882	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\icu\icu.c
883
884fts2.lo:	$(TOP)\ext\fts2\fts2.c $(HDR) $(EXTHDR)
885	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2.c
886
887fts2_hash.lo:	$(TOP)\ext\fts2\fts2_hash.c $(HDR) $(EXTHDR)
888	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_hash.c
889
890fts2_icu.lo:	$(TOP)\ext\fts2\fts2_icu.c $(HDR) $(EXTHDR)
891	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_icu.c
892
893fts2_porter.lo:	$(TOP)\ext\fts2\fts2_porter.c $(HDR) $(EXTHDR)
894	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_porter.c
895
896fts2_tokenizer.lo:	$(TOP)\ext\fts2\fts2_tokenizer.c $(HDR) $(EXTHDR)
897	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer.c
898
899fts2_tokenizer1.lo:	$(TOP)\ext\fts2\fts2_tokenizer1.c $(HDR) $(EXTHDR)
900	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer1.c
901
902fts3.lo:	$(TOP)\ext\fts3\fts3.c $(HDR) $(EXTHDR)
903	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3.c
904
905fts3_aux.lo:	$(TOP)\ext\fts3\fts3_aux.c $(HDR) $(EXTHDR)
906	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_aux.c
907
908fts3_expr.lo:	$(TOP)\ext\fts3\fts3_expr.c $(HDR) $(EXTHDR)
909	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_expr.c
910
911fts3_hash.lo:	$(TOP)\ext\fts3\fts3_hash.c $(HDR) $(EXTHDR)
912	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_hash.c
913
914fts3_icu.lo:	$(TOP)\ext\fts3\fts3_icu.c $(HDR) $(EXTHDR)
915	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_icu.c
916
917fts3_snippet.lo:	$(TOP)\ext\fts3\fts3_snippet.c $(HDR) $(EXTHDR)
918	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_snippet.c
919
920fts3_porter.lo:	$(TOP)\ext\fts3\fts3_porter.c $(HDR) $(EXTHDR)
921	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_porter.c
922
923fts3_tokenizer.lo:	$(TOP)\ext\fts3\fts3_tokenizer.c $(HDR) $(EXTHDR)
924	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer.c
925
926fts3_tokenizer1.lo:	$(TOP)\ext\fts3\fts3_tokenizer1.c $(HDR) $(EXTHDR)
927	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer1.c
928
929fts3_write.lo:	$(TOP)\ext\fts3\fts3_write.c $(HDR) $(EXTHDR)
930	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_write.c
931
932rtree.lo:	$(TOP)\ext\rtree\rtree.c $(HDR) $(EXTHDR)
933	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\rtree\rtree.c
934
935
936# Rules to build the 'testfixture' application.
937#
938# If using the amalgamation, use sqlite3.c directly to build the test
939# fixture.  Otherwise link against libsqlite3.lib.  (This distinction is
940# necessary because the test fixture requires non-API symbols which are
941# hidden when the library is built via the amalgamation).
942#
943TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
944TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
945
946TESTFIXTURE_SRC0 = $(TESTSRC2) libsqlite3.lib
947TESTFIXTURE_SRC1 = sqlite3.c
948!IF $(USE_AMALGAMATION)==0
949TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
950!ELSE
951TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)
952!ENDIF
953
954testfixture.exe:	$(TESTFIXTURE_SRC) $(HDR)
955	$(LTLINK) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
956		-DBUILD_sqlite -I$(TCLINCDIR) \
957		$(TESTFIXTURE_SRC) \
958		/link $(LTLINKOPTS) $(LTLIBPATHS) $(LTLIBS) $(TLIBS)
959
960fulltest:	testfixture.exe sqlite3.exe
961	.\testfixture.exe $(TOP)\test\all.test
962
963soaktest:	testfixture.exe sqlite3.exe
964	.\testfixture.exe $(TOP)\test\all.test -soak=1
965
966test:	testfixture.exe sqlite3.exe
967	.\testfixture.exe $(TOP)\test\veryquick.test
968
969sqlite3_analyzer.c: sqlite3.c $(TOP)\src\test_stat.c $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl
970	copy sqlite3.c + $(TOP)\src\test_stat.c + $(TOP)\src\tclsqlite.c $@
971	echo static const char *tclsh_main_loop(void){ >> $@
972	echo static const char *zMainloop = >> $@
973	$(NAWK) -f $(TOP)\tool\tostr.awk $(TOP)\tool\spaceanal.tcl >> $@
974	echo ; return zMainloop; } >> $@
975
976sqlite3_analyzer.exe:	sqlite3_analyzer.c
977	$(LTLINK) -DBUILD_sqlite -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \
978		/link $(LTLINKOPTS) $(LTLIBPATHS) $(LTLIBS) $(TLIBS)
979
980clean:
981	del /Q *.lo *.ilk *.lib *.obj *.pdb sqlite3.exe libsqlite3.lib
982	del /Q *.da *.bb *.bbg gmon.out
983	del /Q sqlite3.h opcodes.c opcodes.h
984	del /Q lemon.exe lempar.c parse.*
985	del /Q mkkeywordhash.exe keywordhash.h
986	-rmdir /Q/S .deps
987	-rmdir /Q/S .libs
988	-rmdir /Q/S quota2a
989	-rmdir /Q/S quota2b
990	-rmdir /Q/S quota2c
991	-rmdir /Q/S tsrc
992	del /Q .target_source
993	del /Q tclsqlite3.exe
994	del /Q testfixture.exe testfixture.exp test.db
995	del /Q sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def
996	del /Q sqlite3.c
997	del /Q sqlite3_analyzer.exe sqlite3_analyzer.exp sqlite3_analyzer.c
998
999#
1000# Windows section
1001#
1002dll: sqlite3.dll
1003
1004sqlite3.def: libsqlite3.lib
1005	echo EXPORTS > sqlite3.def
1006	dumpbin /all libsqlite3.lib \
1007		| $(NAWK) "/ 1 _?sqlite3_/ { sub(/^.* _?/,\"\");print }" \
1008		| sort >> sqlite3.def
1009
1010sqlite3.dll: $(LIBOBJ) sqlite3.def
1011	link $(LTLINKOPTS) $(LTLIBPATHS) /DLL /DEF:sqlite3.def /OUT:$@ $(LIBOBJ) $(LTLIBS) $(TLIBS)
1012