Bind sqlite3_interrupt() and sqlite3_is_interrupted() to JNI but with caveats regardi...
[sqlite.git] / autoconf / Makefile.msc
blob24154dd5d84184dbf960669f89ab993beea37e23
1 #### DO NOT EDIT ####
2 # This makefile is automatically generated from the Makefile.msc at
3 # the root of the canonical SQLite source tree (not the
4 # amalgamation tarball) using the tool/mkmsvcmin.tcl
5 # script.
9 # nmake Makefile for SQLite
11 ###############################################################################
12 ############################## START OF OPTIONS ###############################
13 ###############################################################################
15 # The toplevel directory of the source tree.  This is the directory
16 # that contains this "Makefile.msc".
18 TOP = .
21 # Set this non-0 to enable full warnings (-W4, etc) when compiling.
23 !IFNDEF USE_FULLWARN
24 USE_FULLWARN = 1
25 !ENDIF
27 # Set this non-0 to enable treating warnings as errors (-WX, etc) when
28 # compiling.
30 !IFNDEF USE_FATAL_WARN
31 USE_FATAL_WARN = 0
32 !ENDIF
34 # Set this non-0 to enable full runtime error checks (-RTC1, etc).  This
35 # has no effect if (any) optimizations are enabled.
37 !IFNDEF USE_RUNTIME_CHECKS
38 USE_RUNTIME_CHECKS = 0
39 !ENDIF
41 # Set this non-0 to create a SQLite amalgamation file that excludes the
42 # various built-in extensions.
44 !IFNDEF MINIMAL_AMALGAMATION
45 MINIMAL_AMALGAMATION = 0
46 !ENDIF
48 # Set this non-0 to use "stdcall" calling convention for the core library
49 # and shell executable.
51 !IFNDEF USE_STDCALL
52 USE_STDCALL = 0
53 !ENDIF
55 # Set this non-0 to use structured exception handling (SEH) for WAL mode
56 # in the core library.
58 !IFNDEF USE_SEH
59 USE_SEH = 0
60 !ENDIF
62 # Set this non-0 to have the shell executable link against the core dynamic
63 # link library.
65 !IFNDEF DYNAMIC_SHELL
66 DYNAMIC_SHELL = 0
67 !ENDIF
69 # Set this non-0 to enable extra code that attempts to detect misuse of the
70 # SQLite API.
72 !IFNDEF API_ARMOR
73 API_ARMOR = 0
74 !ENDIF
76 # If necessary, create a list of harmless compiler warnings to disable when
77 # compiling the various tools.  For the SQLite source code itself, warnings,
78 # if any, will be disabled from within it.
80 !IFNDEF NO_WARN
81 !IF $(USE_FULLWARN)!=0
82 NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206
83 NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
84 !ENDIF
85 !ENDIF
87 # Set this non-0 to use the library paths and other options necessary for
88 # Windows Phone 8.1.
90 !IFNDEF USE_WP81_OPTS
91 USE_WP81_OPTS = 0
92 !ENDIF
94 # Set this non-0 to split the SQLite amalgamation file into chunks to
95 # be used for debugging with Visual Studio.
97 !IFNDEF SPLIT_AMALGAMATION
98 SPLIT_AMALGAMATION = 0
99 !ENDIF
102 # Set this non-0 to dynamically link to the MSVC runtime library.
104 !IFNDEF USE_CRT_DLL
105 USE_CRT_DLL = 0
106 !ENDIF
108 # Set this non-0 to link to the RPCRT4 library.
110 !IFNDEF USE_RPCRT4_LIB
111 USE_RPCRT4_LIB = 0
112 !ENDIF
114 # Set this non-0 to generate assembly code listings for the source code
115 # files.
117 !IFNDEF USE_LISTINGS
118 USE_LISTINGS = 0
119 !ENDIF
121 # Set this non-0 to attempt setting the native compiler automatically
122 # for cross-compiling the command line tools needed during the compilation
123 # process.
125 !IFNDEF XCOMPILE
126 XCOMPILE = 0
127 !ENDIF
129 # Set this non-0 to use the native libraries paths for cross-compiling
130 # the command line tools needed during the compilation process.
132 !IFNDEF USE_NATIVE_LIBPATHS
133 USE_NATIVE_LIBPATHS = 0
134 !ENDIF
136 # Set this 0 to skip the compiling and embedding of version resources.
138 !IFNDEF USE_RC
139 USE_RC = 1
140 !ENDIF
142 # Set this non-0 to compile binaries suitable for the WinRT environment.
143 # This setting does not apply to any binaries that require Tcl to operate
144 # properly (i.e. the text fixture, etc).
146 !IFNDEF FOR_WINRT
147 FOR_WINRT = 0
148 !ENDIF
150 # Set this non-0 to compile binaries suitable for the UWP environment.
151 # This setting does not apply to any binaries that require Tcl to operate
152 # properly (i.e. the text fixture, etc).
154 !IFNDEF FOR_UWP
155 FOR_UWP = 0
156 !ENDIF
158 # Set this non-0 to compile binaries suitable for the Windows 10 platform.
160 !IFNDEF FOR_WIN10
161 FOR_WIN10 = 0
162 !ENDIF
165 # Set this to non-0 to create and use PDBs.
167 !IFNDEF SYMBOLS
168 SYMBOLS = 1
169 !ENDIF
171 # Set this to non-0 to use the SQLite debugging heap subsystem.
173 !IFNDEF MEMDEBUG
174 MEMDEBUG = 0
175 !ENDIF
177 # Set this to non-0 to use the Win32 native heap subsystem.
179 !IFNDEF WIN32HEAP
180 WIN32HEAP = 0
181 !ENDIF
183 # Set this to non-0 to enable OSTRACE() macros, which can be useful when
184 # debugging.
186 !IFNDEF OSTRACE
187 OSTRACE = 0
188 !ENDIF
190 # Set this to one of the following values to enable various debugging
191 # features.  Each level includes the debugging options from the previous
192 # levels.  Currently, the recognized values for DEBUG are:
194 # 0 == NDEBUG: Disables assert() and other runtime diagnostics.
195 # 1 == SQLITE_ENABLE_API_ARMOR: extra attempts to detect misuse of the API.
196 # 2 == Disables NDEBUG and all optimizations and then enables PDBs.
197 # 3 == SQLITE_DEBUG: Enables various diagnostics messages and code.
198 # 4 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call.
199 # 5 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros.
200 # 6 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros.
202 !IFNDEF DEBUG
203 DEBUG = 0
204 !ENDIF
207 # Enable use of available compiler optimizations?  Normally, this should be
208 # non-zero.  Setting this to zero, thus disabling all compiler optimizations,
209 # can be useful for testing.
211 !IFNDEF OPTIMIZATIONS
212 OPTIMIZATIONS = 2
213 !ENDIF
215 # Set this to non-0 to enable support for the session extension.
217 !IFNDEF SESSION
218 SESSION = 0
219 !ENDIF
221 # Set this to non-0 to enable support for the rbu extension.
223 !IFNDEF RBU
224 RBU = 0
225 !ENDIF
227 # Set the source code file to be used by executables and libraries when
228 # they need the amalgamation.
230 !IFNDEF SQLITE3C
231 !IF $(SPLIT_AMALGAMATION)!=0
232 SQLITE3C = sqlite3-all.c
233 !ELSE
234 SQLITE3C = sqlite3.c
235 !ENDIF
236 !ENDIF
238 # Set the include code file to be used by executables and libraries when
239 # they need SQLite.
241 !IFNDEF SQLITE3H
242 SQLITE3H = sqlite3.h
243 !ENDIF
245 # This is the name to use for the SQLite dynamic link library (DLL).
247 !IFNDEF SQLITE3DLL
248 !IF $(FOR_WIN10)!=0
249 SQLITE3DLL = winsqlite3.dll
250 !ELSE
251 SQLITE3DLL = sqlite3.dll
252 !ENDIF
253 !ENDIF
255 # This is the name to use for the SQLite import library (LIB).
257 !IFNDEF SQLITE3LIB
258 !IF $(FOR_WIN10)!=0
259 SQLITE3LIB = winsqlite3.lib
260 !ELSE
261 SQLITE3LIB = sqlite3.lib
262 !ENDIF
263 !ENDIF
265 # This is the name to use for the SQLite shell executable (EXE).
267 !IFNDEF SQLITE3EXE
268 !IF $(FOR_WIN10)!=0
269 SQLITE3EXE = winsqlite3shell.exe
270 !ELSE
271 SQLITE3EXE = sqlite3.exe
272 !ENDIF
273 !ENDIF
275 # This is the argument used to set the program database (PDB) file for the
276 # SQLite shell executable (EXE).
278 !IFNDEF SQLITE3EXEPDB
279 !IF $(FOR_WIN10)!=0
280 SQLITE3EXEPDB =
281 !ELSE
282 SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
283 !ENDIF
284 !ENDIF
287 # These are the "standard" SQLite compilation options used when compiling for
288 # the Windows platform.
290 !IFNDEF OPT_FEATURE_FLAGS
291 !IF $(MINIMAL_AMALGAMATION)==0
292 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
293 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
294 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_GEOPOLY=1
295 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
296 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
297 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
298 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
299 !ENDIF
300 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
301 !ENDIF
303 # Should the session extension be enabled?  If so, add compilation options
304 # to enable it.
306 !IF $(SESSION)!=0
307 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
308 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
309 !ENDIF
311 # Always enable math functions on Windows
312 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS
314 # Should the rbu extension be enabled?  If so, add compilation options
315 # to enable it.
317 !IF $(RBU)!=0
318 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RBU=1
319 !ENDIF
321 # Should structured exception handling (SEH) be enabled for WAL mode in
322 # the core library?
324 !IF $(USE_SEH)!=0
325 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_USE_SEH=1
326 !ENDIF
328 # These are the "extended" SQLite compilation options used when compiling for
329 # the Windows 10 platform.
331 !IFNDEF EXT_FEATURE_FLAGS
332 !IF $(FOR_WIN10)!=0
333 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS4=1
334 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_SYSTEM_MALLOC=1
335 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_OMIT_LOCALTIME=1
336 !ELSE
337 EXT_FEATURE_FLAGS =
338 !ENDIF
339 !ENDIF
341 ###############################################################################
342 ############################### END OF OPTIONS ################################
343 ###############################################################################
345 # When compiling for the Windows 10 platform, the PLATFORM macro must be set
346 # to an appropriate value (e.g. x86, x64, arm, arm64, etc).
348 !IF $(FOR_WIN10)!=0
349 !IFNDEF PLATFORM
350 !ERROR Using the FOR_WIN10 option requires a value for PLATFORM.
351 !ENDIF
352 !ENDIF
354 # This assumes that MSVC is always installed in 32-bit Program Files directory
355 # and sets the variable for use in locating other 32-bit installs accordingly.
357 PROGRAMFILES_X86 = $(VCINSTALLDIR)\..\..
358 PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)
360 # Check for the predefined command macro CC.  This should point to the compiler
361 # binary for the target platform.  If it is not defined, simply define it to
362 # the legacy default value 'cl.exe'.
364 !IFNDEF CC
365 CC = cl.exe
366 !ENDIF
368 # Check for the predefined command macro CSC.  This should point to a working
369 # C Sharp compiler binary.  If it is not defined, simply define it to the
370 # legacy default value 'csc.exe'.
372 !IFNDEF CSC
373 CSC = csc.exe
374 !ENDIF
376 # Check for the command macro LD.  This should point to the linker binary for
377 # the target platform.  If it is not defined, simply define it to the legacy
378 # default value 'link.exe'.
380 !IFNDEF LD
381 LD = link.exe
382 !ENDIF
384 # Check for the predefined command macro RC.  This should point to the resource
385 # compiler binary for the target platform.  If it is not defined, simply define
386 # it to the legacy default value 'rc.exe'.
388 !IFNDEF RC
389 RC = rc.exe
390 !ENDIF
392 # Check for the MSVC runtime library path macro.  Otherwise, this value will
393 # default to the 'lib' directory underneath the MSVC installation directory.
395 !IFNDEF CRTLIBPATH
396 CRTLIBPATH = $(VCINSTALLDIR)\lib
397 !ENDIF
399 CRTLIBPATH = $(CRTLIBPATH:\\=\)
401 # Check for the command macro NCC.  This should point to the compiler binary
402 # for the platform the compilation process is taking place on.  If it is not
403 # defined, simply define it to have the same value as the CC macro.  When
404 # cross-compiling, it is suggested that this macro be modified via the command
405 # line (since nmake itself does not provide a built-in method to guess it).
406 # For example, to use the x86 compiler when cross-compiling for x64, a command
407 # line similar to the following could be used (all on one line):
409 #     nmake /f Makefile.msc sqlite3.dll
410 #           XCOMPILE=1 USE_NATIVE_LIBPATHS=1
412 # Alternatively, the full path and file name to the compiler binary for the
413 # platform the compilation process is taking place may be specified (all on
414 # one line):
416 #     nmake /f Makefile.msc sqlite3.dll
417 #           "NCC=""%VCINSTALLDIR%\bin\cl.exe"""
418 #           USE_NATIVE_LIBPATHS=1
420 !IFDEF NCC
421 NCC = $(NCC:\\=\)
422 !ELSEIF $(XCOMPILE)!=0
423 NCC = "$(VCINSTALLDIR)\bin\$(CC)"
424 NCC = $(NCC:\\=\)
425 !ELSE
426 NCC = $(CC)
427 !ENDIF
429 # Check for the MSVC native runtime library path macro.  Otherwise,
430 # this value will default to the 'lib' directory underneath the MSVC
431 # installation directory.
433 !IFNDEF NCRTLIBPATH
434 NCRTLIBPATH = $(VCINSTALLDIR)\lib
435 !ENDIF
437 NCRTLIBPATH = $(NCRTLIBPATH:\\=\)
439 # Check for the Platform SDK library path macro.  Otherwise, this
440 # value will default to the 'lib' directory underneath the Windows
441 # SDK installation directory (the environment variable used appears
442 # to be available when using Visual C++ 2008 or later via the
443 # command line).
445 !IFNDEF NSDKLIBPATH
446 NSDKLIBPATH = $(WINDOWSSDKDIR)\lib
447 !ENDIF
449 NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
451 # Check for the UCRT library path macro.  Otherwise, this value will
452 # default to the version-specific, platform-specific 'lib' directory
453 # underneath the Windows SDK installation directory.
455 !IFNDEF UCRTLIBPATH
456 UCRTLIBPATH = $(WINDOWSSDKDIR)\lib\$(WINDOWSSDKLIBVERSION)\ucrt\$(PLATFORM)
457 !ENDIF
459 UCRTLIBPATH = $(UCRTLIBPATH:\\=\)
461 # C compiler and options for use in building executables that
462 # will run on the platform that is doing the build.
464 !IF $(USE_FULLWARN)!=0
465 BCC = $(NCC) -nologo -W4 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
466 !ELSE
467 BCC = $(NCC) -nologo -W3 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
468 !ENDIF
470 # Check if assembly code listings should be generated for the source
471 # code files to be compiled.
473 !IF $(USE_LISTINGS)!=0
474 BCC = $(BCC) -FAcs
475 !ENDIF
477 # Check if the native library paths should be used when compiling
478 # the command line tools used during the compilation process.  If
479 # so, set the necessary macro now.
481 !IF $(USE_NATIVE_LIBPATHS)!=0
482 NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
484 !IFDEF NUCRTLIBPATH
485 NUCRTLIBPATH = $(NUCRTLIBPATH:\\=\)
486 NLTLIBPATHS = $(NLTLIBPATHS) "/LIBPATH:$(NUCRTLIBPATH)"
487 !ENDIF
488 !ENDIF
490 # C compiler and options for use in building executables that
491 # will run on the target platform.  (BCC and TCC are usually the
492 # same unless your are cross-compiling.)
494 !IF $(USE_FULLWARN)!=0
495 TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $(TCCOPTS)
496 !ELSE
497 TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)
498 !ENDIF
500 # Check if warnings should be treated as errors when compiling.
502 !IF $(USE_FATAL_WARN)!=0
503 TCC = $(TCC) -WX
504 !ENDIF
506 TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise
507 RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS)
509 # Check if we want to use the "stdcall" calling convention when compiling.
510 # This is not supported by the compilers for non-x86 platforms.  It should
511 # also be noted here that building any target with these "stdcall" options
512 # will most likely fail if the Tcl library is also required.  This is due
513 # to how the Tcl library functions are declared and exported (i.e. without
514 # an explicit calling convention, which results in "cdecl").
516 !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
517 !IF "$(PLATFORM)"=="x86"
518 CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
519 SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
520 !ELSE
521 !IFNDEF PLATFORM
522 CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
523 SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
524 !ELSE
525 CORE_CCONV_OPTS =
526 SHELL_CCONV_OPTS =
527 !ENDIF
528 !ENDIF
529 !ELSE
530 CORE_CCONV_OPTS =
531 SHELL_CCONV_OPTS =
532 !ENDIF
534 # These are additional compiler options used for the core library.
536 !IFNDEF CORE_COMPILE_OPTS
537 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
538 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)
539 !ELSE
540 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
541 !ENDIF
542 !ENDIF
544 # These are the additional targets that the core library should depend on
545 # when linking.
547 !IFNDEF CORE_LINK_DEP
548 !IF $(DYNAMIC_SHELL)!=0
549 CORE_LINK_DEP =
550 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
551 CORE_LINK_DEP = sqlite3.def
552 !ELSE
553 CORE_LINK_DEP =
554 !ENDIF
555 !ENDIF
557 # These are additional linker options used for the core library.
559 !IFNDEF CORE_LINK_OPTS
560 !IF $(DYNAMIC_SHELL)!=0
561 CORE_LINK_OPTS =
562 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
563 CORE_LINK_OPTS = /DEF:sqlite3.def
564 !ELSE
565 CORE_LINK_OPTS =
566 !ENDIF
567 !ENDIF
569 # These are additional compiler options used for the shell executable.
571 !IFNDEF SHELL_COMPILE_OPTS
572 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
573 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)
574 !ELSE
575 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)
576 !ENDIF
577 !ENDIF
579 # This is the source code that the shell executable should be compiled
580 # with.
582 !IFNDEF SHELL_CORE_SRC
583 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
584 SHELL_CORE_SRC =
585 !ELSE
586 SHELL_CORE_SRC = $(SQLITE3C)
587 !ENDIF
588 !ENDIF
590 # This is the core library that the shell executable should depend on.
592 !IFNDEF SHELL_CORE_DEP
593 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
594 SHELL_CORE_DEP = $(SQLITE3DLL)
595 !ELSE
596 SHELL_CORE_DEP =
597 !ENDIF
598 !ENDIF
601 # This is the core library that the shell executable should link with.
603 !IFNDEF SHELL_CORE_LIB
604 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
605 SHELL_CORE_LIB = $(SQLITE3LIB)
606 !ELSE
607 SHELL_CORE_LIB =
608 !ENDIF
609 !ENDIF
611 # These are additional linker options used for the shell executable.
613 !IFNDEF SHELL_LINK_OPTS
614 SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
615 !ENDIF
617 # Check if assembly code listings should be generated for the source
618 # code files to be compiled.
620 !IF $(USE_LISTINGS)!=0
621 TCC = $(TCC) -FAcs
622 !ENDIF
624 # When compiling the library for use in the WinRT environment,
625 # the following compile-time options must be used as well to
626 # disable use of Win32 APIs that are not available and to enable
627 # use of Win32 APIs that are specific to Windows 8 and/or WinRT.
629 !IF $(FOR_WINRT)!=0
630 TCC = $(TCC) -DSQLITE_OS_WINRT=1
631 RCC = $(RCC) -DSQLITE_OS_WINRT=1
632 TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
633 RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
634 !ENDIF
636 # C compiler options for the Windows 10 platform (needs MSVC 2015).
638 !IF $(FOR_WIN10)!=0
639 TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
640 BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
641 !ENDIF
643 # Also, we need to dynamically link to the correct MSVC runtime
644 # when compiling for WinRT (e.g. debug or release) OR if the
645 # USE_CRT_DLL option is set to force dynamically linking to the
646 # MSVC runtime library.
648 !IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
649 !IF $(DEBUG)>1
650 TCC = $(TCC) -MDd
651 BCC = $(BCC) -MDd
652 !ELSE
653 TCC = $(TCC) -MD
654 BCC = $(BCC) -MD
655 !ENDIF
656 !ELSE
657 !IF $(DEBUG)>1
658 TCC = $(TCC) -MTd
659 BCC = $(BCC) -MTd
660 !ELSE
661 TCC = $(TCC) -MT
662 BCC = $(BCC) -MT
663 !ENDIF
664 !ENDIF
667 # Define -DNDEBUG to compile without debugging (i.e., for production usage)
668 # Omitting the define will cause extra debugging code to be inserted and
669 # includes extra comments when "EXPLAIN stmt" is used.
671 !IF $(DEBUG)==0
672 TCC = $(TCC) -DNDEBUG
673 BCC = $(BCC) -DNDEBUG
674 RCC = $(RCC) -DNDEBUG
675 !ENDIF
677 !IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0
678 TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1
679 RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
680 !ENDIF
682 !IF $(DEBUG)>2
683 TCC = $(TCC) -DSQLITE_DEBUG=1
684 RCC = $(RCC) -DSQLITE_DEBUG=1
685 !IF $(DYNAMIC_SHELL)==0
686 TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
687 RCC = $(RCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
688 !ENDIF
689 !ENDIF
691 !IF $(DEBUG)>4 || $(OSTRACE)!=0
692 TCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
693 RCC = $(RCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
694 !ENDIF
696 !IF $(DEBUG)>5
697 TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE=1
698 RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE=1
699 !ENDIF
701 # Prevent warnings about "insecure" MSVC runtime library functions
702 # being used.
704 TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
705 BCC = $(BCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
706 RCC = $(RCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
708 # Prevent warnings about "deprecated" POSIX functions being used.
710 TCC = $(TCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
711 BCC = $(BCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
712 RCC = $(RCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
714 # Use the SQLite debugging heap subsystem?
716 !IF $(MEMDEBUG)!=0
717 TCC = $(TCC) -DSQLITE_MEMDEBUG=1
718 RCC = $(RCC) -DSQLITE_MEMDEBUG=1
720 # Use native Win32 heap subsystem instead of malloc/free?
722 !ELSEIF $(WIN32HEAP)!=0
723 TCC = $(TCC) -DSQLITE_WIN32_MALLOC=1
724 RCC = $(RCC) -DSQLITE_WIN32_MALLOC=1
726 # Validate the heap on every call into the native Win32 heap subsystem?
728 !IF $(DEBUG)>3
729 TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
730 RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
731 !ENDIF
732 !ENDIF
735 # Compiler options needed for programs that use the readline() library.
737 !IFNDEF READLINE_FLAGS
738 READLINE_FLAGS = -DHAVE_READLINE=0
739 !ENDIF
741 # The library that programs using readline() must link against.
743 !IFNDEF LIBREADLINE
744 LIBREADLINE =
745 !ENDIF
747 # Should the database engine be compiled threadsafe
749 TCC = $(TCC) -DSQLITE_THREADSAFE=1
750 RCC = $(RCC) -DSQLITE_THREADSAFE=1
752 # Do threads override each others locks by default (1), or do we test (-1)
754 TCC = $(TCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
755 RCC = $(RCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
757 # Any target libraries which libsqlite must be linked against
759 !IFNDEF TLIBS
760 TLIBS =
761 !ENDIF
763 # Flags controlling use of the in memory btree implementation
765 # SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
766 # default to file, 2 to default to memory, and 3 to force temporary
767 # tables to always be in memory.
769 TCC = $(TCC) -DSQLITE_TEMP_STORE=1
770 RCC = $(RCC) -DSQLITE_TEMP_STORE=1
772 # Enable/disable loadable extensions, and other optional features
773 # based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).
774 # The same set of OMIT and ENABLE flags should be passed to the
775 # LEMON parser generator and the mkkeywordhash tool as well.
777 # These are the required SQLite compilation options used when compiling for
778 # the Windows platform.
780 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=100
782 # If we are linking to the RPCRT4 library, enable features that need it.
784 !IF $(USE_RPCRT4_LIB)!=0
785 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_WIN32_USE_UUID=1
786 !ENDIF
788 # Add the required and optional SQLite compilation options into the command
789 # lines used to invoke the MSVC code and resource compilers.
791 TCC = $(TCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
792 RCC = $(RCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
794 # Add in any optional parameters specified on the commane line, e.g.
795 # nmake /f Makefile.msc all "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1"
797 TCC = $(TCC) $(OPTS)
798 RCC = $(RCC) $(OPTS)
800 # If compiling for debugging, add some defines.
802 !IF $(DEBUG)>1
803 TCC = $(TCC) -D_DEBUG
804 BCC = $(BCC) -D_DEBUG
805 RCC = $(RCC) -D_DEBUG
806 !ENDIF
808 # If optimizations are enabled or disabled (either implicitly or
809 # explicitly), add the necessary flags.
811 !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
812 TCC = $(TCC) -Od
813 BCC = $(BCC) -Od
814 !IF $(USE_RUNTIME_CHECKS)!=0
815 TCC = $(TCC) -RTC1
816 BCC = $(BCC) -RTC1
817 !ENDIF
818 !ELSEIF $(OPTIMIZATIONS)>=3
819 TCC = $(TCC) -Ox
820 BCC = $(BCC) -Ox
821 !ELSEIF $(OPTIMIZATIONS)==2
822 TCC = $(TCC) -O2
823 BCC = $(BCC) -O2
824 !ELSEIF $(OPTIMIZATIONS)==1
825 TCC = $(TCC) -O1
826 BCC = $(BCC) -O1
827 !ENDIF
829 # If symbols are enabled (or compiling for debugging), enable PDBs.
831 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
832 TCC = $(TCC) -Zi
833 BCC = $(BCC) -Zi
834 !ENDIF
837 # Command line prefixes for compiling code, compiling resources,
838 # linking, etc.
840 LTCOMPILE = $(TCC) -Fo$@ -Fd$*.pdb
841 LTRCOMPILE = $(RCC) -r
842 LTLIB = lib.exe
843 LTLINK = $(TCC) -Fe$@
845 # If requested, link to the RPCRT4 library.
847 !IF $(USE_RPCRT4_LIB)!=0
848 LTLIBS = $(LTLIBS) rpcrt4.lib
849 !ENDIF
851 # If a platform was set, force the linker to target that.
852 # Note that the vcvars*.bat family of batch files typically
853 # set this for you.  Otherwise, the linker will attempt
854 # to deduce the binary type based on the object files.
855 !IFDEF PLATFORM
856 LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
857 LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
858 !ELSEIF "$(VISUALSTUDIOVERSION)"=="12.0" || \
859         "$(VISUALSTUDIOVERSION)"=="14.0" || \
860         "$(VISUALSTUDIOVERSION)"=="15.0"
861 LTLINKOPTS = /NOLOGO /MACHINE:x86
862 LTLIBOPTS = /NOLOGO /MACHINE:x86
863 !ELSE
864 LTLINKOPTS = /NOLOGO
865 LTLIBOPTS = /NOLOGO
866 !ENDIF
868 # When compiling for use in the WinRT environment, the following
869 # linker option must be used to mark the executable as runnable
870 # only in the context of an application container.
872 !IF $(FOR_WINRT)!=0
873 LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
874 !IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0"
875 !IFNDEF STORELIBPATH
876 !IF "$(PLATFORM)"=="x86"
877 STORELIBPATH = $(CRTLIBPATH)\store
878 !ELSEIF "$(PLATFORM)"=="x64"
879 STORELIBPATH = $(CRTLIBPATH)\store\amd64
880 !ELSEIF "$(PLATFORM)"=="ARM"
881 STORELIBPATH = $(CRTLIBPATH)\store\arm
882 !ELSE
883 STORELIBPATH = $(CRTLIBPATH)\store
884 !ENDIF
885 !ENDIF
886 STORELIBPATH = $(STORELIBPATH:\\=\)
887 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
888 !ENDIF
889 !ENDIF
891 # When compiling for Windows Phone 8.1, an extra library path is
892 # required.
894 !IF $(USE_WP81_OPTS)!=0
895 !IFNDEF WP81LIBPATH
896 !IF "$(PLATFORM)"=="x86"
897 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
898 !ELSEIF "$(PLATFORM)"=="ARM"
899 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM
900 !ELSE
901 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
902 !ENDIF
903 !ENDIF
904 !ENDIF
906 # When compiling for Windows Phone 8.1, some extra linker options
907 # are also required.
909 !IF $(USE_WP81_OPTS)!=0
910 !IFDEF WP81LIBPATH
911 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
912 !ENDIF
913 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
914 LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
915 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
916 !ENDIF
918 # When compiling for UWP or the Windows 10 platform, some extra linker
919 # options are also required.
921 !IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0
922 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib
923 LTLINKOPTS = $(LTLINKOPTS) mincore.lib
924 !IFDEF PSDKLIBPATH
925 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)"
926 !ENDIF
927 !ENDIF
929 !IF $(FOR_WIN10)!=0
930 LTLINKOPTS = $(LTLINKOPTS) /guard:cf "/LIBPATH:$(UCRTLIBPATH)"
931 !IF $(DEBUG)>1
932 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib
933 !ELSE
934 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
935 !ENDIF
936 !ENDIF
938 # If either debugging or symbols are enabled, enable PDBs.
940 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
941 LDFLAGS = /DEBUG $(LDOPTS)
942 !ELSE
943 LDFLAGS = $(LDOPTS)
944 !ENDIF
947 # You should not have to change anything below this line
948 ###############################################################################
951 # Object files for the amalgamation.
953 LIBOBJS1 = sqlite3.lo
955 # Determine the real value of LIBOBJ based on the 'configure' script
957 LIBOBJ = $(LIBOBJS1)
959 # Determine if embedded resource compilation and usage are enabled.
961 !IF $(USE_RC)!=0
962 LIBRESOBJS = sqlite3res.lo
963 !ELSE
964 LIBRESOBJS =
965 !ENDIF
968 # Additional compiler options for the shell.  These are only effective
969 # when the shell is not being dynamically linked.
971 !IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0
972 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_DQS=0
973 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS4=1
974 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1
975 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1
976 !ENDIF
979 # This is the default Makefile target.  The objects listed here
980 # are what get build when you type just "make" with no arguments.
982 core:   dll shell
984 # Targets that require the Tcl library.
986 tcl:    $(ALL_TCL_TARGETS)
988 # This Makefile target builds all of the standard binaries.
990 all:    core tcl
992 # Dynamic link library section.
994 dll:    $(SQLITE3DLL)
996 # Shell executable.
998 shell:  $(SQLITE3EXE)
1001 $(SQLITE3DLL):  $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
1002         $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
1004 Replace.exe:
1005         $(CSC) /target:exe $(TOP)\Replace.cs
1007 sqlite3.def:    Replace.exe $(LIBOBJ)
1008         echo EXPORTS > sqlite3.def
1009         dumpbin /all $(LIBOBJ) \
1010                 | .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup|rebaser|rbu)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \
1011                 | sort >> sqlite3.def
1013 $(SQLITE3EXE):  shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
1014         $(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) shell.c $(SHELL_CORE_SRC) \
1015                 /link $(SQLITE3EXEPDB) $(LDFLAGS) $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
1018 # Rule to build the amalgamation
1020 sqlite3.lo:     $(SQLITE3C)
1021         $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C)
1024 # Rule to build the Win32 resources object file.
1026 !IF $(USE_RC)!=0
1027 _HASHCHAR=^#
1028 !IF ![echo !IFNDEF VERSION > rcver.vc] && \
1029     ![for /F "delims=" %V in ('type "$(SQLITE3H)" ^| "%SystemRoot%\System32\find.exe" "$(_HASHCHAR)define SQLITE_VERSION "') do (echo VERSION = ^^%V >> rcver.vc)] && \
1030     ![echo !ENDIF >> rcver.vc]
1031 !INCLUDE rcver.vc
1032 !ENDIF
1034 RESOURCE_VERSION = $(VERSION:^#=)
1035 RESOURCE_VERSION = $(RESOURCE_VERSION:define=)
1036 RESOURCE_VERSION = $(RESOURCE_VERSION:SQLITE_VERSION=)
1037 RESOURCE_VERSION = $(RESOURCE_VERSION:"=)
1038 RESOURCE_VERSION = $(RESOURCE_VERSION:.=,)
1040 $(LIBRESOBJS):  $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
1041         echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
1042         echo #define SQLITE_RESOURCE_VERSION $(RESOURCE_VERSION) >> sqlite3rc.h
1043         echo #endif >> sqlite3rc.h
1044         $(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc
1045 !ENDIF
1048 clean:
1049         del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
1050         del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
1051         del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL