1021f9a66Sdrh#### DO NOT EDIT #### 2021f9a66Sdrh# This makefile is automatically generated from the Makefile.msc at 3021f9a66Sdrh# the root of the canonical SQLite source tree (not the 4021f9a66Sdrh# amalgamation tarball) using the tool/mkmsvcmin.tcl 5021f9a66Sdrh# script. 6021f9a66Sdrh# 7021f9a66Sdrh 8021f9a66Sdrh# 9021f9a66Sdrh# nmake Makefile for SQLite 10021f9a66Sdrh# 11021f9a66Sdrh############################################################################### 12021f9a66Sdrh############################## START OF OPTIONS ############################### 13021f9a66Sdrh############################################################################### 14021f9a66Sdrh 15021f9a66Sdrh# The toplevel directory of the source tree. This is the directory 16021f9a66Sdrh# that contains this "Makefile.msc". 17021f9a66Sdrh# 18021f9a66SdrhTOP = . 19021f9a66Sdrh 20021f9a66Sdrh 21021f9a66Sdrh# Set this non-0 to enable full warnings (-W4, etc) when compiling. 22021f9a66Sdrh# 23021f9a66Sdrh!IFNDEF USE_FULLWARN 24c8d3e836SmistachkinUSE_FULLWARN = 1 25021f9a66Sdrh!ENDIF 26021f9a66Sdrh 278c5e8febSmistachkin# Set this non-0 to enable treating warnings as errors (-WX, etc) when 288c5e8febSmistachkin# compiling. 298c5e8febSmistachkin# 308c5e8febSmistachkin!IFNDEF USE_FATAL_WARN 318c5e8febSmistachkinUSE_FATAL_WARN = 0 328c5e8febSmistachkin!ENDIF 338c5e8febSmistachkin 34fefe8287Smistachkin# Set this non-0 to enable full runtime error checks (-RTC1, etc). This 35fefe8287Smistachkin# has no effect if (any) optimizations are enabled. 36fefe8287Smistachkin# 37fefe8287Smistachkin!IFNDEF USE_RUNTIME_CHECKS 38fefe8287SmistachkinUSE_RUNTIME_CHECKS = 0 39fefe8287Smistachkin!ENDIF 40fefe8287Smistachkin 41cc0164b5Smistachkin# Set this non-0 to create a SQLite amalgamation file that excludes the 42cc0164b5Smistachkin# various built-in extensions. 43cc0164b5Smistachkin# 44cc0164b5Smistachkin!IFNDEF MINIMAL_AMALGAMATION 45cc0164b5SmistachkinMINIMAL_AMALGAMATION = 0 46cc0164b5Smistachkin!ENDIF 47cc0164b5Smistachkin 48021f9a66Sdrh# Set this non-0 to use "stdcall" calling convention for the core library 49021f9a66Sdrh# and shell executable. 50021f9a66Sdrh# 51021f9a66Sdrh!IFNDEF USE_STDCALL 52021f9a66SdrhUSE_STDCALL = 0 53021f9a66Sdrh!ENDIF 54021f9a66Sdrh 55021f9a66Sdrh# Set this non-0 to have the shell executable link against the core dynamic 56021f9a66Sdrh# link library. 57021f9a66Sdrh# 58021f9a66Sdrh!IFNDEF DYNAMIC_SHELL 59021f9a66SdrhDYNAMIC_SHELL = 0 60021f9a66Sdrh!ENDIF 61021f9a66Sdrh 62021f9a66Sdrh# Set this non-0 to enable extra code that attempts to detect misuse of the 63021f9a66Sdrh# SQLite API. 64021f9a66Sdrh# 65021f9a66Sdrh!IFNDEF API_ARMOR 66021f9a66SdrhAPI_ARMOR = 0 67021f9a66Sdrh!ENDIF 68021f9a66Sdrh 69021f9a66Sdrh# If necessary, create a list of harmless compiler warnings to disable when 70021f9a66Sdrh# compiling the various tools. For the SQLite source code itself, warnings, 71021f9a66Sdrh# if any, will be disabled from within it. 72021f9a66Sdrh# 73021f9a66Sdrh!IFNDEF NO_WARN 74021f9a66Sdrh!IF $(USE_FULLWARN)!=0 75021f9a66SdrhNO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206 76f71a243aSmistachkinNO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706 77021f9a66Sdrh!ENDIF 78021f9a66Sdrh!ENDIF 79021f9a66Sdrh 80021f9a66Sdrh# Set this non-0 to use the library paths and other options necessary for 81021f9a66Sdrh# Windows Phone 8.1. 82021f9a66Sdrh# 83021f9a66Sdrh!IFNDEF USE_WP81_OPTS 84021f9a66SdrhUSE_WP81_OPTS = 0 85021f9a66Sdrh!ENDIF 86021f9a66Sdrh 87021f9a66Sdrh# Set this non-0 to split the SQLite amalgamation file into chunks to 88021f9a66Sdrh# be used for debugging with Visual Studio. 89021f9a66Sdrh# 90021f9a66Sdrh!IFNDEF SPLIT_AMALGAMATION 91021f9a66SdrhSPLIT_AMALGAMATION = 0 92021f9a66Sdrh!ENDIF 93021f9a66Sdrh 94021f9a66Sdrh 95021f9a66Sdrh# Set this non-0 to dynamically link to the MSVC runtime library. 96021f9a66Sdrh# 97021f9a66Sdrh!IFNDEF USE_CRT_DLL 98021f9a66SdrhUSE_CRT_DLL = 0 99021f9a66Sdrh!ENDIF 100021f9a66Sdrh 101021f9a66Sdrh# Set this non-0 to link to the RPCRT4 library. 102021f9a66Sdrh# 103021f9a66Sdrh!IFNDEF USE_RPCRT4_LIB 104021f9a66SdrhUSE_RPCRT4_LIB = 0 105021f9a66Sdrh!ENDIF 106021f9a66Sdrh 107021f9a66Sdrh# Set this non-0 to generate assembly code listings for the source code 108021f9a66Sdrh# files. 109021f9a66Sdrh# 110021f9a66Sdrh!IFNDEF USE_LISTINGS 111021f9a66SdrhUSE_LISTINGS = 0 112021f9a66Sdrh!ENDIF 113021f9a66Sdrh 114021f9a66Sdrh# Set this non-0 to attempt setting the native compiler automatically 115021f9a66Sdrh# for cross-compiling the command line tools needed during the compilation 116021f9a66Sdrh# process. 117021f9a66Sdrh# 118021f9a66Sdrh!IFNDEF XCOMPILE 119021f9a66SdrhXCOMPILE = 0 120021f9a66Sdrh!ENDIF 121021f9a66Sdrh 122021f9a66Sdrh# Set this non-0 to use the native libraries paths for cross-compiling 123021f9a66Sdrh# the command line tools needed during the compilation process. 124021f9a66Sdrh# 125021f9a66Sdrh!IFNDEF USE_NATIVE_LIBPATHS 126021f9a66SdrhUSE_NATIVE_LIBPATHS = 0 127021f9a66Sdrh!ENDIF 128021f9a66Sdrh 129021f9a66Sdrh# Set this 0 to skip the compiling and embedding of version resources. 130021f9a66Sdrh# 131021f9a66Sdrh!IFNDEF USE_RC 132021f9a66SdrhUSE_RC = 1 133021f9a66Sdrh!ENDIF 134021f9a66Sdrh 135021f9a66Sdrh# Set this non-0 to compile binaries suitable for the WinRT environment. 136021f9a66Sdrh# This setting does not apply to any binaries that require Tcl to operate 137021f9a66Sdrh# properly (i.e. the text fixture, etc). 138021f9a66Sdrh# 139021f9a66Sdrh!IFNDEF FOR_WINRT 140021f9a66SdrhFOR_WINRT = 0 141021f9a66Sdrh!ENDIF 142021f9a66Sdrh 143a819aed8Smistachkin# Set this non-0 to compile binaries suitable for the UWP environment. 144021f9a66Sdrh# This setting does not apply to any binaries that require Tcl to operate 145021f9a66Sdrh# properly (i.e. the text fixture, etc). 146021f9a66Sdrh# 147a819aed8Smistachkin!IFNDEF FOR_UWP 148a819aed8SmistachkinFOR_UWP = 0 149021f9a66Sdrh!ENDIF 150021f9a66Sdrh 151021f9a66Sdrh# Set this non-0 to compile binaries suitable for the Windows 10 platform. 152021f9a66Sdrh# 153021f9a66Sdrh!IFNDEF FOR_WIN10 154021f9a66SdrhFOR_WIN10 = 0 155021f9a66Sdrh!ENDIF 156021f9a66Sdrh 157021f9a66Sdrh 158021f9a66Sdrh# Set this to non-0 to create and use PDBs. 159021f9a66Sdrh# 160021f9a66Sdrh!IFNDEF SYMBOLS 161021f9a66SdrhSYMBOLS = 1 162021f9a66Sdrh!ENDIF 163021f9a66Sdrh 164021f9a66Sdrh# Set this to non-0 to use the SQLite debugging heap subsystem. 165021f9a66Sdrh# 166021f9a66Sdrh!IFNDEF MEMDEBUG 167021f9a66SdrhMEMDEBUG = 0 168021f9a66Sdrh!ENDIF 169021f9a66Sdrh 170021f9a66Sdrh# Set this to non-0 to use the Win32 native heap subsystem. 171021f9a66Sdrh# 172021f9a66Sdrh!IFNDEF WIN32HEAP 173021f9a66SdrhWIN32HEAP = 0 174021f9a66Sdrh!ENDIF 175021f9a66Sdrh 176021f9a66Sdrh# Set this to non-0 to enable OSTRACE() macros, which can be useful when 177021f9a66Sdrh# debugging. 178021f9a66Sdrh# 179021f9a66Sdrh!IFNDEF OSTRACE 180021f9a66SdrhOSTRACE = 0 181021f9a66Sdrh!ENDIF 182021f9a66Sdrh 183021f9a66Sdrh# Set this to one of the following values to enable various debugging 184021f9a66Sdrh# features. Each level includes the debugging options from the previous 185021f9a66Sdrh# levels. Currently, the recognized values for DEBUG are: 186021f9a66Sdrh# 187021f9a66Sdrh# 0 == NDEBUG: Disables assert() and other runtime diagnostics. 188021f9a66Sdrh# 1 == SQLITE_ENABLE_API_ARMOR: extra attempts to detect misuse of the API. 189021f9a66Sdrh# 2 == Disables NDEBUG and all optimizations and then enables PDBs. 190021f9a66Sdrh# 3 == SQLITE_DEBUG: Enables various diagnostics messages and code. 191021f9a66Sdrh# 4 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call. 192021f9a66Sdrh# 5 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros. 193021f9a66Sdrh# 6 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros. 194021f9a66Sdrh# 195021f9a66Sdrh!IFNDEF DEBUG 196021f9a66SdrhDEBUG = 0 197021f9a66Sdrh!ENDIF 198021f9a66Sdrh 199a8e41ecaSmistachkin 200021f9a66Sdrh# Enable use of available compiler optimizations? Normally, this should be 201021f9a66Sdrh# non-zero. Setting this to zero, thus disabling all compiler optimizations, 202021f9a66Sdrh# can be useful for testing. 203021f9a66Sdrh# 204021f9a66Sdrh!IFNDEF OPTIMIZATIONS 205021f9a66SdrhOPTIMIZATIONS = 2 206021f9a66Sdrh!ENDIF 207021f9a66Sdrh 20812b35ea9Smistachkin# Set this to non-0 to enable support for the session extension. 20912b35ea9Smistachkin# 21012b35ea9Smistachkin!IFNDEF SESSION 21112b35ea9SmistachkinSESSION = 0 21212b35ea9Smistachkin!ENDIF 21312b35ea9Smistachkin 214e99cb2daSmistachkin# Set this to non-0 to enable support for the rbu extension. 215e99cb2daSmistachkin# 216e99cb2daSmistachkin!IFNDEF RBU 217e99cb2daSmistachkinRBU = 0 218e99cb2daSmistachkin!ENDIF 219e99cb2daSmistachkin 220021f9a66Sdrh# Set the source code file to be used by executables and libraries when 221021f9a66Sdrh# they need the amalgamation. 222021f9a66Sdrh# 223021f9a66Sdrh!IFNDEF SQLITE3C 224021f9a66Sdrh!IF $(SPLIT_AMALGAMATION)!=0 225021f9a66SdrhSQLITE3C = sqlite3-all.c 226021f9a66Sdrh!ELSE 227021f9a66SdrhSQLITE3C = sqlite3.c 228021f9a66Sdrh!ENDIF 229021f9a66Sdrh!ENDIF 230021f9a66Sdrh 231021f9a66Sdrh# Set the include code file to be used by executables and libraries when 232021f9a66Sdrh# they need SQLite. 233021f9a66Sdrh# 234021f9a66Sdrh!IFNDEF SQLITE3H 235021f9a66SdrhSQLITE3H = sqlite3.h 236021f9a66Sdrh!ENDIF 237021f9a66Sdrh 238021f9a66Sdrh# This is the name to use for the SQLite dynamic link library (DLL). 239021f9a66Sdrh# 240021f9a66Sdrh!IFNDEF SQLITE3DLL 241b0c99afeSmistachkin!IF $(FOR_WIN10)!=0 242b0c99afeSmistachkinSQLITE3DLL = winsqlite3.dll 243b0c99afeSmistachkin!ELSE 244021f9a66SdrhSQLITE3DLL = sqlite3.dll 245021f9a66Sdrh!ENDIF 246b0c99afeSmistachkin!ENDIF 247021f9a66Sdrh 248021f9a66Sdrh# This is the name to use for the SQLite import library (LIB). 249021f9a66Sdrh# 250021f9a66Sdrh!IFNDEF SQLITE3LIB 251b0c99afeSmistachkin!IF $(FOR_WIN10)!=0 252b0c99afeSmistachkinSQLITE3LIB = winsqlite3.lib 253b0c99afeSmistachkin!ELSE 254021f9a66SdrhSQLITE3LIB = sqlite3.lib 255021f9a66Sdrh!ENDIF 256b0c99afeSmistachkin!ENDIF 257021f9a66Sdrh 258021f9a66Sdrh# This is the name to use for the SQLite shell executable (EXE). 259021f9a66Sdrh# 260021f9a66Sdrh!IFNDEF SQLITE3EXE 261b0c99afeSmistachkin!IF $(FOR_WIN10)!=0 262b0c99afeSmistachkinSQLITE3EXE = winsqlite3shell.exe 263b0c99afeSmistachkin!ELSE 264021f9a66SdrhSQLITE3EXE = sqlite3.exe 265021f9a66Sdrh!ENDIF 266b0c99afeSmistachkin!ENDIF 267021f9a66Sdrh 268021f9a66Sdrh# This is the argument used to set the program database (PDB) file for the 269021f9a66Sdrh# SQLite shell executable (EXE). 270021f9a66Sdrh# 271021f9a66Sdrh!IFNDEF SQLITE3EXEPDB 272b0c99afeSmistachkin!IF $(FOR_WIN10)!=0 273b0c99afeSmistachkinSQLITE3EXEPDB = 274b0c99afeSmistachkin!ELSE 275021f9a66SdrhSQLITE3EXEPDB = /pdb:sqlite3sh.pdb 276021f9a66Sdrh!ENDIF 277b0c99afeSmistachkin!ENDIF 278021f9a66Sdrh 279cc0164b5Smistachkin 280021f9a66Sdrh# These are the "standard" SQLite compilation options used when compiling for 281021f9a66Sdrh# the Windows platform. 282021f9a66Sdrh# 283021f9a66Sdrh!IFNDEF OPT_FEATURE_FLAGS 284cc0164b5Smistachkin!IF $(MINIMAL_AMALGAMATION)==0 285021f9a66SdrhOPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1 286021f9a66SdrhOPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1 28790d6f480SmistachkinOPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_GEOPOLY=1 28890d6f480SmistachkinOPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1 28990d6f480SmistachkinOPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1 29090d6f480SmistachkinOPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1 291a8e41ecaSmistachkinOPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1 292cc0164b5Smistachkin!ENDIF 293021f9a66SdrhOPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1 2945e18d402Sdrh!ENDIF 2955e18d402Sdrh 29612b35ea9Smistachkin# Should the session extension be enabled? If so, add compilation options 29712b35ea9Smistachkin# to enable it. 2985e18d402Sdrh# 2995e18d402Sdrh!IF $(SESSION)!=0 30005004784SmistachkinOPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1 30105004784SmistachkinOPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1 302021f9a66Sdrh!ENDIF 303021f9a66Sdrh 3049c0fee29Slarrybr# Always enable math functions on Windows 3059c0fee29SlarrybrOPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS 3069c0fee29Slarrybr 307e99cb2daSmistachkin# Should the rbu extension be enabled? If so, add compilation options 308e99cb2daSmistachkin# to enable it. 309e99cb2daSmistachkin# 310e99cb2daSmistachkin!IF $(RBU)!=0 311e99cb2daSmistachkinOPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RBU=1 312e99cb2daSmistachkin!ENDIF 313e99cb2daSmistachkin 314021f9a66Sdrh# These are the "extended" SQLite compilation options used when compiling for 315021f9a66Sdrh# the Windows 10 platform. 316021f9a66Sdrh# 317021f9a66Sdrh!IFNDEF EXT_FEATURE_FLAGS 318021f9a66Sdrh!IF $(FOR_WIN10)!=0 319021f9a66SdrhEXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS4=1 320021f9a66SdrhEXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_SYSTEM_MALLOC=1 321021f9a66SdrhEXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS) -DSQLITE_OMIT_LOCALTIME=1 322021f9a66Sdrh!ELSE 323021f9a66SdrhEXT_FEATURE_FLAGS = 324021f9a66Sdrh!ENDIF 325021f9a66Sdrh!ENDIF 326021f9a66Sdrh 327021f9a66Sdrh############################################################################### 328021f9a66Sdrh############################### END OF OPTIONS ################################ 329021f9a66Sdrh############################################################################### 330021f9a66Sdrh 33155e88d96Smistachkin# When compiling for the Windows 10 platform, the PLATFORM macro must be set 33255e88d96Smistachkin# to an appropriate value (e.g. x86, x64, arm, arm64, etc). 33355e88d96Smistachkin# 33455e88d96Smistachkin!IF $(FOR_WIN10)!=0 33555e88d96Smistachkin!IFNDEF PLATFORM 33655e88d96Smistachkin!ERROR Using the FOR_WIN10 option requires a value for PLATFORM. 33755e88d96Smistachkin!ENDIF 33855e88d96Smistachkin!ENDIF 33955e88d96Smistachkin 340021f9a66Sdrh# This assumes that MSVC is always installed in 32-bit Program Files directory 341021f9a66Sdrh# and sets the variable for use in locating other 32-bit installs accordingly. 342021f9a66Sdrh# 343021f9a66SdrhPROGRAMFILES_X86 = $(VCINSTALLDIR)\..\.. 344021f9a66SdrhPROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\) 345021f9a66Sdrh 346021f9a66Sdrh# Check for the predefined command macro CC. This should point to the compiler 347021f9a66Sdrh# binary for the target platform. If it is not defined, simply define it to 348021f9a66Sdrh# the legacy default value 'cl.exe'. 349021f9a66Sdrh# 350021f9a66Sdrh!IFNDEF CC 351021f9a66SdrhCC = cl.exe 352021f9a66Sdrh!ENDIF 353021f9a66Sdrh 3549aeb971cSmistachkin# Check for the predefined command macro CSC. This should point to a working 3559aeb971cSmistachkin# C Sharp compiler binary. If it is not defined, simply define it to the 3569aeb971cSmistachkin# legacy default value 'csc.exe'. 3579aeb971cSmistachkin# 3589aeb971cSmistachkin!IFNDEF CSC 3599aeb971cSmistachkinCSC = csc.exe 3609aeb971cSmistachkin!ENDIF 3619aeb971cSmistachkin 362021f9a66Sdrh# Check for the command macro LD. This should point to the linker binary for 363021f9a66Sdrh# the target platform. If it is not defined, simply define it to the legacy 364021f9a66Sdrh# default value 'link.exe'. 365021f9a66Sdrh# 366021f9a66Sdrh!IFNDEF LD 367021f9a66SdrhLD = link.exe 368021f9a66Sdrh!ENDIF 369021f9a66Sdrh 370021f9a66Sdrh# Check for the predefined command macro RC. This should point to the resource 371021f9a66Sdrh# compiler binary for the target platform. If it is not defined, simply define 372021f9a66Sdrh# it to the legacy default value 'rc.exe'. 373021f9a66Sdrh# 374021f9a66Sdrh!IFNDEF RC 375021f9a66SdrhRC = rc.exe 376021f9a66Sdrh!ENDIF 377021f9a66Sdrh 378e48f1ed9Smistachkin# Check for the MSVC runtime library path macro. Otherwise, this value will 379021f9a66Sdrh# default to the 'lib' directory underneath the MSVC installation directory. 380021f9a66Sdrh# 381021f9a66Sdrh!IFNDEF CRTLIBPATH 382021f9a66SdrhCRTLIBPATH = $(VCINSTALLDIR)\lib 383021f9a66Sdrh!ENDIF 384021f9a66Sdrh 385021f9a66SdrhCRTLIBPATH = $(CRTLIBPATH:\\=\) 386021f9a66Sdrh 387021f9a66Sdrh# Check for the command macro NCC. This should point to the compiler binary 388021f9a66Sdrh# for the platform the compilation process is taking place on. If it is not 389021f9a66Sdrh# defined, simply define it to have the same value as the CC macro. When 390021f9a66Sdrh# cross-compiling, it is suggested that this macro be modified via the command 391021f9a66Sdrh# line (since nmake itself does not provide a built-in method to guess it). 392021f9a66Sdrh# For example, to use the x86 compiler when cross-compiling for x64, a command 393021f9a66Sdrh# line similar to the following could be used (all on one line): 394021f9a66Sdrh# 395021f9a66Sdrh# nmake /f Makefile.msc sqlite3.dll 396021f9a66Sdrh# XCOMPILE=1 USE_NATIVE_LIBPATHS=1 397021f9a66Sdrh# 398021f9a66Sdrh# Alternatively, the full path and file name to the compiler binary for the 399021f9a66Sdrh# platform the compilation process is taking place may be specified (all on 400021f9a66Sdrh# one line): 401021f9a66Sdrh# 402021f9a66Sdrh# nmake /f Makefile.msc sqlite3.dll 403021f9a66Sdrh# "NCC=""%VCINSTALLDIR%\bin\cl.exe""" 404021f9a66Sdrh# USE_NATIVE_LIBPATHS=1 405021f9a66Sdrh# 406021f9a66Sdrh!IFDEF NCC 407021f9a66SdrhNCC = $(NCC:\\=\) 408021f9a66Sdrh!ELSEIF $(XCOMPILE)!=0 409021f9a66SdrhNCC = "$(VCINSTALLDIR)\bin\$(CC)" 410021f9a66SdrhNCC = $(NCC:\\=\) 411021f9a66Sdrh!ELSE 412021f9a66SdrhNCC = $(CC) 413021f9a66Sdrh!ENDIF 414021f9a66Sdrh 415e48f1ed9Smistachkin# Check for the MSVC native runtime library path macro. Otherwise, 416021f9a66Sdrh# this value will default to the 'lib' directory underneath the MSVC 417021f9a66Sdrh# installation directory. 418021f9a66Sdrh# 419021f9a66Sdrh!IFNDEF NCRTLIBPATH 420021f9a66SdrhNCRTLIBPATH = $(VCINSTALLDIR)\lib 421021f9a66Sdrh!ENDIF 422021f9a66Sdrh 423021f9a66SdrhNCRTLIBPATH = $(NCRTLIBPATH:\\=\) 424021f9a66Sdrh 425e48f1ed9Smistachkin# Check for the Platform SDK library path macro. Otherwise, this 426021f9a66Sdrh# value will default to the 'lib' directory underneath the Windows 427021f9a66Sdrh# SDK installation directory (the environment variable used appears 428021f9a66Sdrh# to be available when using Visual C++ 2008 or later via the 429021f9a66Sdrh# command line). 430021f9a66Sdrh# 431021f9a66Sdrh!IFNDEF NSDKLIBPATH 432021f9a66SdrhNSDKLIBPATH = $(WINDOWSSDKDIR)\lib 433021f9a66Sdrh!ENDIF 434021f9a66Sdrh 435021f9a66SdrhNSDKLIBPATH = $(NSDKLIBPATH:\\=\) 436021f9a66Sdrh 437e48f1ed9Smistachkin# Check for the UCRT library path macro. Otherwise, this value will 43855e88d96Smistachkin# default to the version-specific, platform-specific 'lib' directory 43955e88d96Smistachkin# underneath the Windows SDK installation directory. 44055e88d96Smistachkin# 44155e88d96Smistachkin!IFNDEF UCRTLIBPATH 44255e88d96SmistachkinUCRTLIBPATH = $(WINDOWSSDKDIR)\lib\$(WINDOWSSDKLIBVERSION)\ucrt\$(PLATFORM) 44355e88d96Smistachkin!ENDIF 44455e88d96Smistachkin 44555e88d96SmistachkinUCRTLIBPATH = $(UCRTLIBPATH:\\=\) 44655e88d96Smistachkin 447021f9a66Sdrh# C compiler and options for use in building executables that 448021f9a66Sdrh# will run on the platform that is doing the build. 449021f9a66Sdrh# 450021f9a66Sdrh!IF $(USE_FULLWARN)!=0 4517ac2ee0aSmistachkinBCC = $(NCC) -nologo -W4 -Fd$*.pdb $(CCOPTS) $(BCCOPTS) 452021f9a66Sdrh!ELSE 4537ac2ee0aSmistachkinBCC = $(NCC) -nologo -W3 -Fd$*.pdb $(CCOPTS) $(BCCOPTS) 454021f9a66Sdrh!ENDIF 455021f9a66Sdrh 456021f9a66Sdrh# Check if assembly code listings should be generated for the source 457021f9a66Sdrh# code files to be compiled. 458021f9a66Sdrh# 459021f9a66Sdrh!IF $(USE_LISTINGS)!=0 460021f9a66SdrhBCC = $(BCC) -FAcs 461021f9a66Sdrh!ENDIF 462021f9a66Sdrh 463021f9a66Sdrh# Check if the native library paths should be used when compiling 464021f9a66Sdrh# the command line tools used during the compilation process. If 465021f9a66Sdrh# so, set the necessary macro now. 466021f9a66Sdrh# 467021f9a66Sdrh!IF $(USE_NATIVE_LIBPATHS)!=0 468021f9a66SdrhNLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)" 469021f9a66Sdrh 470021f9a66Sdrh!IFDEF NUCRTLIBPATH 471021f9a66SdrhNUCRTLIBPATH = $(NUCRTLIBPATH:\\=\) 472021f9a66SdrhNLTLIBPATHS = $(NLTLIBPATHS) "/LIBPATH:$(NUCRTLIBPATH)" 473021f9a66Sdrh!ENDIF 474021f9a66Sdrh!ENDIF 475021f9a66Sdrh 476021f9a66Sdrh# C compiler and options for use in building executables that 477021f9a66Sdrh# will run on the target platform. (BCC and TCC are usually the 478021f9a66Sdrh# same unless your are cross-compiling.) 479021f9a66Sdrh# 480021f9a66Sdrh!IF $(USE_FULLWARN)!=0 481021f9a66SdrhTCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $(TCCOPTS) 482021f9a66Sdrh!ELSE 483021f9a66SdrhTCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS) 484021f9a66Sdrh!ENDIF 485021f9a66Sdrh 4868c5e8febSmistachkin# Check if warnings should be treated as errors when compiling. 4878c5e8febSmistachkin# 4888c5e8febSmistachkin!IF $(USE_FATAL_WARN)!=0 4898c5e8febSmistachkinTCC = $(TCC) -WX 4908c5e8febSmistachkin!ENDIF 4918c5e8febSmistachkin 4928988aeefSmistachkinTCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise 4938988aeefSmistachkinRCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS) 494021f9a66Sdrh 495021f9a66Sdrh# Check if we want to use the "stdcall" calling convention when compiling. 496021f9a66Sdrh# This is not supported by the compilers for non-x86 platforms. It should 497021f9a66Sdrh# also be noted here that building any target with these "stdcall" options 498021f9a66Sdrh# will most likely fail if the Tcl library is also required. This is due 499021f9a66Sdrh# to how the Tcl library functions are declared and exported (i.e. without 500021f9a66Sdrh# an explicit calling convention, which results in "cdecl"). 501021f9a66Sdrh# 502021f9a66Sdrh!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0 503021f9a66Sdrh!IF "$(PLATFORM)"=="x86" 504*3c648882SmistachkinCORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall 505*3c648882SmistachkinSHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall 506021f9a66Sdrh!ELSE 507021f9a66Sdrh!IFNDEF PLATFORM 508*3c648882SmistachkinCORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall 509*3c648882SmistachkinSHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall 510021f9a66Sdrh!ELSE 511021f9a66SdrhCORE_CCONV_OPTS = 512021f9a66SdrhSHELL_CCONV_OPTS = 513021f9a66Sdrh!ENDIF 514021f9a66Sdrh!ENDIF 515021f9a66Sdrh!ELSE 516021f9a66SdrhCORE_CCONV_OPTS = 517021f9a66SdrhSHELL_CCONV_OPTS = 518021f9a66Sdrh!ENDIF 519021f9a66Sdrh 520021f9a66Sdrh# These are additional compiler options used for the core library. 521021f9a66Sdrh# 522021f9a66Sdrh!IFNDEF CORE_COMPILE_OPTS 523021f9a66Sdrh!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0 524021f9a66SdrhCORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport) 525021f9a66Sdrh!ELSE 526021f9a66SdrhCORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) 527021f9a66Sdrh!ENDIF 528021f9a66Sdrh!ENDIF 529021f9a66Sdrh 530021f9a66Sdrh# These are the additional targets that the core library should depend on 531021f9a66Sdrh# when linking. 532021f9a66Sdrh# 533021f9a66Sdrh!IFNDEF CORE_LINK_DEP 5349b88ace8Smistachkin!IF $(DYNAMIC_SHELL)!=0 5359b88ace8SmistachkinCORE_LINK_DEP = 5369b88ace8Smistachkin!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86" 5379aeb971cSmistachkinCORE_LINK_DEP = sqlite3.def 538021f9a66Sdrh!ELSE 539021f9a66SdrhCORE_LINK_DEP = 540021f9a66Sdrh!ENDIF 541021f9a66Sdrh!ENDIF 542021f9a66Sdrh 543021f9a66Sdrh# These are additional linker options used for the core library. 544021f9a66Sdrh# 545021f9a66Sdrh!IFNDEF CORE_LINK_OPTS 5469b88ace8Smistachkin!IF $(DYNAMIC_SHELL)!=0 5479b88ace8SmistachkinCORE_LINK_OPTS = 5489b88ace8Smistachkin!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86" 5499aeb971cSmistachkinCORE_LINK_OPTS = /DEF:sqlite3.def 550021f9a66Sdrh!ELSE 551021f9a66SdrhCORE_LINK_OPTS = 552021f9a66Sdrh!ENDIF 553021f9a66Sdrh!ENDIF 554021f9a66Sdrh 555021f9a66Sdrh# These are additional compiler options used for the shell executable. 556021f9a66Sdrh# 557021f9a66Sdrh!IFNDEF SHELL_COMPILE_OPTS 558021f9a66Sdrh!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0 559021f9a66SdrhSHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport) 560021f9a66Sdrh!ELSE 561021f9a66SdrhSHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) 562021f9a66Sdrh!ENDIF 563021f9a66Sdrh!ENDIF 564021f9a66Sdrh 565021f9a66Sdrh# This is the source code that the shell executable should be compiled 566021f9a66Sdrh# with. 567021f9a66Sdrh# 568021f9a66Sdrh!IFNDEF SHELL_CORE_SRC 569021f9a66Sdrh!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0 570021f9a66SdrhSHELL_CORE_SRC = 571021f9a66Sdrh!ELSE 572021f9a66SdrhSHELL_CORE_SRC = $(SQLITE3C) 573021f9a66Sdrh!ENDIF 574021f9a66Sdrh!ENDIF 575021f9a66Sdrh 576021f9a66Sdrh# This is the core library that the shell executable should depend on. 577021f9a66Sdrh# 578021f9a66Sdrh!IFNDEF SHELL_CORE_DEP 579021f9a66Sdrh!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0 580021f9a66SdrhSHELL_CORE_DEP = $(SQLITE3DLL) 581021f9a66Sdrh!ELSE 582021f9a66SdrhSHELL_CORE_DEP = 583021f9a66Sdrh!ENDIF 584021f9a66Sdrh!ENDIF 585021f9a66Sdrh 586cb6acda9Smistachkin 587021f9a66Sdrh# This is the core library that the shell executable should link with. 588021f9a66Sdrh# 589021f9a66Sdrh!IFNDEF SHELL_CORE_LIB 590021f9a66Sdrh!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0 591021f9a66SdrhSHELL_CORE_LIB = $(SQLITE3LIB) 592021f9a66Sdrh!ELSE 593021f9a66SdrhSHELL_CORE_LIB = 594021f9a66Sdrh!ENDIF 595021f9a66Sdrh!ENDIF 596021f9a66Sdrh 597021f9a66Sdrh# These are additional linker options used for the shell executable. 598021f9a66Sdrh# 599021f9a66Sdrh!IFNDEF SHELL_LINK_OPTS 600021f9a66SdrhSHELL_LINK_OPTS = $(SHELL_CORE_LIB) 601021f9a66Sdrh!ENDIF 602021f9a66Sdrh 603021f9a66Sdrh# Check if assembly code listings should be generated for the source 604021f9a66Sdrh# code files to be compiled. 605021f9a66Sdrh# 606021f9a66Sdrh!IF $(USE_LISTINGS)!=0 607021f9a66SdrhTCC = $(TCC) -FAcs 608021f9a66Sdrh!ENDIF 609021f9a66Sdrh 610021f9a66Sdrh# When compiling the library for use in the WinRT environment, 611021f9a66Sdrh# the following compile-time options must be used as well to 612021f9a66Sdrh# disable use of Win32 APIs that are not available and to enable 613021f9a66Sdrh# use of Win32 APIs that are specific to Windows 8 and/or WinRT. 614021f9a66Sdrh# 615021f9a66Sdrh!IF $(FOR_WINRT)!=0 616021f9a66SdrhTCC = $(TCC) -DSQLITE_OS_WINRT=1 617021f9a66SdrhRCC = $(RCC) -DSQLITE_OS_WINRT=1 618021f9a66SdrhTCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP 619021f9a66SdrhRCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP 620021f9a66Sdrh!ENDIF 621021f9a66Sdrh 622021f9a66Sdrh# C compiler options for the Windows 10 platform (needs MSVC 2015). 623021f9a66Sdrh# 624021f9a66Sdrh!IF $(FOR_WIN10)!=0 625c5286de0SmistachkinTCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE 626c5286de0SmistachkinBCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE 627021f9a66Sdrh!ENDIF 628021f9a66Sdrh 629021f9a66Sdrh# Also, we need to dynamically link to the correct MSVC runtime 630021f9a66Sdrh# when compiling for WinRT (e.g. debug or release) OR if the 631021f9a66Sdrh# USE_CRT_DLL option is set to force dynamically linking to the 632021f9a66Sdrh# MSVC runtime library. 633021f9a66Sdrh# 63455e88d96Smistachkin!IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0 635021f9a66Sdrh!IF $(DEBUG)>1 636021f9a66SdrhTCC = $(TCC) -MDd 637021f9a66SdrhBCC = $(BCC) -MDd 638021f9a66Sdrh!ELSE 639021f9a66SdrhTCC = $(TCC) -MD 640021f9a66SdrhBCC = $(BCC) -MD 641021f9a66Sdrh!ENDIF 642021f9a66Sdrh!ELSE 643021f9a66Sdrh!IF $(DEBUG)>1 644021f9a66SdrhTCC = $(TCC) -MTd 645021f9a66SdrhBCC = $(BCC) -MTd 646021f9a66Sdrh!ELSE 647021f9a66SdrhTCC = $(TCC) -MT 648021f9a66SdrhBCC = $(BCC) -MT 649021f9a66Sdrh!ENDIF 650021f9a66Sdrh!ENDIF 651021f9a66Sdrh 652021f9a66Sdrh 653021f9a66Sdrh# Define -DNDEBUG to compile without debugging (i.e., for production usage) 654021f9a66Sdrh# Omitting the define will cause extra debugging code to be inserted and 655021f9a66Sdrh# includes extra comments when "EXPLAIN stmt" is used. 656021f9a66Sdrh# 657021f9a66Sdrh!IF $(DEBUG)==0 658021f9a66SdrhTCC = $(TCC) -DNDEBUG 659021f9a66SdrhBCC = $(BCC) -DNDEBUG 660021f9a66SdrhRCC = $(RCC) -DNDEBUG 661021f9a66Sdrh!ENDIF 662021f9a66Sdrh 663021f9a66Sdrh!IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0 664021f9a66SdrhTCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1 665021f9a66SdrhRCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1 666021f9a66Sdrh!ENDIF 667021f9a66Sdrh 668021f9a66Sdrh!IF $(DEBUG)>2 669021f9a66SdrhTCC = $(TCC) -DSQLITE_DEBUG=1 670021f9a66SdrhRCC = $(RCC) -DSQLITE_DEBUG=1 671b3d3bea3Smistachkin!IF $(DYNAMIC_SHELL)==0 672b3d3bea3SmistachkinTCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE 673b3d3bea3SmistachkinRCC = $(RCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE 674b3d3bea3Smistachkin!ENDIF 675021f9a66Sdrh!ENDIF 676021f9a66Sdrh 677021f9a66Sdrh!IF $(DEBUG)>4 || $(OSTRACE)!=0 678021f9a66SdrhTCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1 679021f9a66SdrhRCC = $(RCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1 680021f9a66Sdrh!ENDIF 681021f9a66Sdrh 682021f9a66Sdrh!IF $(DEBUG)>5 683021f9a66SdrhTCC = $(TCC) -DSQLITE_ENABLE_IOTRACE=1 684021f9a66SdrhRCC = $(RCC) -DSQLITE_ENABLE_IOTRACE=1 685021f9a66Sdrh!ENDIF 686021f9a66Sdrh 687021f9a66Sdrh# Prevent warnings about "insecure" MSVC runtime library functions 688021f9a66Sdrh# being used. 689021f9a66Sdrh# 690021f9a66SdrhTCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS 691021f9a66SdrhBCC = $(BCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS 692021f9a66SdrhRCC = $(RCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS 693021f9a66Sdrh 694021f9a66Sdrh# Prevent warnings about "deprecated" POSIX functions being used. 695021f9a66Sdrh# 696021f9a66SdrhTCC = $(TCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS 697021f9a66SdrhBCC = $(BCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS 698021f9a66SdrhRCC = $(RCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS 699021f9a66Sdrh 700021f9a66Sdrh# Use the SQLite debugging heap subsystem? 701021f9a66Sdrh# 702021f9a66Sdrh!IF $(MEMDEBUG)!=0 703021f9a66SdrhTCC = $(TCC) -DSQLITE_MEMDEBUG=1 704021f9a66SdrhRCC = $(RCC) -DSQLITE_MEMDEBUG=1 705021f9a66Sdrh 706021f9a66Sdrh# Use native Win32 heap subsystem instead of malloc/free? 707021f9a66Sdrh# 708021f9a66Sdrh!ELSEIF $(WIN32HEAP)!=0 709021f9a66SdrhTCC = $(TCC) -DSQLITE_WIN32_MALLOC=1 710021f9a66SdrhRCC = $(RCC) -DSQLITE_WIN32_MALLOC=1 711021f9a66Sdrh 712021f9a66Sdrh# Validate the heap on every call into the native Win32 heap subsystem? 713021f9a66Sdrh# 714021f9a66Sdrh!IF $(DEBUG)>3 715021f9a66SdrhTCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1 716021f9a66SdrhRCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1 717021f9a66Sdrh!ENDIF 718021f9a66Sdrh!ENDIF 719021f9a66Sdrh 720021f9a66Sdrh 721021f9a66Sdrh# Compiler options needed for programs that use the readline() library. 722021f9a66Sdrh# 723021f9a66Sdrh!IFNDEF READLINE_FLAGS 724021f9a66SdrhREADLINE_FLAGS = -DHAVE_READLINE=0 725021f9a66Sdrh!ENDIF 726021f9a66Sdrh 727021f9a66Sdrh# The library that programs using readline() must link against. 728021f9a66Sdrh# 729021f9a66Sdrh!IFNDEF LIBREADLINE 730021f9a66SdrhLIBREADLINE = 731021f9a66Sdrh!ENDIF 732021f9a66Sdrh 733021f9a66Sdrh# Should the database engine be compiled threadsafe 734021f9a66Sdrh# 735021f9a66SdrhTCC = $(TCC) -DSQLITE_THREADSAFE=1 736021f9a66SdrhRCC = $(RCC) -DSQLITE_THREADSAFE=1 737021f9a66Sdrh 738021f9a66Sdrh# Do threads override each others locks by default (1), or do we test (-1) 739021f9a66Sdrh# 740021f9a66SdrhTCC = $(TCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1 741021f9a66SdrhRCC = $(RCC) -DSQLITE_THREAD_OVERRIDE_LOCK=-1 742021f9a66Sdrh 743021f9a66Sdrh# Any target libraries which libsqlite must be linked against 744021f9a66Sdrh# 745021f9a66Sdrh!IFNDEF TLIBS 746021f9a66SdrhTLIBS = 747021f9a66Sdrh!ENDIF 748021f9a66Sdrh 749021f9a66Sdrh# Flags controlling use of the in memory btree implementation 750021f9a66Sdrh# 751021f9a66Sdrh# SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to 752021f9a66Sdrh# default to file, 2 to default to memory, and 3 to force temporary 753021f9a66Sdrh# tables to always be in memory. 754021f9a66Sdrh# 755021f9a66SdrhTCC = $(TCC) -DSQLITE_TEMP_STORE=1 756021f9a66SdrhRCC = $(RCC) -DSQLITE_TEMP_STORE=1 757021f9a66Sdrh 758021f9a66Sdrh# Enable/disable loadable extensions, and other optional features 759021f9a66Sdrh# based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*). 760021f9a66Sdrh# The same set of OMIT and ENABLE flags should be passed to the 761021f9a66Sdrh# LEMON parser generator and the mkkeywordhash tool as well. 762021f9a66Sdrh 763021f9a66Sdrh# These are the required SQLite compilation options used when compiling for 764021f9a66Sdrh# the Windows platform. 765021f9a66Sdrh# 766021f9a66SdrhREQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_MAX_TRIGGER_DEPTH=100 767021f9a66Sdrh 768021f9a66Sdrh# If we are linking to the RPCRT4 library, enable features that need it. 769021f9a66Sdrh# 770021f9a66Sdrh!IF $(USE_RPCRT4_LIB)!=0 771021f9a66SdrhREQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS) -DSQLITE_WIN32_USE_UUID=1 772021f9a66Sdrh!ENDIF 773021f9a66Sdrh 774021f9a66Sdrh# Add the required and optional SQLite compilation options into the command 775021f9a66Sdrh# lines used to invoke the MSVC code and resource compilers. 776021f9a66Sdrh# 777021f9a66SdrhTCC = $(TCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) 778021f9a66SdrhRCC = $(RCC) $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) 779021f9a66Sdrh 780021f9a66Sdrh# Add in any optional parameters specified on the commane line, e.g. 781021f9a66Sdrh# nmake /f Makefile.msc all "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1" 782021f9a66Sdrh# 783021f9a66SdrhTCC = $(TCC) $(OPTS) 784021f9a66SdrhRCC = $(RCC) $(OPTS) 785021f9a66Sdrh 786021f9a66Sdrh# If compiling for debugging, add some defines. 787021f9a66Sdrh# 788021f9a66Sdrh!IF $(DEBUG)>1 789021f9a66SdrhTCC = $(TCC) -D_DEBUG 790021f9a66SdrhBCC = $(BCC) -D_DEBUG 791021f9a66SdrhRCC = $(RCC) -D_DEBUG 792021f9a66Sdrh!ENDIF 793021f9a66Sdrh 794021f9a66Sdrh# If optimizations are enabled or disabled (either implicitly or 795021f9a66Sdrh# explicitly), add the necessary flags. 796021f9a66Sdrh# 797021f9a66Sdrh!IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0 798021f9a66SdrhTCC = $(TCC) -Od 799021f9a66SdrhBCC = $(BCC) -Od 800fefe8287Smistachkin!IF $(USE_RUNTIME_CHECKS)!=0 801fefe8287SmistachkinTCC = $(TCC) -RTC1 802fefe8287SmistachkinBCC = $(BCC) -RTC1 803fefe8287Smistachkin!ENDIF 804021f9a66Sdrh!ELSEIF $(OPTIMIZATIONS)>=3 805021f9a66SdrhTCC = $(TCC) -Ox 806021f9a66SdrhBCC = $(BCC) -Ox 807021f9a66Sdrh!ELSEIF $(OPTIMIZATIONS)==2 808021f9a66SdrhTCC = $(TCC) -O2 809021f9a66SdrhBCC = $(BCC) -O2 810021f9a66Sdrh!ELSEIF $(OPTIMIZATIONS)==1 811021f9a66SdrhTCC = $(TCC) -O1 812021f9a66SdrhBCC = $(BCC) -O1 813021f9a66Sdrh!ENDIF 814021f9a66Sdrh 815021f9a66Sdrh# If symbols are enabled (or compiling for debugging), enable PDBs. 816021f9a66Sdrh# 817021f9a66Sdrh!IF $(DEBUG)>1 || $(SYMBOLS)!=0 818021f9a66SdrhTCC = $(TCC) -Zi 819021f9a66SdrhBCC = $(BCC) -Zi 820021f9a66Sdrh!ENDIF 821021f9a66Sdrh 822021f9a66Sdrh 823021f9a66Sdrh# Command line prefixes for compiling code, compiling resources, 824021f9a66Sdrh# linking, etc. 825021f9a66Sdrh# 8267ac2ee0aSmistachkinLTCOMPILE = $(TCC) -Fo$@ -Fd$*.pdb 827021f9a66SdrhLTRCOMPILE = $(RCC) -r 828021f9a66SdrhLTLIB = lib.exe 829021f9a66SdrhLTLINK = $(TCC) -Fe$@ 830021f9a66Sdrh 831021f9a66Sdrh# If requested, link to the RPCRT4 library. 832021f9a66Sdrh# 833021f9a66Sdrh!IF $(USE_RPCRT4_LIB)!=0 834041343deSmistachkinLTLIBS = $(LTLIBS) rpcrt4.lib 835021f9a66Sdrh!ENDIF 836021f9a66Sdrh 837021f9a66Sdrh# If a platform was set, force the linker to target that. 838021f9a66Sdrh# Note that the vcvars*.bat family of batch files typically 839021f9a66Sdrh# set this for you. Otherwise, the linker will attempt 840021f9a66Sdrh# to deduce the binary type based on the object files. 841021f9a66Sdrh!IFDEF PLATFORM 842021f9a66SdrhLTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM) 843021f9a66SdrhLTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM) 844b1b808b9Smistachkin!ELSEIF "$(VISUALSTUDIOVERSION)"=="12.0" || \ 845b1b808b9Smistachkin "$(VISUALSTUDIOVERSION)"=="14.0" || \ 846b1b808b9Smistachkin "$(VISUALSTUDIOVERSION)"=="15.0" 847b1b808b9SmistachkinLTLINKOPTS = /NOLOGO /MACHINE:x86 848b1b808b9SmistachkinLTLIBOPTS = /NOLOGO /MACHINE:x86 849021f9a66Sdrh!ELSE 850021f9a66SdrhLTLINKOPTS = /NOLOGO 851021f9a66SdrhLTLIBOPTS = /NOLOGO 852021f9a66Sdrh!ENDIF 853021f9a66Sdrh 854021f9a66Sdrh# When compiling for use in the WinRT environment, the following 855021f9a66Sdrh# linker option must be used to mark the executable as runnable 856021f9a66Sdrh# only in the context of an application container. 857021f9a66Sdrh# 858021f9a66Sdrh!IF $(FOR_WINRT)!=0 859021f9a66SdrhLTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER 860021f9a66Sdrh!IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0" 861021f9a66Sdrh!IFNDEF STORELIBPATH 862021f9a66Sdrh!IF "$(PLATFORM)"=="x86" 863021f9a66SdrhSTORELIBPATH = $(CRTLIBPATH)\store 864021f9a66Sdrh!ELSEIF "$(PLATFORM)"=="x64" 865021f9a66SdrhSTORELIBPATH = $(CRTLIBPATH)\store\amd64 866021f9a66Sdrh!ELSEIF "$(PLATFORM)"=="ARM" 867021f9a66SdrhSTORELIBPATH = $(CRTLIBPATH)\store\arm 868021f9a66Sdrh!ELSE 869021f9a66SdrhSTORELIBPATH = $(CRTLIBPATH)\store 870021f9a66Sdrh!ENDIF 871021f9a66Sdrh!ENDIF 872021f9a66SdrhSTORELIBPATH = $(STORELIBPATH:\\=\) 873021f9a66SdrhLTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)" 874021f9a66Sdrh!ENDIF 875021f9a66Sdrh!ENDIF 876021f9a66Sdrh 877021f9a66Sdrh# When compiling for Windows Phone 8.1, an extra library path is 878021f9a66Sdrh# required. 879021f9a66Sdrh# 880021f9a66Sdrh!IF $(USE_WP81_OPTS)!=0 881021f9a66Sdrh!IFNDEF WP81LIBPATH 882021f9a66Sdrh!IF "$(PLATFORM)"=="x86" 883021f9a66SdrhWP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86 884021f9a66Sdrh!ELSEIF "$(PLATFORM)"=="ARM" 885021f9a66SdrhWP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM 886021f9a66Sdrh!ELSE 887021f9a66SdrhWP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86 888021f9a66Sdrh!ENDIF 889021f9a66Sdrh!ENDIF 890021f9a66Sdrh!ENDIF 891021f9a66Sdrh 892021f9a66Sdrh# When compiling for Windows Phone 8.1, some extra linker options 893021f9a66Sdrh# are also required. 894021f9a66Sdrh# 895021f9a66Sdrh!IF $(USE_WP81_OPTS)!=0 896021f9a66Sdrh!IFDEF WP81LIBPATH 897021f9a66SdrhLTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)" 898021f9a66Sdrh!ENDIF 899021f9a66SdrhLTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE 900021f9a66SdrhLTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib 901021f9a66SdrhLTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib 902021f9a66Sdrh!ENDIF 903021f9a66Sdrh 904a819aed8Smistachkin# When compiling for UWP or the Windows 10 platform, some extra linker 90555e88d96Smistachkin# options are also required. 906021f9a66Sdrh# 907a819aed8Smistachkin!IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0 908021f9a66SdrhLTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib 909021f9a66SdrhLTLINKOPTS = $(LTLINKOPTS) mincore.lib 910021f9a66Sdrh!IFDEF PSDKLIBPATH 911021f9a66SdrhLTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)" 912021f9a66Sdrh!ENDIF 913021f9a66Sdrh!ENDIF 914021f9a66Sdrh 91555e88d96Smistachkin!IF $(FOR_WIN10)!=0 916c5286de0SmistachkinLTLINKOPTS = $(LTLINKOPTS) /guard:cf "/LIBPATH:$(UCRTLIBPATH)" 91755e88d96Smistachkin!IF $(DEBUG)>1 91855e88d96SmistachkinLTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib 91955e88d96Smistachkin!ELSE 92055e88d96SmistachkinLTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib 92155e88d96Smistachkin!ENDIF 92255e88d96Smistachkin!ENDIF 92355e88d96Smistachkin 924021f9a66Sdrh# If either debugging or symbols are enabled, enable PDBs. 925021f9a66Sdrh# 926021f9a66Sdrh!IF $(DEBUG)>1 || $(SYMBOLS)!=0 927021f9a66SdrhLDFLAGS = /DEBUG $(LDOPTS) 928021f9a66Sdrh!ELSE 929021f9a66SdrhLDFLAGS = $(LDOPTS) 930021f9a66Sdrh!ENDIF 931021f9a66Sdrh 932021f9a66Sdrh 933021f9a66Sdrh# You should not have to change anything below this line 934021f9a66Sdrh############################################################################### 935021f9a66Sdrh 936021f9a66Sdrh 937021f9a66Sdrh# Object files for the amalgamation. 938021f9a66Sdrh# 939021f9a66SdrhLIBOBJS1 = sqlite3.lo 940021f9a66Sdrh 941021f9a66Sdrh# Determine the real value of LIBOBJ based on the 'configure' script 942021f9a66Sdrh# 943021f9a66SdrhLIBOBJ = $(LIBOBJS1) 944021f9a66Sdrh 945021f9a66Sdrh# Determine if embedded resource compilation and usage are enabled. 946021f9a66Sdrh# 947021f9a66Sdrh!IF $(USE_RC)!=0 948021f9a66SdrhLIBRESOBJS = sqlite3res.lo 949021f9a66Sdrh!ELSE 950021f9a66SdrhLIBRESOBJS = 951021f9a66Sdrh!ENDIF 952021f9a66Sdrh 953021f9a66Sdrh 954021f9a66Sdrh# Additional compiler options for the shell. These are only effective 955021f9a66Sdrh# when the shell is not being dynamically linked. 956021f9a66Sdrh# 957021f9a66Sdrh!IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0 95890d6f480SmistachkinSHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS4=1 95990d6f480SmistachkinSHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1 96090d6f480SmistachkinSHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1 961021f9a66Sdrh!ENDIF 962021f9a66Sdrh 963021f9a66Sdrh 964021f9a66Sdrh# This is the default Makefile target. The objects listed here 965021f9a66Sdrh# are what get build when you type just "make" with no arguments. 966021f9a66Sdrh# 967b3ec2e1fSmistachkincore: dll shell 968b3ec2e1fSmistachkin 969b3ec2e1fSmistachkin# Targets that require the Tcl library. 970b3ec2e1fSmistachkin# 971b3ec2e1fSmistachkintcl: $(ALL_TCL_TARGETS) 972b3ec2e1fSmistachkin 973b3ec2e1fSmistachkin# This Makefile target builds all of the standard binaries. 974b3ec2e1fSmistachkin# 975b3ec2e1fSmistachkinall: core tcl 976021f9a66Sdrh 977021f9a66Sdrh# Dynamic link library section. 978021f9a66Sdrh# 979021f9a66Sdrhdll: $(SQLITE3DLL) 980021f9a66Sdrh 981021f9a66Sdrh# Shell executable. 982021f9a66Sdrh# 983021f9a66Sdrhshell: $(SQLITE3EXE) 984021f9a66Sdrh 985021f9a66Sdrh 986021f9a66Sdrh$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP) 987021f9a66Sdrh $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) 988021f9a66Sdrh 9899aeb971cSmistachkinReplace.exe: 9909aeb971cSmistachkin $(CSC) /target:exe $(TOP)\Replace.cs 9919aeb971cSmistachkin 9929aeb971cSmistachkinsqlite3.def: Replace.exe $(LIBOBJ) 9939aeb971cSmistachkin echo EXPORTS > sqlite3.def 9949aeb971cSmistachkin dumpbin /all $(LIBOBJ) \ 995e99cb2daSmistachkin | .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup|rebaser|rbu)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \ 9969aeb971cSmistachkin | sort >> sqlite3.def 997021f9a66Sdrh 998835cd436Smistachkin$(SQLITE3EXE): shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H) 999835cd436Smistachkin $(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) shell.c $(SHELL_CORE_SRC) \ 1000021f9a66Sdrh /link $(SQLITE3EXEPDB) $(LDFLAGS) $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS) 1001021f9a66Sdrh 1002021f9a66Sdrh 1003021f9a66Sdrh# Rule to build the amalgamation 1004021f9a66Sdrh# 1005021f9a66Sdrhsqlite3.lo: $(SQLITE3C) 1006021f9a66Sdrh $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C) 1007021f9a66Sdrh 1008021f9a66Sdrh 1009021f9a66Sdrh# Rule to build the Win32 resources object file. 1010021f9a66Sdrh# 1011021f9a66Sdrh!IF $(USE_RC)!=0 1012021f9a66Sdrh_HASHCHAR=^# 1013021f9a66Sdrh!IF ![echo !IFNDEF VERSION > rcver.vc] && \ 1014ea78f64dSmistachkin ![for /F "delims=" %V in ('type "$(SQLITE3H)" ^| "%SystemRoot%\System32\find.exe" "$(_HASHCHAR)define SQLITE_VERSION "') do (echo VERSION = ^^%V >> rcver.vc)] && \ 1015021f9a66Sdrh ![echo !ENDIF >> rcver.vc] 1016021f9a66Sdrh!INCLUDE rcver.vc 1017021f9a66Sdrh!ENDIF 1018021f9a66Sdrh 1019021f9a66SdrhRESOURCE_VERSION = $(VERSION:^#=) 1020021f9a66SdrhRESOURCE_VERSION = $(RESOURCE_VERSION:define=) 1021021f9a66SdrhRESOURCE_VERSION = $(RESOURCE_VERSION:SQLITE_VERSION=) 1022021f9a66SdrhRESOURCE_VERSION = $(RESOURCE_VERSION:"=) 1023021f9a66SdrhRESOURCE_VERSION = $(RESOURCE_VERSION:.=,) 1024021f9a66Sdrh 1025021f9a66Sdrh$(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H) 1026021f9a66Sdrh echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h 1027021f9a66Sdrh echo #define SQLITE_RESOURCE_VERSION $(RESOURCE_VERSION) >> sqlite3rc.h 1028021f9a66Sdrh echo #endif >> sqlite3rc.h 1029021f9a66Sdrh $(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc 1030021f9a66Sdrh!ENDIF 1031021f9a66Sdrh 1032021f9a66Sdrh 1033021f9a66Sdrhclean: 1034021f9a66Sdrh del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL 103556362a5aSmistachkin del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL 1036fe41a98fSmistachkin del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL 1037