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
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".
21 # Set this non-0 to enable full warnings (-W4, etc) when compiling.
27 # Set this non-0 to enable treating warnings as errors (-WX, etc) when
30 !IFNDEF USE_FATAL_WARN
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
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
48 # Set this non-0 to use "stdcall" calling convention for the core library
49 # and shell executable.
55 # Use the USE_SEH=0 option on the nmake command line to omit structured
56 # exception handling (SEH) support. SEH is on by default.
62 # Set this non-0 to have the shell executable link against the core dynamic
69 # Set this non-0 to enable extra code that attempts to detect misuse of the
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.
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
87 # Set this non-0 to use the library paths and other options necessary for
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
102 # Set this non-0 to dynamically link to the MSVC runtime library.
108 # Set this non-0 to link to the RPCRT4 library.
110 !IFNDEF USE_RPCRT4_LIB
114 # Set this non-0 to generate assembly code listings for the source code
121 # Set this non-0 to attempt setting the native compiler automatically
122 # for cross-compiling the command line tools needed during the compilation
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
136 # Set this 0 to skip the compiling and embedding of version resources.
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).
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).
158 # Set this non-0 to compile binaries suitable for the Windows 10 platform.
165 # Set this to non-0 to create and use PDBs.
171 # Set this to non-0 to use the SQLite debugging heap subsystem.
177 # Set this to non-0 to use the Win32 native heap subsystem.
183 # Set this to non-0 to enable OSTRACE() macros, which can be useful when
190 # enable address sanitizer using ASAN=1 on the command-line.
196 # Set this to one of the following values to enable various debugging
197 # features. Each level includes the debugging options from the previous
198 # levels. Currently, the recognized values for DEBUG are:
200 # 0 == NDEBUG: Disables assert() and other runtime diagnostics.
201 # 1 == SQLITE_ENABLE_API_ARMOR: extra attempts to detect misuse of the API.
202 # 2 == Disables NDEBUG and all optimizations and then enables PDBs.
203 # 3 == SQLITE_DEBUG: Enables various diagnostics messages and code.
204 # 4 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call.
205 # 5 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros.
206 # 6 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros.
213 # Enable use of available compiler optimizations? Normally, this should be
214 # non-zero. Setting this to zero, thus disabling all compiler optimizations,
215 # can be useful for testing.
217 !IFNDEF OPTIMIZATIONS
221 # Set this to non-0 to enable support for the session extension.
227 # Set this to non-0 to enable support for the rbu extension.
233 # Set the source code file to be used by executables and libraries when
234 # they need the amalgamation.
237 !IF $(SPLIT_AMALGAMATION)!=0
238 SQLITE3C = sqlite3-all.c
244 # Set the include code file to be used by executables and libraries when
251 # This is the name to use for the SQLite dynamic link library (DLL).
255 SQLITE3DLL = winsqlite3.dll
257 SQLITE3DLL = sqlite3.dll
261 # This is the name to use for the SQLite import library (LIB).
265 SQLITE3LIB = winsqlite3.lib
267 SQLITE3LIB = sqlite3.lib
271 # This is the name to use for the SQLite shell executable (EXE).
275 SQLITE3EXE = winsqlite3shell.exe
277 SQLITE3EXE = sqlite3.exe
281 # This is the argument used to set the program database (PDB) file for the
282 # SQLite shell executable (EXE).
284 !IFNDEF SQLITE3EXEPDB
288 SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
293 # These are the "standard" SQLite compilation options used when compiling for
294 # the Windows platform.
296 !IFNDEF OPT_FEATURE_FLAGS
297 !IF $(MINIMAL_AMALGAMATION)==0
298 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
299 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS5=1
300 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
301 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_GEOPOLY=1
302 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
303 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
304 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
305 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
307 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
310 # Should the session extension be enabled? If so, add compilation options
314 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
315 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
318 # Always enable math functions on Windows
319 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS
321 # Should the rbu extension be enabled? If so, add compilation options
325 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RBU=1
328 # Should structured exception handling (SEH) be enabled for WAL mode in
329 # the core library? It is on by default. Only omit it if the
330 # USE_SEH=0 option is provided on the nmake command-line.
333 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_OMIT_SEH=1
336 # These are the "extended" SQLite compilation options used when compiling for
337 # the Windows 10 platform.
339 !IFNDEF EXT_FEATURE_FLAGS
341 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS4=1
342 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_SYSTEM_MALLOC=1
343 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_OMIT_LOCALTIME=1
349 ###############################################################################
350 ############################### END OF OPTIONS ################################
351 ###############################################################################
353 # When compiling for the Windows 10 platform, the PLATFORM macro must be set
354 # to an appropriate value (e.g. x86, x64, arm, arm64, etc).
358 !ERROR Using the FOR_WIN10 option requires a value for PLATFORM.
362 # This assumes that MSVC is always installed in 32-bit Program Files directory
363 # and sets the variable for use in locating other 32-bit installs accordingly.
365 PROGRAMFILES_X86 = $(VCINSTALLDIR)\..\..
366 PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)
368 # Check for the predefined command macro CC. This should point to the compiler
369 # binary for the target platform. If it is not defined, simply define it to
370 # the legacy default value 'cl.exe'.
376 # Check for the predefined command macro CSC. This should point to a working
377 # C Sharp compiler binary. If it is not defined, simply define it to the
378 # legacy default value 'csc.exe'.
384 # Check for the command macro LD. This should point to the linker binary for
385 # the target platform. If it is not defined, simply define it to the legacy
386 # default value 'link.exe'.
392 # Check for the predefined command macro RC. This should point to the resource
393 # compiler binary for the target platform. If it is not defined, simply define
394 # it to the legacy default value 'rc.exe'.
400 # Check for the MSVC runtime library path macro. Otherwise, this value will
401 # default to the 'lib' directory underneath the MSVC installation directory.
404 CRTLIBPATH = $(VCINSTALLDIR)\lib
407 CRTLIBPATH = $(CRTLIBPATH:\\=\)
409 # Check for the command macro NCC. This should point to the compiler binary
410 # for the platform the compilation process is taking place on. If it is not
411 # defined, simply define it to have the same value as the CC macro. When
412 # cross-compiling, it is suggested that this macro be modified via the command
413 # line (since nmake itself does not provide a built-in method to guess it).
414 # For example, to use the x86 compiler when cross-compiling for x64, a command
415 # line similar to the following could be used (all on one line):
417 # nmake /f Makefile.msc sqlite3.dll
418 # XCOMPILE=1 USE_NATIVE_LIBPATHS=1
420 # Alternatively, the full path and file name to the compiler binary for the
421 # platform the compilation process is taking place may be specified (all on
424 # nmake /f Makefile.msc sqlite3.dll
425 # "NCC=""%VCINSTALLDIR%\bin\cl.exe"""
426 # USE_NATIVE_LIBPATHS=1
430 !ELSEIF $(XCOMPILE)!=0
431 NCC = "$(VCINSTALLDIR)\bin\$(CC)"
437 # Check for the MSVC native runtime library path macro. Otherwise,
438 # this value will default to the 'lib' directory underneath the MSVC
439 # installation directory.
442 NCRTLIBPATH = $(VCINSTALLDIR)\lib
445 NCRTLIBPATH = $(NCRTLIBPATH:\\=\)
447 # Check for the Platform SDK library path macro. Otherwise, this
448 # value will default to the 'lib' directory underneath the Windows
449 # SDK installation directory (the environment variable used appears
450 # to be available when using Visual C++ 2008 or later via the
454 NSDKLIBPATH = $(WINDOWSSDKDIR)\lib
457 NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
459 # Check for the UCRT library path macro. Otherwise, this value will
460 # default to the version-specific, platform-specific 'lib' directory
461 # underneath the Windows SDK installation directory.
464 UCRTLIBPATH = $(WINDOWSSDKDIR)\lib\$(WINDOWSSDKLIBVERSION)\ucrt\$(PLATFORM)
467 UCRTLIBPATH = $(UCRTLIBPATH:\\=\)
469 # C compiler and options for use in building executables that
470 # will run on the platform that is doing the build.
472 !IF $(USE_FULLWARN)!=0
473 BCC = $(NCC) -nologo -W4 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
475 BCC = $(NCC) -nologo -W3 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
478 # Check if assembly code listings should be generated for the source
479 # code files to be compiled.
481 !IF $(USE_LISTINGS)!=0
485 # Check if the native library paths should be used when compiling
486 # the command line tools used during the compilation process. If
487 # so, set the necessary macro now.
489 !IF $(USE_NATIVE_LIBPATHS)!=0
490 NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
493 NUCRTLIBPATH = $(NUCRTLIBPATH:\\=\)
494 NLTLIBPATHS = $(NLTLIBPATHS) "/LIBPATH:$(NUCRTLIBPATH)"
498 # C compiler and options for use in building executables that
499 # will run on the target platform. (BCC and TCC are usually the
500 # same unless your are cross-compiling.)
502 !IF $(USE_FULLWARN)!=0
503 TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $(TCCOPTS)
505 TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)
508 # Check if warnings should be treated as errors when compiling.
510 !IF $(USE_FATAL_WARN)!=0
514 TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise
515 RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS)
517 # Check if we want to use the "stdcall" calling convention when compiling.
518 # This is not supported by the compilers for non-x86 platforms. It should
519 # also be noted here that building any target with these "stdcall" options
520 # will most likely fail if the Tcl library is also required. This is due
521 # to how the Tcl library functions are declared and exported (i.e. without
522 # an explicit calling convention, which results in "cdecl").
524 !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
525 !IF "$(PLATFORM)"=="x86"
526 CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
527 SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
530 CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
531 SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
542 # These are additional compiler options used for the core library.
544 !IFNDEF CORE_COMPILE_OPTS
545 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
546 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)
548 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
552 # These are the additional targets that the core library should depend on
555 !IFNDEF CORE_LINK_DEP
556 !IF $(DYNAMIC_SHELL)!=0
558 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
559 CORE_LINK_DEP = sqlite3.def
565 # These are additional linker options used for the core library.
567 !IFNDEF CORE_LINK_OPTS
568 !IF $(DYNAMIC_SHELL)!=0
570 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
571 CORE_LINK_OPTS = /DEF:sqlite3.def
577 # These are additional compiler options used for the shell executable.
579 !IFNDEF SHELL_COMPILE_OPTS
580 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
581 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)
583 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)
587 # This is the source code that the shell executable should be compiled
590 !IFNDEF SHELL_CORE_SRC
591 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
594 SHELL_CORE_SRC = $(SQLITE3C)
598 # This is the core library that the shell executable should depend on.
600 !IFNDEF SHELL_CORE_DEP
601 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
602 SHELL_CORE_DEP = $(SQLITE3DLL)
609 # This is the core library that the shell executable should link with.
611 !IFNDEF SHELL_CORE_LIB
612 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
613 SHELL_CORE_LIB = $(SQLITE3LIB)
619 # These are additional linker options used for the shell executable.
621 !IFNDEF SHELL_LINK_OPTS
622 SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
625 # Check if assembly code listings should be generated for the source
626 # code files to be compiled.
628 !IF $(USE_LISTINGS)!=0
632 # When compiling the library for use in the WinRT environment,
633 # the following compile-time options must be used as well to
634 # disable use of Win32 APIs that are not available and to enable
635 # use of Win32 APIs that are specific to Windows 8 and/or WinRT.
638 TCC = $(TCC) -DSQLITE_OS_WINRT=1
639 RCC = $(RCC) -DSQLITE_OS_WINRT=1
640 TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
641 RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
644 # C compiler options for the Windows 10 platform (needs MSVC 2015).
647 TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
648 BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
651 # Also, we need to dynamically link to the correct MSVC runtime
652 # when compiling for WinRT (e.g. debug or release) OR if the
653 # USE_CRT_DLL option is set to force dynamically linking to the
654 # MSVC runtime library.
656 !IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
675 # Define -DNDEBUG to compile without debugging (i.e., for production usage)
676 # Omitting the define will cause extra debugging code to be inserted and
677 # includes extra comments when "EXPLAIN stmt" is used.
680 TCC = $(TCC) -DNDEBUG
681 BCC = $(BCC) -DNDEBUG
682 RCC = $(RCC) -DNDEBUG
685 !IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0
686 TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1
687 RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
691 TCC = $(TCC) -DSQLITE_DEBUG=1
692 RCC = $(RCC) -DSQLITE_DEBUG=1
693 !IF $(DYNAMIC_SHELL)==0
694 TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
695 RCC = $(RCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
699 !IF $(DEBUG)>4 || $(OSTRACE)!=0
700 TCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
701 RCC = $(RCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
705 TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE=1
706 RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE=1
709 # Prevent warnings about "insecure" MSVC runtime library functions
712 TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
713 BCC = $(BCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
714 RCC = $(RCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
716 # Prevent warnings about "deprecated" POSIX functions being used.
718 TCC = $(TCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
719 BCC = $(BCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
720 RCC = $(RCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
722 # Use the SQLite debugging heap subsystem?
725 TCC = $(TCC) -DSQLITE_MEMDEBUG=1
726 RCC = $(RCC) -DSQLITE_MEMDEBUG=1
728 # Use native Win32 heap subsystem instead of malloc/free?
730 !ELSEIF $(WIN32HEAP)!=0
731 TCC = $(TCC) -DSQLITE_WIN32_MALLOC=1
732 RCC = $(RCC) -DSQLITE_WIN32_MALLOC=1
734 # Validate the heap on every call into the native Win32 heap subsystem?
737 TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
738 RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
743 # Address sanitizer if ASAN=1
746 TCC = $(TCC) /fsanitize=address
750 # Compiler options needed for programs that use the readline() library.
752 !IFNDEF READLINE_FLAGS
753 READLINE_FLAGS = -DHAVE_READLINE=0
756 # The library that programs using readline() must link against.
762 # Should the database engine be compiled threadsafe
764 TCC = $(TCC) -DSQLITE_THREADSAFE=1
765 RCC = $(RCC) -DSQLITE_THREADSAFE=1
767 # Do threads override each others locks by default (1), or do we test (-1)
769 TCC = $(TCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
770 RCC = $(RCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
772 # Any target libraries which libsqlite must be linked against
778 # Flags controlling use of the in memory btree implementation
780 # SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
781 # default to file, 2 to default to memory, and 3 to force temporary
782 # tables to always be in memory.
784 TCC = $(TCC) -DSQLITE_TEMP_STORE=1
785 RCC = $(RCC) -DSQLITE_TEMP_STORE=1
787 # Enable/disable loadable extensions, and other optional features
788 # based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).
789 # The same set of OMIT and ENABLE flags should be passed to the
790 # LEMON parser generator and the mkkeywordhash tool as well.
792 # These are the required SQLite compilation options used when compiling for
793 # the Windows platform.
795 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=100
797 # If we are linking to the RPCRT4 library, enable features that need it.
799 !IF $(USE_RPCRT4_LIB)!=0
800 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_WIN32_USE_UUID=1
803 # Add the required and optional SQLite compilation options into the command
804 # lines used to invoke the MSVC code and resource compilers.
806 TCC = $(TCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
807 RCC = $(RCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
809 # Add in any optional parameters specified on the commane line, e.g.
810 # nmake /f Makefile.msc all "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1"
815 # If compiling for debugging, add some defines.
818 TCC = $(TCC) -D_DEBUG
819 BCC = $(BCC) -D_DEBUG
820 RCC = $(RCC) -D_DEBUG
823 # If optimizations are enabled or disabled (either implicitly or
824 # explicitly), add the necessary flags.
826 !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
829 !IF $(USE_RUNTIME_CHECKS)!=0
833 !ELSEIF $(OPTIMIZATIONS)>=3
836 !ELSEIF $(OPTIMIZATIONS)==2
839 !ELSEIF $(OPTIMIZATIONS)==1
844 # If symbols are enabled (or compiling for debugging), enable PDBs.
846 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
852 # Command line prefixes for compiling code, compiling resources,
855 LTCOMPILE = $(TCC) -Fo$@ -Fd$*.pdb
856 LTRCOMPILE = $(RCC) -r
858 LTLINK = $(TCC) -Fe$@
860 # If requested, link to the RPCRT4 library.
862 !IF $(USE_RPCRT4_LIB)!=0
863 LTLIBS = $(LTLIBS) rpcrt4.lib
866 # If a platform was set, force the linker to target that.
867 # Note that the vcvars*.bat family of batch files typically
868 # set this for you. Otherwise, the linker will attempt
869 # to deduce the binary type based on the object files.
871 LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
872 LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
873 !ELSEIF "$(VISUALSTUDIOVERSION)"=="12.0" || \
874 "$(VISUALSTUDIOVERSION)"=="14.0" || \
875 "$(VISUALSTUDIOVERSION)"=="15.0"
876 LTLINKOPTS = /NOLOGO /MACHINE:x86
877 LTLIBOPTS = /NOLOGO /MACHINE:x86
883 # When compiling for use in the WinRT environment, the following
884 # linker option must be used to mark the executable as runnable
885 # only in the context of an application container.
888 LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
889 !IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0"
891 !IF "$(PLATFORM)"=="x86"
892 STORELIBPATH = $(CRTLIBPATH)\store
893 !ELSEIF "$(PLATFORM)"=="x64"
894 STORELIBPATH = $(CRTLIBPATH)\store\amd64
895 !ELSEIF "$(PLATFORM)"=="ARM"
896 STORELIBPATH = $(CRTLIBPATH)\store\arm
898 STORELIBPATH = $(CRTLIBPATH)\store
901 STORELIBPATH = $(STORELIBPATH:\\=\)
902 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
906 # When compiling for Windows Phone 8.1, an extra library path is
909 !IF $(USE_WP81_OPTS)!=0
911 !IF "$(PLATFORM)"=="x86"
912 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
913 !ELSEIF "$(PLATFORM)"=="ARM"
914 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM
916 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
921 # When compiling for Windows Phone 8.1, some extra linker options
924 !IF $(USE_WP81_OPTS)!=0
926 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
928 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
929 LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
930 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
933 # When compiling for UWP or the Windows 10 platform, some extra linker
934 # options are also required.
936 !IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0
937 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib
938 LTLINKOPTS = $(LTLINKOPTS) mincore.lib
940 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)"
945 LTLINKOPTS = $(LTLINKOPTS) /guard:cf "/LIBPATH:$(UCRTLIBPATH)"
947 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib
949 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
953 # If either debugging or symbols are enabled, enable PDBs.
955 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
956 LDFLAGS = /DEBUG $(LDOPTS)
962 # You should not have to change anything below this line
963 ###############################################################################
966 # Object files for the amalgamation.
968 LIBOBJS1 = sqlite3.lo
970 # Determine the real value of LIBOBJ based on the 'configure' script
974 # Determine if embedded resource compilation and usage are enabled.
977 LIBRESOBJS = sqlite3res.lo
983 # Additional compiler options for the shell. These are only effective
984 # when the shell is not being dynamically linked.
986 !IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0
987 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_DQS=0
988 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS4=1
989 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1
990 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1
991 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION=1
992 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_STMT_SCANSTATUS=1
993 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_STRICT_SUBTYPE=1
997 # This is the default Makefile target. The objects listed here
998 # are what get build when you type just "make" with no arguments.
1002 # Targets that require the Tcl library.
1004 tcl: $(ALL_TCL_TARGETS)
1006 # This Makefile target builds all of the standard binaries.
1010 # Dynamic link library section.
1016 shell: $(SQLITE3EXE)
1019 $(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
1020 $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
1023 $(CSC) /target:exe $(TOP)\Replace.cs
1025 sqlite3.def: Replace.exe $(LIBOBJ)
1026 echo EXPORTS > sqlite3.def
1027 dumpbin /all $(LIBOBJ) \
1028 | .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup|rebaser|rbu)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \
1029 | sort >> sqlite3.def
1031 $(SQLITE3EXE): shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
1032 $(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) shell.c $(SHELL_CORE_SRC) \
1033 /link $(SQLITE3EXEPDB) $(LDFLAGS) $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
1036 # Rule to build the amalgamation
1038 sqlite3.lo: $(SQLITE3C)
1039 $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C)
1042 # Rule to build the Win32 resources object file.
1046 !IF ![echo !IFNDEF VERSION > rcver.vc] && \
1047 ![for /F "delims=" %V in ('type "$(SQLITE3H)" ^| "%SystemRoot%\System32\find.exe" "$(_HASHCHAR)define SQLITE_VERSION "') do (echo VERSION = ^^%V >> rcver.vc)] && \
1048 ![echo !ENDIF >> rcver.vc]
1052 RESOURCE_VERSION = $(VERSION:^#=)
1053 RESOURCE_VERSION = $(RESOURCE_VERSION:define=)
1054 RESOURCE_VERSION = $(RESOURCE_VERSION:SQLITE_VERSION=)
1055 RESOURCE_VERSION = $(RESOURCE_VERSION:"=)
1056 RESOURCE_VERSION = $(RESOURCE_VERSION:.=,)
1058 $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
1059 echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
1060 echo #define SQLITE_RESOURCE_VERSION $(RESOURCE_VERSION) >> sqlite3rc.h
1061 echo #endif >> sqlite3rc.h
1062 $(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc
1067 del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
1068 del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
1069 del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL