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