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