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 # Set this non-0 to have the shell executable link against the core dynamic
62 # Set this non-0 to enable extra code that attempts to detect misuse of the
69 # If necessary, create a list of harmless compiler warnings to disable when
70 # compiling the various tools. For the SQLite source code itself, warnings,
71 # if any, will be disabled from within it.
74 !IF $(USE_FULLWARN)!=0
75 NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206
76 NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
80 # Set this non-0 to use the library paths and other options necessary for
87 # Set this non-0 to split the SQLite amalgamation file into chunks to
88 # be used for debugging with Visual Studio.
90 !IFNDEF SPLIT_AMALGAMATION
91 SPLIT_AMALGAMATION = 0
95 # Set this non-0 to dynamically link to the MSVC runtime library.
101 # Set this non-0 to link to the RPCRT4 library.
103 !IFNDEF USE_RPCRT4_LIB
107 # Set this non-0 to generate assembly code listings for the source code
114 # Set this non-0 to attempt setting the native compiler automatically
115 # for cross-compiling the command line tools needed during the compilation
122 # Set this non-0 to use the native libraries paths for cross-compiling
123 # the command line tools needed during the compilation process.
125 !IFNDEF USE_NATIVE_LIBPATHS
126 USE_NATIVE_LIBPATHS = 0
129 # Set this 0 to skip the compiling and embedding of version resources.
135 # Set this non-0 to compile binaries suitable for the WinRT environment.
136 # This setting does not apply to any binaries that require Tcl to operate
137 # properly (i.e. the text fixture, etc).
143 # Set this non-0 to compile binaries suitable for the UWP environment.
144 # This setting does not apply to any binaries that require Tcl to operate
145 # properly (i.e. the text fixture, etc).
151 # Set this non-0 to compile binaries suitable for the Windows 10 platform.
158 # Set this to non-0 to create and use PDBs.
164 # Set this to non-0 to use the SQLite debugging heap subsystem.
170 # Set this to non-0 to use the Win32 native heap subsystem.
176 # Set this to non-0 to enable OSTRACE() macros, which can be useful when
183 # Set this to one of the following values to enable various debugging
184 # features. Each level includes the debugging options from the previous
185 # levels. Currently, the recognized values for DEBUG are:
187 # 0 == NDEBUG: Disables assert() and other runtime diagnostics.
188 # 1 == SQLITE_ENABLE_API_ARMOR: extra attempts to detect misuse of the API.
189 # 2 == Disables NDEBUG and all optimizations and then enables PDBs.
190 # 3 == SQLITE_DEBUG: Enables various diagnostics messages and code.
191 # 4 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call.
192 # 5 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros.
193 # 6 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros.
200 # Enable use of available compiler optimizations? Normally, this should be
201 # non-zero. Setting this to zero, thus disabling all compiler optimizations,
202 # can be useful for testing.
204 !IFNDEF OPTIMIZATIONS
208 # Set this to non-0 to enable support for the session extension.
214 # Set this to non-0 to enable support for the rbu extension.
220 # Set the source code file to be used by executables and libraries when
221 # they need the amalgamation.
224 !IF $(SPLIT_AMALGAMATION)!=0
225 SQLITE3C = sqlite3-all.c
231 # Set the include code file to be used by executables and libraries when
238 # This is the name to use for the SQLite dynamic link library (DLL).
242 SQLITE3DLL = winsqlite3.dll
244 SQLITE3DLL = sqlite3.dll
248 # This is the name to use for the SQLite import library (LIB).
252 SQLITE3LIB = winsqlite3.lib
254 SQLITE3LIB = sqlite3.lib
258 # This is the name to use for the SQLite shell executable (EXE).
262 SQLITE3EXE = winsqlite3shell.exe
264 SQLITE3EXE = sqlite3.exe
268 # This is the argument used to set the program database (PDB) file for the
269 # SQLite shell executable (EXE).
271 !IFNDEF SQLITE3EXEPDB
275 SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
280 # These are the "standard" SQLite compilation options used when compiling for
281 # the Windows platform.
283 !IFNDEF OPT_FEATURE_FLAGS
284 !IF $(MINIMAL_AMALGAMATION)==0
285 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
286 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
287 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_GEOPOLY=1
288 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
289 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
290 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
291 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
293 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
296 # Should the session extension be enabled? If so, add compilation options
300 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
301 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
304 # Always enable math functions on Windows
305 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS
307 # Should the rbu extension be enabled? If so, add compilation options
311 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RBU=1
314 # These are the "extended" SQLite compilation options used when compiling for
315 # the Windows 10 platform.
317 !IFNDEF EXT_FEATURE_FLAGS
319 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS4=1
320 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_SYSTEM_MALLOC=1
321 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_OMIT_LOCALTIME=1
327 ###############################################################################
328 ############################### END OF OPTIONS ################################
329 ###############################################################################
331 # When compiling for the Windows 10 platform, the PLATFORM macro must be set
332 # to an appropriate value (e.g. x86, x64, arm, arm64, etc).
336 !ERROR Using the FOR_WIN10 option requires a value for PLATFORM.
340 # This assumes that MSVC is always installed in 32-bit Program Files directory
341 # and sets the variable for use in locating other 32-bit installs accordingly.
343 PROGRAMFILES_X86 = $(VCINSTALLDIR)\..\..
344 PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)
346 # Check for the predefined command macro CC. This should point to the compiler
347 # binary for the target platform. If it is not defined, simply define it to
348 # the legacy default value 'cl.exe'.
354 # Check for the predefined command macro CSC. This should point to a working
355 # C Sharp compiler binary. If it is not defined, simply define it to the
356 # legacy default value 'csc.exe'.
362 # Check for the command macro LD. This should point to the linker binary for
363 # the target platform. If it is not defined, simply define it to the legacy
364 # default value 'link.exe'.
370 # Check for the predefined command macro RC. This should point to the resource
371 # compiler binary for the target platform. If it is not defined, simply define
372 # it to the legacy default value 'rc.exe'.
378 # Check for the MSVC runtime library path macro. Otherwise, this value will
379 # default to the 'lib' directory underneath the MSVC installation directory.
382 CRTLIBPATH = $(VCINSTALLDIR)\lib
385 CRTLIBPATH = $(CRTLIBPATH:\\=\)
387 # Check for the command macro NCC. This should point to the compiler binary
388 # for the platform the compilation process is taking place on. If it is not
389 # defined, simply define it to have the same value as the CC macro. When
390 # cross-compiling, it is suggested that this macro be modified via the command
391 # line (since nmake itself does not provide a built-in method to guess it).
392 # For example, to use the x86 compiler when cross-compiling for x64, a command
393 # line similar to the following could be used (all on one line):
395 # nmake /f Makefile.msc sqlite3.dll
396 # XCOMPILE=1 USE_NATIVE_LIBPATHS=1
398 # Alternatively, the full path and file name to the compiler binary for the
399 # platform the compilation process is taking place may be specified (all on
402 # nmake /f Makefile.msc sqlite3.dll
403 # "NCC=""%VCINSTALLDIR%\bin\cl.exe"""
404 # USE_NATIVE_LIBPATHS=1
408 !ELSEIF $(XCOMPILE)!=0
409 NCC = "$(VCINSTALLDIR)\bin\$(CC)"
415 # Check for the MSVC native runtime library path macro. Otherwise,
416 # this value will default to the 'lib' directory underneath the MSVC
417 # installation directory.
420 NCRTLIBPATH = $(VCINSTALLDIR)\lib
423 NCRTLIBPATH = $(NCRTLIBPATH:\\=\)
425 # Check for the Platform SDK library path macro. Otherwise, this
426 # value will default to the 'lib' directory underneath the Windows
427 # SDK installation directory (the environment variable used appears
428 # to be available when using Visual C++ 2008 or later via the
432 NSDKLIBPATH = $(WINDOWSSDKDIR)\lib
435 NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
437 # Check for the UCRT library path macro. Otherwise, this value will
438 # default to the version-specific, platform-specific 'lib' directory
439 # underneath the Windows SDK installation directory.
442 UCRTLIBPATH = $(WINDOWSSDKDIR)\lib\$(WINDOWSSDKLIBVERSION)\ucrt\$(PLATFORM)
445 UCRTLIBPATH = $(UCRTLIBPATH:\\=\)
447 # C compiler and options for use in building executables that
448 # will run on the platform that is doing the build.
450 !IF $(USE_FULLWARN)!=0
451 BCC = $(NCC) -nologo -W4 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
453 BCC = $(NCC) -nologo -W3 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
456 # Check if assembly code listings should be generated for the source
457 # code files to be compiled.
459 !IF $(USE_LISTINGS)!=0
463 # Check if the native library paths should be used when compiling
464 # the command line tools used during the compilation process. If
465 # so, set the necessary macro now.
467 !IF $(USE_NATIVE_LIBPATHS)!=0
468 NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
471 NUCRTLIBPATH = $(NUCRTLIBPATH:\\=\)
472 NLTLIBPATHS = $(NLTLIBPATHS) "/LIBPATH:$(NUCRTLIBPATH)"
476 # C compiler and options for use in building executables that
477 # will run on the target platform. (BCC and TCC are usually the
478 # same unless your are cross-compiling.)
480 !IF $(USE_FULLWARN)!=0
481 TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $(TCCOPTS)
483 TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)
486 # Check if warnings should be treated as errors when compiling.
488 !IF $(USE_FATAL_WARN)!=0
492 TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise
493 RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS)
495 # Check if we want to use the "stdcall" calling convention when compiling.
496 # This is not supported by the compilers for non-x86 platforms. It should
497 # also be noted here that building any target with these "stdcall" options
498 # will most likely fail if the Tcl library is also required. This is due
499 # to how the Tcl library functions are declared and exported (i.e. without
500 # an explicit calling convention, which results in "cdecl").
502 !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
503 !IF "$(PLATFORM)"=="x86"
504 CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
505 SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
508 CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
509 SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
520 # These are additional compiler options used for the core library.
522 !IFNDEF CORE_COMPILE_OPTS
523 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
524 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)
526 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
530 # These are the additional targets that the core library should depend on
533 !IFNDEF CORE_LINK_DEP
534 !IF $(DYNAMIC_SHELL)!=0
536 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
537 CORE_LINK_DEP = sqlite3.def
543 # These are additional linker options used for the core library.
545 !IFNDEF CORE_LINK_OPTS
546 !IF $(DYNAMIC_SHELL)!=0
548 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
549 CORE_LINK_OPTS = /DEF:sqlite3.def
555 # These are additional compiler options used for the shell executable.
557 !IFNDEF SHELL_COMPILE_OPTS
558 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
559 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)
561 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)
565 # This is the source code that the shell executable should be compiled
568 !IFNDEF SHELL_CORE_SRC
569 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
572 SHELL_CORE_SRC = $(SQLITE3C)
576 # This is the core library that the shell executable should depend on.
578 !IFNDEF SHELL_CORE_DEP
579 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
580 SHELL_CORE_DEP = $(SQLITE3DLL)
587 # This is the core library that the shell executable should link with.
589 !IFNDEF SHELL_CORE_LIB
590 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
591 SHELL_CORE_LIB = $(SQLITE3LIB)
597 # These are additional linker options used for the shell executable.
599 !IFNDEF SHELL_LINK_OPTS
600 SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
603 # Check if assembly code listings should be generated for the source
604 # code files to be compiled.
606 !IF $(USE_LISTINGS)!=0
610 # When compiling the library for use in the WinRT environment,
611 # the following compile-time options must be used as well to
612 # disable use of Win32 APIs that are not available and to enable
613 # use of Win32 APIs that are specific to Windows 8 and/or WinRT.
616 TCC = $(TCC) -DSQLITE_OS_WINRT=1
617 RCC = $(RCC) -DSQLITE_OS_WINRT=1
618 TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
619 RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
622 # C compiler options for the Windows 10 platform (needs MSVC 2015).
625 TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
626 BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
629 # Also, we need to dynamically link to the correct MSVC runtime
630 # when compiling for WinRT (e.g. debug or release) OR if the
631 # USE_CRT_DLL option is set to force dynamically linking to the
632 # MSVC runtime library.
634 !IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
653 # Define -DNDEBUG to compile without debugging (i.e., for production usage)
654 # Omitting the define will cause extra debugging code to be inserted and
655 # includes extra comments when "EXPLAIN stmt" is used.
658 TCC = $(TCC) -DNDEBUG
659 BCC = $(BCC) -DNDEBUG
660 RCC = $(RCC) -DNDEBUG
663 !IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0
664 TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1
665 RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
669 TCC = $(TCC) -DSQLITE_DEBUG=1
670 RCC = $(RCC) -DSQLITE_DEBUG=1
671 !IF $(DYNAMIC_SHELL)==0
672 TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
673 RCC = $(RCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
677 !IF $(DEBUG)>4 || $(OSTRACE)!=0
678 TCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
679 RCC = $(RCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
683 TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE=1
684 RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE=1
687 # Prevent warnings about "insecure" MSVC runtime library functions
690 TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
691 BCC = $(BCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
692 RCC = $(RCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
694 # Prevent warnings about "deprecated" POSIX functions being used.
696 TCC = $(TCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
697 BCC = $(BCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
698 RCC = $(RCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
700 # Use the SQLite debugging heap subsystem?
703 TCC = $(TCC) -DSQLITE_MEMDEBUG=1
704 RCC = $(RCC) -DSQLITE_MEMDEBUG=1
706 # Use native Win32 heap subsystem instead of malloc/free?
708 !ELSEIF $(WIN32HEAP)!=0
709 TCC = $(TCC) -DSQLITE_WIN32_MALLOC=1
710 RCC = $(RCC) -DSQLITE_WIN32_MALLOC=1
712 # Validate the heap on every call into the native Win32 heap subsystem?
715 TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
716 RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
721 # Compiler options needed for programs that use the readline() library.
723 !IFNDEF READLINE_FLAGS
724 READLINE_FLAGS = -DHAVE_READLINE=0
727 # The library that programs using readline() must link against.
733 # Should the database engine be compiled threadsafe
735 TCC = $(TCC) -DSQLITE_THREADSAFE=1
736 RCC = $(RCC) -DSQLITE_THREADSAFE=1
738 # Do threads override each others locks by default (1), or do we test (-1)
740 TCC = $(TCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
741 RCC = $(RCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
743 # Any target libraries which libsqlite must be linked against
749 # Flags controlling use of the in memory btree implementation
751 # SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
752 # default to file, 2 to default to memory, and 3 to force temporary
753 # tables to always be in memory.
755 TCC = $(TCC) -DSQLITE_TEMP_STORE=1
756 RCC = $(RCC) -DSQLITE_TEMP_STORE=1
758 # Enable/disable loadable extensions, and other optional features
759 # based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).
760 # The same set of OMIT and ENABLE flags should be passed to the
761 # LEMON parser generator and the mkkeywordhash tool as well.
763 # These are the required SQLite compilation options used when compiling for
764 # the Windows platform.
766 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=100
768 # If we are linking to the RPCRT4 library, enable features that need it.
770 !IF $(USE_RPCRT4_LIB)!=0
771 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_WIN32_USE_UUID=1
774 # Add the required and optional SQLite compilation options into the command
775 # lines used to invoke the MSVC code and resource compilers.
777 TCC = $(TCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
778 RCC = $(RCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
780 # Add in any optional parameters specified on the commane line, e.g.
781 # nmake /f Makefile.msc all "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1"
786 # If compiling for debugging, add some defines.
789 TCC = $(TCC) -D_DEBUG
790 BCC = $(BCC) -D_DEBUG
791 RCC = $(RCC) -D_DEBUG
794 # If optimizations are enabled or disabled (either implicitly or
795 # explicitly), add the necessary flags.
797 !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
800 !IF $(USE_RUNTIME_CHECKS)!=0
804 !ELSEIF $(OPTIMIZATIONS)>=3
807 !ELSEIF $(OPTIMIZATIONS)==2
810 !ELSEIF $(OPTIMIZATIONS)==1
815 # If symbols are enabled (or compiling for debugging), enable PDBs.
817 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
823 # Command line prefixes for compiling code, compiling resources,
826 LTCOMPILE = $(TCC) -Fo$@ -Fd$*.pdb
827 LTRCOMPILE = $(RCC) -r
829 LTLINK = $(TCC) -Fe$@
831 # If requested, link to the RPCRT4 library.
833 !IF $(USE_RPCRT4_LIB)!=0
834 LTLIBS = $(LTLIBS) rpcrt4.lib
837 # If a platform was set, force the linker to target that.
838 # Note that the vcvars*.bat family of batch files typically
839 # set this for you. Otherwise, the linker will attempt
840 # to deduce the binary type based on the object files.
842 LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
843 LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
844 !ELSEIF "$(VISUALSTUDIOVERSION)"=="12.0" || \
845 "$(VISUALSTUDIOVERSION)"=="14.0" || \
846 "$(VISUALSTUDIOVERSION)"=="15.0"
847 LTLINKOPTS = /NOLOGO /MACHINE:x86
848 LTLIBOPTS = /NOLOGO /MACHINE:x86
854 # When compiling for use in the WinRT environment, the following
855 # linker option must be used to mark the executable as runnable
856 # only in the context of an application container.
859 LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
860 !IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0"
862 !IF "$(PLATFORM)"=="x86"
863 STORELIBPATH = $(CRTLIBPATH)\store
864 !ELSEIF "$(PLATFORM)"=="x64"
865 STORELIBPATH = $(CRTLIBPATH)\store\amd64
866 !ELSEIF "$(PLATFORM)"=="ARM"
867 STORELIBPATH = $(CRTLIBPATH)\store\arm
869 STORELIBPATH = $(CRTLIBPATH)\store
872 STORELIBPATH = $(STORELIBPATH:\\=\)
873 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
877 # When compiling for Windows Phone 8.1, an extra library path is
880 !IF $(USE_WP81_OPTS)!=0
882 !IF "$(PLATFORM)"=="x86"
883 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
884 !ELSEIF "$(PLATFORM)"=="ARM"
885 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM
887 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
892 # When compiling for Windows Phone 8.1, some extra linker options
895 !IF $(USE_WP81_OPTS)!=0
897 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
899 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
900 LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
901 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
904 # When compiling for UWP or the Windows 10 platform, some extra linker
905 # options are also required.
907 !IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0
908 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib
909 LTLINKOPTS = $(LTLINKOPTS) mincore.lib
911 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)"
916 LTLINKOPTS = $(LTLINKOPTS) /guard:cf "/LIBPATH:$(UCRTLIBPATH)"
918 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib
920 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
924 # If either debugging or symbols are enabled, enable PDBs.
926 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
927 LDFLAGS = /DEBUG $(LDOPTS)
933 # You should not have to change anything below this line
934 ###############################################################################
937 # Object files for the amalgamation.
939 LIBOBJS1 = sqlite3.lo
941 # Determine the real value of LIBOBJ based on the 'configure' script
945 # Determine if embedded resource compilation and usage are enabled.
948 LIBRESOBJS = sqlite3res.lo
954 # Additional compiler options for the shell. These are only effective
955 # when the shell is not being dynamically linked.
957 !IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0
958 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_DQS=0
959 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS4=1
960 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1
961 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1
965 # This is the default Makefile target. The objects listed here
966 # are what get build when you type just "make" with no arguments.
970 # Targets that require the Tcl library.
972 tcl: $(ALL_TCL_TARGETS)
974 # This Makefile target builds all of the standard binaries.
978 # Dynamic link library section.
987 $(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
988 $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
991 $(CSC) /target:exe $(TOP)\Replace.cs
993 sqlite3.def: Replace.exe $(LIBOBJ)
994 echo EXPORTS > sqlite3.def
995 dumpbin /all $(LIBOBJ) \
996 | .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup|rebaser|rbu)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \
997 | sort >> sqlite3.def
999 $(SQLITE3EXE): shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
1000 $(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) shell.c $(SHELL_CORE_SRC) \
1001 /link $(SQLITE3EXEPDB) $(LDFLAGS) $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
1004 # Rule to build the amalgamation
1006 sqlite3.lo: $(SQLITE3C)
1007 $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C)
1010 # Rule to build the Win32 resources object file.
1014 !IF ![echo !IFNDEF VERSION > rcver.vc] && \
1015 ![for /F "delims=" %V in ('type "$(SQLITE3H)" ^| "%SystemRoot%\System32\find.exe" "$(_HASHCHAR)define SQLITE_VERSION "') do (echo VERSION = ^^%V >> rcver.vc)] && \
1016 ![echo !ENDIF >> rcver.vc]
1020 RESOURCE_VERSION = $(VERSION:^#=)
1021 RESOURCE_VERSION = $(RESOURCE_VERSION:define=)
1022 RESOURCE_VERSION = $(RESOURCE_VERSION:SQLITE_VERSION=)
1023 RESOURCE_VERSION = $(RESOURCE_VERSION:"=)
1024 RESOURCE_VERSION = $(RESOURCE_VERSION:.=,)
1026 $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
1027 echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
1028 echo #define SQLITE_RESOURCE_VERSION $(RESOURCE_VERSION) >> sqlite3rc.h
1029 echo #endif >> sqlite3rc.h
1030 $(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc
1035 del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
1036 del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
1037 del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL