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 -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.
199 # Enable use of available compiler optimizations? Normally, this should be
200 # non-zero. Setting this to zero, thus disabling all compiler optimizations,
201 # can be useful for testing.
203 !IFNDEF OPTIMIZATIONS
207 # Set this to non-0 to enable support for the session extension.
213 # Set the source code file to be used by executables and libraries when
214 # they need the amalgamation.
217 !IF $(SPLIT_AMALGAMATION)!=0
218 SQLITE3C = sqlite3-all.c
224 # Set the include code file to be used by executables and libraries when
231 # This is the name to use for the SQLite dynamic link library (DLL).
235 SQLITE3DLL = winsqlite3.dll
237 SQLITE3DLL = sqlite3.dll
241 # This is the name to use for the SQLite import library (LIB).
245 SQLITE3LIB = winsqlite3.lib
247 SQLITE3LIB = sqlite3.lib
251 # This is the name to use for the SQLite shell executable (EXE).
255 SQLITE3EXE = winsqlite3shell.exe
257 SQLITE3EXE = sqlite3.exe
261 # This is the argument used to set the program database (PDB) file for the
262 # SQLite shell executable (EXE).
264 !IFNDEF SQLITE3EXEPDB
268 SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
273 # These are the "standard" SQLite compilation options used when compiling for
274 # the Windows platform.
276 !IFNDEF OPT_FEATURE_FLAGS
277 !IF $(MINIMAL_AMALGAMATION)==0
278 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
279 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
281 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
284 # Should the session extension be enabled? If so, add compilation options
288 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
289 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
292 # These are the "extended" SQLite compilation options used when compiling for
293 # the Windows 10 platform.
295 !IFNDEF EXT_FEATURE_FLAGS
297 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS4=1
298 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_SYSTEM_MALLOC=1
299 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_OMIT_LOCALTIME=1
305 ###############################################################################
306 ############################### END OF OPTIONS ################################
307 ###############################################################################
309 # When compiling for the Windows 10 platform, the PLATFORM macro must be set
310 # to an appropriate value (e.g. x86, x64, arm, arm64, etc).
314 !ERROR Using the FOR_WIN10 option requires a value for PLATFORM.
318 # This assumes that MSVC is always installed in 32-bit Program Files directory
319 # and sets the variable for use in locating other 32-bit installs accordingly.
321 PROGRAMFILES_X86 = $(VCINSTALLDIR)\..\..
322 PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)
324 # Check for the predefined command macro CC. This should point to the compiler
325 # binary for the target platform. If it is not defined, simply define it to
326 # the legacy default value 'cl.exe'.
332 # Check for the predefined command macro CSC. This should point to a working
333 # C Sharp compiler binary. If it is not defined, simply define it to the
334 # legacy default value 'csc.exe'.
340 # Check for the command macro LD. This should point to the linker binary for
341 # the target platform. If it is not defined, simply define it to the legacy
342 # default value 'link.exe'.
348 # Check for the predefined command macro RC. This should point to the resource
349 # compiler binary for the target platform. If it is not defined, simply define
350 # it to the legacy default value 'rc.exe'.
356 # Check for the MSVC runtime library path macro. Otherwise, this value will
357 # default to the 'lib' directory underneath the MSVC installation directory.
360 CRTLIBPATH = $(VCINSTALLDIR)\lib
363 CRTLIBPATH = $(CRTLIBPATH:\\=\)
365 # Check for the command macro NCC. This should point to the compiler binary
366 # for the platform the compilation process is taking place on. If it is not
367 # defined, simply define it to have the same value as the CC macro. When
368 # cross-compiling, it is suggested that this macro be modified via the command
369 # line (since nmake itself does not provide a built-in method to guess it).
370 # For example, to use the x86 compiler when cross-compiling for x64, a command
371 # line similar to the following could be used (all on one line):
373 # nmake /f Makefile.msc sqlite3.dll
374 # XCOMPILE=1 USE_NATIVE_LIBPATHS=1
376 # Alternatively, the full path and file name to the compiler binary for the
377 # platform the compilation process is taking place may be specified (all on
380 # nmake /f Makefile.msc sqlite3.dll
381 # "NCC=""%VCINSTALLDIR%\bin\cl.exe"""
382 # USE_NATIVE_LIBPATHS=1
386 !ELSEIF $(XCOMPILE)!=0
387 NCC = "$(VCINSTALLDIR)\bin\$(CC)"
393 # Check for the MSVC native runtime library path macro. Otherwise,
394 # this value will default to the 'lib' directory underneath the MSVC
395 # installation directory.
398 NCRTLIBPATH = $(VCINSTALLDIR)\lib
401 NCRTLIBPATH = $(NCRTLIBPATH:\\=\)
403 # Check for the Platform SDK library path macro. Otherwise, this
404 # value will default to the 'lib' directory underneath the Windows
405 # SDK installation directory (the environment variable used appears
406 # to be available when using Visual C++ 2008 or later via the
410 NSDKLIBPATH = $(WINDOWSSDKDIR)\lib
413 NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
415 # Check for the UCRT library path macro. Otherwise, this value will
416 # default to the version-specific, platform-specific 'lib' directory
417 # underneath the Windows SDK installation directory.
420 UCRTLIBPATH = $(WINDOWSSDKDIR)\lib\$(WINDOWSSDKLIBVERSION)\ucrt\$(PLATFORM)
423 UCRTLIBPATH = $(UCRTLIBPATH:\\=\)
425 # C compiler and options for use in building executables that
426 # will run on the platform that is doing the build.
428 !IF $(USE_FULLWARN)!=0
429 BCC = $(NCC) -nologo -W4 $(CCOPTS) $(BCCOPTS)
431 BCC = $(NCC) -nologo -W3 $(CCOPTS) $(BCCOPTS)
434 # Check if assembly code listings should be generated for the source
435 # code files to be compiled.
437 !IF $(USE_LISTINGS)!=0
441 # Check if the native library paths should be used when compiling
442 # the command line tools used during the compilation process. If
443 # so, set the necessary macro now.
445 !IF $(USE_NATIVE_LIBPATHS)!=0
446 NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
449 NUCRTLIBPATH = $(NUCRTLIBPATH:\\=\)
450 NLTLIBPATHS = $(NLTLIBPATHS) "/LIBPATH:$(NUCRTLIBPATH)"
454 # C compiler and options for use in building executables that
455 # will run on the target platform. (BCC and TCC are usually the
456 # same unless your are cross-compiling.)
458 !IF $(USE_FULLWARN)!=0
459 TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $(TCCOPTS)
461 TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)
464 # Check if warnings should be treated as errors when compiling.
466 !IF $(USE_FATAL_WARN)!=0
470 TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise
471 RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS)
473 # Check if we want to use the "stdcall" calling convention when compiling.
474 # This is not supported by the compilers for non-x86 platforms. It should
475 # also be noted here that building any target with these "stdcall" options
476 # will most likely fail if the Tcl library is also required. This is due
477 # to how the Tcl library functions are declared and exported (i.e. without
478 # an explicit calling convention, which results in "cdecl").
480 !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
481 !IF "$(PLATFORM)"=="x86"
482 CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
483 SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
486 CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
487 SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
498 # These are additional compiler options used for the core library.
500 !IFNDEF CORE_COMPILE_OPTS
501 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
502 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)
504 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
508 # These are the additional targets that the core library should depend on
511 !IFNDEF CORE_LINK_DEP
512 !IF $(DYNAMIC_SHELL)!=0
514 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
515 CORE_LINK_DEP = sqlite3.def
521 # These are additional linker options used for the core library.
523 !IFNDEF CORE_LINK_OPTS
524 !IF $(DYNAMIC_SHELL)!=0
526 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
527 CORE_LINK_OPTS = /DEF:sqlite3.def
533 # These are additional compiler options used for the shell executable.
535 !IFNDEF SHELL_COMPILE_OPTS
536 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
537 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)
539 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)
543 # This is the source code that the shell executable should be compiled
546 !IFNDEF SHELL_CORE_SRC
547 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
550 SHELL_CORE_SRC = $(SQLITE3C)
554 # This is the core library that the shell executable should depend on.
556 !IFNDEF SHELL_CORE_DEP
557 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
558 SHELL_CORE_DEP = $(SQLITE3DLL)
565 # This is the core library that the shell executable should link with.
567 !IFNDEF SHELL_CORE_LIB
568 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
569 SHELL_CORE_LIB = $(SQLITE3LIB)
575 # These are additional linker options used for the shell executable.
577 !IFNDEF SHELL_LINK_OPTS
578 SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
581 # Check if assembly code listings should be generated for the source
582 # code files to be compiled.
584 !IF $(USE_LISTINGS)!=0
588 # When compiling the library for use in the WinRT environment,
589 # the following compile-time options must be used as well to
590 # disable use of Win32 APIs that are not available and to enable
591 # use of Win32 APIs that are specific to Windows 8 and/or WinRT.
594 TCC = $(TCC) -DSQLITE_OS_WINRT=1
595 RCC = $(RCC) -DSQLITE_OS_WINRT=1
596 TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
597 RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
600 # C compiler options for the Windows 10 platform (needs MSVC 2015).
603 TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
604 BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
607 # Also, we need to dynamically link to the correct MSVC runtime
608 # when compiling for WinRT (e.g. debug or release) OR if the
609 # USE_CRT_DLL option is set to force dynamically linking to the
610 # MSVC runtime library.
612 !IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
631 # Define -DNDEBUG to compile without debugging (i.e., for production usage)
632 # Omitting the define will cause extra debugging code to be inserted and
633 # includes extra comments when "EXPLAIN stmt" is used.
636 TCC = $(TCC) -DNDEBUG
637 BCC = $(BCC) -DNDEBUG
638 RCC = $(RCC) -DNDEBUG
641 !IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0
642 TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1
643 RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
647 TCC = $(TCC) -DSQLITE_DEBUG=1
648 RCC = $(RCC) -DSQLITE_DEBUG=1
649 !IF $(DYNAMIC_SHELL)==0
650 TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
651 RCC = $(RCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
655 !IF $(DEBUG)>4 || $(OSTRACE)!=0
656 TCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
657 RCC = $(RCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
661 TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE=1
662 RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE=1
665 # Prevent warnings about "insecure" MSVC runtime library functions
668 TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
669 BCC = $(BCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
670 RCC = $(RCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
672 # Prevent warnings about "deprecated" POSIX functions being used.
674 TCC = $(TCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
675 BCC = $(BCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
676 RCC = $(RCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
678 # Use the SQLite debugging heap subsystem?
681 TCC = $(TCC) -DSQLITE_MEMDEBUG=1
682 RCC = $(RCC) -DSQLITE_MEMDEBUG=1
684 # Use native Win32 heap subsystem instead of malloc/free?
686 !ELSEIF $(WIN32HEAP)!=0
687 TCC = $(TCC) -DSQLITE_WIN32_MALLOC=1
688 RCC = $(RCC) -DSQLITE_WIN32_MALLOC=1
690 # Validate the heap on every call into the native Win32 heap subsystem?
693 TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
694 RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
699 # Compiler options needed for programs that use the readline() library.
701 !IFNDEF READLINE_FLAGS
702 READLINE_FLAGS = -DHAVE_READLINE=0
705 # The library that programs using readline() must link against.
711 # Should the database engine be compiled threadsafe
713 TCC = $(TCC) -DSQLITE_THREADSAFE=1
714 RCC = $(RCC) -DSQLITE_THREADSAFE=1
716 # Do threads override each others locks by default (1), or do we test (-1)
718 TCC = $(TCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
719 RCC = $(RCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
721 # Any target libraries which libsqlite must be linked against
727 # Flags controlling use of the in memory btree implementation
729 # SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
730 # default to file, 2 to default to memory, and 3 to force temporary
731 # tables to always be in memory.
733 TCC = $(TCC) -DSQLITE_TEMP_STORE=1
734 RCC = $(RCC) -DSQLITE_TEMP_STORE=1
736 # Enable/disable loadable extensions, and other optional features
737 # based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).
738 # The same set of OMIT and ENABLE flags should be passed to the
739 # LEMON parser generator and the mkkeywordhash tool as well.
741 # These are the required SQLite compilation options used when compiling for
742 # the Windows platform.
744 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=100
746 # If we are linking to the RPCRT4 library, enable features that need it.
748 !IF $(USE_RPCRT4_LIB)!=0
749 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_WIN32_USE_UUID=1
752 # Add the required and optional SQLite compilation options into the command
753 # lines used to invoke the MSVC code and resource compilers.
755 TCC = $(TCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
756 RCC = $(RCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
758 # Add in any optional parameters specified on the commane line, e.g.
759 # nmake /f Makefile.msc all "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1"
764 # If compiling for debugging, add some defines.
767 TCC = $(TCC) -D_DEBUG
768 BCC = $(BCC) -D_DEBUG
769 RCC = $(RCC) -D_DEBUG
772 # If optimizations are enabled or disabled (either implicitly or
773 # explicitly), add the necessary flags.
775 !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
778 !IF $(USE_RUNTIME_CHECKS)!=0
782 !ELSEIF $(OPTIMIZATIONS)>=3
785 !ELSEIF $(OPTIMIZATIONS)==2
788 !ELSEIF $(OPTIMIZATIONS)==1
793 # If symbols are enabled (or compiling for debugging), enable PDBs.
795 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
801 # Command line prefixes for compiling code, compiling resources,
804 LTCOMPILE = $(TCC) -Fo$@
805 LTRCOMPILE = $(RCC) -r
807 LTLINK = $(TCC) -Fe$@
809 # If requested, link to the RPCRT4 library.
811 !IF $(USE_RPCRT4_LIB)!=0
812 LTLIBS = $(LTLIBS) rpcrt4.lib
815 # If a platform was set, force the linker to target that.
816 # Note that the vcvars*.bat family of batch files typically
817 # set this for you. Otherwise, the linker will attempt
818 # to deduce the binary type based on the object files.
820 LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
821 LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
827 # When compiling for use in the WinRT environment, the following
828 # linker option must be used to mark the executable as runnable
829 # only in the context of an application container.
832 LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
833 !IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0"
835 !IF "$(PLATFORM)"=="x86"
836 STORELIBPATH = $(CRTLIBPATH)\store
837 !ELSEIF "$(PLATFORM)"=="x64"
838 STORELIBPATH = $(CRTLIBPATH)\store\amd64
839 !ELSEIF "$(PLATFORM)"=="ARM"
840 STORELIBPATH = $(CRTLIBPATH)\store\arm
842 STORELIBPATH = $(CRTLIBPATH)\store
845 STORELIBPATH = $(STORELIBPATH:\\=\)
846 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
850 # When compiling for Windows Phone 8.1, an extra library path is
853 !IF $(USE_WP81_OPTS)!=0
855 !IF "$(PLATFORM)"=="x86"
856 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
857 !ELSEIF "$(PLATFORM)"=="ARM"
858 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM
860 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
865 # When compiling for Windows Phone 8.1, some extra linker options
868 !IF $(USE_WP81_OPTS)!=0
870 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
872 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
873 LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
874 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
877 # When compiling for UWP or the Windows 10 platform, some extra linker
878 # options are also required.
880 !IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0
881 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib
882 LTLINKOPTS = $(LTLINKOPTS) mincore.lib
884 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)"
889 LTLINKOPTS = $(LTLINKOPTS) /guard:cf "/LIBPATH:$(UCRTLIBPATH)"
891 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib
893 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
897 # If either debugging or symbols are enabled, enable PDBs.
899 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
900 LDFLAGS = /DEBUG $(LDOPTS)
906 # You should not have to change anything below this line
907 ###############################################################################
910 # Object files for the amalgamation.
912 LIBOBJS1 = sqlite3.lo
914 # Determine the real value of LIBOBJ based on the 'configure' script
918 # Determine if embedded resource compilation and usage are enabled.
921 LIBRESOBJS = sqlite3res.lo
927 # Additional compiler options for the shell. These are only effective
928 # when the shell is not being dynamically linked.
930 !IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0
931 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_STMTVTAB
932 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_DBSTAT_VTAB
933 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_INTROSPECTION_PRAGMAS
937 # This is the default Makefile target. The objects listed here
938 # are what get build when you type just "make" with no arguments.
942 # Targets that require the Tcl library.
944 tcl: $(ALL_TCL_TARGETS)
946 # This Makefile target builds all of the standard binaries.
950 # Dynamic link library section.
959 $(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
960 $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
963 $(CSC) /target:exe $(TOP)\Replace.cs
965 sqlite3.def: Replace.exe $(LIBOBJ)
966 echo EXPORTS > sqlite3.def
967 dumpbin /all $(LIBOBJ) \
968 | .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \
969 | sort >> sqlite3.def
971 $(SQLITE3EXE): shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
972 $(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) shell.c $(SHELL_CORE_SRC) \
973 /link $(SQLITE3EXEPDB) $(LDFLAGS) $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
976 # Rule to build the amalgamation
978 sqlite3.lo: $(SQLITE3C)
979 $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C)
982 # Rule to build the Win32 resources object file.
986 !IF ![echo !IFNDEF VERSION > rcver.vc] && \
987 ![for /F "delims=" %V in ('type "$(SQLITE3H)" ^| "%SystemRoot%\System32\find.exe" "$(_HASHCHAR)define SQLITE_VERSION "') do (echo VERSION = ^^%V >> rcver.vc)] && \
988 ![echo !ENDIF >> rcver.vc]
992 RESOURCE_VERSION = $(VERSION:^#=)
993 RESOURCE_VERSION = $(RESOURCE_VERSION:define=)
994 RESOURCE_VERSION = $(RESOURCE_VERSION:SQLITE_VERSION=)
995 RESOURCE_VERSION = $(RESOURCE_VERSION:"=)
996 RESOURCE_VERSION = $(RESOURCE_VERSION:.=,)
998 $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
999 echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
1000 echo #define SQLITE_RESOURCE_VERSION $(RESOURCE_VERSION) >> sqlite3rc.h
1001 echo #endif >> sqlite3rc.h
1002 $(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc
1007 del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
1008 del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
1009 del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL