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