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