AryaWu/sqlite
0
1#2# nmake Makefile for SQLite3#4###############################################################################5############################## START OF OPTIONS ###############################6###############################################################################7 8# The toplevel directory of the source tree. This is the directory9# that contains this "Makefile.msc".10#11TOP = .12 13# <<mark>>14# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc15#16# Set this non-0 to create and use the SQLite amalgamation file.17#18!IFNDEF USE_AMALGAMATION19USE_AMALGAMATION = 120!ENDIF21# <</mark>>22 23# Optionally set EXTRA_SRC to a list of C files to append to24# the generated sqlite3.c. Any sqlite3 extensions added this25# way may require manual editing, as described in26# https://sqlite.org/forum/forumpost/903f721f3e7c0d2527#28!IFNDEF EXTRA_SRC29EXTRA_SRC =30!ENDIF31 32# Set this non-0 to enable full warnings (-W4, etc) when compiling.33#34!IFNDEF USE_FULLWARN35USE_FULLWARN = 136!ENDIF37 38# Set this non-0 to enable treating warnings as errors (-WX, etc) when39# compiling.40#41!IFNDEF USE_FATAL_WARN42USE_FATAL_WARN = 043!ENDIF44 45# Set this non-0 to enable full runtime error checks (-RTC1, etc). This46# has no effect if (any) optimizations are enabled.47#48!IFNDEF USE_RUNTIME_CHECKS49USE_RUNTIME_CHECKS = 050!ENDIF51 52# Set this non-0 to create a SQLite amalgamation file that excludes the53# various built-in extensions.54#55!IFNDEF MINIMAL_AMALGAMATION56MINIMAL_AMALGAMATION = 057!ENDIF58 59# Set this non-0 to use "stdcall" calling convention for the core library60# and shell executable.61#62!IFNDEF USE_STDCALL63USE_STDCALL = 064!ENDIF65 66# Use the USE_SEH=0 option on the nmake command line to omit structured67# exception handling (SEH) support. SEH is on by default.68#69!IFNDEF USE_SEH70USE_SEH = 171!ENDIF72 73# Use STATICALLY_LINK_TCL=1 to statically link against TCL74#75!IFNDEF STATICALLY_LINK_TCL76STATICALLY_LINK_TCL = 077!ELSEIF $(STATICALLY_LINK_TCL)!=078CCOPTS = $(CCOPTS) -DSTATIC_BUILD79!ENDIF80 81# Set this non-0 to have the shell executable link against the core dynamic82# link library.83#84!IFNDEF DYNAMIC_SHELL85DYNAMIC_SHELL = 086!ENDIF87 88# Set this non-0 to enable extra code that attempts to detect misuse of the89# SQLite API.90#91!IFNDEF API_ARMOR92API_ARMOR = 093!ENDIF94 95# If necessary, create a list of harmless compiler warnings to disable when96# compiling the various tools. For the SQLite source code itself, warnings,97# if any, will be disabled from within it.98#99!IFNDEF NO_WARN100!IF $(USE_FULLWARN)!=0101NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206102NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706103!ENDIF104!ENDIF105 106# Set this non-0 to split the SQLite amalgamation file into chunks to107# be used for debugging with Visual Studio.108#109!IFNDEF SPLIT_AMALGAMATION110SPLIT_AMALGAMATION = 0111!ENDIF112 113# <<mark>>114# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc115#116 117# Set this non-0 to use zlib, possibly compiling it from source code.118#119!IFNDEF USE_ZLIB120USE_ZLIB = 0121!ENDIF122 123# Set this non-0 to build zlib from source code. This is enabled by124# default and in that case it will be assumed that the ZLIBDIR macro125# points to the top-level source code directory for zlib.126#127!IFNDEF BUILD_ZLIB128BUILD_ZLIB = 1129!ENDIF130 131# Set this non-0 to use the International Components for Unicode (ICU).132#133!IFNDEF USE_ICU134USE_ICU = 0135!ENDIF136# <</mark>>137 138# Set this non-0 to dynamically link to the MSVC runtime library.139#140!IFNDEF USE_CRT_DLL141USE_CRT_DLL = 0142!ENDIF143 144# Set this non-0 to link to the RPCRT4 library.145#146!IFNDEF USE_RPCRT4_LIB147USE_RPCRT4_LIB = 0148!ENDIF149 150# Set this non-0 to generate assembly code listings for the source code151# files.152#153!IFNDEF USE_LISTINGS154USE_LISTINGS = 0155!ENDIF156 157# Set this non-0 to attempt setting the native compiler automatically158# for cross-compiling the command line tools needed during the compilation159# process.160#161!IFNDEF XCOMPILE162XCOMPILE = 0163!ENDIF164 165# Set this non-0 to use the native libraries paths for cross-compiling166# the command line tools needed during the compilation process.167#168!IFNDEF USE_NATIVE_LIBPATHS169USE_NATIVE_LIBPATHS = 0170!ENDIF171 172# Set this 0 to skip the compiling and embedding of version resources.173#174!IFNDEF USE_RC175USE_RC = 1176!ENDIF177 178# Set this non-0 to compile binaries suitable for the UWP environment.179# This setting does not apply to any binaries that require Tcl to operate180# properly (i.e. the text fixture, etc).181#182!IFNDEF FOR_UWP183FOR_UWP = 0184!ENDIF185 186# Set this non-0 to compile binaries suitable for the Windows 10 platform.187#188!IFNDEF FOR_WIN10189FOR_WIN10 = 0190!ENDIF191 192# <<mark>>193# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc194#195# Set this non-0 to skip attempting to look for and/or link with the Tcl196# runtime library.197#198!IFNDEF NO_TCL199NO_TCL = 0200!ENDIF201# <</mark>>202 203# Set this to non-0 to create and use PDBs.204#205!IFNDEF SYMBOLS206SYMBOLS = 1207!ENDIF208 209# Set this to non-0 to use the SQLite debugging heap subsystem.210#211!IFNDEF MEMDEBUG212MEMDEBUG = 0213!ENDIF214 215# Set this to non-0 to use the Win32 native heap subsystem.216#217!IFNDEF WIN32HEAP218WIN32HEAP = 0219!ENDIF220 221# Set this to non-0 to enable OSTRACE() macros, which can be useful when222# debugging.223#224!IFNDEF OSTRACE225OSTRACE = 0226!ENDIF227 228# enable address sanitizer using ASAN=1 on the command-line.229#230!IFNDEF ASAN231ASAN = 0232!ENDIF233 234# Set this to one of the following values to enable various debugging235# features. Each level includes the debugging options from the previous236# levels. Currently, the recognized values for DEBUG are:237#238# 0 == NDEBUG: Disables assert() and other runtime diagnostics.239# 1 == SQLITE_ENABLE_API_ARMOR: extra attempts to detect misuse of the API.240# 2 == Disables NDEBUG and all optimizations and then enables PDBs.241# 3 == SQLITE_DEBUG: Enables various diagnostics messages and code.242# 4 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call.243# 5 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros.244# 6 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros.245#246!IFNDEF DEBUG247DEBUG = 0248!ENDIF249 250# <<mark>>251# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc252#253# By default, use --linemacros=1 argument to the mksqlite3c.tcl tool, which254# is used to build the amalgamation. This can be turned off to ease debug255# of the amalgamation away from the source tree.256#257!IFNDEF NO_LINEMACROS258NO_LINEMACROS = 0259!ENDIF260# <</mark>>261 262# Enable use of available compiler optimizations? Normally, this should be263# non-zero. Setting this to zero, thus disabling all compiler optimizations,264# can be useful for testing.265#266!IFNDEF OPTIMIZATIONS267OPTIMIZATIONS = 2268!ENDIF269 270# Set this to non-0 to enable support for the session extension.271#272!IFNDEF SESSION273SESSION = 0274!ENDIF275 276# Set this to non-0 to enable support for the rbu extension.277#278!IFNDEF RBU279RBU = 0280!ENDIF281 282# Set this to non-0 to enable support for blocking locks.283#284!IFNDEF SETLK_TIMEOUT285SETLK_TIMEOUT = 0286!ENDIF287 288# Set the source code file to be used by executables and libraries when289# they need the amalgamation.290#291!IFNDEF SQLITE3C292!IF $(SPLIT_AMALGAMATION)!=0293SQLITE3C = sqlite3-all.c294!ELSE295SQLITE3C = sqlite3.c296!ENDIF297!ENDIF298 299# Set the include code file to be used by executables and libraries when300# they need SQLite.301#302!IFNDEF SQLITE3H303SQLITE3H = sqlite3.h304!ENDIF305 306# This is the name to use for the SQLite dynamic link library (DLL).307#308!IFNDEF SQLITE3DLL309!IF $(FOR_WIN10)!=0310SQLITE3DLL = winsqlite3.dll311!ELSE312SQLITE3DLL = sqlite3.dll313!ENDIF314!ENDIF315 316# This is the name to use for the SQLite import library (LIB).317#318!IFNDEF SQLITE3LIB319!IF $(FOR_WIN10)!=0320SQLITE3LIB = winsqlite3.lib321!ELSE322SQLITE3LIB = sqlite3.lib323!ENDIF324!ENDIF325 326# This is the name to use for the SQLite shell executable (EXE).327#328!IFNDEF SQLITE3EXE329!IF $(FOR_WIN10)!=0330SQLITE3EXE = winsqlite3shell.exe331!ELSE332SQLITE3EXE = sqlite3.exe333!ENDIF334!ENDIF335 336# This is the argument used to set the program database (PDB) file for the337# SQLite shell executable (EXE).338#339!IFNDEF SQLITE3EXEPDB340!IF $(FOR_WIN10)!=0341SQLITE3EXEPDB =342!ELSE343SQLITE3EXEPDB = /pdb:sqlite3sh.pdb344!ENDIF345!ENDIF346 347# <<mark>>348# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc349#350# These are the names of the customized Tcl header files used by various parts351# of this makefile when the stdcall calling convention is in use. It is not352# used for any other purpose.353#354!IFNDEF SQLITETCLH355SQLITETCLH = sqlite_tcl.h356!ENDIF357 358!IFNDEF SQLITETCLDECLSH359SQLITETCLDECLSH = sqlite_tclDecls.h360!ENDIF361 362# This is the name to use for the dynamic link library (DLL) containing the363# Tcl bindings for SQLite.364#365!IFNDEF SQLITE3TCLDLL366SQLITE3TCLDLL = tclsqlite3.dll367!ENDIF368 369# These are the additional targets that the targets that integrate with the370# Tcl library should depend on when compiling, etc.371#372!IFNDEF SQLITE_TCL_DEP373!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0374SQLITE_TCL_DEP = $(SQLITETCLDECLSH) $(SQLITETCLH)375!ELSE376SQLITE_TCL_DEP =377!ENDIF378!ENDIF379# <</mark>>380 381# These are the "standard" SQLite compilation options used when compiling for382# the Windows platform.383#384!IFNDEF OPT_FEATURE_FLAGS385OPT_FEATURE_FLAGS = $(OPT_XTRA)386!IF $(MINIMAL_AMALGAMATION)==0387OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1388OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS5=1389OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1390OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_GEOPOLY=1391OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1392OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1393OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1394OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1395OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_CARRAY=1396!ENDIF397OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1398!ENDIF399 400# Additional feature-options above and beyond what are normally used can be401# be added using OPTIONS=.... on the command-line. These values are402# appended to the OPT_FEATURE_FLAGS variable.403#404!IFDEF OPTIONS405OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) $(OPTIONS)406!ENDIF407 408# Should the session extension be enabled? If so, add compilation options409# to enable it.410#411!IF $(SESSION)!=0412OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1413OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1414!ENDIF415 416# Always enable math functions on Windows417OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS418OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PERCENTILE419 420# Should the rbu extension be enabled? If so, add compilation options421# to enable it.422#423!IF $(RBU)!=0424OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RBU=1425!ENDIF426 427# Should structured exception handling (SEH) be enabled for WAL mode in428# the core library? It is on by default. Only omit it if the429# USE_SEH=0 option is provided on the nmake command-line.430#431!IF $(USE_SEH)==0432OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_OMIT_SEH=1433!ENDIF434 435# These are the "extended" SQLite compilation options used when compiling for436# the Windows 10 platform.437#438!IFNDEF EXT_FEATURE_FLAGS439!IF $(FOR_WIN10)!=0440EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS4=1441EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_SYSTEM_MALLOC=1442EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_OMIT_LOCALTIME=1443!ELSE444EXT_FEATURE_FLAGS =445!ENDIF446!ENDIF447 448!IF $(SETLK_TIMEOUT)!=0449OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SETLK_TIMEOUT450!ENDIF451 452###############################################################################453############################### END OF OPTIONS ################################454###############################################################################455 456# When compiling for the Windows 10 platform, the PLATFORM macro must be set457# to an appropriate value (e.g. x86, x64, arm, arm64, etc).458#459!IF $(FOR_WIN10)!=0460!IFNDEF PLATFORM461!ERROR Using the FOR_WIN10 option requires a value for PLATFORM.462!ENDIF463!ENDIF464 465# This assumes that MSVC is always installed in 32-bit Program Files directory466# and sets the variable for use in locating other 32-bit installs accordingly.467#468PROGRAMFILES_X86 = $(VCINSTALLDIR)\..\..469PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)470 471# Check for the predefined command macro CC. This should point to the compiler472# binary for the target platform. If it is not defined, simply define it to473# the legacy default value 'cl.exe'.474#475!IFNDEF CC476CC = cl.exe477!ENDIF478 479# Check for the predefined command macro CSC. This should point to a working480# C Sharp compiler binary. If it is not defined, simply define it to the481# legacy default value 'csc.exe'.482#483!IFNDEF CSC484CSC = csc.exe485!ENDIF486 487# Check for the command macro LD. This should point to the linker binary for488# the target platform. If it is not defined, simply define it to the legacy489# default value 'link.exe'.490#491!IFNDEF LD492LD = link.exe493!ENDIF494 495# Check for the predefined command macro RC. This should point to the resource496# compiler binary for the target platform. If it is not defined, simply define497# it to the legacy default value 'rc.exe'.498#499!IFNDEF RC500RC = rc.exe501!ENDIF502 503# Check for the MSVC runtime library path macro. Otherwise, this value will504# default to the 'lib' directory underneath the MSVC installation directory.505#506!IFNDEF CRTLIBPATH507CRTLIBPATH = $(VCINSTALLDIR)\lib508!ENDIF509 510CRTLIBPATH = $(CRTLIBPATH:\\=\)511 512# Check for the command macro NCC. This should point to the compiler binary513# for the platform the compilation process is taking place on. If it is not514# defined, simply define it to have the same value as the CC macro. When515# cross-compiling, it is suggested that this macro be modified via the command516# line (since nmake itself does not provide a built-in method to guess it).517# For example, to use the x86 compiler when cross-compiling for x64, a command518# line similar to the following could be used (all on one line):519#520# nmake /f Makefile.msc sqlite3.dll521# XCOMPILE=1 USE_NATIVE_LIBPATHS=1522#523# Alternatively, the full path and file name to the compiler binary for the524# platform the compilation process is taking place may be specified (all on525# one line):526#527# nmake /f Makefile.msc sqlite3.dll528# "NCC=""%VCINSTALLDIR%\bin\cl.exe"""529# USE_NATIVE_LIBPATHS=1530#531!IFDEF NCC532NCC = $(NCC:\\=\)533!ELSEIF $(XCOMPILE)!=0534NCC = "$(VCINSTALLDIR)\bin\$(CC)"535NCC = $(NCC:\\=\)536!ELSE537NCC = $(CC)538!ENDIF539 540# Check for the MSVC native runtime library path macro. Otherwise,541# this value will default to the 'lib' directory underneath the MSVC542# installation directory.543#544!IFNDEF NCRTLIBPATH545NCRTLIBPATH = $(VCINSTALLDIR)\lib546!ENDIF547 548NCRTLIBPATH = $(NCRTLIBPATH:\\=\)549 550# Check for the Platform SDK library path macro. Otherwise, this551# value will default to the 'lib' directory underneath the Windows552# SDK installation directory (the environment variable used appears553# to be available when using Visual C++ 2008 or later via the554# command line).555#556!IFNDEF NSDKLIBPATH557NSDKLIBPATH = $(WINDOWSSDKDIR)\lib558!ENDIF559 560NSDKLIBPATH = $(NSDKLIBPATH:\\=\)561 562# Check for the UCRT library path macro. Otherwise, this value will563# default to the version-specific, platform-specific 'lib' directory564# underneath the Windows SDK installation directory.565#566!IFNDEF UCRTLIBPATH567UCRTLIBPATH = $(WINDOWSSDKDIR)\lib\$(WINDOWSSDKLIBVERSION)\ucrt\$(PLATFORM)568!ENDIF569 570UCRTLIBPATH = $(UCRTLIBPATH:\\=\)571 572# C compiler and options for use in building executables that573# will run on the platform that is doing the build.574#575!IF $(USE_FULLWARN)!=0576BCC = $(NCC) -nologo -W4 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)577!ELSE578BCC = $(NCC) -nologo -W3 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)579!ENDIF580 581# Check if assembly code listings should be generated for the source582# code files to be compiled.583#584!IF $(USE_LISTINGS)!=0585BCC = $(BCC) -FAcs586!ENDIF587 588# Check if the native library paths should be used when compiling589# the command line tools used during the compilation process. If590# so, set the necessary macro now.591#592!IF $(USE_NATIVE_LIBPATHS)!=0593NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"594 595!IFDEF NUCRTLIBPATH596NUCRTLIBPATH = $(NUCRTLIBPATH:\\=\)597NLTLIBPATHS = $(NLTLIBPATHS) "/LIBPATH:$(NUCRTLIBPATH)"598!ENDIF599!ENDIF600 601# C compiler and options for use in building executables that602# will run on the target platform. (BCC and TCC are usually the603# same unless your are cross-compiling.)604#605!IF $(USE_FULLWARN)!=0606TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $(TCCOPTS)607!ELSE608TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)609!ENDIF610 611# Check if warnings should be treated as errors when compiling.612#613!IF $(USE_FATAL_WARN)!=0614TCC = $(TCC) -WX615!ENDIF616 617TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise618RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src $(RCOPTS) $(RCCOPTS)619 620# Check if we want to use the "stdcall" calling convention when compiling.621# This is not supported by the compilers for non-x86 platforms. It should622# also be noted here that building any target with these "stdcall" options623# will most likely fail if the Tcl library is also required. This is due624# to how the Tcl library functions are declared and exported (i.e. without625# an explicit calling convention, which results in "cdecl").626#627!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0628!IF "$(PLATFORM)"=="x86"629CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall630SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall631 632# <<mark>>633# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc634#635TEST_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl636# <</mark>>637 638!ELSE639!IFNDEF PLATFORM640CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall641SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall642 643# <<mark>>644# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc645#646TEST_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl647# <</mark>>648 649!ELSE650CORE_CCONV_OPTS =651SHELL_CCONV_OPTS =652# <<mark>>653TEST_CCONV_OPTS =654# <</mark>>655!ENDIF656!ENDIF657!ELSE658CORE_CCONV_OPTS =659SHELL_CCONV_OPTS =660# <<mark>>661TEST_CCONV_OPTS =662# <</mark>>663!ENDIF664 665# These are additional compiler options used for the core library.666#667!IFNDEF CORE_COMPILE_OPTS668!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0669CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)670!ELSE671CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)672!ENDIF673!ENDIF674 675# These are the additional targets that the core library should depend on676# when linking.677#678!IFNDEF CORE_LINK_DEP679!IF $(DYNAMIC_SHELL)!=0680CORE_LINK_DEP =681!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"682CORE_LINK_DEP = sqlite3.def683!ELSE684CORE_LINK_DEP =685!ENDIF686!ENDIF687 688# These are additional linker options used for the core library.689#690!IFNDEF CORE_LINK_OPTS691!IF $(DYNAMIC_SHELL)!=0692CORE_LINK_OPTS =693!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"694CORE_LINK_OPTS = /DEF:sqlite3.def695!ELSE696CORE_LINK_OPTS =697!ENDIF698!ENDIF699 700# These are additional compiler options used for the shell executable.701#702!IFNDEF SHELL_COMPILE_OPTS703!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0704SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)705!ELSE706SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)707!ENDIF708!ENDIF709 710# This is the source code that the shell executable should be compiled711# with.712#713!IFNDEF SHELL_CORE_SRC714!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0715SHELL_CORE_SRC =716# <<mark>>717!ELSEIF $(USE_AMALGAMATION)==0718SHELL_CORE_SRC =719# <</mark>>720!ELSE721SHELL_CORE_SRC = $(SQLITE3C)722!ENDIF723!ENDIF724 725# This is the core library that the shell executable should depend on.726#727!IFNDEF SHELL_CORE_DEP728!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0729SHELL_CORE_DEP = $(SQLITE3DLL)730# <<mark>>731!ELSEIF $(USE_AMALGAMATION)==0732SHELL_CORE_DEP = libsqlite3.lib733# <</mark>>734!ELSE735SHELL_CORE_DEP =736!ENDIF737!ENDIF738 739# <<mark>>740# If zlib support is enabled, add the dependencies for it.741#742!IF $(USE_ZLIB)!=0 && $(BUILD_ZLIB)!=0743SHELL_CORE_DEP = zlib $(SHELL_CORE_DEP)744TESTFIXTURE_DEP = zlib $(TESTFIXTURE_DEP)745!ENDIF746# <</mark>>747 748# This is the core library that the shell executable should link with.749#750!IFNDEF SHELL_CORE_LIB751!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0752SHELL_CORE_LIB = $(SQLITE3LIB)753# <<mark>>754!ELSEIF $(USE_AMALGAMATION)==0755SHELL_CORE_LIB = libsqlite3.lib756# <</mark>>757!ELSE758SHELL_CORE_LIB =759!ENDIF760!ENDIF761 762# These are additional linker options used for the shell executable.763#764!IFNDEF SHELL_LINK_OPTS765SHELL_LINK_OPTS = $(SHELL_CORE_LIB)766!ENDIF767 768# Check if assembly code listings should be generated for the source769# code files to be compiled.770#771!IF $(USE_LISTINGS)!=0772TCC = $(TCC) -FAcs773!ENDIF774 775# C compiler options for the Windows 10 platform (needs MSVC 2015).776#777!IF $(FOR_WIN10)!=0778TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE779BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE780!ENDIF781 782# Also, we need to dynamically link to the correct MSVC runtime783# when compiling for WinRT (e.g. debug or release) OR if the784# USE_CRT_DLL option is set to force dynamically linking to the785# MSVC runtime library.786#787!IF $(USE_CRT_DLL)!=0788!IF $(DEBUG)>1789TCC = $(TCC) -MDd790BCC = $(BCC) -MDd791ZLIBCFLAGS = -nologo -MDd -W3 -O2 -Oy- -Zi792!ELSE793TCC = $(TCC) -MD794BCC = $(BCC) -MD795ZLIBCFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi796!ENDIF797!ELSE798!IF $(DEBUG)>1799TCC = $(TCC) -MTd800BCC = $(BCC) -MTd801ZLIBCFLAGS = -nologo -MTd -W3 -O2 -Oy- -Zi802!ELSE803TCC = $(TCC) -MT804BCC = $(BCC) -MT805ZLIBCFLAGS = -nologo -MT -W3 -O2 -Oy- -Zi806!ENDIF807!ENDIF808 809# <<mark>>810# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc811#812# The mksqlite3c.tcl and mksqlite3h.tcl scripts will pull in813# any extension header files by default. For non-amalgamation814# builds, we need to make sure the compiler can find these.815#816!IF $(USE_AMALGAMATION)==0817TCC = $(TCC) -I$(TOP)\ext\fts3818RCC = $(RCC) -I$(TOP)\ext\fts3819TCC = $(TCC) -I$(TOP)\ext\rtree820RCC = $(RCC) -I$(TOP)\ext\rtree821TCC = $(TCC) -I$(TOP)\ext\session822RCC = $(RCC) -I$(TOP)\ext\session823!ENDIF824 825# The mksqlite3c.tcl script accepts some options on the command826# line. When compiling with debugging enabled, some of these827# options are necessary in order to allow debugging symbols to828# work correctly with Visual Studio when using the amalgamation.829#830!IFNDEF MKSQLITE3C_TOOL831!IF $(MINIMAL_AMALGAMATION)!=0832MKSQLITE3C_TOOL = $(TOP)\tool\mksqlite3c-noext.tcl833!ELSE834MKSQLITE3C_TOOL = $(TOP)\tool\mksqlite3c.tcl835!ENDIF836!ENDIF837 838!IFNDEF MKSQLITE3C_ARGS839!IF $(DEBUG)>1 && $(NO_LINEMACROS)==0840MKSQLITE3C_ARGS = --linemacros=1841!ELSE842MKSQLITE3C_ARGS = --linemacros=0843!ENDIF844!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0845MKSQLITE3C_ARGS = $(MKSQLITE3C_ARGS) --useapicall846!ENDIF847!ENDIF848 849# The mksqlite3h.tcl script accepts some options on the command line.850# When compiling with stdcall support, some of these options are851# necessary.852#853!IFNDEF MKSQLITE3H_ARGS854!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0855MKSQLITE3H_ARGS = --useapicall856!ELSE857MKSQLITE3H_ARGS =858!ENDIF859!ENDIF860# <</mark>>861 862!IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0863TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1864RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1865!ENDIF866 867!IF $(DEBUG)>2868TCC = $(TCC) -DSQLITE_DEBUG=1 -DSQLITE_USE_W32_FOR_CONSOLE_IO869RCC = $(RCC) -DSQLITE_DEBUG=1870!IF $(DYNAMIC_SHELL)==0871TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE872RCC = $(RCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE873!ENDIF874!ENDIF875 876!IF $(DEBUG)>4 || $(OSTRACE)!=0877TCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1878RCC = $(RCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1879!ENDIF880 881!IF $(DEBUG)>5882TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE=1883RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE=1884!ENDIF885 886# Prevent warnings about "insecure" MSVC runtime library functions887# being used.888#889TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS890BCC = $(BCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS891RCC = $(RCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS892 893# Prevent warnings about "deprecated" POSIX functions being used.894#895TCC = $(TCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS896BCC = $(BCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS897RCC = $(RCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS898 899# Use the SQLite debugging heap subsystem?900#901!IF $(MEMDEBUG)!=0902TCC = $(TCC) -DSQLITE_MEMDEBUG=1903RCC = $(RCC) -DSQLITE_MEMDEBUG=1904 905# Use native Win32 heap subsystem instead of malloc/free?906#907!ELSEIF $(WIN32HEAP)!=0908TCC = $(TCC) -DSQLITE_WIN32_MALLOC=1909RCC = $(RCC) -DSQLITE_WIN32_MALLOC=1910 911# Validate the heap on every call into the native Win32 heap subsystem?912#913!IF $(DEBUG)>3914TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1915RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1916!ENDIF917!ENDIF918 919 920# Address sanitizer if ASAN=1921#922!IF $(ASAN)>0923TCC = $(TCC) /fsanitize=address924!ENDIF925 926# <<mark>>927# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc928#929# The locations of the Tcl header and library files. Also, the library that930# non-stubs enabled programs using Tcl must link against. These variables931# (TCLINCDIR, TCLLIBDIR, and LIBTCL) may be overridden via the environment932# prior to running nmake in order to match the actual installed location and933# version on this machine.934#935!IF $(STATICALLY_LINK_TCL)!=0936TCLSUFFIX = s937!ENDIF938!IFNDEF TCLSUFFIX939TCLSUFFIX =940!ENDIF941 942!IFNDEF TCLDIR943TCLDIR = C:\Tcl944!ENDIF945 946!IFNDEF TCLVERSION947!IF EXISTS("$(TCLDIR)\lib\tcl90$(TCLSUFFIX).lib")948TCLVERSION = 90949!ELSEIF EXISTS("$(TCLDIR)\lib\tcl86$(TCLSUFFIX).lib")950TCLVERSION = 86951!ELSEIF EXISTS("$(TCLDIR)\lib\tcl86t.lib")952TCLSUFFIX = t953TCLVERSION = 86954!ELSE955TCLVERSION = 90956!ENDIF957!ENDIF958 959!IFNDEF TCLINCDIR960TCLINCDIR = $(TCLDIR)\include961!ENDIF962 963!IFNDEF TCLLIBDIR964TCLLIBDIR = $(TCLDIR)\lib965!ENDIF966 967!IFNDEF LIBTCL968LIBTCL = tcl$(TCLVERSION)$(TCLSUFFIX).lib969!ENDIF970 971!IFNDEF TCLLIBS972!IF $(STATICALLY_LINK_TCL)!=0973TCLLIBS = /NODEFAULTLIB:libucrt.lib netapi32.lib user32.lib ucrt.lib974!ELSE975TCLLIBS =976!ENDIF977!ENDIF978 979!IFNDEF LIBTCLSTUB980!IF EXISTS("$(TCLLIBDIR)\tclstub$(TCLVERSION)$(TCLSUFFIX).lib")981LIBTCLSTUB = tclstub$(TCLVERSION)$(TCLSUFFIX).lib982!ELSEIF EXISTS("$(TCLLIBDIR)\tclstub$(TCLSUFFIX).lib")983LIBTCLSTUB = tclstub$(TCLSUFFIX).lib984!ELSEIF EXISTS("$(TCLLIBDIR)\tclstub$(TCLVERSION).lib")985LIBTCLSTUB = tclstub$(TCLVERSION).lib986!ELSE987LIBTCLSTUB = tclstub.lib988!ENDIF989!ENDIF990 991!IFNDEF LIBTCLPATH992LIBTCLPATH = $(TCLDIR)\bin993!ENDIF994 995# The locations of the zlib header and library files. These variables996# (ZLIBINCDIR, ZLIBLIBDIR, and ZLIBLIB) may be overridden via the environment997# prior to running nmake in order to match the actual installed (or source998# code) location on this machine.999#1000!IFNDEF ZLIBDIR1001ZLIBDIR = $(TOP)\compat\zlib1002!ENDIF1003 1004!IFNDEF ZLIBINCDIR1005ZLIBINCDIR = $(ZLIBDIR)1006!ENDIF1007 1008!IFNDEF ZLIBLIBDIR1009ZLIBLIBDIR = $(ZLIBDIR)1010!ENDIF1011 1012!IFNDEF ZLIBLIB1013!IF $(DYNAMIC_SHELL)!=01014ZLIBLIB = zdll.lib1015!ELSE1016ZLIBLIB = zlib.lib1017!ENDIF1018!ENDIF1019 1020# The locations of the ICU header and library files. These variables1021# (ICUINCDIR, ICULIBDIR, and LIBICU) may be overridden via the environment1022# prior to running nmake in order to match the actual installed location on1023# this machine.1024#1025!IFNDEF ICUDIR1026ICUDIR = $(TOP)\compat\icu1027!ENDIF1028 1029!IFNDEF ICUINCDIR1030ICUINCDIR = $(ICUDIR)\include1031!ENDIF1032 1033!IFNDEF ICULIBDIR1034ICULIBDIR = $(ICUDIR)\lib1035!ENDIF1036 1037!IFNDEF LIBICU1038LIBICU = icuuc.lib icuin.lib1039!ENDIF1040 1041# This is the command to use for tclsh - normally just "tclsh", but we may1042# know the specific version we want to use. This variable (TCLSH_CMD) may be1043# overridden via the environment prior to running nmake in order to select a1044# specific Tcl shell to use.1045#1046!IFNDEF TCLSH_CMD1047!IF EXISTS("$(TCLDIR)\bin\tclsh$(TCLVERSION).exe")1048TCLSH_CMD = $(TCLDIR)\bin\tclsh$(TCLVERSION).exe1049!ELSEIF EXISTS("$(TCLDIR)\bin\tclsh90.exe")1050TCLSH_CMD = $(TCLDIR)\bin\tclsh90.exe1051!ELSEIF EXISTS("$(TCLDIR)\bin\tclsh86.exe")1052TCLSH_CMD = $(TCLDIR)\bin\tclsh86.exe1053!ELSEIF EXISTS("$(TCLDIR)\bin\tclsh86t.exe")1054TCLSH_CMD = $(TCLDIR)\bin\tclsh86t.exe1055!ELSEIF EXISTS("$(TCLDIR)\bin\tclsh.exe")1056TCLSH_CMD = $(TCLDIR)\bin\tclsh.exe1057!ELSE1058TCLSH_CMD = tclsh1059!ENDIF1060!ENDIF1061 1062# A light-weight TCLSH replacement that can be used for code generation1063# but which is not adequate for testing. This is "jimsh0" by default,1064# with source code in the repository. To force the whole build to use1065# the full, official tclsh, add WITHOUT_JIMSH=1 to the nmake command line.1066#1067!IFDEF WITHOUT_JIMSH1068JIM_TCLSH = $(TCLSH_CMD)1069!ENDIF1070!IFNDEF JIM_TCLSH1071JIM_TCLSH = jimsh0.exe1072!ENDIF1073# <</mark>>1074 1075# Compiler options needed for programs that use the readline() library.1076#1077!IFNDEF READLINE_FLAGS1078READLINE_FLAGS = -DHAVE_READLINE=01079!ENDIF1080 1081# The library that programs using readline() must link against.1082#1083!IFNDEF LIBREADLINE1084LIBREADLINE =1085!ENDIF1086 1087# Should the database engine be compiled threadsafe1088#1089TCC = $(TCC) -DSQLITE_THREADSAFE=11090RCC = $(RCC) -DSQLITE_THREADSAFE=11091 1092# Do threads override each others locks by default (1), or do we test (-1)1093#1094TCC = $(TCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-11095RCC = $(RCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-11096 1097# Any target libraries which libsqlite must be linked against1098#1099!IFNDEF TLIBS1100TLIBS =1101!ENDIF1102 1103# Enable/disable loadable extensions, and other optional features1104# based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).1105# The same set of OMIT and ENABLE flags should be passed to the1106# LEMON parser generator and the mkkeywordhash tool as well.1107 1108# These are the required SQLite compilation options used when compiling for1109# the Windows platform.1110#1111REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=1001112 1113# If we are linking to the RPCRT4 library, enable features that need it.1114#1115!IF $(USE_RPCRT4_LIB)!=01116REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_WIN32_USE_UUID=11117!ENDIF1118 1119# Add the required and optional SQLite compilation options into the command1120# lines used to invoke the MSVC code and resource compilers.1121#1122TCC = $(TCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)1123RCC = $(RCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS)1124 1125# Add in any optional parameters specified on the commane line, e.g.1126# nmake /f Makefile.msc all "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1"1127#1128TCC = $(TCC) $(OPTS)1129RCC = $(RCC) $(OPTS)1130 1131# If compiling for debugging, add some defines.1132#1133!IF $(DEBUG)>11134TCC = $(TCC) -D_DEBUG1135BCC = $(BCC) -D_DEBUG1136RCC = $(RCC) -D_DEBUG1137!ENDIF1138 1139# If optimizations are enabled or disabled (either implicitly or1140# explicitly), add the necessary flags.1141#1142!IF $(DEBUG)>1 || $(OPTIMIZATIONS)==01143TCC = $(TCC) -Od1144BCC = $(BCC) -Od1145!IF $(USE_RUNTIME_CHECKS)!=01146TCC = $(TCC) -RTC11147BCC = $(BCC) -RTC11148!ENDIF1149!ELSEIF $(OPTIMIZATIONS)>=31150TCC = $(TCC) -Ox1151BCC = $(BCC) -Ox1152!ELSEIF $(OPTIMIZATIONS)==21153TCC = $(TCC) -O21154BCC = $(BCC) -O21155!ELSEIF $(OPTIMIZATIONS)==11156TCC = $(TCC) -O11157BCC = $(BCC) -O11158!ENDIF1159 1160# If symbols are enabled (or compiling for debugging), enable PDBs.1161#1162!IF $(DEBUG)>1 || $(SYMBOLS)!=01163TCC = $(TCC) -Zi1164BCC = $(BCC) -Zi1165!ENDIF1166 1167# <<mark>>1168# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc1169#1170# If zlib support is enabled, add the compiler options for it.1171#1172!IF $(USE_ZLIB)!=01173TCC = $(TCC) -DSQLITE_HAVE_ZLIB=11174RCC = $(RCC) -DSQLITE_HAVE_ZLIB=11175TCC = $(TCC) -I$(ZLIBINCDIR)1176RCC = $(RCC) -I$(ZLIBINCDIR)1177!ENDIF1178 1179# If ICU support is enabled, add the compiler options for it.1180#1181!IF $(USE_ICU)!=01182TCC = $(TCC) -DSQLITE_ENABLE_ICU=11183RCC = $(RCC) -DSQLITE_ENABLE_ICU=11184TCC = $(TCC) -I$(TOP)\ext\icu1185RCC = $(RCC) -I$(TOP)\ext\icu1186TCC = $(TCC) -I$(ICUINCDIR)1187RCC = $(RCC) -I$(ICUINCDIR)1188!ENDIF1189# <</mark>>1190 1191# Command line prefixes for compiling code, compiling resources,1192# linking, etc.1193#1194LTCOMPILE = $(TCC) -Fo$@ -Fd$*.pdb1195LTRCOMPILE = $(RCC) -r1196LTLIB = lib.exe1197LTLINK = $(TCC) -Fe$@1198 1199# If requested, link to the RPCRT4 library.1200#