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