Snapshot of upstream SQLite 3.15.2
[sqlcipher.git] / autoconf / Makefile.msc
blobb53e2370eb07db66506d936ef920163197ec9a13
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 = 0
25 !ENDIF
27 # Set this non-0 to enable full runtime error checks (-RTC1, etc).  This
28 # has no effect if (any) optimizations are enabled.
30 !IFNDEF USE_RUNTIME_CHECKS
31 USE_RUNTIME_CHECKS = 0
32 !ENDIF
34 # Set this non-0 to create a SQLite amalgamation file that excludes the
35 # various built-in extensions.
37 !IFNDEF MINIMAL_AMALGAMATION
38 MINIMAL_AMALGAMATION = 0
39 !ENDIF
41 # Set this non-0 to use "stdcall" calling convention for the core library
42 # and shell executable.
44 !IFNDEF USE_STDCALL
45 USE_STDCALL = 0
46 !ENDIF
48 # Set this non-0 to have the shell executable link against the core dynamic
49 # link library.
51 !IFNDEF DYNAMIC_SHELL
52 DYNAMIC_SHELL = 0
53 !ENDIF
55 # Set this non-0 to enable extra code that attempts to detect misuse of the
56 # SQLite API.
58 !IFNDEF API_ARMOR
59 API_ARMOR = 0
60 !ENDIF
62 # If necessary, create a list of harmless compiler warnings to disable when
63 # compiling the various tools.  For the SQLite source code itself, warnings,
64 # if any, will be disabled from within it.
66 !IFNDEF NO_WARN
67 !IF $(USE_FULLWARN)!=0
68 NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206
69 NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4305 -wd4306 -wd4702 -wd4706
70 !ENDIF
71 !ENDIF
73 # Set this non-0 to use the library paths and other options necessary for
74 # Windows Phone 8.1.
76 !IFNDEF USE_WP81_OPTS
77 USE_WP81_OPTS = 0
78 !ENDIF
80 # Set this non-0 to split the SQLite amalgamation file into chunks to
81 # be used for debugging with Visual Studio.
83 !IFNDEF SPLIT_AMALGAMATION
84 SPLIT_AMALGAMATION = 0
85 !ENDIF
88 # Set this non-0 to dynamically link to the MSVC runtime library.
90 !IFNDEF USE_CRT_DLL
91 USE_CRT_DLL = 0
92 !ENDIF
94 # Set this non-0 to link to the RPCRT4 library.
96 !IFNDEF USE_RPCRT4_LIB
97 USE_RPCRT4_LIB = 0
98 !ENDIF
100 # Set this non-0 to generate assembly code listings for the source code
101 # files.
103 !IFNDEF USE_LISTINGS
104 USE_LISTINGS = 0
105 !ENDIF
107 # Set this non-0 to attempt setting the native compiler automatically
108 # for cross-compiling the command line tools needed during the compilation
109 # process.
111 !IFNDEF XCOMPILE
112 XCOMPILE = 0
113 !ENDIF
115 # Set this non-0 to use the native libraries paths for cross-compiling
116 # the command line tools needed during the compilation process.
118 !IFNDEF USE_NATIVE_LIBPATHS
119 USE_NATIVE_LIBPATHS = 0
120 !ENDIF
122 # Set this 0 to skip the compiling and embedding of version resources.
124 !IFNDEF USE_RC
125 USE_RC = 1
126 !ENDIF
128 # Set this non-0 to compile binaries suitable for the WinRT environment.
129 # This setting does not apply to any binaries that require Tcl to operate
130 # properly (i.e. the text fixture, etc).
132 !IFNDEF FOR_WINRT
133 FOR_WINRT = 0
134 !ENDIF
136 # Set this non-0 to compile binaries suitable for the UWP environment.
137 # This setting does not apply to any binaries that require Tcl to operate
138 # properly (i.e. the text fixture, etc).
140 !IFNDEF FOR_UWP
141 FOR_UWP = 0
142 !ENDIF
144 # Set this non-0 to compile binaries suitable for the Windows 10 platform.
146 !IFNDEF FOR_WIN10
147 FOR_WIN10 = 0
148 !ENDIF
151 # Set this to non-0 to create and use PDBs.
153 !IFNDEF SYMBOLS
154 SYMBOLS = 1
155 !ENDIF
157 # Set this to non-0 to use the SQLite debugging heap subsystem.
159 !IFNDEF MEMDEBUG
160 MEMDEBUG = 0
161 !ENDIF
163 # Set this to non-0 to use the Win32 native heap subsystem.
165 !IFNDEF WIN32HEAP
166 WIN32HEAP = 0
167 !ENDIF
169 # Set this to non-0 to enable OSTRACE() macros, which can be useful when
170 # debugging.
172 !IFNDEF OSTRACE
173 OSTRACE = 0
174 !ENDIF
176 # Set this to one of the following values to enable various debugging
177 # features.  Each level includes the debugging options from the previous
178 # levels.  Currently, the recognized values for DEBUG are:
180 # 0 == NDEBUG: Disables assert() and other runtime diagnostics.
181 # 1 == SQLITE_ENABLE_API_ARMOR: extra attempts to detect misuse of the API.
182 # 2 == Disables NDEBUG and all optimizations and then enables PDBs.
183 # 3 == SQLITE_DEBUG: Enables various diagnostics messages and code.
184 # 4 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call.
185 # 5 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros.
186 # 6 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros.
188 !IFNDEF DEBUG
189 DEBUG = 0
190 !ENDIF
192 # Enable use of available compiler optimizations?  Normally, this should be
193 # non-zero.  Setting this to zero, thus disabling all compiler optimizations,
194 # can be useful for testing.
196 !IFNDEF OPTIMIZATIONS
197 OPTIMIZATIONS = 2
198 !ENDIF
200 # Set this to non-0 to enable support for the session extension.
202 !IFNDEF SESSION
203 SESSION = 0
204 !ENDIF
206 # Set the source code file to be used by executables and libraries when
207 # they need the amalgamation.
209 !IFNDEF SQLITE3C
210 !IF $(SPLIT_AMALGAMATION)!=0
211 SQLITE3C = sqlite3-all.c
212 !ELSE
213 SQLITE3C = sqlite3.c
214 !ENDIF
215 !ENDIF
217 # Set the include code file to be used by executables and libraries when
218 # they need SQLite.
220 !IFNDEF SQLITE3H
221 SQLITE3H = sqlite3.h
222 !ENDIF
224 # This is the name to use for the SQLite dynamic link library (DLL).
226 !IFNDEF SQLITE3DLL
227 !IF $(FOR_WIN10)!=0
228 SQLITE3DLL = winsqlite3.dll
229 !ELSE
230 SQLITE3DLL = sqlite3.dll
231 !ENDIF
232 !ENDIF
234 # This is the name to use for the SQLite import library (LIB).
236 !IFNDEF SQLITE3LIB
237 !IF $(FOR_WIN10)!=0
238 SQLITE3LIB = winsqlite3.lib
239 !ELSE
240 SQLITE3LIB = sqlite3.lib
241 !ENDIF
242 !ENDIF
244 # This is the name to use for the SQLite shell executable (EXE).
246 !IFNDEF SQLITE3EXE
247 !IF $(FOR_WIN10)!=0
248 SQLITE3EXE = winsqlite3shell.exe
249 !ELSE
250 SQLITE3EXE = sqlite3.exe
251 !ENDIF
252 !ENDIF
254 # This is the argument used to set the program database (PDB) file for the
255 # SQLite shell executable (EXE).
257 !IFNDEF SQLITE3EXEPDB
258 !IF $(FOR_WIN10)!=0
259 SQLITE3EXEPDB =
260 !ELSE
261 SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
262 !ENDIF
263 !ENDIF
266 # These are the "standard" SQLite compilation options used when compiling for
267 # the Windows platform.
269 !IFNDEF OPT_FEATURE_FLAGS
270 !IF $(MINIMAL_AMALGAMATION)==0
271 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
272 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
273 !ENDIF
274 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
275 !ENDIF
277 # Should the session extension be enabled?  If so, add compilation options
278 # to enable it.
280 !IF $(SESSION)!=0
281 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
282 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
283 !ENDIF
285 # These are the "extended" SQLite compilation options used when compiling for
286 # the Windows 10 platform.
288 !IFNDEF EXT_FEATURE_FLAGS
289 !IF $(FOR_WIN10)!=0
290 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS4=1
291 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_SYSTEM_MALLOC=1
292 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_OMIT_LOCALTIME=1
293 !ELSE
294 EXT_FEATURE_FLAGS =
295 !ENDIF
296 !ENDIF
298 ###############################################################################
299 ############################### END OF OPTIONS ################################
300 ###############################################################################
302 # When compiling for the Windows 10 platform, the PLATFORM macro must be set
303 # to an appropriate value (e.g. x86, x64, arm, arm64, etc).
305 !IF $(FOR_WIN10)!=0
306 !IFNDEF PLATFORM
307 !ERROR Using the FOR_WIN10 option requires a value for PLATFORM.
308 !ENDIF
309 !ENDIF
311 # This assumes that MSVC is always installed in 32-bit Program Files directory
312 # and sets the variable for use in locating other 32-bit installs accordingly.
314 PROGRAMFILES_X86 = $(VCINSTALLDIR)\..\..
315 PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)
317 # Check for the predefined command macro CC.  This should point to the compiler
318 # binary for the target platform.  If it is not defined, simply define it to
319 # the legacy default value 'cl.exe'.
321 !IFNDEF CC
322 CC = cl.exe
323 !ENDIF
325 # Check for the predefined command macro CSC.  This should point to a working
326 # C Sharp compiler binary.  If it is not defined, simply define it to the
327 # legacy default value 'csc.exe'.
329 !IFNDEF CSC
330 CSC = csc.exe
331 !ENDIF
333 # Check for the command macro LD.  This should point to the linker binary for
334 # the target platform.  If it is not defined, simply define it to the legacy
335 # default value 'link.exe'.
337 !IFNDEF LD
338 LD = link.exe
339 !ENDIF
341 # Check for the predefined command macro RC.  This should point to the resource
342 # compiler binary for the target platform.  If it is not defined, simply define
343 # it to the legacy default value 'rc.exe'.
345 !IFNDEF RC
346 RC = rc.exe
347 !ENDIF
349 # Check for the MSVC runtime library path macro.  Otherwise, this value will
350 # default to the 'lib' directory underneath the MSVC installation directory.
352 !IFNDEF CRTLIBPATH
353 CRTLIBPATH = $(VCINSTALLDIR)\lib
354 !ENDIF
356 CRTLIBPATH = $(CRTLIBPATH:\\=\)
358 # Check for the command macro NCC.  This should point to the compiler binary
359 # for the platform the compilation process is taking place on.  If it is not
360 # defined, simply define it to have the same value as the CC macro.  When
361 # cross-compiling, it is suggested that this macro be modified via the command
362 # line (since nmake itself does not provide a built-in method to guess it).
363 # For example, to use the x86 compiler when cross-compiling for x64, a command
364 # line similar to the following could be used (all on one line):
366 #     nmake /f Makefile.msc sqlite3.dll
367 #           XCOMPILE=1 USE_NATIVE_LIBPATHS=1
369 # Alternatively, the full path and file name to the compiler binary for the
370 # platform the compilation process is taking place may be specified (all on
371 # one line):
373 #     nmake /f Makefile.msc sqlite3.dll
374 #           "NCC=""%VCINSTALLDIR%\bin\cl.exe"""
375 #           USE_NATIVE_LIBPATHS=1
377 !IFDEF NCC
378 NCC = $(NCC:\\=\)
379 !ELSEIF $(XCOMPILE)!=0
380 NCC = "$(VCINSTALLDIR)\bin\$(CC)"
381 NCC = $(NCC:\\=\)
382 !ELSE
383 NCC = $(CC)
384 !ENDIF
386 # Check for the MSVC native runtime library path macro.  Otherwise,
387 # this value will default to the 'lib' directory underneath the MSVC
388 # installation directory.
390 !IFNDEF NCRTLIBPATH
391 NCRTLIBPATH = $(VCINSTALLDIR)\lib
392 !ENDIF
394 NCRTLIBPATH = $(NCRTLIBPATH:\\=\)
396 # Check for the Platform SDK library path macro.  Otherwise, this
397 # value will default to the 'lib' directory underneath the Windows
398 # SDK installation directory (the environment variable used appears
399 # to be available when using Visual C++ 2008 or later via the
400 # command line).
402 !IFNDEF NSDKLIBPATH
403 NSDKLIBPATH = $(WINDOWSSDKDIR)\lib
404 !ENDIF
406 NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
408 # Check for the UCRT library path macro.  Otherwise, this value will
409 # default to the version-specific, platform-specific 'lib' directory
410 # underneath the Windows SDK installation directory.
412 !IFNDEF UCRTLIBPATH
413 UCRTLIBPATH = $(WINDOWSSDKDIR)\lib\$(WINDOWSSDKLIBVERSION)\ucrt\$(PLATFORM)
414 !ENDIF
416 UCRTLIBPATH = $(UCRTLIBPATH:\\=\)
418 # C compiler and options for use in building executables that
419 # will run on the platform that is doing the build.
421 !IF $(USE_FULLWARN)!=0
422 BCC = $(NCC) -nologo -W4 $(CCOPTS) $(BCCOPTS)
423 !ELSE
424 BCC = $(NCC) -nologo -W3 $(CCOPTS) $(BCCOPTS)
425 !ENDIF
427 # Check if assembly code listings should be generated for the source
428 # code files to be compiled.
430 !IF $(USE_LISTINGS)!=0
431 BCC = $(BCC) -FAcs
432 !ENDIF
434 # Check if the native library paths should be used when compiling
435 # the command line tools used during the compilation process.  If
436 # so, set the necessary macro now.
438 !IF $(USE_NATIVE_LIBPATHS)!=0
439 NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
441 !IFDEF NUCRTLIBPATH
442 NUCRTLIBPATH = $(NUCRTLIBPATH:\\=\)
443 NLTLIBPATHS = $(NLTLIBPATHS) "/LIBPATH:$(NUCRTLIBPATH)"
444 !ENDIF
445 !ENDIF
447 # C compiler and options for use in building executables that
448 # will run on the target platform.  (BCC and TCC are usually the
449 # same unless your are cross-compiling.)
451 !IF $(USE_FULLWARN)!=0
452 TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $(TCCOPTS)
453 !ELSE
454 TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)
455 !ENDIF
457 TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise
458 RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS)
460 # Check if we want to use the "stdcall" calling convention when compiling.
461 # This is not supported by the compilers for non-x86 platforms.  It should
462 # also be noted here that building any target with these "stdcall" options
463 # will most likely fail if the Tcl library is also required.  This is due
464 # to how the Tcl library functions are declared and exported (i.e. without
465 # an explicit calling convention, which results in "cdecl").
467 !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
468 !IF "$(PLATFORM)"=="x86"
469 CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
470 SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
471 !ELSE
472 !IFNDEF PLATFORM
473 CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
474 SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
475 !ELSE
476 CORE_CCONV_OPTS =
477 SHELL_CCONV_OPTS =
478 !ENDIF
479 !ENDIF
480 !ELSE
481 CORE_CCONV_OPTS =
482 SHELL_CCONV_OPTS =
483 !ENDIF
485 # These are additional compiler options used for the core library.
487 !IFNDEF CORE_COMPILE_OPTS
488 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
489 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)
490 !ELSE
491 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
492 !ENDIF
493 !ENDIF
495 # These are the additional targets that the core library should depend on
496 # when linking.
498 !IFNDEF CORE_LINK_DEP
499 !IF $(DYNAMIC_SHELL)!=0
500 CORE_LINK_DEP =
501 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
502 CORE_LINK_DEP = sqlite3.def
503 !ELSE
504 CORE_LINK_DEP =
505 !ENDIF
506 !ENDIF
508 # These are additional linker options used for the core library.
510 !IFNDEF CORE_LINK_OPTS
511 !IF $(DYNAMIC_SHELL)!=0
512 CORE_LINK_OPTS =
513 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
514 CORE_LINK_OPTS = /DEF:sqlite3.def
515 !ELSE
516 CORE_LINK_OPTS =
517 !ENDIF
518 !ENDIF
520 # These are additional compiler options used for the shell executable.
522 !IFNDEF SHELL_COMPILE_OPTS
523 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
524 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)
525 !ELSE
526 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)
527 !ENDIF
528 !ENDIF
530 # This is the source code that the shell executable should be compiled
531 # with.
533 !IFNDEF SHELL_CORE_SRC
534 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
535 SHELL_CORE_SRC =
536 !ELSE
537 SHELL_CORE_SRC = $(SQLITE3C)
538 !ENDIF
539 !ENDIF
541 # This is the core library that the shell executable should depend on.
543 !IFNDEF SHELL_CORE_DEP
544 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
545 SHELL_CORE_DEP = $(SQLITE3DLL)
546 !ELSE
547 SHELL_CORE_DEP =
548 !ENDIF
549 !ENDIF
551 # This is the core library that the shell executable should link with.
553 !IFNDEF SHELL_CORE_LIB
554 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
555 SHELL_CORE_LIB = $(SQLITE3LIB)
556 !ELSE
557 SHELL_CORE_LIB =
558 !ENDIF
559 !ENDIF
561 # These are additional linker options used for the shell executable.
563 !IFNDEF SHELL_LINK_OPTS
564 SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
565 !ENDIF
567 # Check if assembly code listings should be generated for the source
568 # code files to be compiled.
570 !IF $(USE_LISTINGS)!=0
571 TCC = $(TCC) -FAcs
572 !ENDIF
574 # When compiling the library for use in the WinRT environment,
575 # the following compile-time options must be used as well to
576 # disable use of Win32 APIs that are not available and to enable
577 # use of Win32 APIs that are specific to Windows 8 and/or WinRT.
579 !IF $(FOR_WINRT)!=0
580 TCC = $(TCC) -DSQLITE_OS_WINRT=1
581 RCC = $(RCC) -DSQLITE_OS_WINRT=1
582 TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
583 RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
584 !ENDIF
586 # C compiler options for the Windows 10 platform (needs MSVC 2015).
588 !IF $(FOR_WIN10)!=0
589 TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
590 BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
591 !ENDIF
593 # Also, we need to dynamically link to the correct MSVC runtime
594 # when compiling for WinRT (e.g. debug or release) OR if the
595 # USE_CRT_DLL option is set to force dynamically linking to the
596 # MSVC runtime library.
598 !IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
599 !IF $(DEBUG)>1
600 TCC = $(TCC) -MDd
601 BCC = $(BCC) -MDd
602 !ELSE
603 TCC = $(TCC) -MD
604 BCC = $(BCC) -MD
605 !ENDIF
606 !ELSE
607 !IF $(DEBUG)>1
608 TCC = $(TCC) -MTd
609 BCC = $(BCC) -MTd
610 !ELSE
611 TCC = $(TCC) -MT
612 BCC = $(BCC) -MT
613 !ENDIF
614 !ENDIF
617 # Define -DNDEBUG to compile without debugging (i.e., for production usage)
618 # Omitting the define will cause extra debugging code to be inserted and
619 # includes extra comments when "EXPLAIN stmt" is used.
621 !IF $(DEBUG)==0
622 TCC = $(TCC) -DNDEBUG
623 BCC = $(BCC) -DNDEBUG
624 RCC = $(RCC) -DNDEBUG
625 !ENDIF
627 !IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0
628 TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1
629 RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
630 !ENDIF
632 !IF $(DEBUG)>2
633 TCC = $(TCC) -DSQLITE_DEBUG=1
634 RCC = $(RCC) -DSQLITE_DEBUG=1
635 !ENDIF
637 !IF $(DEBUG)>4 || $(OSTRACE)!=0
638 TCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
639 RCC = $(RCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
640 !ENDIF
642 !IF $(DEBUG)>5
643 TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE=1
644 RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE=1
645 !ENDIF
647 # Prevent warnings about "insecure" MSVC runtime library functions
648 # being used.
650 TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
651 BCC = $(BCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
652 RCC = $(RCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
654 # Prevent warnings about "deprecated" POSIX functions being used.
656 TCC = $(TCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
657 BCC = $(BCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
658 RCC = $(RCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
660 # Use the SQLite debugging heap subsystem?
662 !IF $(MEMDEBUG)!=0
663 TCC = $(TCC) -DSQLITE_MEMDEBUG=1
664 RCC = $(RCC) -DSQLITE_MEMDEBUG=1
666 # Use native Win32 heap subsystem instead of malloc/free?
668 !ELSEIF $(WIN32HEAP)!=0
669 TCC = $(TCC) -DSQLITE_WIN32_MALLOC=1
670 RCC = $(RCC) -DSQLITE_WIN32_MALLOC=1
672 # Validate the heap on every call into the native Win32 heap subsystem?
674 !IF $(DEBUG)>3
675 TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
676 RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
677 !ENDIF
678 !ENDIF
681 # Compiler options needed for programs that use the readline() library.
683 !IFNDEF READLINE_FLAGS
684 READLINE_FLAGS = -DHAVE_READLINE=0
685 !ENDIF
687 # The library that programs using readline() must link against.
689 !IFNDEF LIBREADLINE
690 LIBREADLINE =
691 !ENDIF
693 # Should the database engine be compiled threadsafe
695 TCC = $(TCC) -DSQLITE_THREADSAFE=1
696 RCC = $(RCC) -DSQLITE_THREADSAFE=1
698 # Do threads override each others locks by default (1), or do we test (-1)
700 TCC = $(TCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
701 RCC = $(RCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
703 # Any target libraries which libsqlite must be linked against
705 !IFNDEF TLIBS
706 TLIBS =
707 !ENDIF
709 # Flags controlling use of the in memory btree implementation
711 # SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
712 # default to file, 2 to default to memory, and 3 to force temporary
713 # tables to always be in memory.
715 TCC = $(TCC) -DSQLITE_TEMP_STORE=1
716 RCC = $(RCC) -DSQLITE_TEMP_STORE=1
718 # Enable/disable loadable extensions, and other optional features
719 # based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).
720 # The same set of OMIT and ENABLE flags should be passed to the
721 # LEMON parser generator and the mkkeywordhash tool as well.
723 # These are the required SQLite compilation options used when compiling for
724 # the Windows platform.
726 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=100
728 # If we are linking to the RPCRT4 library, enable features that need it.
730 !IF $(USE_RPCRT4_LIB)!=0
731 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_WIN32_USE_UUID=1
732 !ENDIF
734 # Add the required and optional SQLite compilation options into the command
735 # lines used to invoke the MSVC code and resource compilers.
737 TCC = $(TCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
738 RCC = $(RCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
740 # Add in any optional parameters specified on the commane line, e.g.
741 # nmake /f Makefile.msc all "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1"
743 TCC = $(TCC) $(OPTS)
744 RCC = $(RCC) $(OPTS)
746 # If compiling for debugging, add some defines.
748 !IF $(DEBUG)>1
749 TCC = $(TCC) -D_DEBUG
750 BCC = $(BCC) -D_DEBUG
751 RCC = $(RCC) -D_DEBUG
752 !ENDIF
754 # If optimizations are enabled or disabled (either implicitly or
755 # explicitly), add the necessary flags.
757 !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
758 TCC = $(TCC) -Od
759 BCC = $(BCC) -Od
760 !IF $(USE_RUNTIME_CHECKS)!=0
761 TCC = $(TCC) -RTC1
762 BCC = $(BCC) -RTC1
763 !ENDIF
764 !ELSEIF $(OPTIMIZATIONS)>=3
765 TCC = $(TCC) -Ox
766 BCC = $(BCC) -Ox
767 !ELSEIF $(OPTIMIZATIONS)==2
768 TCC = $(TCC) -O2
769 BCC = $(BCC) -O2
770 !ELSEIF $(OPTIMIZATIONS)==1
771 TCC = $(TCC) -O1
772 BCC = $(BCC) -O1
773 !ENDIF
775 # If symbols are enabled (or compiling for debugging), enable PDBs.
777 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
778 TCC = $(TCC) -Zi
779 BCC = $(BCC) -Zi
780 !ENDIF
783 # Command line prefixes for compiling code, compiling resources,
784 # linking, etc.
786 LTCOMPILE = $(TCC) -Fo$@
787 LTRCOMPILE = $(RCC) -r
788 LTLIB = lib.exe
789 LTLINK = $(TCC) -Fe$@
791 # If requested, link to the RPCRT4 library.
793 !IF $(USE_RPCRT4_LIB)!=0
794 LTLINK = $(LTLINK) rpcrt4.lib
795 !ENDIF
797 # If a platform was set, force the linker to target that.
798 # Note that the vcvars*.bat family of batch files typically
799 # set this for you.  Otherwise, the linker will attempt
800 # to deduce the binary type based on the object files.
801 !IFDEF PLATFORM
802 LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
803 LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
804 !ELSE
805 LTLINKOPTS = /NOLOGO
806 LTLIBOPTS = /NOLOGO
807 !ENDIF
809 # When compiling for use in the WinRT environment, the following
810 # linker option must be used to mark the executable as runnable
811 # only in the context of an application container.
813 !IF $(FOR_WINRT)!=0
814 LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
815 !IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0"
816 !IFNDEF STORELIBPATH
817 !IF "$(PLATFORM)"=="x86"
818 STORELIBPATH = $(CRTLIBPATH)\store
819 !ELSEIF "$(PLATFORM)"=="x64"
820 STORELIBPATH = $(CRTLIBPATH)\store\amd64
821 !ELSEIF "$(PLATFORM)"=="ARM"
822 STORELIBPATH = $(CRTLIBPATH)\store\arm
823 !ELSE
824 STORELIBPATH = $(CRTLIBPATH)\store
825 !ENDIF
826 !ENDIF
827 STORELIBPATH = $(STORELIBPATH:\\=\)
828 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
829 !ENDIF
830 !ENDIF
832 # When compiling for Windows Phone 8.1, an extra library path is
833 # required.
835 !IF $(USE_WP81_OPTS)!=0
836 !IFNDEF WP81LIBPATH
837 !IF "$(PLATFORM)"=="x86"
838 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
839 !ELSEIF "$(PLATFORM)"=="ARM"
840 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM
841 !ELSE
842 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
843 !ENDIF
844 !ENDIF
845 !ENDIF
847 # When compiling for Windows Phone 8.1, some extra linker options
848 # are also required.
850 !IF $(USE_WP81_OPTS)!=0
851 !IFDEF WP81LIBPATH
852 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
853 !ENDIF
854 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
855 LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
856 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
857 !ENDIF
859 # When compiling for UWP or the Windows 10 platform, some extra linker
860 # options are also required.
862 !IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0
863 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib
864 LTLINKOPTS = $(LTLINKOPTS) mincore.lib
865 !IFDEF PSDKLIBPATH
866 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)"
867 !ENDIF
868 !ENDIF
870 !IF $(FOR_WIN10)!=0
871 LTLINKOPTS = $(LTLINKOPTS) /guard:cf "/LIBPATH:$(UCRTLIBPATH)"
872 !IF $(DEBUG)>1
873 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib
874 !ELSE
875 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
876 !ENDIF
877 !ENDIF
879 # If either debugging or symbols are enabled, enable PDBs.
881 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
882 LDFLAGS = /DEBUG $(LDOPTS)
883 !ELSE
884 LDFLAGS = $(LDOPTS)
885 !ENDIF
888 # You should not have to change anything below this line
889 ###############################################################################
892 # Object files for the amalgamation.
894 LIBOBJS1 = sqlite3.lo
896 # Determine the real value of LIBOBJ based on the 'configure' script
898 LIBOBJ = $(LIBOBJS1)
900 # Determine if embedded resource compilation and usage are enabled.
902 !IF $(USE_RC)!=0
903 LIBRESOBJS = sqlite3res.lo
904 !ELSE
905 LIBRESOBJS =
906 !ENDIF
909 # Additional compiler options for the shell.  These are only effective
910 # when the shell is not being dynamically linked.
912 !IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0
913 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS
914 !ENDIF
917 # This is the default Makefile target.  The objects listed here
918 # are what get build when you type just "make" with no arguments.
920 all:    dll shell
922 # Dynamic link library section.
924 dll:    $(SQLITE3DLL)
926 # Shell executable.
928 shell:  $(SQLITE3EXE)
931 $(SQLITE3DLL):  $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
932         $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
934 Replace.exe:
935         $(CSC) /target:exe $(TOP)\Replace.cs
937 sqlite3.def:    Replace.exe $(LIBOBJ)
938         echo EXPORTS > sqlite3.def
939         dumpbin /all $(LIBOBJ) \
940                 | .\Replace.exe "^\s+/EXPORT:_?(sqlite3_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \
941                 | sort >> sqlite3.def
943 $(SQLITE3EXE):  $(TOP)\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
944         $(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\shell.c $(SHELL_CORE_SRC) \
945                 /link $(SQLITE3EXEPDB) $(LDFLAGS) $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
948 # Rule to build the amalgamation
950 sqlite3.lo:     $(SQLITE3C)
951         $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C)
954 # Rule to build the Win32 resources object file.
956 !IF $(USE_RC)!=0
957 _HASHCHAR=^#
958 !IF ![echo !IFNDEF VERSION > rcver.vc] && \
959     ![for /F "delims=" %V in ('type "$(SQLITE3H)" ^| find "$(_HASHCHAR)define SQLITE_VERSION "') do (echo VERSION = ^^%V >> rcver.vc)] && \
960     ![echo !ENDIF >> rcver.vc]
961 !INCLUDE rcver.vc
962 !ENDIF
964 RESOURCE_VERSION = $(VERSION:^#=)
965 RESOURCE_VERSION = $(RESOURCE_VERSION:define=)
966 RESOURCE_VERSION = $(RESOURCE_VERSION:SQLITE_VERSION=)
967 RESOURCE_VERSION = $(RESOURCE_VERSION:"=)
968 RESOURCE_VERSION = $(RESOURCE_VERSION:.=,)
970 $(LIBRESOBJS):  $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
971         echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
972         echo #define SQLITE_RESOURCE_VERSION $(RESOURCE_VERSION) >> sqlite3rc.h
973         echo #endif >> sqlite3rc.h
974         $(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc
975 !ENDIF
978 clean:
979         del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
980         del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
981         del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL