]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/sqlite3/Makefile.msc
libarchive: merge vendor bugfixes
[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 # Set this non-0 to have the shell executable link against the core dynamic
56 # link library.
57 #
58 !IFNDEF DYNAMIC_SHELL
59 DYNAMIC_SHELL = 0
60 !ENDIF
61
62 # Set this non-0 to enable extra code that attempts to detect misuse of the
63 # SQLite API.
64 #
65 !IFNDEF API_ARMOR
66 API_ARMOR = 0
67 !ENDIF
68
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.
72 #
73 !IFNDEF NO_WARN
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
77 !ENDIF
78 !ENDIF
79
80 # Set this non-0 to use the library paths and other options necessary for
81 # Windows Phone 8.1.
82 #
83 !IFNDEF USE_WP81_OPTS
84 USE_WP81_OPTS = 0
85 !ENDIF
86
87 # Set this non-0 to split the SQLite amalgamation file into chunks to
88 # be used for debugging with Visual Studio.
89 #
90 !IFNDEF SPLIT_AMALGAMATION
91 SPLIT_AMALGAMATION = 0
92 !ENDIF
93
94
95 # Set this non-0 to dynamically link to the MSVC runtime library.
96 #
97 !IFNDEF USE_CRT_DLL
98 USE_CRT_DLL = 0
99 !ENDIF
100
101 # Set this non-0 to link to the RPCRT4 library.
102 #
103 !IFNDEF USE_RPCRT4_LIB
104 USE_RPCRT4_LIB = 0
105 !ENDIF
106
107 # Set this non-0 to generate assembly code listings for the source code
108 # files.
109 #
110 !IFNDEF USE_LISTINGS
111 USE_LISTINGS = 0
112 !ENDIF
113
114 # Set this non-0 to attempt setting the native compiler automatically
115 # for cross-compiling the command line tools needed during the compilation
116 # process.
117 #
118 !IFNDEF XCOMPILE
119 XCOMPILE = 0
120 !ENDIF
121
122 # Set this non-0 to use the native libraries paths for cross-compiling
123 # the command line tools needed during the compilation process.
124 #
125 !IFNDEF USE_NATIVE_LIBPATHS
126 USE_NATIVE_LIBPATHS = 0
127 !ENDIF
128
129 # Set this 0 to skip the compiling and embedding of version resources.
130 #
131 !IFNDEF USE_RC
132 USE_RC = 1
133 !ENDIF
134
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).
138 #
139 !IFNDEF FOR_WINRT
140 FOR_WINRT = 0
141 !ENDIF
142
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).
146 #
147 !IFNDEF FOR_UWP
148 FOR_UWP = 0
149 !ENDIF
150
151 # Set this non-0 to compile binaries suitable for the Windows 10 platform.
152 #
153 !IFNDEF FOR_WIN10
154 FOR_WIN10 = 0
155 !ENDIF
156
157
158 # Set this to non-0 to create and use PDBs.
159 #
160 !IFNDEF SYMBOLS
161 SYMBOLS = 1
162 !ENDIF
163
164 # Set this to non-0 to use the SQLite debugging heap subsystem.
165 #
166 !IFNDEF MEMDEBUG
167 MEMDEBUG = 0
168 !ENDIF
169
170 # Set this to non-0 to use the Win32 native heap subsystem.
171 #
172 !IFNDEF WIN32HEAP
173 WIN32HEAP = 0
174 !ENDIF
175
176 # Set this to non-0 to enable OSTRACE() macros, which can be useful when
177 # debugging.
178 #
179 !IFNDEF OSTRACE
180 OSTRACE = 0
181 !ENDIF
182
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:
186 #
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.
194 #
195 !IFNDEF DEBUG
196 DEBUG = 0
197 !ENDIF
198
199
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.
203 #
204 !IFNDEF OPTIMIZATIONS
205 OPTIMIZATIONS = 2
206 !ENDIF
207
208 # Set this to non-0 to enable support for the session extension.
209 #
210 !IFNDEF SESSION
211 SESSION = 0
212 !ENDIF
213
214 # Set this to non-0 to enable support for the rbu extension.
215 #
216 !IFNDEF RBU
217 RBU = 0
218 !ENDIF
219
220 # Set the source code file to be used by executables and libraries when
221 # they need the amalgamation.
222 #
223 !IFNDEF SQLITE3C
224 !IF $(SPLIT_AMALGAMATION)!=0
225 SQLITE3C = sqlite3-all.c
226 !ELSE
227 SQLITE3C = sqlite3.c
228 !ENDIF
229 !ENDIF
230
231 # Set the include code file to be used by executables and libraries when
232 # they need SQLite.
233 #
234 !IFNDEF SQLITE3H
235 SQLITE3H = sqlite3.h
236 !ENDIF
237
238 # This is the name to use for the SQLite dynamic link library (DLL).
239 #
240 !IFNDEF SQLITE3DLL
241 !IF $(FOR_WIN10)!=0
242 SQLITE3DLL = winsqlite3.dll
243 !ELSE
244 SQLITE3DLL = sqlite3.dll
245 !ENDIF
246 !ENDIF
247
248 # This is the name to use for the SQLite import library (LIB).
249 #
250 !IFNDEF SQLITE3LIB
251 !IF $(FOR_WIN10)!=0
252 SQLITE3LIB = winsqlite3.lib
253 !ELSE
254 SQLITE3LIB = sqlite3.lib
255 !ENDIF
256 !ENDIF
257
258 # This is the name to use for the SQLite shell executable (EXE).
259 #
260 !IFNDEF SQLITE3EXE
261 !IF $(FOR_WIN10)!=0
262 SQLITE3EXE = winsqlite3shell.exe
263 !ELSE
264 SQLITE3EXE = sqlite3.exe
265 !ENDIF
266 !ENDIF
267
268 # This is the argument used to set the program database (PDB) file for the
269 # SQLite shell executable (EXE).
270 #
271 !IFNDEF SQLITE3EXEPDB
272 !IF $(FOR_WIN10)!=0
273 SQLITE3EXEPDB =
274 !ELSE
275 SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
276 !ENDIF
277 !ENDIF
278
279
280 # These are the "standard" SQLite compilation options used when compiling for
281 # the Windows platform.
282 #
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_JSON1=1
289 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
290 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
291 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
292 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
293 !ENDIF
294 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
295 !ENDIF
296
297 # Should the session extension be enabled?  If so, add compilation options
298 # to enable it.
299 #
300 !IF $(SESSION)!=0
301 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
302 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
303 !ENDIF
304
305 # Always enable math functions on Windows
306 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS
307
308 # Should the rbu extension be enabled?  If so, add compilation options
309 # to enable it.
310 #
311 !IF $(RBU)!=0
312 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RBU=1
313 !ENDIF
314
315 # These are the "extended" SQLite compilation options used when compiling for
316 # the Windows 10 platform.
317 #
318 !IFNDEF EXT_FEATURE_FLAGS
319 !IF $(FOR_WIN10)!=0
320 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS4=1
321 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_SYSTEM_MALLOC=1
322 EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_OMIT_LOCALTIME=1
323 !ELSE
324 EXT_FEATURE_FLAGS =
325 !ENDIF
326 !ENDIF
327
328 ###############################################################################
329 ############################### END OF OPTIONS ################################
330 ###############################################################################
331
332 # When compiling for the Windows 10 platform, the PLATFORM macro must be set
333 # to an appropriate value (e.g. x86, x64, arm, arm64, etc).
334 #
335 !IF $(FOR_WIN10)!=0
336 !IFNDEF PLATFORM
337 !ERROR Using the FOR_WIN10 option requires a value for PLATFORM.
338 !ENDIF
339 !ENDIF
340
341 # This assumes that MSVC is always installed in 32-bit Program Files directory
342 # and sets the variable for use in locating other 32-bit installs accordingly.
343 #
344 PROGRAMFILES_X86 = $(VCINSTALLDIR)\..\..
345 PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)
346
347 # Check for the predefined command macro CC.  This should point to the compiler
348 # binary for the target platform.  If it is not defined, simply define it to
349 # the legacy default value 'cl.exe'.
350 #
351 !IFNDEF CC
352 CC = cl.exe
353 !ENDIF
354
355 # Check for the predefined command macro CSC.  This should point to a working
356 # C Sharp compiler binary.  If it is not defined, simply define it to the
357 # legacy default value 'csc.exe'.
358 #
359 !IFNDEF CSC
360 CSC = csc.exe
361 !ENDIF
362
363 # Check for the command macro LD.  This should point to the linker binary for
364 # the target platform.  If it is not defined, simply define it to the legacy
365 # default value 'link.exe'.
366 #
367 !IFNDEF LD
368 LD = link.exe
369 !ENDIF
370
371 # Check for the predefined command macro RC.  This should point to the resource
372 # compiler binary for the target platform.  If it is not defined, simply define
373 # it to the legacy default value 'rc.exe'.
374 #
375 !IFNDEF RC
376 RC = rc.exe
377 !ENDIF
378
379 # Check for the MSVC runtime library path macro.  Otherwise, this value will
380 # default to the 'lib' directory underneath the MSVC installation directory.
381 #
382 !IFNDEF CRTLIBPATH
383 CRTLIBPATH = $(VCINSTALLDIR)\lib
384 !ENDIF
385
386 CRTLIBPATH = $(CRTLIBPATH:\\=\)
387
388 # Check for the command macro NCC.  This should point to the compiler binary
389 # for the platform the compilation process is taking place on.  If it is not
390 # defined, simply define it to have the same value as the CC macro.  When
391 # cross-compiling, it is suggested that this macro be modified via the command
392 # line (since nmake itself does not provide a built-in method to guess it).
393 # For example, to use the x86 compiler when cross-compiling for x64, a command
394 # line similar to the following could be used (all on one line):
395 #
396 #     nmake /f Makefile.msc sqlite3.dll
397 #           XCOMPILE=1 USE_NATIVE_LIBPATHS=1
398 #
399 # Alternatively, the full path and file name to the compiler binary for the
400 # platform the compilation process is taking place may be specified (all on
401 # one line):
402 #
403 #     nmake /f Makefile.msc sqlite3.dll
404 #           "NCC=""%VCINSTALLDIR%\bin\cl.exe"""
405 #           USE_NATIVE_LIBPATHS=1
406 #
407 !IFDEF NCC
408 NCC = $(NCC:\\=\)
409 !ELSEIF $(XCOMPILE)!=0
410 NCC = "$(VCINSTALLDIR)\bin\$(CC)"
411 NCC = $(NCC:\\=\)
412 !ELSE
413 NCC = $(CC)
414 !ENDIF
415
416 # Check for the MSVC native runtime library path macro.  Otherwise,
417 # this value will default to the 'lib' directory underneath the MSVC
418 # installation directory.
419 #
420 !IFNDEF NCRTLIBPATH
421 NCRTLIBPATH = $(VCINSTALLDIR)\lib
422 !ENDIF
423
424 NCRTLIBPATH = $(NCRTLIBPATH:\\=\)
425
426 # Check for the Platform SDK library path macro.  Otherwise, this
427 # value will default to the 'lib' directory underneath the Windows
428 # SDK installation directory (the environment variable used appears
429 # to be available when using Visual C++ 2008 or later via the
430 # command line).
431 #
432 !IFNDEF NSDKLIBPATH
433 NSDKLIBPATH = $(WINDOWSSDKDIR)\lib
434 !ENDIF
435
436 NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
437
438 # Check for the UCRT library path macro.  Otherwise, this value will
439 # default to the version-specific, platform-specific 'lib' directory
440 # underneath the Windows SDK installation directory.
441 #
442 !IFNDEF UCRTLIBPATH
443 UCRTLIBPATH = $(WINDOWSSDKDIR)\lib\$(WINDOWSSDKLIBVERSION)\ucrt\$(PLATFORM)
444 !ENDIF
445
446 UCRTLIBPATH = $(UCRTLIBPATH:\\=\)
447
448 # C compiler and options for use in building executables that
449 # will run on the platform that is doing the build.
450 #
451 !IF $(USE_FULLWARN)!=0
452 BCC = $(NCC) -nologo -W4 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
453 !ELSE
454 BCC = $(NCC) -nologo -W3 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
455 !ENDIF
456
457 # Check if assembly code listings should be generated for the source
458 # code files to be compiled.
459 #
460 !IF $(USE_LISTINGS)!=0
461 BCC = $(BCC) -FAcs
462 !ENDIF
463
464 # Check if the native library paths should be used when compiling
465 # the command line tools used during the compilation process.  If
466 # so, set the necessary macro now.
467 #
468 !IF $(USE_NATIVE_LIBPATHS)!=0
469 NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
470
471 !IFDEF NUCRTLIBPATH
472 NUCRTLIBPATH = $(NUCRTLIBPATH:\\=\)
473 NLTLIBPATHS = $(NLTLIBPATHS) "/LIBPATH:$(NUCRTLIBPATH)"
474 !ENDIF
475 !ENDIF
476
477 # C compiler and options for use in building executables that
478 # will run on the target platform.  (BCC and TCC are usually the
479 # same unless your are cross-compiling.)
480 #
481 !IF $(USE_FULLWARN)!=0
482 TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $(TCCOPTS)
483 !ELSE
484 TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)
485 !ENDIF
486
487 # Check if warnings should be treated as errors when compiling.
488 #
489 !IF $(USE_FATAL_WARN)!=0
490 TCC = $(TCC) -WX
491 !ENDIF
492
493 TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise
494 RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS)
495
496 # Check if we want to use the "stdcall" calling convention when compiling.
497 # This is not supported by the compilers for non-x86 platforms.  It should
498 # also be noted here that building any target with these "stdcall" options
499 # will most likely fail if the Tcl library is also required.  This is due
500 # to how the Tcl library functions are declared and exported (i.e. without
501 # an explicit calling convention, which results in "cdecl").
502 #
503 !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
504 !IF "$(PLATFORM)"=="x86"
505 CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
506 SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
507 !ELSE
508 !IFNDEF PLATFORM
509 CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
510 SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
511 !ELSE
512 CORE_CCONV_OPTS =
513 SHELL_CCONV_OPTS =
514 !ENDIF
515 !ENDIF
516 !ELSE
517 CORE_CCONV_OPTS =
518 SHELL_CCONV_OPTS =
519 !ENDIF
520
521 # These are additional compiler options used for the core library.
522 #
523 !IFNDEF CORE_COMPILE_OPTS
524 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
525 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)
526 !ELSE
527 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
528 !ENDIF
529 !ENDIF
530
531 # These are the additional targets that the core library should depend on
532 # when linking.
533 #
534 !IFNDEF CORE_LINK_DEP
535 !IF $(DYNAMIC_SHELL)!=0
536 CORE_LINK_DEP =
537 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
538 CORE_LINK_DEP = sqlite3.def
539 !ELSE
540 CORE_LINK_DEP =
541 !ENDIF
542 !ENDIF
543
544 # These are additional linker options used for the core library.
545 #
546 !IFNDEF CORE_LINK_OPTS
547 !IF $(DYNAMIC_SHELL)!=0
548 CORE_LINK_OPTS =
549 !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
550 CORE_LINK_OPTS = /DEF:sqlite3.def
551 !ELSE
552 CORE_LINK_OPTS =
553 !ENDIF
554 !ENDIF
555
556 # These are additional compiler options used for the shell executable.
557 #
558 !IFNDEF SHELL_COMPILE_OPTS
559 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
560 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)
561 !ELSE
562 SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)
563 !ENDIF
564 !ENDIF
565
566 # This is the source code that the shell executable should be compiled
567 # with.
568 #
569 !IFNDEF SHELL_CORE_SRC
570 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
571 SHELL_CORE_SRC =
572 !ELSE
573 SHELL_CORE_SRC = $(SQLITE3C)
574 !ENDIF
575 !ENDIF
576
577 # This is the core library that the shell executable should depend on.
578 #
579 !IFNDEF SHELL_CORE_DEP
580 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
581 SHELL_CORE_DEP = $(SQLITE3DLL)
582 !ELSE
583 SHELL_CORE_DEP =
584 !ENDIF
585 !ENDIF
586
587
588 # This is the core library that the shell executable should link with.
589 #
590 !IFNDEF SHELL_CORE_LIB
591 !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
592 SHELL_CORE_LIB = $(SQLITE3LIB)
593 !ELSE
594 SHELL_CORE_LIB =
595 !ENDIF
596 !ENDIF
597
598 # These are additional linker options used for the shell executable.
599 #
600 !IFNDEF SHELL_LINK_OPTS
601 SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
602 !ENDIF
603
604 # Check if assembly code listings should be generated for the source
605 # code files to be compiled.
606 #
607 !IF $(USE_LISTINGS)!=0
608 TCC = $(TCC) -FAcs
609 !ENDIF
610
611 # When compiling the library for use in the WinRT environment,
612 # the following compile-time options must be used as well to
613 # disable use of Win32 APIs that are not available and to enable
614 # use of Win32 APIs that are specific to Windows 8 and/or WinRT.
615 #
616 !IF $(FOR_WINRT)!=0
617 TCC = $(TCC) -DSQLITE_OS_WINRT=1
618 RCC = $(RCC) -DSQLITE_OS_WINRT=1
619 TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
620 RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
621 !ENDIF
622
623 # C compiler options for the Windows 10 platform (needs MSVC 2015).
624 #
625 !IF $(FOR_WIN10)!=0
626 TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
627 BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
628 !ENDIF
629
630 # Also, we need to dynamically link to the correct MSVC runtime
631 # when compiling for WinRT (e.g. debug or release) OR if the
632 # USE_CRT_DLL option is set to force dynamically linking to the
633 # MSVC runtime library.
634 #
635 !IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
636 !IF $(DEBUG)>1
637 TCC = $(TCC) -MDd
638 BCC = $(BCC) -MDd
639 !ELSE
640 TCC = $(TCC) -MD
641 BCC = $(BCC) -MD
642 !ENDIF
643 !ELSE
644 !IF $(DEBUG)>1
645 TCC = $(TCC) -MTd
646 BCC = $(BCC) -MTd
647 !ELSE
648 TCC = $(TCC) -MT
649 BCC = $(BCC) -MT
650 !ENDIF
651 !ENDIF
652
653
654 # Define -DNDEBUG to compile without debugging (i.e., for production usage)
655 # Omitting the define will cause extra debugging code to be inserted and
656 # includes extra comments when "EXPLAIN stmt" is used.
657 #
658 !IF $(DEBUG)==0
659 TCC = $(TCC) -DNDEBUG
660 BCC = $(BCC) -DNDEBUG
661 RCC = $(RCC) -DNDEBUG
662 !ENDIF
663
664 !IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0
665 TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1
666 RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
667 !ENDIF
668
669 !IF $(DEBUG)>2
670 TCC = $(TCC) -DSQLITE_DEBUG=1
671 RCC = $(RCC) -DSQLITE_DEBUG=1
672 !IF $(DYNAMIC_SHELL)==0
673 TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
674 RCC = $(RCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
675 !ENDIF
676 !ENDIF
677
678 !IF $(DEBUG)>4 || $(OSTRACE)!=0
679 TCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
680 RCC = $(RCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1
681 !ENDIF
682
683 !IF $(DEBUG)>5
684 TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE=1
685 RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE=1
686 !ENDIF
687
688 # Prevent warnings about "insecure" MSVC runtime library functions
689 # being used.
690 #
691 TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
692 BCC = $(BCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
693 RCC = $(RCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
694
695 # Prevent warnings about "deprecated" POSIX functions being used.
696 #
697 TCC = $(TCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
698 BCC = $(BCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
699 RCC = $(RCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
700
701 # Use the SQLite debugging heap subsystem?
702 #
703 !IF $(MEMDEBUG)!=0
704 TCC = $(TCC) -DSQLITE_MEMDEBUG=1
705 RCC = $(RCC) -DSQLITE_MEMDEBUG=1
706
707 # Use native Win32 heap subsystem instead of malloc/free?
708 #
709 !ELSEIF $(WIN32HEAP)!=0
710 TCC = $(TCC) -DSQLITE_WIN32_MALLOC=1
711 RCC = $(RCC) -DSQLITE_WIN32_MALLOC=1
712
713 # Validate the heap on every call into the native Win32 heap subsystem?
714 #
715 !IF $(DEBUG)>3
716 TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
717 RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
718 !ENDIF
719 !ENDIF
720
721
722 # Compiler options needed for programs that use the readline() library.
723 #
724 !IFNDEF READLINE_FLAGS
725 READLINE_FLAGS = -DHAVE_READLINE=0
726 !ENDIF
727
728 # The library that programs using readline() must link against.
729 #
730 !IFNDEF LIBREADLINE
731 LIBREADLINE =
732 !ENDIF
733
734 # Should the database engine be compiled threadsafe
735 #
736 TCC = $(TCC) -DSQLITE_THREADSAFE=1
737 RCC = $(RCC) -DSQLITE_THREADSAFE=1
738
739 # Do threads override each others locks by default (1), or do we test (-1)
740 #
741 TCC = $(TCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
742 RCC = $(RCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1
743
744 # Any target libraries which libsqlite must be linked against
745 #
746 !IFNDEF TLIBS
747 TLIBS =
748 !ENDIF
749
750 # Flags controlling use of the in memory btree implementation
751 #
752 # SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to
753 # default to file, 2 to default to memory, and 3 to force temporary
754 # tables to always be in memory.
755 #
756 TCC = $(TCC) -DSQLITE_TEMP_STORE=1
757 RCC = $(RCC) -DSQLITE_TEMP_STORE=1
758
759 # Enable/disable loadable extensions, and other optional features
760 # based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).
761 # The same set of OMIT and ENABLE flags should be passed to the
762 # LEMON parser generator and the mkkeywordhash tool as well.
763
764 # These are the required SQLite compilation options used when compiling for
765 # the Windows platform.
766 #
767 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=100
768
769 # If we are linking to the RPCRT4 library, enable features that need it.
770 #
771 !IF $(USE_RPCRT4_LIB)!=0
772 REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_WIN32_USE_UUID=1
773 !ENDIF
774
775 # Add the required and optional SQLite compilation options into the command
776 # lines used to invoke the MSVC code and resource compilers.
777 #
778 TCC = $(TCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
779 RCC = $(RCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)
780
781 # Add in any optional parameters specified on the commane line, e.g.
782 # nmake /f Makefile.msc all "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1"
783 #
784 TCC = $(TCC) $(OPTS)
785 RCC = $(RCC) $(OPTS)
786
787 # If compiling for debugging, add some defines.
788 #
789 !IF $(DEBUG)>1
790 TCC = $(TCC) -D_DEBUG
791 BCC = $(BCC) -D_DEBUG
792 RCC = $(RCC) -D_DEBUG
793 !ENDIF
794
795 # If optimizations are enabled or disabled (either implicitly or
796 # explicitly), add the necessary flags.
797 #
798 !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
799 TCC = $(TCC) -Od
800 BCC = $(BCC) -Od
801 !IF $(USE_RUNTIME_CHECKS)!=0
802 TCC = $(TCC) -RTC1
803 BCC = $(BCC) -RTC1
804 !ENDIF
805 !ELSEIF $(OPTIMIZATIONS)>=3
806 TCC = $(TCC) -Ox
807 BCC = $(BCC) -Ox
808 !ELSEIF $(OPTIMIZATIONS)==2
809 TCC = $(TCC) -O2
810 BCC = $(BCC) -O2
811 !ELSEIF $(OPTIMIZATIONS)==1
812 TCC = $(TCC) -O1
813 BCC = $(BCC) -O1
814 !ENDIF
815
816 # If symbols are enabled (or compiling for debugging), enable PDBs.
817 #
818 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
819 TCC = $(TCC) -Zi
820 BCC = $(BCC) -Zi
821 !ENDIF
822
823
824 # Command line prefixes for compiling code, compiling resources,
825 # linking, etc.
826 #
827 LTCOMPILE = $(TCC) -Fo$@ -Fd$*.pdb
828 LTRCOMPILE = $(RCC) -r
829 LTLIB = lib.exe
830 LTLINK = $(TCC) -Fe$@
831
832 # If requested, link to the RPCRT4 library.
833 #
834 !IF $(USE_RPCRT4_LIB)!=0
835 LTLIBS = $(LTLIBS) rpcrt4.lib
836 !ENDIF
837
838 # If a platform was set, force the linker to target that.
839 # Note that the vcvars*.bat family of batch files typically
840 # set this for you.  Otherwise, the linker will attempt
841 # to deduce the binary type based on the object files.
842 !IFDEF PLATFORM
843 LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
844 LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
845 !ELSEIF "$(VISUALSTUDIOVERSION)"=="12.0" || \
846         "$(VISUALSTUDIOVERSION)"=="14.0" || \
847         "$(VISUALSTUDIOVERSION)"=="15.0"
848 LTLINKOPTS = /NOLOGO /MACHINE:x86
849 LTLIBOPTS = /NOLOGO /MACHINE:x86
850 !ELSE
851 LTLINKOPTS = /NOLOGO
852 LTLIBOPTS = /NOLOGO
853 !ENDIF
854
855 # When compiling for use in the WinRT environment, the following
856 # linker option must be used to mark the executable as runnable
857 # only in the context of an application container.
858 #
859 !IF $(FOR_WINRT)!=0
860 LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
861 !IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0"
862 !IFNDEF STORELIBPATH
863 !IF "$(PLATFORM)"=="x86"
864 STORELIBPATH = $(CRTLIBPATH)\store
865 !ELSEIF "$(PLATFORM)"=="x64"
866 STORELIBPATH = $(CRTLIBPATH)\store\amd64
867 !ELSEIF "$(PLATFORM)"=="ARM"
868 STORELIBPATH = $(CRTLIBPATH)\store\arm
869 !ELSE
870 STORELIBPATH = $(CRTLIBPATH)\store
871 !ENDIF
872 !ENDIF
873 STORELIBPATH = $(STORELIBPATH:\\=\)
874 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
875 !ENDIF
876 !ENDIF
877
878 # When compiling for Windows Phone 8.1, an extra library path is
879 # required.
880 #
881 !IF $(USE_WP81_OPTS)!=0
882 !IFNDEF WP81LIBPATH
883 !IF "$(PLATFORM)"=="x86"
884 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
885 !ELSEIF "$(PLATFORM)"=="ARM"
886 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM
887 !ELSE
888 WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
889 !ENDIF
890 !ENDIF
891 !ENDIF
892
893 # When compiling for Windows Phone 8.1, some extra linker options
894 # are also required.
895 #
896 !IF $(USE_WP81_OPTS)!=0
897 !IFDEF WP81LIBPATH
898 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
899 !ENDIF
900 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
901 LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
902 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
903 !ENDIF
904
905 # When compiling for UWP or the Windows 10 platform, some extra linker
906 # options are also required.
907 #
908 !IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0
909 LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib
910 LTLINKOPTS = $(LTLINKOPTS) mincore.lib
911 !IFDEF PSDKLIBPATH
912 LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)"
913 !ENDIF
914 !ENDIF
915
916 !IF $(FOR_WIN10)!=0
917 LTLINKOPTS = $(LTLINKOPTS) /guard:cf "/LIBPATH:$(UCRTLIBPATH)"
918 !IF $(DEBUG)>1
919 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib
920 !ELSE
921 LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
922 !ENDIF
923 !ENDIF
924
925 # If either debugging or symbols are enabled, enable PDBs.
926 #
927 !IF $(DEBUG)>1 || $(SYMBOLS)!=0
928 LDFLAGS = /DEBUG $(LDOPTS)
929 !ELSE
930 LDFLAGS = $(LDOPTS)
931 !ENDIF
932
933
934 # You should not have to change anything below this line
935 ###############################################################################
936
937
938 # Object files for the amalgamation.
939 #
940 LIBOBJS1 = sqlite3.lo
941
942 # Determine the real value of LIBOBJ based on the 'configure' script
943 #
944 LIBOBJ = $(LIBOBJS1)
945
946 # Determine if embedded resource compilation and usage are enabled.
947 #
948 !IF $(USE_RC)!=0
949 LIBRESOBJS = sqlite3res.lo
950 !ELSE
951 LIBRESOBJS =
952 !ENDIF
953
954
955 # Additional compiler options for the shell.  These are only effective
956 # when the shell is not being dynamically linked.
957 #
958 !IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==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
962 !ENDIF
963
964
965 # This is the default Makefile target.  The objects listed here
966 # are what get build when you type just "make" with no arguments.
967 #
968 core:   dll shell
969
970 # Targets that require the Tcl library.
971 #
972 tcl:    $(ALL_TCL_TARGETS)
973
974 # This Makefile target builds all of the standard binaries.
975 #
976 all:    core tcl
977
978 # Dynamic link library section.
979 #
980 dll:    $(SQLITE3DLL)
981
982 # Shell executable.
983 #
984 shell:  $(SQLITE3EXE)
985
986
987 $(SQLITE3DLL):  $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
988         $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
989
990 Replace.exe:
991         $(CSC) /target:exe $(TOP)\Replace.cs
992
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
998
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)
1002
1003
1004 # Rule to build the amalgamation
1005 #
1006 sqlite3.lo:     $(SQLITE3C)
1007         $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C)
1008
1009
1010 # Rule to build the Win32 resources object file.
1011 #
1012 !IF $(USE_RC)!=0
1013 _HASHCHAR=^#
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]
1017 !INCLUDE rcver.vc
1018 !ENDIF
1019
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:.=,)
1025
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
1031 !ENDIF
1032
1033
1034 clean:
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