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