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