AryaWu/sqlite
0
1#### DO NOT EDIT ####2# This makefile is automatically generated from the Makefile.msc at3# the root of the canonical SQLite source tree (not the4# amalgamation tarball) using the tool/mkmsvcmin.tcl5# script.6#7 8#9# nmake Makefile for SQLite10#11###############################################################################12############################## START OF OPTIONS ###############################13###############################################################################14 15# The toplevel directory of the source tree. This is the directory16# that contains this "Makefile.msc".17#18TOP = .19 20 21# Optionally set EXTRA_SRC to a list of C files to append to22# the generated sqlite3.c. Any sqlite3 extensions added this23# way may require manual editing, as described in24# https://sqlite.org/forum/forumpost/903f721f3e7c0d2525#26!IFNDEF EXTRA_SRC27EXTRA_SRC =28!ENDIF29 30# Set this non-0 to enable full warnings (-W4, etc) when compiling.31#32!IFNDEF USE_FULLWARN33USE_FULLWARN = 134!ENDIF35 36# Set this non-0 to enable treating warnings as errors (-WX, etc) when37# compiling.38#39!IFNDEF USE_FATAL_WARN40USE_FATAL_WARN = 041!ENDIF42 43# Set this non-0 to enable full runtime error checks (-RTC1, etc). This44# has no effect if (any) optimizations are enabled.45#46!IFNDEF USE_RUNTIME_CHECKS47USE_RUNTIME_CHECKS = 048!ENDIF49 50# Set this non-0 to create a SQLite amalgamation file that excludes the51# various built-in extensions.52#53!IFNDEF MINIMAL_AMALGAMATION54MINIMAL_AMALGAMATION = 055!ENDIF56 57# Set this non-0 to use "stdcall" calling convention for the core library58# and shell executable.59#60!IFNDEF USE_STDCALL61USE_STDCALL = 062!ENDIF63 64# Use the USE_SEH=0 option on the nmake command line to omit structured65# exception handling (SEH) support. SEH is on by default.66#67!IFNDEF USE_SEH68USE_SEH = 169!ENDIF70 71# Use STATICALLY_LINK_TCL=1 to statically link against TCL72#73!IFNDEF STATICALLY_LINK_TCL74STATICALLY_LINK_TCL = 075!ELSEIF $(STATICALLY_LINK_TCL)!=076CCOPTS = $(CCOPTS) -DSTATIC_BUILD77!ENDIF78 79# Set this non-0 to have the shell executable link against the core dynamic80# link library.81#82!IFNDEF DYNAMIC_SHELL83DYNAMIC_SHELL = 084!ENDIF85 86# Set this non-0 to enable extra code that attempts to detect misuse of the87# SQLite API.88#89!IFNDEF API_ARMOR90API_ARMOR = 091!ENDIF92 93# If necessary, create a list of harmless compiler warnings to disable when94# compiling the various tools. For the SQLite source code itself, warnings,95# if any, will be disabled from within it.96#97!IFNDEF NO_WARN98!IF $(USE_FULLWARN)!=099NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206100NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706101!ENDIF102!ENDIF103 104# Set this non-0 to split the SQLite amalgamation file into chunks to105# be used for debugging with Visual Studio.106#107!IFNDEF SPLIT_AMALGAMATION108SPLIT_AMALGAMATION = 0109!ENDIF110 111 112# Set this non-0 to dynamically link to the MSVC runtime library.113#114!IFNDEF USE_CRT_DLL115USE_CRT_DLL = 0116!ENDIF117 118# Set this non-0 to link to the RPCRT4 library.119#120!IFNDEF USE_RPCRT4_LIB121USE_RPCRT4_LIB = 0122!ENDIF123 124# Set this non-0 to generate assembly code listings for the source code125# files.126#127!IFNDEF USE_LISTINGS128USE_LISTINGS = 0129!ENDIF130 131# Set this non-0 to attempt setting the native compiler automatically132# for cross-compiling the command line tools needed during the compilation133# process.134#135!IFNDEF XCOMPILE136XCOMPILE = 0137!ENDIF138 139# Set this non-0 to use the native libraries paths for cross-compiling140# the command line tools needed during the compilation process.141#142!IFNDEF USE_NATIVE_LIBPATHS143USE_NATIVE_LIBPATHS = 0144!ENDIF145 146# Set this 0 to skip the compiling and embedding of version resources.147#148!IFNDEF USE_RC149USE_RC = 1150!ENDIF151 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 operate154# properly (i.e. the text fixture, etc).155#156!IFNDEF FOR_UWP157FOR_UWP = 0158!ENDIF159 160# Set this non-0 to compile binaries suitable for the Windows 10 platform.161#162!IFNDEF FOR_WIN10163FOR_WIN10 = 0164!ENDIF165 166 167# Set this to non-0 to create and use PDBs.168#169!IFNDEF SYMBOLS170SYMBOLS = 1171!ENDIF172 173# Set this to non-0 to use the SQLite debugging heap subsystem.174#175!IFNDEF MEMDEBUG176MEMDEBUG = 0177!ENDIF178 179# Set this to non-0 to use the Win32 native heap subsystem.180#181!IFNDEF WIN32HEAP182WIN32HEAP = 0183!ENDIF184 185# Set this to non-0 to enable OSTRACE() macros, which can be useful when186# debugging.187#188!IFNDEF OSTRACE189OSTRACE = 0190!ENDIF191 192# enable address sanitizer using ASAN=1 on the command-line.193#194!IFNDEF ASAN195ASAN = 0196!ENDIF197 198# Set this to one of the following values to enable various debugging199# features. Each level includes the debugging options from the previous200# 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 DEBUG211DEBUG = 0212!ENDIF213 214 215# Enable use of available compiler optimizations? Normally, this should be216# non-zero. Setting this to zero, thus disabling all compiler optimizations,217# can be useful for testing.218#219!IFNDEF OPTIMIZATIONS220OPTIMIZATIONS = 2221!ENDIF222 223# Set this to non-0 to enable support for the session extension.224#225!IFNDEF SESSION226SESSION = 0227!ENDIF228 229# Set this to non-0 to enable support for the rbu extension.230#231!IFNDEF RBU232RBU = 0233!ENDIF234 235# Set this to non-0 to enable support for blocking locks.236#237!IFNDEF SETLK_TIMEOUT238SETLK_TIMEOUT = 0239!ENDIF240 241# Set the source code file to be used by executables and libraries when242# they need the amalgamation.243#244!IFNDEF SQLITE3C245!IF $(SPLIT_AMALGAMATION)!=0246SQLITE3C = sqlite3-all.c247!ELSE248SQLITE3C = sqlite3.c249!ENDIF250!ENDIF251 252# Set the include code file to be used by executables and libraries when253# they need SQLite.254#255!IFNDEF SQLITE3H256SQLITE3H = sqlite3.h257!ENDIF258 259# This is the name to use for the SQLite dynamic link library (DLL).260#261!IFNDEF SQLITE3DLL262!IF $(FOR_WIN10)!=0263SQLITE3DLL = winsqlite3.dll264!ELSE265SQLITE3DLL = sqlite3.dll266!ENDIF267!ENDIF268 269# This is the name to use for the SQLite import library (LIB).270#271!IFNDEF SQLITE3LIB272!IF $(FOR_WIN10)!=0273SQLITE3LIB = winsqlite3.lib274!ELSE275SQLITE3LIB = sqlite3.lib276!ENDIF277!ENDIF278 279# This is the name to use for the SQLite shell executable (EXE).280#281!IFNDEF SQLITE3EXE282!IF $(FOR_WIN10)!=0283SQLITE3EXE = winsqlite3shell.exe284!ELSE285SQLITE3EXE = sqlite3.exe286!ENDIF287!ENDIF288 289# This is the argument used to set the program database (PDB) file for the290# SQLite shell executable (EXE).291#292!IFNDEF SQLITE3EXEPDB293!IF $(FOR_WIN10)!=0294SQLITE3EXEPDB =295!ELSE296SQLITE3EXEPDB = /pdb:sqlite3sh.pdb297!ENDIF298!ENDIF299 300 301# These are the "standard" SQLite compilation options used when compiling for302# the Windows platform.303#304!IFNDEF OPT_FEATURE_FLAGS305OPT_FEATURE_FLAGS = $(OPT_XTRA)306!IF $(MINIMAL_AMALGAMATION)==0307OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1308OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS5=1309OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1310OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_GEOPOLY=1311OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1312OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1313OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1314OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1315OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_CARRAY=1316!ENDIF317OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1318!ENDIF319 320# Additional feature-options above and beyond what are normally used can be321# be added using OPTIONS=.... on the command-line. These values are322# appended to the OPT_FEATURE_FLAGS variable.323#324!IFDEF OPTIONS325OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) $(OPTIONS)326!ENDIF327 328# Should the session extension be enabled? If so, add compilation options329# to enable it.330#331!IF $(SESSION)!=0332OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1333OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1334!ENDIF335 336# Always enable math functions on Windows337OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS338OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PERCENTILE339 340# Should the rbu extension be enabled? If so, add compilation options341# to enable it.342#343!IF $(RBU)!=0344OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RBU=1345!ENDIF346 347# Should structured exception handling (SEH) be enabled for WAL mode in348# the core library? It is on by default. Only omit it if the349# USE_SEH=0 option is provided on the nmake command-line.350#351!IF $(USE_SEH)==0352OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_OMIT_SEH=1353!ENDIF354 355# These are the "extended" SQLite compilation options used when compiling for356# the Windows 10 platform.357#358!IFNDEF EXT_FEATURE_FLAGS359!IF $(FOR_WIN10)!=0360EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS4=1361EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_SYSTEM_MALLOC=1362EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_OMIT_LOCALTIME=1363!ELSE364EXT_FEATURE_FLAGS =365!ENDIF366!ENDIF367 368!IF $(SETLK_TIMEOUT)!=0369OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SETLK_TIMEOUT370!ENDIF371 372###############################################################################373############################### END OF OPTIONS ################################374###############################################################################375 376# When compiling for the Windows 10 platform, the PLATFORM macro must be set377# to an appropriate value (e.g. x86, x64, arm, arm64, etc).378#379!IF $(FOR_WIN10)!=0380!IFNDEF PLATFORM381!ERROR Using the FOR_WIN10 option requires a value for PLATFORM.382!ENDIF383!ENDIF384 385# This assumes that MSVC is always installed in 32-bit Program Files directory386# 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 compiler392# binary for the target platform. If it is not defined, simply define it to393# the legacy default value 'cl.exe'.394#395!IFNDEF CC396CC = cl.exe397!ENDIF398 399# Check for the predefined command macro CSC. This should point to a working400# C Sharp compiler binary. If it is not defined, simply define it to the401# legacy default value 'csc.exe'.402#403!IFNDEF CSC404CSC = csc.exe405!ENDIF406 407# Check for the command macro LD. This should point to the linker binary for408# the target platform. If it is not defined, simply define it to the legacy409# default value 'link.exe'.410#411!IFNDEF LD412LD = link.exe413!ENDIF414 415# Check for the predefined command macro RC. This should point to the resource416# compiler binary for the target platform. If it is not defined, simply define417# it to the legacy default value 'rc.exe'.418#419!IFNDEF RC420RC = rc.exe421!ENDIF422 423# Check for the MSVC runtime library path macro. Otherwise, this value will424# default to the 'lib' directory underneath the MSVC installation directory.425#426!IFNDEF CRTLIBPATH427CRTLIBPATH = $(VCINSTALLDIR)\lib428!ENDIF429 430CRTLIBPATH = $(CRTLIBPATH:\\=\)431 432# Check for the command macro NCC. This should point to the compiler binary433# for the platform the compilation process is taking place on. If it is not434# defined, simply define it to have the same value as the CC macro. When435# cross-compiling, it is suggested that this macro be modified via the command436# 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 command438# line similar to the following could be used (all on one line):439#440# nmake /f Makefile.msc sqlite3.dll441# XCOMPILE=1 USE_NATIVE_LIBPATHS=1442#443# Alternatively, the full path and file name to the compiler binary for the444# platform the compilation process is taking place may be specified (all on445# one line):446#447# nmake /f Makefile.msc sqlite3.dll448# "NCC=""%VCINSTALLDIR%\bin\cl.exe"""449# USE_NATIVE_LIBPATHS=1450#451!IFDEF NCC452NCC = $(NCC:\\=\)453!ELSEIF $(XCOMPILE)!=0454NCC = "$(VCINSTALLDIR)\bin\$(CC)"455NCC = $(NCC:\\=\)456!ELSE457NCC = $(CC)458!ENDIF459 460# Check for the MSVC native runtime library path macro. Otherwise,461# this value will default to the 'lib' directory underneath the MSVC462# installation directory.463#464!IFNDEF NCRTLIBPATH465NCRTLIBPATH = $(VCINSTALLDIR)\lib466!ENDIF467 468NCRTLIBPATH = $(NCRTLIBPATH:\\=\)469 470# Check for the Platform SDK library path macro. Otherwise, this471# value will default to the 'lib' directory underneath the Windows472# SDK installation directory (the environment variable used appears473# to be available when using Visual C++ 2008 or later via the474# command line).475#476!IFNDEF NSDKLIBPATH477NSDKLIBPATH = $(WINDOWSSDKDIR)\lib478!ENDIF479 480NSDKLIBPATH = $(NSDKLIBPATH:\\=\)481 482# Check for the UCRT library path macro. Otherwise, this value will483# default to the version-specific, platform-specific 'lib' directory484# underneath the Windows SDK installation directory.485#486!IFNDEF UCRTLIBPATH487UCRTLIBPATH = $(WINDOWSSDKDIR)\lib\$(WINDOWSSDKLIBVERSION)\ucrt\$(PLATFORM)488!ENDIF489 490UCRTLIBPATH = $(UCRTLIBPATH:\\=\)491 492# C compiler and options for use in building executables that493# will run on the platform that is doing the build.494#495!IF $(USE_FULLWARN)!=0496BCC = $(NCC) -nologo -W4 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)497!ELSE498BCC = $(NCC) -nologo -W3 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)499!ENDIF500 501# Check if assembly code listings should be generated for the source502# code files to be compiled.503#504!IF $(USE_LISTINGS)!=0505BCC = $(BCC) -FAcs506!ENDIF507 508# Check if the native library paths should be used when compiling509# the command line tools used during the compilation process. If510# so, set the necessary macro now.511#512!IF $(USE_NATIVE_LIBPATHS)!=0513NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"514 515!IFDEF NUCRTLIBPATH516NUCRTLIBPATH = $(NUCRTLIBPATH:\\=\)517NLTLIBPATHS = $(NLTLIBPATHS) "/LIBPATH:$(NUCRTLIBPATH)"518!ENDIF519!ENDIF520 521# C compiler and options for use in building executables that522# will run on the target platform. (BCC and TCC are usually the523# same unless your are cross-compiling.)524#525!IF $(USE_FULLWARN)!=0526TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $(TCCOPTS)527!ELSE528TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)529!ENDIF530 531# Check if warnings should be treated as errors when compiling.532#533!IF $(USE_FATAL_WARN)!=0534TCC = $(TCC) -WX535!ENDIF536 537TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise538RCC = $(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 should542# also be noted here that building any target with these "stdcall" options543# will most likely fail if the Tcl library is also required. This is due544# to how the Tcl library functions are declared and exported (i.e. without545# an explicit calling convention, which results in "cdecl").546#547!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0548!IF "$(PLATFORM)"=="x86"549CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall550SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall551 552 553!ELSE554!IFNDEF PLATFORM555CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall556SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall557 558 559!ELSE560CORE_CCONV_OPTS =561SHELL_CCONV_OPTS =562!ENDIF563!ENDIF564!ELSE565CORE_CCONV_OPTS =566SHELL_CCONV_OPTS =567!ENDIF568 569# These are additional compiler options used for the core library.570#571!IFNDEF CORE_COMPILE_OPTS572!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0573CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)574!ELSE575CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)576!ENDIF577!ENDIF578 579# These are the additional targets that the core library should depend on580# when linking.581#582!IFNDEF CORE_LINK_DEP583!IF $(DYNAMIC_SHELL)!=0584CORE_LINK_DEP =585!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"586CORE_LINK_DEP = sqlite3.def587!ELSE588CORE_LINK_DEP =589!ENDIF590!ENDIF591 592# These are additional linker options used for the core library.593#594!IFNDEF CORE_LINK_OPTS595!IF $(DYNAMIC_SHELL)!=0596CORE_LINK_OPTS =597!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"598CORE_LINK_OPTS = /DEF:sqlite3.def599!ELSE600CORE_LINK_OPTS =601!ENDIF602!ENDIF603 604# These are additional compiler options used for the shell executable.605#606!IFNDEF SHELL_COMPILE_OPTS607!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0608SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)609!ELSE610SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)611!ENDIF612!ENDIF613 614# This is the source code that the shell executable should be compiled615# with.616#617!IFNDEF SHELL_CORE_SRC618!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0619SHELL_CORE_SRC =620!ELSE621SHELL_CORE_SRC = $(SQLITE3C)622!ENDIF623!ENDIF624 625# This is the core library that the shell executable should depend on.626#627!IFNDEF SHELL_CORE_DEP628!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0629SHELL_CORE_DEP = $(SQLITE3DLL)630!ELSE631SHELL_CORE_DEP =632!ENDIF633!ENDIF634 635 636# This is the core library that the shell executable should link with.637#638!IFNDEF SHELL_CORE_LIB639!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0640SHELL_CORE_LIB = $(SQLITE3LIB)641!ELSE642SHELL_CORE_LIB =643!ENDIF644!ENDIF645 646# These are additional linker options used for the shell executable.647#648!IFNDEF SHELL_LINK_OPTS649SHELL_LINK_OPTS = $(SHELL_CORE_LIB)650!ENDIF651 652# Check if assembly code listings should be generated for the source653# code files to be compiled.654#655!IF $(USE_LISTINGS)!=0656TCC = $(TCC) -FAcs657!ENDIF658 659# C compiler options for the Windows 10 platform (needs MSVC 2015).660#661!IF $(FOR_WIN10)!=0662TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE663BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE664!ENDIF665 666# Also, we need to dynamically link to the correct MSVC runtime667# when compiling for WinRT (e.g. debug or release) OR if the668# USE_CRT_DLL option is set to force dynamically linking to the669# MSVC runtime library.670#671!IF $(USE_CRT_DLL)!=0672!IF $(DEBUG)>1673TCC = $(TCC) -MDd674BCC = $(BCC) -MDd675ZLIBCFLAGS = -nologo -MDd -W3 -O2 -Oy- -Zi676!ELSE677TCC = $(TCC) -MD678BCC = $(BCC) -MD679ZLIBCFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi680!ENDIF681!ELSE682!IF $(DEBUG)>1683TCC = $(TCC) -MTd684BCC = $(BCC) -MTd685ZLIBCFLAGS = -nologo -MTd -W3 -O2 -Oy- -Zi686!ELSE687TCC = $(TCC) -MT688BCC = $(BCC) -MT689ZLIBCFLAGS = -nologo -MT -W3 -O2 -Oy- -Zi690!ENDIF691!ENDIF692 693 694!IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0695TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1696RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1697!ENDIF698 699!IF $(DEBUG)>2700TCC = $(TCC) -DSQLITE_DEBUG=1 -DSQLITE_USE_W32_FOR_CONSOLE_IO701RCC = $(RCC) -DSQLITE_DEBUG=1702!IF $(DYNAMIC_SHELL)==0703TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE704RCC = $(RCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE705!ENDIF706!ENDIF707 708!IF $(DEBUG)>4 || $(OSTRACE)!=0709TCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1710RCC = $(RCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1711!ENDIF712 713!IF $(DEBUG)>5714TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE=1715RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE=1716!ENDIF717 718# Prevent warnings about "insecure" MSVC runtime library functions719# being used.720#721TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS722BCC = $(BCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS723RCC = $(RCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS724 725# Prevent warnings about "deprecated" POSIX functions being used.726#727TCC = $(TCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS728BCC = $(BCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS729RCC = $(RCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS730 731# Use the SQLite debugging heap subsystem?732#733!IF $(MEMDEBUG)!=0734TCC = $(TCC) -DSQLITE_MEMDEBUG=1735RCC = $(RCC) -DSQLITE_MEMDEBUG=1736 737# Use native Win32 heap subsystem instead of malloc/free?738#739!ELSEIF $(WIN32HEAP)!=0740TCC = $(TCC) -DSQLITE_WIN32_MALLOC=1741RCC = $(RCC) -DSQLITE_WIN32_MALLOC=1742 743# Validate the heap on every call into the native Win32 heap subsystem?744#745!IF $(DEBUG)>3746TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1747RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1748!ENDIF749!ENDIF750 751 752# Address sanitizer if ASAN=1753#754!IF $(ASAN)>0755TCC = $(TCC) /fsanitize=address756!ENDIF757 758 759# Compiler options needed for programs that use the readline() library.760#761!IFNDEF READLINE_FLAGS762READLINE_FLAGS = -DHAVE_READLINE=0763!ENDIF764 765# The library that programs using readline() must link against.766#767!IFNDEF LIBREADLINE768LIBREADLINE =769!ENDIF770 771# Should the database engine be compiled threadsafe772#773TCC = $(TCC) -DSQLITE_THREADSAFE=1774RCC = $(RCC) -DSQLITE_THREADSAFE=1775 776# Do threads override each others locks by default (1), or do we test (-1)777#778TCC = $(TCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1779RCC = $(RCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1780 781# Any target libraries which libsqlite must be linked against782#783!IFNDEF TLIBS784TLIBS =785!ENDIF786 787# Enable/disable loadable extensions, and other optional features788# based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).789# The same set of OMIT and ENABLE flags should be passed to the790# LEMON parser generator and the mkkeywordhash tool as well.791 792# These are the required SQLite compilation options used when compiling for793# the Windows platform.794#795REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=100796 797# If we are linking to the RPCRT4 library, enable features that need it.798#799!IF $(USE_RPCRT4_LIB)!=0800REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_WIN32_USE_UUID=1801!ENDIF802 803# Add the required and optional SQLite compilation options into the command804# 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)>1818TCC = $(TCC) -D_DEBUG819BCC = $(BCC) -D_DEBUG820RCC = $(RCC) -D_DEBUG821!ENDIF822 823# If optimizations are enabled or disabled (either implicitly or824# explicitly), add the necessary flags.825#826!IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0827TCC = $(TCC) -Od828BCC = $(BCC) -Od829!IF $(USE_RUNTIME_CHECKS)!=0830TCC = $(TCC) -RTC1831BCC = $(BCC) -RTC1832!ENDIF833!ELSEIF $(OPTIMIZATIONS)>=3834TCC = $(TCC) -Ox835BCC = $(BCC) -Ox836!ELSEIF $(OPTIMIZATIONS)==2837TCC = $(TCC) -O2838BCC = $(BCC) -O2839!ELSEIF $(OPTIMIZATIONS)==1840TCC = $(TCC) -O1841BCC = $(BCC) -O1842!ENDIF843 844# If symbols are enabled (or compiling for debugging), enable PDBs.845#846!IF $(DEBUG)>1 || $(SYMBOLS)!=0847TCC = $(TCC) -Zi848BCC = $(BCC) -Zi849!ENDIF850 851 852# Command line prefixes for compiling code, compiling resources,853# linking, etc.854#855LTCOMPILE = $(TCC) -Fo$@ -Fd$*.pdb856LTRCOMPILE = $(RCC) -r857LTLIB = lib.exe858LTLINK = $(TCC) -Fe$@859 860# If requested, link to the RPCRT4 library.861#862!IF $(USE_RPCRT4_LIB)!=0863LTLIBS = $(LTLIBS) rpcrt4.lib864!ENDIF865 866# If a platform was set, force the linker to target that.867# Note that the vcvars*.bat family of batch files typically868# set this for you. Otherwise, the linker will attempt869# to deduce the binary type based on the object files.870!IFDEF PLATFORM871LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)872LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)873!ELSEIF "$(VISUALSTUDIOVERSION)"=="12.0" || \874 "$(VISUALSTUDIOVERSION)"=="14.0" || \875 "$(VISUALSTUDIOVERSION)"=="15.0"876LTLINKOPTS = /NOLOGO /MACHINE:x86877LTLIBOPTS = /NOLOGO /MACHINE:x86878!ELSE879LTLINKOPTS = /NOLOGO880LTLIBOPTS = /NOLOGO881!ENDIF882 883# When compiling for UWP or the Windows 10 platform, some extra linker884# options are also required.885#886!IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0887LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib888LTLINKOPTS = $(LTLINKOPTS) mincore.lib889!IFDEF PSDKLIBPATH890LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)"891!ENDIF892!ENDIF893 894!IF $(FOR_WIN10)!=0895LTLINKOPTS = $(LTLINKOPTS) /guard:cf "/LIBPATH:$(UCRTLIBPATH)"896!IF $(DEBUG)>1897LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib898!ELSE899LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib900!ENDIF901!ENDIF902 903# If either debugging or symbols are enabled, enable PDBs.904#905!IF $(DEBUG)>1 || $(SYMBOLS)!=0906LDFLAGS = /NODEFAULTLIB:msvcrt /DEBUG $(LDOPTS)907!ELSE908LDFLAGS = /NODEFAULTLIB:msvcrt $(LDOPTS)909!ENDIF910 911 912# You should not have to change anything below this line913###############################################################################914 915 916# Object files for the amalgamation.917#918LIBOBJS1 = sqlite3.lo919 920# Determine the real value of LIBOBJ based on the 'configure' script921#922LIBOBJ = $(LIBOBJS1)923 924# Determine if embedded resource compilation and usage are enabled.925#926!IF $(USE_RC)!=0927LIBRESOBJS = sqlite3res.lo928!ELSE929LIBRESOBJS =930!ENDIF931 932 933# Additional compiler options for the shell. These are only effective934# when the shell is not being dynamically linked.935#936!IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0937SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_DQS=0938SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS4=1939SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1940SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1941SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_PERCENTILE=1942SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION=1943SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_STMT_SCANSTATUS=1944SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_BYTECODE_VTAB=1945SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_STRICT_SUBTYPE=1946!ENDIF947 948 949# This is the default Makefile target. The objects listed here950# are what get build when you type just "make" with no arguments.951#952core: dll shell953 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 tcl961 962# Dynamic link library section.963#964dll: $(SQLITE3DLL)965 966# Shell executable.967#968shell: $(SQLITE3EXE)969 970# jimsh0 - replacement for tclsh971#972jimsh0.exe: $(TOP)\autosetup\jimsh0.c973 cl -DHAVE__FULLPATH=1 $(TOP)\autosetup\jimsh0.c974 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.cs981 982sqlite3.def: Replace.exe $(LIBOBJ)983 echo EXPORTS > sqlite3.def984 dumpbin /all $(LIBOBJ) \985 | .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup|rebaser|rbu)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \986 | sort >> sqlite3.def987 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 amalgamation996#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)!=01004_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.vc1009!ENDIF1010 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.h1019 echo #define SQLITE_RESOURCE_VERSION $(RESOURCE_VERSION) >> sqlite3rc.h1020 echo #endif >> sqlite3rc.h1021 $(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc1022!ENDIF1023 1024 1025clean:1026 del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL1027 del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL1028 del /Q sqlite3.def tclsqlite3.def ctime.c pragma.h 2>NUL1029 del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL1030 