]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/sqlite3/Makefile.msc
unbound: Vendor import 1.19.0
[FreeBSD/FreeBSD.git] / contrib / sqlite3 / Makefile.msc
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.
6 #
7
8 #
9 # nmake Makefile for SQLite
10 #
11 ###############################################################################
12 ############################## START OF OPTIONS ###############################
13 ###############################################################################
14
15 # The toplevel directory of the source tree.  This is the directory
16 # that contains this "Makefile.msc".
17 #
18 TOP = .
19
20
21 # Set this non-0 to enable full warnings (-W4, etc) when compiling.
22 #
23 !IFNDEF USE_FULLWARN
24 USE_FULLWARN = 1
25 !ENDIF
26
27 # Set this non-0 to enable treating warnings as errors (-WX, etc) when
28 # compiling.
29 #
30 !IFNDEF USE_FATAL_WARN
31 USE_FATAL_WARN = 0
32 !ENDIF
33
34 # Set this non-0 to enable full runtime error checks (-RTC1, etc).  This
35 # has no effect if (any) optimizations are enabled.
36 #
37 !IFNDEF USE_RUNTIME_CHECKS
38 USE_RUNTIME_CHECKS = 0
39 !ENDIF
40
41 # Set this non-0 to create a SQLite amalgamation file that excludes the
42 # various built-in extensions.
43 #
44 !IFNDEF MINIMAL_AMALGAMATION
45 MINIMAL_AMALGAMATION = 0
46 !ENDIF
47
48 # Set this non-0 to use "stdcall" calling convention for the core library
49 # and shell executable.
50 #
51 !IFNDEF USE_STDCALL
52 USE_STDCALL = 0
53 !ENDIF
54
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.
57 #
58 !IFNDEF USE_SEH
59 USE_SEH = 1
60 !ENDIF
61
62 # Set this non-0 to have the shell executable link against the core dynamic
63 # link library.
64 #
65 !IFNDEF DYNAMIC_SHELL
66 DYNAMIC_SHELL = 0
67 !ENDIF
68
69 # Set this non-0 to enable extra code that attempts to detect misuse of the
70 # SQLite API.
71 #
72 !IFNDEF API_ARMOR
73 API_ARMOR = 0
74 !ENDIF
75
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.
79 #
80 !IFNDEF NO_WARN
81 !IF $(USE_FULLWARN)!=0
82 NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206
83 NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
84 !ENDIF
85 !ENDIF
86
87 # Set this non-0 to use the library paths and other options necessary for
88 # Windows Phone 8.1.
89 #
90 !IFNDEF USE_WP81_OPTS
91 USE_WP81_OPTS = 0
92 !ENDIF
93
94 # Set this non-0 to split the SQLite amalgamation file into chunks to
95 # be used for debugging with Visual Studio.
96 #
97 !IFNDEF SPLIT_AMALGAMATION
98 SPLIT_AMALGAMATION = 0
99 !ENDIF
100
101
102 # Set this non-0 to dynamically link to the MSVC runtime library.
103 #
104 !IFNDEF USE_CRT_DLL
105 USE_CRT_DLL = 0
106 !ENDIF
107
108 # Set this non-0 to link to the RPCRT4 library.
109 #
110 !IFNDEF USE_RPCRT4_LIB
111 USE_RPCRT4_LIB = 0
112 !ENDIF
113
114 # Set this non-0 to generate assembly code listings for the source code
115 # files.
116 #
117 !IFNDEF USE_LISTINGS
118 USE_LISTINGS = 0
119 !ENDIF
120
121 # Set this non-0 to attempt setting the native compiler automatically
122 # for cross-compiling the command line tools needed during the compilation
123 # process.
124 #
125 !IFNDEF XCOMPILE
126 XCOMPILE = 0
127 !ENDIF
128
129 # Set this non-0 to use the native libraries paths for cross-compiling
130 # the command line tools needed during the compilation process.
131 #
132 !IFNDEF USE_NATIVE_LIBPATHS
133 USE_NATIVE_LIBPATHS = 0
134 !ENDIF
135
136 # Set this 0 to skip the compiling and embedding of version resources.
137 #
138 !IFNDEF USE_RC
139 USE_RC = 1
140 !ENDIF
141
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).
145 #
146 !IFNDEF FOR_WINRT
147 FOR_WINRT = 0
148 !ENDIF
149
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).
153 #
154 !IFNDEF FOR_UWP
155 FOR_UWP = 0
156 !ENDIF
157
158 # Set this non-0 to compile binaries suitable for the Windows 10 platform.
159 #
160 !IFNDEF FOR_WIN10
161 FOR_WIN10 = 0
162 !ENDIF
163
164
165 # Set this to non-0 to create and use PDBs.
166 #
167 !IFNDEF SYMBOLS
168 SYMBOLS = 1
169 !ENDIF
170
171 # Set this to non-0 to use the SQLite debugging heap subsystem.
172 #
173 !IFNDEF MEMDEBUG
174 MEMDEBUG = 0
175 !ENDIF
176
177 # Set this to non-0 to use the Win32 native heap subsystem.
178 #
179 !IFNDEF WIN32HEAP
180 WIN32HEAP = 0
181 !ENDIF
182
183 # Set this to non-0 to enable OSTRACE() macros, which can be useful when
184 # debugging.
185 #
186 !IFNDEF OSTRACE
187 OSTRACE = 0
188 !ENDIF
189
190 # enable address sanitizer using ASAN=1 on the command-line.
191 #
192 !IFNDEF ASAN
193 ASAN = 0
194 !ENDIF
195
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:
199 #
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.
207 #
208 !IFNDEF DEBUG
209 DEBUG = 0
210 !ENDIF
211
212
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.
216 #
217 !IFNDEF OPTIMIZATIONS
218 OPTIMIZATIONS = 2
219 !ENDIF
220
221 # Set this to non-0 to enable support for the session extension.
222 #
223 !IFNDEF SESSION
224 SESSION = 0
225 !ENDIF
226
227 # Set this to non-0 to enable support for the rbu extension.
228 #
229 !IFNDEF RBU
230 RBU = 0
231 !ENDIF
232
233 # Set the source code file to be used by executables and libraries when
234 # they need the amalgamation.
235 #
236 !IFNDEF SQLITE3C
237 !IF $(SPLIT_AMALGAMATION)!=0
238 SQLITE3C = sqlite3-all.c
239 !ELSE
240 SQLITE3C = sqlite3.c
241 !ENDIF
242 !ENDIF
243
244 # Set the include code file to be used by executables and libraries when
245 # they need SQLite.
246 #
247 !IFNDEF SQLITE3H
248 SQLITE3H = sqlite3.h
249 !ENDIF
250
251 # This is the name to use for the SQLite dynamic link library (DLL).
252 #
253 !IFNDEF SQLITE3DLL
254 !IF $(FOR_WIN10)!=0
255 SQLITE3DLL = winsqlite3.dll
256 !ELSE
257 SQLITE3DLL = sqlite3.dll
258 !ENDIF
259 !ENDIF
260
261 # This is the name to use for the SQLite import library (LIB).
262 #
263 !IFNDEF SQLITE3LIB
264 !IF $(FOR_WIN10)!=0
265 SQLITE3LIB = winsqlite3.lib
266 !ELSE
267 SQLITE3LIB = sqlite3.lib
268 !ENDIF
269 !ENDIF
270
271 # This is the name to use for the SQLite shell executable (EXE).
272 #
273 !IFNDEF SQLITE3EXE
274 !IF $(FOR_WIN10)!=0
275 SQLITE3EXE = winsqlite3shell.exe
276 !ELSE
277 SQLITE3EXE = sqlite3.exe
278 !ENDIF
279 !ENDIF
280
281 # This is the argument used to set the program database (PDB) file for the
282 # SQLite shell executable (EXE).
283 #
284 !IFNDEF SQLITE3EXEPDB
285 !IF $(FOR_WIN10)!=0
286 SQLITE3EXEPDB =
287 !ELSE
288 SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
289 !ENDIF
290 !ENDIF
291
292
293 # These are the "standard" SQLite compilation options used when compiling for
294 # the Windows platform.
295 #
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
306 !ENDIF
307 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
308 !ENDIF
309
310 # Should the session extension be enabled?  If so, add compilation options
311 # to enable it.
312 #
313 !IF $(SESSION)!=0
314 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
315 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
316 !ENDIF
317
318 # Always enable math functions on Windows
319 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS
320
321 # Should the rbu extension be enabled?  If so, add compilation options
322 # to enable it.
323 #
324 !IF $(RBU)!=0
325 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RBU=1
326 !ENDIF
327
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.
331 #
332 !IF $(USE_SEH)==0
333 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_OMIT_SEH=1
334 !ENDIF
335
336 # These are the "extended" SQLite compilation options used when compiling for
337 # the Windows 10 platform.
338 #
339 !IFNDEF EXT_FEATURE_FLAGS
340 !IF $(FOR_WIN10)!=0
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
344 !ELSE
345 EXT_FEATURE_FLAGS =
346 !ENDIF
347 !ENDIF
348
349 ###############################################################################
350 ############################### END OF OPTIONS ################################
351 ###############################################################################
352
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).
355 #
356 !IF $(FOR_WIN10)!=0
357 !IFNDEF PLATFORM
358 !ERROR Using the FOR_WIN10 option requires a value for PLATFORM.
359 !ENDIF
360 !ENDIF
361
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.
364 #
365 PROGRAMFILES_X86 = $(VCINSTALLDIR)\..\..
366 PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)
367
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'.
371 #
372 !IFNDEF CC
373 CC = cl.exe
374 !ENDIF
375
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'.
379 #
380 !IFNDEF CSC
381 CSC = csc.exe
382 !ENDIF
383
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'.
387 #
388 !IFNDEF LD
389 LD = link.exe
390 !ENDIF
391
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'.
395 #
396 !IFNDEF RC
397 RC = rc.exe
398 !ENDIF
399
400 # Check for the MSVC runtime library path macro.  Otherwise, this value will
401 # default to the 'lib' directory underneath the MSVC installation directory.
402 #
403 !IFNDEF CRTLIBPATH
404 CRTLIBPATH = $(VCINSTALLDIR)\lib
405 !ENDIF
406
407 CRTLIBPATH = $(CRTLIBPATH:\\=\)
408
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):
416 #
417 #     nmake /f Makefile.msc sqlite3.dll
418 #           XCOMPILE=1 USE_NATIVE_LIBPATHS=1
419 #
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
422 # one line):
423 #
424 #     nmake /f Makefile.msc sqlite3.dll
425 #           "NCC=""%VCINSTALLDIR%\bin\cl.exe"""
426 #           USE_NATIVE_LIBPATHS=1
427 #
428 !IFDEF NCC
429 NCC = $(NCC:\\=\)
430 !ELSEIF $(XCOMPILE)!=0
431 NCC = "$(VCINSTALLDIR)\bin\$(CC)"
432 NCC = $(NCC:\\=\)
433 !ELSE
434 NCC = $(CC)
435 !ENDIF
436
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.
440 #
441 !IFNDEF NCRTLIBPATH
442 NCRTLIBPATH = $(VCINSTALLDIR)\lib
443 !ENDIF
444
445 NCRTLIBPATH = $(NCRTLIBPATH:\\=\)
446
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
451 # command line).
452 #
453 !IFNDEF NSDKLIBPATH
454 NSDKLIBPATH = $(WINDOWSSDKDIR)\lib
455 !ENDIF
456
457 NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
458
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.
462 #
463 !IFNDEF UCRTLIBPATH
464 UCRTLIBPATH = $(WINDOWSSDKDIR)\lib\$(WINDOWSSDKLIBVERSION)\ucrt\$(PLATFORM)
465 !ENDIF
466
467 UCRTLIBPATH = $(UCRTLIBPATH:\\=\)
468
469 # C compiler and options for use in building executables that
470 # will run on the platform that is doing the build.
471 #
472 !IF $(USE_FULLWARN)!=0
473 BCC = $(NCC) -nologo -W4 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
474 !ELSE
475 BCC = $(NCC) -nologo -W3 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
476 !ENDIF
477
478 # Check if assembly code listings should be generated for the source
479 # code files to be compiled.
480 #
481 !IF $(USE_LISTINGS)!=0
482 BCC = $(BCC) -FAcs
483 !ENDIF
484
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.
488 #
489 !IF $(USE_NATIVE_LIBPATHS)!=0
490 NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
491
492 !IFDEF NUCRTLIBPATH
493 NUCRTLIBPATH = $(NUCRTLIBPATH:\\=\)
494 NLTLIBPATHS = $(NLTLIBPATHS) "/LIBPATH:$(NUCRTLIBPATH)"
495 !ENDIF
496 !ENDIF
497
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.)
501 #
502 !IF $(USE_FULLWARN)!=0
503 TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $(TCCOPTS)
504 !ELSE
505 TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)
506 !ENDIF
507
508 # Check if warnings should be treated as errors when compiling.
509 #
510 !IF $(USE_FATAL_WARN)!=0
511 TCC = $(TCC) -WX
512 !ENDIF
513
514 TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise
515 RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS)
516
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").
523 #
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
528 !ELSE
529 !IFNDEF PLATFORM
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
532 !ELSE
533 CORE_CCONV_OPTS =
534 SHELL_CCONV_OPTS =
535 !ENDIF
536 !ENDIF
537 !ELSE
538 CORE_CCONV_OPTS =
539 SHELL_CCONV_OPTS =
540 !ENDIF
541
542 # These are additional compiler options used for the core library.
543 #
544 !IFNDEF CORE_COMPILE_OPTS
545 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
546 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)
547 !ELSE
548 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
549 !ENDIF
550 !ENDIF
551
552 # These are the additional targets that the core library should depend on
553 # when linking.
554 #
555 !IFNDEF CORE_LINK_DEP
556 !IF $(DYNAMIC_SHELL)!=0
557 CORE_LINK_DEP =
558 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
559 CORE_LINK_DEP = sqlite3.def
560 !ELSE
561 CORE_LINK_DEP =
562 !ENDIF
563 !ENDIF
564
565 # These are additional linker options used for the core library.
566 #
567 !IFNDEF CORE_LINK_OPTS
568 !IF $(DYNAMIC_SHELL)!=0
569 CORE_LINK_OPTS =
570 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
571 CORE_LINK_OPTS = /DEF:sqlite3.def
572 !ELSE
573 CORE_LINK_OPTS =
574 !ENDIF
575 !ENDIF
576
577 # These are additional compiler options used for the shell executable.
578 #
579 !IFNDEF SHELL_COMPILE_OPTS
580 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
581 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)
582 !ELSE
583 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)
584 !ENDIF
585 !ENDIF
586
587 # This is the source code that the shell executable should be compiled
588 # with.
589 #
590 !IFNDEF SHELL_CORE_SRC
591 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
592 SHELL_CORE_SRC =
593 !ELSE
594 SHELL_CORE_SRC = $(SQLITE3C)
595 !ENDIF
596 !ENDIF
597
598 # This is the core library that the shell executable should depend on.
599 #
600 !IFNDEF SHELL_CORE_DEP
601 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
602 SHELL_CORE_DEP = $(SQLITE3DLL)
603 !ELSE
604 SHELL_CORE_DEP =
605 !ENDIF
606 !ENDIF
607
608
609 # This is the core library that the shell executable should link with.
610 #
611 !IFNDEF SHELL_CORE_LIB
612 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
613 SHELL_CORE_LIB = $(SQLITE3LIB)
614 !ELSE
615 SHELL_CORE_LIB =
616 !ENDIF
617 !ENDIF
618
619 # These are additional linker options used for the shell executable.
620 #
621 !IFNDEF SHELL_LINK_OPTS
622 SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
623 !ENDIF
624
625 # Check if assembly code listings should be generated for the source
626 # code files to be compiled.
627 #
628 !IF $(USE_LISTINGS)!=0
629 TCC = $(TCC) -FAcs
630 !ENDIF
631
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.
636 #
637 !IF $(FOR_WINRT)!=0
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
642 !ENDIF
643
644 # C compiler options for the Windows 10 platform (needs MSVC 2015).
645 #
646 !IF $(FOR_WIN10)!=0
647 TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
648 BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
649 !ENDIF
650
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.
655 #
656 !IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
657 !IF $(DEBUG)>1
658 TCC = $(TCC) -MDd
659 BCC = $(BCC) -MDd
660 !ELSE
661 TCC = $(TCC) -MD
662 BCC = $(BCC) -MD
663 !ENDIF
664 !ELSE
665 !IF $(DEBUG)>1
666 TCC = $(TCC) -MTd
667 BCC = $(BCC) -MTd
668 !ELSE
669 TCC = $(TCC) -MT
670 BCC = $(BCC) -MT
671 !ENDIF
672 !ENDIF
673
674
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.
678 #
679 !IF $(DEBUG)==0
680 TCC = $(TCC) -DNDEBUG
681 BCC = $(BCC) -DNDEBUG
682 RCC = $(RCC) -DNDEBUG
683 !ENDIF
684
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
688 !ENDIF
689
690 !IF $(DEBUG)>2
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
696 !ENDIF
697 !ENDIF
698
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
702 !ENDIF
703
704 !IF $(DEBUG)>5
705 TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE=1
706 RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE=1
707 !ENDIF
708
709 # Prevent warnings about "insecure" MSVC runtime library functions
710 # being used.
711 #
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
715
716 # Prevent warnings about "deprecated" POSIX functions being used.
717 #
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
721
722 # Use the SQLite debugging heap subsystem?
723 #
724 !IF $(MEMDEBUG)!=0
725 TCC = $(TCC) -DSQLITE_MEMDEBUG=1
726 RCC = $(RCC) -DSQLITE_MEMDEBUG=1
727
728 # Use native Win32 heap subsystem instead of malloc/free?
729 #
730 !ELSEIF $(WIN32HEAP)!=0
731 TCC = $(TCC) -DSQLITE_WIN32_MALLOC=1
732 RCC = $(RCC) -DSQLITE_WIN32_MALLOC=1
733
734 # Validate the heap on every call into the native Win32 heap subsystem?
735 #
736 !IF $(DEBUG)>3
737 TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
738 RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
739 !ENDIF
740 !ENDIF
741
742
743 # Address sanitizer if ASAN=1
744 #
745 !IF $(ASAN)>0
746 TCC = $(TCC) /fsanitize=address
747 !ENDIF
748
749
750 # Compiler options needed for programs that use the readline() library.
751 #
752 !IFNDEF READLINE_FLAGS
753 READLINE_FLAGS = -DHAVE_READLINE=0
754 !ENDIF
755
756 # The library that programs using readline() must link against.
757 #
758 !IFNDEF LIBREADLINE
759 LIBREADLINE =
760 !ENDIF
761
762 # Should the database engine be compiled threadsafe
763 #
764 TCC = $(TCC) -DSQLITE_THREADSAFE=1
765 RCC = $(RCC) -DSQLITE_THREADSAFE=1
766
767 # Do threads override each others locks by default (1), or do we test (-1)
768 #
769 TCC = $(TCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
770 RCC = $(RCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
771
772 # Any target libraries which libsqlite must be linked against
773 #
774 !IFNDEF TLIBS
775 TLIBS =
776 !ENDIF
777
778 # Flags controlling use of the in memory btree implementation
779 #
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.
783 #
784 TCC = $(TCC) -DSQLITE_TEMP_STORE=1
785 RCC = $(RCC) -DSQLITE_TEMP_STORE=1
786
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.
791
792 # These are the required SQLite compilation options used when compiling for
793 # the Windows platform.
794 #
795 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=100
796
797 # If we are linking to the RPCRT4 library, enable features that need it.
798 #
799 !IF $(USE_RPCRT4_LIB)!=0
800 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_WIN32_USE_UUID=1
801 !ENDIF
802
803 # Add the required and optional SQLite compilation options into the command
804 # lines used to invoke the MSVC code and resource compilers.
805 #
806 TCC = $(TCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
807 RCC = $(RCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
808
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"
811 #
812 TCC = $(TCC) $(OPTS)
813 RCC = $(RCC) $(OPTS)
814
815 # If compiling for debugging, add some defines.
816 #
817 !IF $(DEBUG)>1
818 TCC = $(TCC) -D_DEBUG
819 BCC = $(BCC) -D_DEBUG
820 RCC = $(RCC) -D_DEBUG
821 !ENDIF
822
823 # If optimizations are enabled or disabled (either implicitly or
824 # explicitly), add the necessary flags.
825 #
826 !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
827 TCC = $(TCC) -Od
828 BCC = $(BCC) -Od
829 !IF $(USE_RUNTIME_CHECKS)!=0
830 TCC = $(TCC) -RTC1
831 BCC = $(BCC) -RTC1
832 !ENDIF
833 !ELSEIF $(OPTIMIZATIONS)>=3
834 TCC = $(TCC) -Ox
835 BCC = $(BCC) -Ox
836 !ELSEIF $(OPTIMIZATIONS)==2
837 TCC = $(TCC) -O2
838 BCC = $(BCC) -O2
839 !ELSEIF $(OPTIMIZATIONS)==1
840 TCC = $(TCC) -O1
841 BCC = $(BCC) -O1
842 !ENDIF
843
844 # If symbols are enabled (or compiling for debugging), enable PDBs.
845 #
846 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
847 TCC = $(TCC) -Zi
848 BCC = $(BCC) -Zi
849 !ENDIF
850
851
852 # Command line prefixes for compiling code, compiling resources,
853 # linking, etc.
854 #
855 LTCOMPILE = $(TCC) -Fo$@ -Fd$*.pdb
856 LTRCOMPILE = $(RCC) -r
857 LTLIB = lib.exe
858 LTLINK = $(TCC) -Fe$@
859
860 # If requested, link to the RPCRT4 library.
861 #
862 !IF $(USE_RPCRT4_LIB)!=0
863 LTLIBS = $(LTLIBS) rpcrt4.lib
864 !ENDIF
865
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.
870 !IFDEF PLATFORM
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
878 !ELSE
879 LTLINKOPTS = /NOLOGO
880 LTLIBOPTS = /NOLOGO
881 !ENDIF
882
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.
886 #
887 !IF $(FOR_WINRT)!=0
888 LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
889 !IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0"
890 !IFNDEF STORELIBPATH
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
897 !ELSE
898 STORELIBPATH = $(CRTLIBPATH)\store
899 !ENDIF
900 !ENDIF
901 STORELIBPATH = $(STORELIBPATH:\\=\)
902 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
903 !ENDIF
904 !ENDIF
905
906 # When compiling for Windows Phone 8.1, an extra library path is
907 # required.
908 #
909 !IF $(USE_WP81_OPTS)!=0
910 !IFNDEF WP81LIBPATH
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
915 !ELSE
916 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
917 !ENDIF
918 !ENDIF
919 !ENDIF
920
921 # When compiling for Windows Phone 8.1, some extra linker options
922 # are also required.
923 #
924 !IF $(USE_WP81_OPTS)!=0
925 !IFDEF WP81LIBPATH
926 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
927 !ENDIF
928 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
929 LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
930 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
931 !ENDIF
932
933 # When compiling for UWP or the Windows 10 platform, some extra linker
934 # options are also required.
935 #
936 !IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0
937 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib
938 LTLINKOPTS = $(LTLINKOPTS) mincore.lib
939 !IFDEF PSDKLIBPATH
940 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)"
941 !ENDIF
942 !ENDIF
943
944 !IF $(FOR_WIN10)!=0
945 LTLINKOPTS = $(LTLINKOPTS) /guard:cf "/LIBPATH:$(UCRTLIBPATH)"
946 !IF $(DEBUG)>1
947 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib
948 !ELSE
949 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
950 !ENDIF
951 !ENDIF
952
953 # If either debugging or symbols are enabled, enable PDBs.
954 #
955 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
956 LDFLAGS = /DEBUG $(LDOPTS)
957 !ELSE
958 LDFLAGS = $(LDOPTS)
959 !ENDIF
960
961
962 # You should not have to change anything below this line
963 ###############################################################################
964
965
966 # Object files for the amalgamation.
967 #
968 LIBOBJS1 = sqlite3.lo
969
970 # Determine the real value of LIBOBJ based on the 'configure' script
971 #
972 LIBOBJ = $(LIBOBJS1)
973
974 # Determine if embedded resource compilation and usage are enabled.
975 #
976 !IF $(USE_RC)!=0
977 LIBRESOBJS = sqlite3res.lo
978 !ELSE
979 LIBRESOBJS =
980 !ENDIF
981
982
983 # Additional compiler options for the shell.  These are only effective
984 # when the shell is not being dynamically linked.
985 #
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 !ENDIF
994
995
996 # This is the default Makefile target.  The objects listed here
997 # are what get build when you type just "make" with no arguments.
998 #
999 core:   dll shell
1000
1001 # Targets that require the Tcl library.
1002 #
1003 tcl:    $(ALL_TCL_TARGETS)
1004
1005 # This Makefile target builds all of the standard binaries.
1006 #
1007 all:    core tcl
1008
1009 # Dynamic link library section.
1010 #
1011 dll:    $(SQLITE3DLL)
1012
1013 # Shell executable.
1014 #
1015 shell:  $(SQLITE3EXE)
1016
1017
1018 $(SQLITE3DLL):  $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
1019         $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
1020
1021 Replace.exe:
1022         $(CSC) /target:exe $(TOP)\Replace.cs
1023
1024 sqlite3.def:    Replace.exe $(LIBOBJ)
1025         echo EXPORTS > sqlite3.def
1026         dumpbin /all $(LIBOBJ) \
1027                 | .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup|rebaser|rbu)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \
1028                 | sort >> sqlite3.def
1029
1030 $(SQLITE3EXE):  shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
1031         $(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) shell.c $(SHELL_CORE_SRC) \
1032                 /link $(SQLITE3EXEPDB) $(LDFLAGS) $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
1033
1034
1035 # Rule to build the amalgamation
1036 #
1037 sqlite3.lo:     $(SQLITE3C)
1038         $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C)
1039
1040
1041 # Rule to build the Win32 resources object file.
1042 #
1043 !IF $(USE_RC)!=0
1044 _HASHCHAR=^#
1045 !IF ![echo !IFNDEF VERSION > rcver.vc] && \
1046     ![for /F "delims=" %V in ('type "$(SQLITE3H)" ^| "%SystemRoot%\System32\find.exe" "$(_HASHCHAR)define SQLITE_VERSION "') do (echo VERSION = ^^%V >> rcver.vc)] && \
1047     ![echo !ENDIF >> rcver.vc]
1048 !INCLUDE rcver.vc
1049 !ENDIF
1050
1051 RESOURCE_VERSION = $(VERSION:^#=)
1052 RESOURCE_VERSION = $(RESOURCE_VERSION:define=)
1053 RESOURCE_VERSION = $(RESOURCE_VERSION:SQLITE_VERSION=)
1054 RESOURCE_VERSION = $(RESOURCE_VERSION:"=)
1055 RESOURCE_VERSION = $(RESOURCE_VERSION:.=,)
1056
1057 $(LIBRESOBJS):  $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
1058         echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
1059         echo #define SQLITE_RESOURCE_VERSION $(RESOURCE_VERSION) >> sqlite3rc.h
1060         echo #endif >> sqlite3rc.h
1061         $(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc
1062 !ENDIF
1063
1064
1065 clean:
1066         del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
1067         del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
1068         del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL