sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
sqlite / main.mk
| 1 | #!/do/not/make |
| 2 | # ^^^^ help out editors which guess this file's type. |
| 3 | ############################################################################### |
| 4 | # This is the main makefile for sqlite. It expects to be included from |
| 5 | # a higher-level makefile which configures any dynamic state needed by |
| 6 | # this one (as documented below). |
| 7 | # |
| 8 | # Maintenance reminders: |
| 9 | # |
| 10 | # - This file must remain devoid of GNU Make-isms. i.e. it must be |
| 11 | # POSIX Make compatible. "bmake" (BSD make) is available on most |
| 12 | # Linux systems, so compatibility is relatively easy to test. As a |
| 13 | # harmless exception, this file sometimes uses $(MAKEFILE_LIST) as a |
| 14 | # dependency. That var, in GNU Make, holds a list of all of the |
| 15 | # makefiles currently loaded. |
| 16 | # |
| 17 | # The variables listed below must be defined before this script is |
| 18 | # invoked. This file will use defaults, very possibly invalid, for any |
| 19 | # which are not defined. |
| 20 | ######################################################################## |
| 21 | all: |
| 22 | # |
| 23 | # $(TOP) = |
| 24 | # |
| 25 | # The top-level directory of the source tree. For canonical builds |
| 26 | # this is the directory that contains this "Makefile.in" and the |
| 27 | # "auto.def" script. For out-of-tree builds, this will differ from |
| 28 | # $(PWD). |
| 29 | # |
| 30 | TOP ?= $(PWD) |
| 31 | # |
| 32 | # $(PACKAGE_VERSION) = |
| 33 | # |
| 34 | # The MAJOR.MINOR.PATCH version number of this build. |
| 35 | # |
| 36 | PACKAGE_VERSION ?= |
| 37 | # |
| 38 | # $(B.cc) = |
| 39 | # |
| 40 | # C Compiler and options for use in building executables that will run |
| 41 | # on the platform that is doing the build. |
| 42 | # |
| 43 | B.cc ?= $(CC) |
| 44 | # |
| 45 | # $(T.cc) = |
| 46 | # |
| 47 | # C Compiler and options for use in building executables that will run |
| 48 | # on the target platform. This is usually the same as B.cc, unless |
| 49 | # you are cross-compiling. It should only contain flags which are used |
| 50 | # by _all_ build targets. Flags needed only by specific targets are |
| 51 | # defined elsewhere and applied on a per-target basis. |
| 52 | # |
| 53 | T.cc ?= $(B.cc) |
| 54 | # |
| 55 | # $(AR) = |
| 56 | # |
| 57 | # Tool used to build a static library from object files, without its |
| 58 | # arguments. $(AR.flags) are its flags for creating a lib. |
| 59 | # |
| 60 | AR ?= ar |
| 61 | AR.flags ?= cr |
| 62 | # |
| 63 | # $(B.exe) = |
| 64 | # |
| 65 | # File extension for executables on the build platform:. .exe for |
| 66 | # Windows and empty everywhere else. |
| 67 | # |
| 68 | B.exe ?= |
| 69 | # |
| 70 | # $(B.dll) and $(B.lib) = |
| 71 | # |
| 72 | # The DLL resp. static library counterparts of $(B.exe). |
| 73 | # |
| 74 | B.dll ?= .so |
| 75 | B.lib ?= .a |
| 76 | # |
| 77 | # $(T.exe) = |
| 78 | # |
| 79 | # File extension for executables on the target platform: .exe for |
| 80 | # Windows and empty everywhere else. |
| 81 | # |
| 82 | T.exe ?= $(B.exe) |
| 83 | # |
| 84 | # $(T.dll) and $(T.lib) = |
| 85 | # |
| 86 | # The DLL resp. static library counterparts of $(T.exe). |
| 87 | # |
| 88 | T.dll ?= $(B.dll) |
| 89 | T.lib ?= $(B.lib) |
| 90 | # |
| 91 | # HAVE_TCL = 1 to enable full tcl support, else 0. |
| 92 | # |
| 93 | HAVE_TCL ?= 0 |
| 94 | # |
| 95 | # $(TCLSH_CMD) = |
| 96 | # |
| 97 | # The canonical tclsh. |
| 98 | # |
| 99 | TCLSH_CMD ?= tclsh |
| 100 | # |
| 101 | # JimTCL is part of the autosetup suite and is suitable for all |
| 102 | # current in-tree code-generation TCL jobs, but it requires that we |
| 103 | # build it with non-default flags. The canonical build tree will, if |
| 104 | # no system-level tclsh is found, also have a ./jimsh0 binary. That |
| 105 | # one is a bare-bones build for the configure process, whereas we need |
| 106 | # to build it with another option enabled for use with the various |
| 107 | # code generators. |
| 108 | # |
| 109 | # JIMSH requires a leading path component, even if it's ./, so that it |
| 110 | # can be used as a shell command. |
| 111 | # |
| 112 | # On Windows platforms, if -DHAVE_REALPATH does not work then try |
| 113 | # -DHAVE__FULLPATH (note the double-underscore). |
| 114 | # |
| 115 | CFLAGS.jimsh ?= -DHAVE_REALPATH |
| 116 | JIMSH ?= ./jimsh$(T.exe) |
| 117 | # |
| 118 | # $(B.tclsh) = |
| 119 | # |
| 120 | # The TCL interpreter for in-tree code generation. May be either the |
| 121 | # in-tree JimTCL ($(JIMSH)) or the canonical TCL ($(TCLSH_CMD)). If |
| 122 | # it's JimTCL, it must be compiled with -DHAVE_REALPATH (Unix) or |
| 123 | # -DHAVE__FULLPATH (Windows) so that the Tcl function [file normalize] |
| 124 | # can work. |
| 125 | # |
| 126 | B.tclsh ?= $(JIMSH) |
| 127 | |
| 128 | # |
| 129 | # Autotools-conventional vars which are (in this tree) used only by |
| 130 | # package installation rules and for generating sqlite3.pc (pkg-config |
| 131 | # data file). |
| 132 | # |
| 133 | # The following ${XYZdir} vars are provided for the sake of clients |
| 134 | # who expect to be able to override these using autotools-conventional |
| 135 | # dir name vars. |
| 136 | # |
| 137 | prefix ?= /usr/local |
| 138 | datadir ?= $(prefix)/share |
| 139 | mandir ?= $(datadir)/man |
| 140 | includedir ?= $(prefix)/include |
| 141 | exec_prefix ?= $(prefix) |
| 142 | bindir ?= $(exec_prefix)/bin |
| 143 | libdir ?= $(exec_prefix)/lib |
| 144 | # This makefile does not use any of: |
| 145 | # sbindir ?= $(exec_prefix)/sbin |
| 146 | # sysconfdir ?= /etc |
| 147 | # sharedstatedir ?= $(prefix)/com |
| 148 | # localstatedir ?= /var |
| 149 | # runstatedir ?= /run |
| 150 | # infodir ?= $(datadir)/info |
| 151 | # libexecdir ?= $(exec_prefix)/libexec |
| 152 | ### end of autotools-compatible install dir vars |
| 153 | |
| 154 | |
| 155 | # |
| 156 | # $(LDFLAGS.{feature}) and $(CFLAGS.{feature}) = |
| 157 | # |
| 158 | # Linker resp. C/CPP flags required by a specific feature, e.g. |
| 159 | # $(LDFLAGS.pthread) or $(CFLAGS.readline). |
| 160 | # |
| 161 | # Rather that stuffing all CFLAGS and LDFLAGS into a single set, we |
| 162 | # break them down on a per-feature basis and expect the build targets |
| 163 | # to use the one(s) it needs. |
| 164 | # |
| 165 | LDFLAGS.zlib ?= -lz |
| 166 | LDFLAGS.math ?= -lm |
| 167 | LDFLAGS.rpath ?= -Wl,-rpath -Wl,$(prefix)/lib |
| 168 | LDFLAGS.pthread ?= -lpthread |
| 169 | LDFLAGS.dlopen ?= -ldl |
| 170 | LDFLAGS.shlib ?= -shared |
| 171 | LDFLAGS.rt ?= # nanosleep on some platforms |
| 172 | LDFLAGS.icu ?= # -licui18n -licuuc -licudata |
| 173 | CFLAGS.icu ?= |
| 174 | LDFLAGS.libsqlite3.soname ?= # see https://sqlite.org/src/forumpost/5a3b44f510df8ded |
| 175 | LDFLAGS.libsqlite3.os-specific ?= # see https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7 |
| 176 | # libreadline (or a workalike): |
| 177 | # To activate readline in the shell: SHELL_OPT = -DHAVE_READLINE=1 |
| 178 | LDFLAGS.readline ?= -lreadline # these vary across platforms |
| 179 | CFLAGS.readline ?= -I$(prefix)/include |
| 180 | # ^^^ When using linenoise instead of readline, do something like: |
| 181 | # SHELL_OPT += -DHAVE_LINENOISE=1 |
| 182 | # CFLAGS.readline = -I$(HOME)/linenoise $(HOME)/linenoise/linenoise.c |
| 183 | # LDFLAGS.readline = # empty |
| 184 | |
| 185 | # |
| 186 | # |
| 187 | # $(INSTALL) = |
| 188 | # |
| 189 | # Tool for installing files and directories. It must be compatible |
| 190 | # with conventional Unix /usr/bin/install. libtool's install-sh is |
| 191 | # _not_ compatible with this because it _moves_ targets during |
| 192 | # installation, which may break the build of targets which are built |
| 193 | # after others are installed. |
| 194 | # |
| 195 | # Maintenance reminder: we specifically do not strip binaries, as |
| 196 | # discussed in https://sqlite.org/forum/forumpost/9a67df63eda9925c. |
| 197 | # |
| 198 | INSTALL ?= install |
| 199 | # |
| 200 | # $(ENABLE_LIB_SHARED) = |
| 201 | # |
| 202 | # 1 if libsqlite3$(T.dll) should be built. |
| 203 | # |
| 204 | ENABLE_LIB_SHARED ?= 1 |
| 205 | # |
| 206 | # $(ENABLE_LIB_STATIC) = |
| 207 | # |
| 208 | # 1 if libsqlite3$(T.lib) should be built. Some components, |
| 209 | # e.g. libtclsqlite3 and some test apps, implicitly require the static |
| 210 | # library and will ignore this preference. |
| 211 | # |
| 212 | ENABLE_LIB_STATIC ?= 1 |
| 213 | # |
| 214 | # $(USE_AMALGAMATION) |
| 215 | # |
| 216 | # 1 if the amalgamation (sqlite3.c/h) should be built/used, otherwise |
| 217 | # the library is built from all of its original source files. |
| 218 | # Certain tools, like sqlite3$(T.exe), require the amalgamation and |
| 219 | # will ignore this preference. |
| 220 | # |
| 221 | USE_AMALGAMATION ?= 1 |
| 222 | # |
| 223 | # $(LINK_TOOLS_DYNAMICALLY) |
| 224 | # |
| 225 | # If 1, certain binaries which typically statically link against |
| 226 | # libsqlite3 or its component object files will instead link against |
| 227 | # the DLL. The caveat is that running such builds from the source tree |
| 228 | # may require that the user specifically prepend "." to their |
| 229 | # $LD_LIBRARY_PATH so that the dynamic linker does not pick up a |
| 230 | # libsqlite3.so from outside the source tree. Alternately, symlinking |
| 231 | # the in-build-tree $(libsqlite3.DLL) to some dir in the system's |
| 232 | # library path will work for giving the apps access to the in-tree |
| 233 | # DLL. |
| 234 | # |
| 235 | LINK_TOOLS_DYNAMICALLY ?= 0 |
| 236 | # |
| 237 | # $(AMALGAMATION_GEN_FLAGS) = |
| 238 | # |
| 239 | # Optional flags for the amalgamation generator. |
| 240 | # |
| 241 | AMALGAMATION_GEN_FLAGS ?= --linemacros=0 |
| 242 | # |
| 243 | # EXTRA_SRC = list of C files to append as-is to the generated |
| 244 | # amalgamation. It should arguably be called AMALGAMATION_EXTRA_SRC |
| 245 | # but this older name is already in use by clients. |
| 246 | # |
| 247 | EXTRA_SRC ?= |
| 248 | |
| 249 | # |
| 250 | # $(OPT_FEATURE_FLAGS) = |
| 251 | # |
| 252 | # Preprocessor flags for enabling and disabling specific libsqlite3 |
| 253 | # features (-DSQLITE_OMIT*, -DSQLITE_ENABLE*). The same set of OMIT |
| 254 | # and ENABLE flags must be passed to the LEMON parser generator and |
| 255 | # the mkkeywordhash tool as well. This is normally set by the |
| 256 | # configure process, and passing a custom value to a |
| 257 | # configure-filtered Makefile may not work. |
| 258 | # |
| 259 | # When using the canonical makefile, add $(OPTIONS)=... on the make |
| 260 | # command line to append additional options to the |
| 261 | # $(OPT_FEATURE_FLAGS). Some flags, because they influence generation |
| 262 | # of the SQL parser, only work if the build is specifically configured |
| 263 | # to account for them. Adding them later, when compiling the |
| 264 | # amalgamation separately, may or may not work. |
| 265 | # |
| 266 | # $(OPTS)=... is another way of influencing C compilation. It is |
| 267 | # distinctly separate from $(OPTIONS) and $(OPT_FEATURE_FLAGS) but, |
| 268 | # like those, $(OPTS) applies to all invocations of $(T.cc) (and some |
| 269 | # invocations of $(B.cc)). The configure process does not set either |
| 270 | # of $(OPTIONS) or $(OPTS). |
| 271 | # |
| 272 | # The difference between $(OPT_FEATURE_FLAGS) and $(OPTS) is that the |
| 273 | # former is historically provided by the configure script, whereas |
| 274 | # $(OPTS) is intended to be provided as an argument to the make |
| 275 | # invocation. |
| 276 | # |
| 277 | OPT_FEATURE_FLAGS ?= |
| 278 | # |
| 279 | # $(SHELL_OPT) = |
| 280 | # |
| 281 | # CFLAGS specific to the sqlite3 CLI shell app and its close cousins. |
| 282 | # |
| 283 | SHELL_OPT ?= |
| 284 | # |
| 285 | # TCL_CONFIG_SH must, for some of the build targets, refer to a valid |
| 286 | # tclConfig.sh. That script will be used to populate most of the other |
| 287 | # TCL-related vars the build needs. The core library does not require |
| 288 | # TCL, but TCL is needed for running tests and certain tools, e.g. |
| 289 | # sqlite3_analyzer. |
| 290 | # |
| 291 | TCL_CONFIG_SH ?= |
| 292 | # |
| 293 | # $(HAVE_WASI_SDK) = |
| 294 | # |
| 295 | # Set to 1 when building with the WASI SDK. This disables certain |
| 296 | # build targets. It is expected that the invoker sets $(CC), $(LD), |
| 297 | # and $(AR) to their counterparts from the wasi-sdk. |
| 298 | # |
| 299 | HAVE_WASI_SDK ?= 0 |
| 300 | # |
| 301 | # $(ENABLE_RPATH) tells libtclsqlite3 whether to use an -rpath |
| 302 | # flag. By default it does for historical compatibility. In the |
| 303 | # canonical build configure --disable-rpath disables the use of rpath. |
| 304 | # |
| 305 | ENABLE_RPATH ?= 1 |
| 306 | |
| 307 | # |
| 308 | # ... and many, many more. Sane defaults are selected where possible. |
| 309 | # |
| 310 | # With the above-described defined, the rest of this make script will |
| 311 | # build the project's deliverables and testing tools. |
| 312 | ################################################################################ |
| 313 | all: sqlite3.h sqlite3.c |
| 314 | |
| 315 | ######################################################################## |
| 316 | ######################################################################## |
| 317 | # Modifying anything after this point should not be necessary for most |
| 318 | # builds. |
| 319 | ######################################################################## |
| 320 | ######################################################################## |
| 321 | |
| 322 | # |
| 323 | # $(CFLAGS.env) holds the any $(CFLAGS) provided at configure- or |
| 324 | # make-time (the latter overriding the former). |
| 325 | # |
| 326 | # $(CFLAGS) should ideally only contain flags which are relevant for |
| 327 | # all binaries built for the target platform. However, many people |
| 328 | # like to pass it to "make" without realizing that it applies to |
| 329 | # dozens of deliverables, and they override core flags (like -fPIC) |
| 330 | # when doing so. To help work around that, we expect all core-most |
| 331 | # CFLAGS, e.g. -fPIC, to be set in $(CFLAGS.core). That enables people |
| 332 | # to pass their other CFLAGS without triggering, e.g., "recompile with |
| 333 | # -fPIC" errors. |
| 334 | # |
| 335 | # Historical note: the pre-3.48 build does not honor CPPFLAGS passed |
| 336 | # to make, so we do not do so here. Both the legacy and 3.48+ builds |
| 337 | # support CPPFLAGS passed at configure-time, and combines them with |
| 338 | # the configure-time CFLAGS. |
| 339 | # |
| 340 | CFLAGS.core ?= |
| 341 | CFLAGS.env = $(CFLAGS) |
| 342 | T.cc += $(CFLAGS.core) $(CFLAGS.env) |
| 343 | T.cc += $(OPT_FEATURE_FLAGS) $(OPTS) |
| 344 | |
| 345 | # |
| 346 | # $(LDFLAGS.configure) represents any LDFLAGS=... the client passes to |
| 347 | # the configure process. The historical build enabled passing-on of |
| 348 | # user-provided LDFLAGS at configure-time but not make-time. That |
| 349 | # behavior is not possible to fully emulate here because this makefile |
| 350 | # is not filtered by the configure script, so we instead |
| 351 | # "soft-enforce" it by using a level of indirection, which clients who |
| 352 | # read this can (but are not advised to!) bypass by passing |
| 353 | # LDFLAGS.configure=... to this makefile. (We do not guaranty this |
| 354 | # variable name to be stable, so do not rely on that capability!) |
| 355 | # |
| 356 | # A significant difference from the legacy build: |
| 357 | # |
| 358 | # The legacy build applied such LDFLAGS to all link operations for all |
| 359 | # deliverables. The 3.48+ build applies them (as of this writing) more |
| 360 | # selectively: search this file LDFLAGS.configure to see where they're |
| 361 | # set. |
| 362 | # |
| 363 | LDFLAGS.configure ?= |
| 364 | |
| 365 | # |
| 366 | # $(INSTALL) invocation for use with non-executable files. |
| 367 | # |
| 368 | INSTALL.noexec = $(INSTALL) -m 0644 |
| 369 | # ^^^ do not use GNU-specific flags to $(INSTALL), e.g. --mode=... |
| 370 | |
| 371 | # |
| 372 | # T.compile.gcov = gcov-specific compilation flags for the target |
| 373 | # platform. |
| 374 | # |
| 375 | T.compile.gcov ?= |
| 376 | # |
| 377 | # T.link.gcov = gcov-specific link flags for the target platform. |
| 378 | # |
| 379 | T.link.gcov ?= |
| 380 | |
| 381 | # |
| 382 | # $(T.compile) = generic target platform compiler invocation, |
| 383 | # differing only from $(T.cc) in that it appends $(T.compile.gcov), |
| 384 | # which is intended for use with gcov-related flags. |
| 385 | # |
| 386 | T.compile = $(T.cc) $(T.compile.gcov) |
| 387 | |
| 388 | # |
| 389 | # Extra CFLAGS for both the core sqlite3 components and extensions. |
| 390 | # |
| 391 | # Define -D_HAVE_SQLITE_CONFIG_H so that the code knows it |
| 392 | # can include the generated sqlite_cfg.h. |
| 393 | # |
| 394 | T.cc.sqlite.extras = -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite |
| 395 | |
| 396 | # |
| 397 | # $(T.cc.sqlite) is $(T.cc) plus any flags which are desired for the |
| 398 | # library as a whole, but not necessarily needed for every binary. It |
| 399 | # will normally get initially populated with flags by the |
| 400 | # configure-generated makefile. |
| 401 | # |
| 402 | T.cc.sqlite ?= $(T.compile) $(T.cc.sqlite.extras) |
| 403 | |
| 404 | # |
| 405 | # $(CFLAGS.intree_includes) = -I... flags relevant specifically to |
| 406 | # this tree, including any subdirectories commonly needed for building |
| 407 | # various tools. |
| 408 | # |
| 409 | CFLAGS.intree_includes = \ |
| 410 | -I. -I$(TOP)/src -I$(TOP)/ext/rtree -I$(TOP)/ext/icu \ |
| 411 | -I$(TOP)/ext/fts3 -I$(TOP)/ext/session \ |
| 412 | -I$(TOP)/ext/misc |
| 413 | T.cc.sqlite += $(CFLAGS.intree_includes) |
| 414 | |
| 415 | # |
| 416 | # $(T.cc.extension) = compiler invocation for loadable extensions. |
| 417 | # |
| 418 | T.cc.extension = $(T.compile) -I. -I$(TOP)/src $(T.cc.sqlite.extras) -DSQLITE_CORE |
| 419 | |
| 420 | # |
| 421 | # $(T.link) = compiler invocation for when the target will be an |
| 422 | # executable for the target platform. |
| 423 | # |
| 424 | # $(T.link.gcov) = optional config-specific flags for $(T.link), |
| 425 | # intended for use with gcov-related flags. |
| 426 | # |
| 427 | T.link = $(T.cc.sqlite) $(T.link.gcov) |
| 428 | # |
| 429 | # $(T.link.shared) = $(T.link) invocation specifically for shared libraries |
| 430 | # |
| 431 | T.link.shared = $(T.link) $(LDFLAGS.shlib) |
| 432 | |
| 433 | # |
| 434 | # $(LDFLAGS.libsqlite3) should be used with any deliverable for which |
| 435 | # any of the following apply: |
| 436 | # |
| 437 | # - Results in building libsqlite3.so |
| 438 | # - Compiles sqlite3.c in to an application |
| 439 | # - Links with libsqlite3.a |
| 440 | # - Links in either of $(LIBOBJSO) or $(LIBOBJS1) |
| 441 | # |
| 442 | # These flags are for the target build platform, not necessarily |
| 443 | # localhost. i.e. it should be used with $(T.cc.sqlite) or $(T.link) |
| 444 | # but not $(B.cc). |
| 445 | # |
| 446 | LDFLAGS.libsqlite3 = \ |
| 447 | $(LDFLAGS.rpath) $(LDFLAGS.pthread) \ |
| 448 | $(LDFLAGS.math) $(LDFLAGS.dlopen) \ |
| 449 | $(LDFLAGS.zlib) $(LDFLAGS.icu) \ |
| 450 | $(LDFLAGS.rt) $(LDFLAGS.configure) |
| 451 | |
| 452 | # |
| 453 | # $(install-dir.XYZ) = dirs for installation. |
| 454 | # |
| 455 | # Design note: these should arguably all be defined with surrounding |
| 456 | # double-quotes so that targets which have spaces in their paths will |
| 457 | # work, but that leads to Make treating the quotes as part of the dir |
| 458 | # name, which in turn leads to it never finding a matching name in the |
| 459 | # filesystem and always invoking ($(INSTALL) -d ...) for them. The |
| 460 | # moral of this story is that spaces in installation paths will break |
| 461 | # the install process. |
| 462 | # |
| 463 | install-dir.bin = $(DESTDIR)$(bindir) |
| 464 | install-dir.lib = $(DESTDIR)$(libdir) |
| 465 | install-dir.include = $(DESTDIR)$(includedir) |
| 466 | install-dir.pkgconfig = $(DESTDIR)$(libdir)/pkgconfig |
| 467 | install-dir.man1 = $(DESTDIR)$(mandir)/man1 |
| 468 | install-dir.all = $(install-dir.bin) $(install-dir.include) \ |
| 469 | $(install-dir.lib) $(install-dir.man1) \ |
| 470 | $(install-dir.pkgconfig) |
| 471 | $(install-dir.all): |
| 472 | @if [ ! -d "$@" ]; then set -x; $(INSTALL) -d "$@"; fi |
| 473 | # ^^^^ on some platforms, install -d fails if the target already exists. |
| 474 | |
| 475 | # |
| 476 | # After jimsh is compiled, we run some sanity checks to ensure that |
| 477 | # it was built in a way compatible with this project's scripts: |
| 478 | # |
| 479 | # 1) Ensure that it was built with realpath() or _fullpath() support. |
| 480 | # Without that flag the [file normalize] command will always resolve |
| 481 | # to an empty string. |
| 482 | # |
| 483 | # 2) Ensure that it is built with -DJIM_COMPAT (which may be |
| 484 | # hard-coded into jimsh0.c). Without this, the [expr] command accepts |
| 485 | # only a single argument. (That said: the real fix for that is to |
| 486 | # update any scripts which still pass multiple arguments to [expr].) |
| 487 | # |
| 488 | $(JIMSH): $(TOP)/autosetup/jimsh0.c |
| 489 | $(B.cc) -o $@ $(CFLAGS.jimsh) $(TOP)/autosetup/jimsh0.c |
| 490 | @if [ x = "x$$($(JIMSH) -e 'file normalize $(JIMSH)' 2>/dev/null)" ]; then \ |
| 491 | echo "$(JIMSH) was built without -DHAVE_REALPATH or -DHAVE__FULLPATH." 1>&2; \ |
| 492 | exit 1; \ |
| 493 | fi |
| 494 | @if [ x3 != "x$$($(JIMSH) -e 'expr 1 + 2' 2>/dev/null)" ]; then \ |
| 495 | echo "$(JIMSH) was built without -DJIM_COMPAT." 1>&2; \ |
| 496 | exit 1; \ |
| 497 | fi |
| 498 | distclean-jimsh: |
| 499 | rm -f $(JIMSH) |
| 500 | distclean: distclean-jimsh |
| 501 | |
| 502 | # |
| 503 | # $(MAKE_SANITY_CHECK) = a set of checks for various make vars which |
| 504 | # must be provided to this file before including it. If any are |
| 505 | # missing, this target fails. It does (almost) no semantic validation, |
| 506 | # only checks to see that appropriate vars are not empty. |
| 507 | # |
| 508 | # The dependency on $(MAKEFILE_LIST) is a GNU-make-ism but its use is |
| 509 | # harmless in other flavors of Make. |
| 510 | # |
| 511 | MAKE_SANITY_CHECK = .main.mk.checks |
| 512 | $(MAKE_SANITY_CHECK): $(MAKEFILE_LIST) $(TOP)/auto.def |
| 513 | @if [ x = "x$(TOP)" ]; then echo "Missing TOP var" 1>&2; exit 1; fi |
| 514 | @if [ ! -d "$(TOP)" ]; then echo "$(TOP) is not a directory" 1>&2; exit 1; fi |
| 515 | @if [ ! -f "$(TOP)/auto.def" ]; then echo "$(TOP) does not appear to be the top-most source dir" 1>&2; exit 1; fi |
| 516 | @if [ x = "x$(PACKAGE_VERSION)" ]; then echo "PACKAGE_VERSION must be set to the library's X.Y.Z-format version number" 1>&2; exit 1; fi |
| 517 | @if [ x = "x$(B.cc)" ]; then echo "Missing B.cc var" 1>&2; exit 1; fi |
| 518 | @if [ x = "x$(T.cc)" ]; then echo "Missing T.cc var" 1>&2; exit 1; fi |
| 519 | @if [ x = "x$(B.tclsh)" ]; then echo "Missing B.tclsh var" 1>&2; exit 1; fi |
| 520 | @if [ x = "x$(AR)" ]; then echo "Missing AR var" 1>&2; exit 1; fi |
| 521 | touch $@ |
| 522 | clean-sanity-check: |
| 523 | rm -f $(MAKE_SANITY_CHECK) |
| 524 | clean: clean-sanity-check |
| 525 | |
| 526 | # |
| 527 | # Object files for the SQLite library (non-amalgamation). |
| 528 | # |
| 529 | LIBOBJS0 = alter.o analyze.o attach.o auth.o \ |
| 530 | backup.o bitvec.o btmutex.o btree.o build.o \ |
| 531 | callback.o carray.o complete.o ctime.o \ |
| 532 | date.o dbpage.o dbstat.o delete.o \ |
| 533 | expr.o fault.o fkey.o \ |
| 534 | fts3.o fts3_aux.o fts3_expr.o fts3_hash.o fts3_icu.o \ |
| 535 | fts3_porter.o fts3_snippet.o fts3_tokenizer.o fts3_tokenizer1.o \ |
| 536 | fts3_tokenize_vtab.o \ |
| 537 | fts3_unicode.o fts3_unicode2.o fts3_write.o \ |
| 538 | fts5.o \ |
| 539 | func.o global.o hash.o \ |
| 540 | icu.o insert.o json.o legacy.o loadext.o \ |
| 541 | main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \ |
| 542 | memdb.o memjournal.o \ |
| 543 | mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \ |
| 544 | notify.o opcodes.o os.o os_kv.o os_unix.o os_win.o \ |
| 545 | pager.o parse.o pcache.o pcache1.o pragma.o prepare.o printf.o \ |
| 546 | random.o resolve.o rowset.o rtree.o \ |
| 547 | sqlite3session.o select.o sqlite3rbu.o status.o stmt.o \ |
| 548 | table.o threads.o tokenize.o treeview.o trigger.o \ |
| 549 | update.o upsert.o utf.o util.o vacuum.o \ |
| 550 | vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \ |
| 551 | vdbetrace.o vdbevtab.o vtab.o \ |
| 552 | wal.o walker.o where.o wherecode.o whereexpr.o \ |
| 553 | window.o |
| 554 | LIBOBJS = $(LIBOBJS0) |
| 555 | |
| 556 | # |
| 557 | # Object files for the amalgamation. |
| 558 | # |
| 559 | LIBOBJS1 = sqlite3.o |
| 560 | |
| 561 | # |
| 562 | # Determine the real value of LIBOBJ based on whether the amalgamation |
| 563 | # is enabled or not. |
| 564 | # |
| 565 | LIBOBJ = $(LIBOBJS$(USE_AMALGAMATION)) |
| 566 | $(LIBOBJ): $(MAKE_SANITY_CHECK) |
| 567 | |
| 568 | # |
| 569 | # All of the source code files. |
| 570 | # |
| 571 | SRC = \ |
| 572 | $(TOP)/src/alter.c \ |
| 573 | $(TOP)/src/analyze.c \ |
| 574 | $(TOP)/src/attach.c \ |
| 575 | $(TOP)/src/auth.c \ |
| 576 | $(TOP)/src/backup.c \ |
| 577 | $(TOP)/src/bitvec.c \ |
| 578 | $(TOP)/src/btmutex.c \ |
| 579 | $(TOP)/src/btree.c \ |
| 580 | $(TOP)/src/btree.h \ |
| 581 | $(TOP)/src/btreeInt.h \ |
| 582 | $(TOP)/src/build.c \ |
| 583 | $(TOP)/src/callback.c \ |
| 584 | $(TOP)/src/carray.c \ |
| 585 | $(TOP)/src/complete.c \ |
| 586 | ctime.c \ |
| 587 | $(TOP)/src/date.c \ |
| 588 | $(TOP)/src/dbpage.c \ |
| 589 | $(TOP)/src/dbstat.c \ |
| 590 | $(TOP)/src/delete.c \ |
| 591 | $(TOP)/src/expr.c \ |
| 592 | $(TOP)/src/fault.c \ |
| 593 | $(TOP)/src/fkey.c \ |
| 594 | $(TOP)/src/func.c \ |
| 595 | $(TOP)/src/global.c \ |
| 596 | $(TOP)/src/hash.c \ |
| 597 | $(TOP)/src/hash.h \ |
| 598 | $(TOP)/src/hwtime.h \ |
| 599 | $(TOP)/src/insert.c \ |
| 600 | $(TOP)/src/json.c \ |
| 601 | $(TOP)/src/legacy.c \ |
| 602 | $(TOP)/src/loadext.c \ |
| 603 | $(TOP)/src/main.c \ |
| 604 | $(TOP)/src/malloc.c \ |
| 605 | $(TOP)/src/mem0.c \ |
| 606 | $(TOP)/src/mem1.c \ |
| 607 | $(TOP)/src/mem2.c \ |
| 608 | $(TOP)/src/mem3.c \ |
| 609 | $(TOP)/src/mem5.c \ |
| 610 | $(TOP)/src/memdb.c \ |
| 611 | $(TOP)/src/memjournal.c \ |
| 612 | $(TOP)/src/msvc.h \ |
| 613 | $(TOP)/src/mutex.c \ |
| 614 | $(TOP)/src/mutex.h \ |
| 615 | $(TOP)/src/mutex_noop.c \ |
| 616 | $(TOP)/src/mutex_unix.c \ |
| 617 | $(TOP)/src/mutex_w32.c \ |
| 618 | $(TOP)/src/notify.c \ |
| 619 | $(TOP)/src/os.c \ |
| 620 | $(TOP)/src/os.h \ |
| 621 | $(TOP)/src/os_common.h \ |
| 622 | $(TOP)/src/os_setup.h \ |
| 623 | $(TOP)/src/os_kv.c \ |
| 624 | $(TOP)/src/os_unix.c \ |
| 625 | $(TOP)/src/os_win.c \ |
| 626 | $(TOP)/src/os_win.h \ |
| 627 | $(TOP)/src/pager.c \ |
| 628 | $(TOP)/src/pager.h \ |
| 629 | $(TOP)/src/parse.y \ |
| 630 | $(TOP)/src/pcache.c \ |
| 631 | $(TOP)/src/pcache.h \ |
| 632 | $(TOP)/src/pcache1.c \ |
| 633 | $(TOP)/src/pragma.c \ |
| 634 | pragma.h \ |
| 635 | $(TOP)/src/prepare.c \ |
| 636 | $(TOP)/src/printf.c \ |
| 637 | $(TOP)/src/random.c \ |
| 638 | $(TOP)/src/resolve.c \ |
| 639 | $(TOP)/src/rowset.c \ |
| 640 | $(TOP)/src/select.c \ |
| 641 | $(TOP)/src/status.c \ |
| 642 | $(TOP)/src/shell.c.in \ |
| 643 | $(TOP)/src/sqlite.h.in \ |
| 644 | $(TOP)/src/sqlite3ext.h \ |
| 645 | $(TOP)/src/sqliteInt.h \ |
| 646 | $(TOP)/src/sqliteLimit.h \ |
| 647 | $(TOP)/src/table.c \ |
| 648 | tclsqlite-ex.c \ |
| 649 | $(TOP)/src/threads.c \ |
| 650 | $(TOP)/src/tokenize.c \ |
| 651 | $(TOP)/src/treeview.c \ |
| 652 | $(TOP)/src/trigger.c \ |
| 653 | $(TOP)/src/utf.c \ |
| 654 | $(TOP)/src/update.c \ |
| 655 | $(TOP)/src/upsert.c \ |
| 656 | $(TOP)/src/util.c \ |
| 657 | $(TOP)/src/vacuum.c \ |
| 658 | $(TOP)/src/vdbe.c \ |
| 659 | $(TOP)/src/vdbe.h \ |
| 660 | $(TOP)/src/vdbeapi.c \ |
| 661 | $(TOP)/src/vdbeaux.c \ |
| 662 | $(TOP)/src/vdbeblob.c \ |
| 663 | $(TOP)/src/vdbemem.c \ |
| 664 | $(TOP)/src/vdbesort.c \ |
| 665 | $(TOP)/src/vdbetrace.c \ |
| 666 | $(TOP)/src/vdbevtab.c \ |
| 667 | $(TOP)/src/vdbeInt.h \ |
| 668 | $(TOP)/src/vtab.c \ |
| 669 | $(TOP)/src/vxworks.h \ |
| 670 | $(TOP)/src/wal.c \ |
| 671 | $(TOP)/src/wal.h \ |
| 672 | $(TOP)/src/walker.c \ |
| 673 | $(TOP)/src/where.c \ |
| 674 | $(TOP)/src/wherecode.c \ |
| 675 | $(TOP)/src/whereexpr.c \ |
| 676 | $(TOP)/src/whereInt.h \ |
| 677 | $(TOP)/src/window.c |
| 678 | |
| 679 | # Source code for extensions |
| 680 | # |
| 681 | SRC += \ |
| 682 | $(TOP)/ext/fts3/fts3.c \ |
| 683 | $(TOP)/ext/fts3/fts3.h \ |
| 684 | $(TOP)/ext/fts3/fts3Int.h \ |
| 685 | $(TOP)/ext/fts3/fts3_aux.c \ |
| 686 | $(TOP)/ext/fts3/fts3_expr.c \ |
| 687 | $(TOP)/ext/fts3/fts3_hash.c \ |
| 688 | $(TOP)/ext/fts3/fts3_hash.h \ |
| 689 | $(TOP)/ext/fts3/fts3_icu.c \ |
| 690 | $(TOP)/ext/fts3/fts3_porter.c \ |
| 691 | $(TOP)/ext/fts3/fts3_snippet.c \ |
| 692 | $(TOP)/ext/fts3/fts3_tokenizer.h \ |
| 693 | $(TOP)/ext/fts3/fts3_tokenizer.c \ |
| 694 | $(TOP)/ext/fts3/fts3_tokenizer1.c \ |
| 695 | $(TOP)/ext/fts3/fts3_tokenize_vtab.c \ |
| 696 | $(TOP)/ext/fts3/fts3_unicode.c \ |
| 697 | $(TOP)/ext/fts3/fts3_unicode2.c \ |
| 698 | $(TOP)/ext/fts3/fts3_write.c |
| 699 | SRC += \ |
| 700 | $(TOP)/ext/icu/sqliteicu.h \ |
| 701 | $(TOP)/ext/icu/icu.c |
| 702 | SRC += \ |
| 703 | $(TOP)/ext/rtree/rtree.h \ |
| 704 | $(TOP)/ext/rtree/rtree.c \ |
| 705 | $(TOP)/ext/rtree/geopoly.c |
| 706 | SRC += \ |
| 707 | $(TOP)/ext/session/sqlite3session.c \ |
| 708 | $(TOP)/ext/session/sqlite3session.h |
| 709 | SRC += \ |
| 710 | $(TOP)/ext/rbu/sqlite3rbu.h \ |
| 711 | $(TOP)/ext/rbu/sqlite3rbu.c |
| 712 | SRC += \ |
| 713 | $(TOP)/ext/misc/stmt.c |
| 714 | |
| 715 | # Generated source code files |
| 716 | # |
| 717 | SRC += \ |
| 718 | keywordhash.h \ |
| 719 | opcodes.c \ |
| 720 | opcodes.h \ |
| 721 | parse.c \ |
| 722 | parse.h \ |
| 723 | sqlite_cfg.h \ |
| 724 | shell.c \ |
| 725 | sqlite3.h |
| 726 | |
| 727 | # Source code to the test files. |
| 728 | # |
| 729 | TESTSRC = \ |
| 730 | $(TOP)/src/test1.c \ |
| 731 | $(TOP)/src/test2.c \ |
| 732 | $(TOP)/src/test3.c \ |
| 733 | $(TOP)/src/test4.c \ |
| 734 | $(TOP)/src/test5.c \ |
| 735 | $(TOP)/src/test6.c \ |
| 736 | $(TOP)/src/test8.c \ |
| 737 | $(TOP)/src/test9.c \ |
| 738 | $(TOP)/src/test_autoext.c \ |
| 739 | $(TOP)/src/test_backup.c \ |
| 740 | $(TOP)/src/test_bestindex.c \ |
| 741 | $(TOP)/src/test_blob.c \ |
| 742 | $(TOP)/src/test_btree.c \ |
| 743 | $(TOP)/src/test_config.c \ |
| 744 | $(TOP)/src/test_delete.c \ |
| 745 | $(TOP)/src/test_demovfs.c \ |
| 746 | $(TOP)/src/test_devsym.c \ |
| 747 | $(TOP)/src/test_fs.c \ |
| 748 | $(TOP)/src/test_func.c \ |
| 749 | $(TOP)/src/test_hexio.c \ |
| 750 | $(TOP)/src/test_init.c \ |
| 751 | $(TOP)/src/test_intarray.c \ |
| 752 | $(TOP)/src/test_journal.c \ |
| 753 | $(TOP)/src/test_malloc.c \ |
| 754 | $(TOP)/src/test_md5.c \ |
| 755 | $(TOP)/src/test_multiplex.c \ |
| 756 | $(TOP)/src/test_mutex.c \ |
| 757 | $(TOP)/src/test_onefile.c \ |
| 758 | $(TOP)/src/test_osinst.c \ |
| 759 | $(TOP)/src/test_pcache.c \ |
| 760 | $(TOP)/src/test_quota.c \ |
| 761 | $(TOP)/src/test_rtree.c \ |
| 762 | $(TOP)/src/test_schema.c \ |
| 763 | $(TOP)/src/test_superlock.c \ |
| 764 | $(TOP)/src/test_syscall.c \ |
| 765 | $(TOP)/src/test_tclsh.c \ |
| 766 | $(TOP)/src/test_tclvar.c \ |
| 767 | $(TOP)/src/test_thread.c \ |
| 768 | $(TOP)/src/test_vdbecov.c \ |
| 769 | $(TOP)/src/test_vfs.c \ |
| 770 | $(TOP)/src/test_window.c \ |
| 771 | $(TOP)/src/test_wsd.c \ |
| 772 | $(TOP)/ext/fts3/fts3_term.c \ |
| 773 | $(TOP)/ext/fts3/fts3_test.c \ |
| 774 | $(TOP)/ext/session/test_session.c \ |
| 775 | $(TOP)/ext/recover/sqlite3recover.c \ |
| 776 | $(TOP)/ext/recover/dbdata.c \ |
| 777 | $(TOP)/ext/recover/test_recover.c \ |
| 778 | $(TOP)/ext/intck/test_intck.c \ |
| 779 | $(TOP)/ext/intck/sqlite3intck.c \ |
| 780 | $(TOP)/ext/rbu/test_rbu.c |
| 781 | |
| 782 | # Statically linked extensions |
| 783 | # |
| 784 | TESTSRC += \ |
| 785 | $(TOP)/ext/expert/sqlite3expert.c \ |
| 786 | $(TOP)/ext/expert/test_expert.c \ |
| 787 | $(TOP)/ext/misc/amatch.c \ |
| 788 | $(TOP)/ext/misc/appendvfs.c \ |
| 789 | $(TOP)/ext/misc/basexx.c \ |
| 790 | $(TOP)/ext/misc/cksumvfs.c \ |
| 791 | $(TOP)/ext/misc/closure.c \ |
| 792 | $(TOP)/ext/misc/csv.c \ |
| 793 | $(TOP)/ext/misc/decimal.c \ |
| 794 | $(TOP)/ext/misc/diskused.c \ |
| 795 | $(TOP)/ext/misc/eval.c \ |
| 796 | $(TOP)/ext/misc/explain.c \ |
| 797 | $(TOP)/ext/misc/fileio.c \ |
| 798 | $(TOP)/ext/misc/fuzzer.c \ |
| 799 | $(TOP)/ext/fts5/fts5_tcl.c \ |
| 800 | $(TOP)/ext/fts5/fts5_test_mi.c \ |
| 801 | $(TOP)/ext/fts5/fts5_test_tok.c \ |
| 802 | $(TOP)/ext/misc/ieee754.c \ |
| 803 | $(TOP)/ext/misc/mmapwarm.c \ |
| 804 | $(TOP)/ext/misc/nextchar.c \ |
| 805 | $(TOP)/ext/misc/normalize.c \ |
| 806 | $(TOP)/ext/misc/optname.c \ |
| 807 | $(TOP)/ext/misc/prefixes.c \ |
| 808 | $(TOP)/ext/misc/qpvtab.c \ |
| 809 | $(TOP)/ext/misc/randomjson.c \ |
| 810 | $(TOP)/ext/misc/regexp.c \ |
| 811 | $(TOP)/ext/misc/remember.c \ |
| 812 | $(TOP)/ext/misc/series.c \ |
| 813 | $(TOP)/ext/misc/spellfix.c \ |
| 814 | $(TOP)/ext/misc/stmtrand.c \ |
| 815 | $(TOP)/ext/misc/strdup.c \ |
| 816 | $(TOP)/ext/misc/totype.c \ |
| 817 | $(TOP)/ext/misc/tryeval.c \ |
| 818 | $(TOP)/ext/misc/unionvtab.c \ |
| 819 | $(TOP)/ext/misc/wholenumber.c \ |
| 820 | $(TOP)/ext/misc/zipfile.c \ |
| 821 | $(TOP)/ext/rtree/test_rtreedoc.c |
| 822 | |
| 823 | # Source code to the library files needed by the test fixture |
| 824 | # |
| 825 | TESTSRC2 = \ |
| 826 | $(TOP)/src/attach.c \ |
| 827 | $(TOP)/src/backup.c \ |
| 828 | $(TOP)/src/bitvec.c \ |
| 829 | $(TOP)/src/btree.c \ |
| 830 | $(TOP)/src/build.c \ |
| 831 | $(TOP)/src/carray.c \ |
| 832 | ctime.c \ |
| 833 | $(TOP)/src/date.c \ |
| 834 | $(TOP)/src/dbpage.c \ |
| 835 | $(TOP)/src/dbstat.c \ |
| 836 | $(TOP)/src/expr.c \ |
| 837 | $(TOP)/src/func.c \ |
| 838 | $(TOP)/src/global.c \ |
| 839 | $(TOP)/src/insert.c \ |
| 840 | $(TOP)/src/wal.c \ |
| 841 | $(TOP)/src/main.c \ |
| 842 | $(TOP)/src/mem5.c \ |
| 843 | $(TOP)/src/os.c \ |
| 844 | $(TOP)/src/os_kv.c \ |
| 845 | $(TOP)/src/os_unix.c \ |
| 846 | $(TOP)/src/os_win.c \ |
| 847 | $(TOP)/src/pager.c \ |
| 848 | $(TOP)/src/pragma.c \ |
| 849 | $(TOP)/src/prepare.c \ |
| 850 | $(TOP)/src/printf.c \ |
| 851 | $(TOP)/src/random.c \ |
| 852 | $(TOP)/src/pcache.c \ |
| 853 | $(TOP)/src/pcache1.c \ |
| 854 | $(TOP)/src/select.c \ |
| 855 | $(TOP)/src/tokenize.c \ |
| 856 | $(TOP)/src/treeview.c \ |
| 857 | $(TOP)/src/utf.c \ |
| 858 | $(TOP)/src/util.c \ |
| 859 | $(TOP)/src/vdbeapi.c \ |
| 860 | $(TOP)/src/vdbeaux.c \ |
| 861 | $(TOP)/src/vdbe.c \ |
| 862 | $(TOP)/src/vdbemem.c \ |
| 863 | $(TOP)/src/vdbetrace.c \ |
| 864 | $(TOP)/src/vdbevtab.c \ |
| 865 | $(TOP)/src/where.c \ |
| 866 | $(TOP)/src/wherecode.c \ |
| 867 | $(TOP)/src/whereexpr.c \ |
| 868 | $(TOP)/src/window.c \ |
| 869 | parse.c \ |
| 870 | $(TOP)/ext/fts3/fts3.c \ |
| 871 | $(TOP)/ext/fts3/fts3_aux.c \ |
| 872 | $(TOP)/ext/fts3/fts3_expr.c \ |
| 873 | $(TOP)/ext/fts3/fts3_tokenizer.c \ |
| 874 | $(TOP)/ext/fts3/fts3_write.c \ |
| 875 | $(TOP)/ext/session/sqlite3session.c \ |
| 876 | $(TOP)/ext/misc/stmt.c \ |
| 877 | fts5.c |
| 878 | |
| 879 | # Header files used by all library source files. |
| 880 | # |
| 881 | HDR = \ |
| 882 | $(TOP)/src/btree.h \ |
| 883 | $(TOP)/src/btreeInt.h \ |
| 884 | $(TOP)/src/hash.h \ |
| 885 | $(TOP)/src/hwtime.h \ |
| 886 | keywordhash.h \ |
| 887 | $(TOP)/src/msvc.h \ |
| 888 | $(TOP)/src/mutex.h \ |
| 889 | opcodes.h \ |
| 890 | $(TOP)/src/os.h \ |
| 891 | $(TOP)/src/os_common.h \ |
| 892 | $(TOP)/src/os_setup.h \ |
| 893 | $(TOP)/src/os_win.h \ |
| 894 | $(TOP)/src/pager.h \ |
| 895 | $(TOP)/src/pcache.h \ |
| 896 | parse.h \ |
| 897 | pragma.h \ |
| 898 | sqlite3.h \ |
| 899 | $(TOP)/src/sqlite3ext.h \ |
| 900 | $(TOP)/src/sqliteInt.h \ |
| 901 | $(TOP)/src/sqliteLimit.h \ |
| 902 | $(TOP)/src/vdbe.h \ |
| 903 | $(TOP)/src/vdbeInt.h \ |
| 904 | $(TOP)/src/vxworks.h \ |
| 905 | $(TOP)/src/whereInt.h \ |
| 906 | sqlite_cfg.h |
| 907 | # Reminder: sqlite_cfg.h is typically created by the configure script |
| 908 | |
| 909 | # Header files used by extensions |
| 910 | # |
| 911 | EXTHDR += \ |
| 912 | $(TOP)/ext/fts3/fts3.h \ |
| 913 | $(TOP)/ext/fts3/fts3Int.h \ |
| 914 | $(TOP)/ext/fts3/fts3_hash.h \ |
| 915 | $(TOP)/ext/fts3/fts3_tokenizer.h |
| 916 | EXTHDR += \ |
| 917 | $(TOP)/ext/rtree/rtree.h \ |
| 918 | $(TOP)/ext/rtree/geopoly.c |
| 919 | EXTHDR += \ |
| 920 | $(TOP)/ext/icu/sqliteicu.h |
| 921 | EXTHDR += \ |
| 922 | $(TOP)/ext/rtree/sqlite3rtree.h |
| 923 | |
| 924 | # |
| 925 | # Executables needed for testing |
| 926 | # |
| 927 | TESTPROGS = \ |
| 928 | testfixture$(T.exe) \ |
| 929 | sqlite3$(T.exe) \ |
| 930 | sqldiff$(T.exe) \ |
| 931 | dbhash$(T.exe) \ |
| 932 | sqltclsh$(T.exe) |
| 933 | |
| 934 | # Databases containing fuzzer test cases |
| 935 | # |
| 936 | FUZZDATA = \ |
| 937 | $(TOP)/test/fuzzdata1.db \ |
| 938 | $(TOP)/test/fuzzdata2.db \ |
| 939 | $(TOP)/test/fuzzdata3.db \ |
| 940 | $(TOP)/test/fuzzdata4.db \ |
| 941 | $(TOP)/test/fuzzdata5.db \ |
| 942 | $(TOP)/test/fuzzdata6.db \ |
| 943 | $(TOP)/test/fuzzdata7.db \ |
| 944 | $(TOP)/test/fuzzdata8.db |
| 945 | |
| 946 | # |
| 947 | # Standard options to testfixture |
| 948 | # |
| 949 | TESTOPTS = --verbose=file --output=test-out.txt |
| 950 | |
| 951 | FUZZERSHELL_OPT = |
| 952 | FUZZCHECK_OPT += -I$(TOP)/test |
| 953 | FUZZCHECK_OPT += -I$(TOP)/ext/recover |
| 954 | FUZZCHECK_OPT += \ |
| 955 | -DSQLITE_OSS_FUZZ \ |
| 956 | -DSQLITE_DECIMAL_MAX_DIGIT=1000 \ |
| 957 | -DSQLITE_ENABLE_BYTECODE_VTAB \ |
| 958 | -DSQLITE_ENABLE_CARRAY \ |
| 959 | -DSQLITE_ENABLE_DBPAGE_VTAB \ |
| 960 | -DSQLITE_ENABLE_DBSTAT_VTAB \ |
| 961 | -DSQLITE_ENABLE_DESERIALIZE \ |
| 962 | -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ |
| 963 | -DSQLITE_ENABLE_FTS3_PARENTHESIS \ |
| 964 | -DSQLITE_ENABLE_FTS4 \ |
| 965 | -DSQLITE_ENABLE_FTS5 \ |
| 966 | -DSQLITE_ENABLE_GEOPOLY \ |
| 967 | -DSQLITE_ENABLE_MATH_FUNCTIONS \ |
| 968 | -DSQLITE_ENABLE_MEMSYS5 \ |
| 969 | -DSQLITE_ENABLE_NORMALIZE \ |
| 970 | -DSQLITE_ENABLE_OFFSET_SQL_FUNC \ |
| 971 | -DSQLITE_ENABLE_PERCENTILE \ |
| 972 | -DSQLITE_ENABLE_PREUPDATE_HOOK \ |
| 973 | -DSQLITE_ENABLE_RTREE \ |
| 974 | -DSQLITE_ENABLE_SESSION \ |
| 975 | -DSQLITE_ENABLE_STMTVTAB \ |
| 976 | -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION \ |
| 977 | -DSQLITE_ENABLE_STAT4 \ |
| 978 | -DSQLITE_ENABLE_STMT_SCANSTATUS \ |
| 979 | -DSQLITE_JSON_MAX_DEPTH=500 \ |
| 980 | -DSQLITE_MAX_MEMORY=50000000 \ |
| 981 | -DSQLITE_MAX_MMAP_SIZE=0 \ |
| 982 | -DSQLITE_OMIT_LOAD_EXTENSION \ |
| 983 | -DSQLITE_PRINTF_PRECISION_LIMIT=1000 \ |
| 984 | -DSQLITE_PRIVATE="" \ |
| 985 | -DSQLITE_STRICT_SUBTYPE=1 \ |
| 986 | -DSQLITE_STATIC_RANDOMJSON |
| 987 | |
| 988 | FUZZCHECK_SRC = sqlite3.c \ |
| 989 | $(TOP)/test/fuzzcheck.c \ |
| 990 | $(TOP)/test/ossfuzz.c \ |
| 991 | $(TOP)/test/fuzzinvariants.c \ |
| 992 | $(TOP)/ext/recover/dbdata.c \ |
| 993 | $(TOP)/ext/recover/sqlite3recover.c \ |
| 994 | $(TOP)/test/vt02.c \ |
| 995 | $(TOP)/ext/misc/base64.c \ |
| 996 | $(TOP)/ext/misc/base85.c \ |
| 997 | $(TOP)/ext/misc/completion.c \ |
| 998 | $(TOP)/ext/misc/decimal.c \ |
| 999 | $(TOP)/ext/misc/diskused.c \ |
| 1000 | $(TOP)/ext/misc/ieee754.c \ |
| 1001 | $(TOP)/ext/misc/randomjson.c \ |
| 1002 | $(TOP)/ext/misc/regexp.c \ |
| 1003 | $(TOP)/ext/misc/series.c \ |
| 1004 | $(TOP)/ext/misc/shathree.c \ |
| 1005 | $(TOP)/ext/misc/sha1.c \ |
| 1006 | $(TOP)/ext/misc/stmtrand.c \ |
| 1007 | $(TOP)/ext/misc/strdup.c |
| 1008 | |
| 1009 | FUZZCHECK_DEP = sqlite3.h |
| 1010 | DBFUZZ_OPT = |
| 1011 | ST_OPT = -DSQLITE_OS_KV_OPTIONAL |
| 1012 | |
| 1013 | $(TCLSH_CMD): |
| 1014 | has_tclsh84: |
| 1015 | sh $(TOP)/tool/cktclsh.sh 8.4 $(TCLSH_CMD) |
| 1016 | touch has_tclsh84 |
| 1017 | |
| 1018 | has_tclsh85: |
| 1019 | sh $(TOP)/tool/cktclsh.sh 8.5 $(TCLSH_CMD) |
| 1020 | touch has_tclsh85 |
| 1021 | |
| 1022 | # |
| 1023 | # $(T.tcl.env.sh) is a shell script intended for source'ing to set |
| 1024 | # various TCL config info in the current shell context: |
| 1025 | # |
| 1026 | # - All info exported by tclConfig.sh |
| 1027 | # |
| 1028 | # - TCLLIBDIR = the first entry from TCL's $auto_path which refers to |
| 1029 | # an existing dir, then append /sqlite3 to it. If TCLLIBDIR is |
| 1030 | # provided via the environment, that value is used instead. |
| 1031 | # |
| 1032 | # Maintenance reminder: the ./ at the start of the name is required or /bin/sh |
| 1033 | # refuses to source it: |
| 1034 | # |
| 1035 | # . .tclenv.sh ==> .tclenv.sh: not found |
| 1036 | # . ./.tclenv.sh ==> fine |
| 1037 | # |
| 1038 | # It took half an hour to figure that out. |
| 1039 | # |
| 1040 | T.tcl.env.sh = ./.tclenv.sh |
| 1041 | $(T.tcl.env.sh): $(TCLSH_CMD) $(TCL_CONFIG_SH) $(MAKEFILE_LIST) |
| 1042 | @if [ x = "x$(TCL_CONFIG_SH)" ]; then \ |
| 1043 | echo 'TCL_CONFIG_SH must be set to point to a "tclConfig.sh"' 1>&2; exit 1; \ |
| 1044 | fi; \ |
| 1045 | if [ x != "x$(TCLLIBDIR)" ]; then \ |
| 1046 | echo "# generated by main.mk"; \ |
| 1047 | echo TCLLIBDIR="$(TCLLIBDIR)"; \ |
| 1048 | else \ |
| 1049 | ld= ; \ |
| 1050 | for d in `echo "puts stdout \\$$auto_path" | $(TCLSH_CMD)`; do \ |
| 1051 | if [ -d "$$d" ]; then ld=$$d; break; fi; \ |
| 1052 | done; \ |
| 1053 | if [ x = "x$$ld" ]; then echo "Cannot determine TCLLIBDIR" 1>&2; exit 1; fi; \ |
| 1054 | echo "# generated by main.mk"; \ |
| 1055 | echo "TCLLIBDIR=$$ld/sqlite3$(PACKAGE_VERSION)"; \ |
| 1056 | fi > $@; \ |
| 1057 | echo ". \"$(TCL_CONFIG_SH)\" || exit \$$?" >> $@; \ |
| 1058 | echo "Created $@" |
| 1059 | |
| 1060 | # |
| 1061 | # $(T.tcl.env.source) is shell code to be run as part of any |
| 1062 | # compilation or link step which requires vars from |
| 1063 | # $(TCL_CONFIG_SH). All targets which use this should also have a |
| 1064 | # dependency on $(T.tcl.env.sh). |
| 1065 | # |
| 1066 | T.tcl.env.source = . $(T.tcl.env.sh) || exit $$? |
| 1067 | |
| 1068 | # |
| 1069 | # $(T.compile.tcl) and $(T.link.tcl) are TCL-specific counterparts for |
| 1070 | # $(T.compile) and $(T.link) which first invoke |
| 1071 | # $(T.tcl.env.source). Any targets which used them must have a |
| 1072 | # dependency on $(T.tcl.env.sh) |
| 1073 | # |
| 1074 | # -DBUILD_sqlite is required for cross-compilation on Unix-on-Windows |
| 1075 | # environments: https://sqlite.org/forum/forumpost/fe9e99eb27c8c2ba |
| 1076 | # |
| 1077 | T.compile.tcl = $(T.tcl.env.source); $(T.compile) $(CFLAGS.intree_includes) -DBUILD_sqlite |
| 1078 | T.link.tcl = $(T.tcl.env.source); $(T.link) |
| 1079 | |
| 1080 | # |
| 1081 | # This target creates a directory named "tsrc" and fills it with |
| 1082 | # copies of all of the C source code and header files needed to |
| 1083 | # build on the target system. Some of the C source code and header |
| 1084 | # files are automatically generated. This target takes care of |
| 1085 | # all that automatic generation. |
| 1086 | # |
| 1087 | .target_source: $(MAKE_SANITY_CHECK) $(SRC) $(TOP)/tool/vdbe-compress.tcl \ |
| 1088 | fts5.c $(B.tclsh) |
| 1089 | rm -rf tsrc |
| 1090 | mkdir tsrc |
| 1091 | cp -f $(SRC) tsrc |
| 1092 | rm -f tsrc/sqlite.h.in tsrc/parse.y |
| 1093 | $(B.tclsh) $(TOP)/tool/vdbe-compress.tcl $(OPTS) <tsrc/vdbe.c >vdbe.new |
| 1094 | mv -f vdbe.new tsrc/vdbe.c |
| 1095 | cp fts5.c fts5.h tsrc |
| 1096 | touch .target_source |
| 1097 | |
| 1098 | # |
| 1099 | # libsqlite3.DLL.basename = the base name of the resulting DLL. This |
| 1100 | # is typically libsqlite3 but varies wildly on Unix-like Windows |
| 1101 | # environments (msys, cygwin, and friends). Conversely, the base name |
| 1102 | # of the static library ($(libsqlite3.LIB)) is constant on all tested |
| 1103 | # platforms. |
| 1104 | # |
| 1105 | libsqlite3.DLL.basename ?= libsqlite3 |
| 1106 | # |
| 1107 | # libsqlite3.DLL => the DLL library |
| 1108 | # |
| 1109 | libsqlite3.DLL = $(libsqlite3.DLL.basename)$(T.dll) |
| 1110 | # |
| 1111 | # libsqlite3.out.implib => "import library" file generated by the |
| 1112 | # --out-implib linker flag. Not commonly used on Unix systems but is |
| 1113 | # on the Windows-side Unix-esque environments and typically has a |
| 1114 | # value of "libsqlite3.dll.a". It is expected to match the filename, |
| 1115 | # if any, provided by the -Wl,--out-implib,FILENAME flag. |
| 1116 | # |
| 1117 | libsqlite3.out.implib ?= |
| 1118 | # |
| 1119 | # libsqlite3.LIB => the static library |
| 1120 | # |
| 1121 | libsqlite3.LIB = libsqlite3$(T.lib) |
| 1122 | |
| 1123 | # |
| 1124 | # libsqlite3.DLL.install-rules => the suffix of the symoblic name of |
| 1125 | # the makefile rules for installing the DLL. Must be one of |
| 1126 | # (unix-generic, msys, mingw, cygwin, darwin) and a target named |
| 1127 | # install-dll-THATNAME is responsible for DLL installation. |
| 1128 | libsqlite3.DLL.install-rules ?= unix-generic |
| 1129 | |
| 1130 | # Rules to build the LEMON compiler generator |
| 1131 | # |
| 1132 | lemon$(B.exe): $(MAKE_SANITY_CHECK) $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c |
| 1133 | $(B.cc) -o $@ $(TOP)/tool/lemon.c |
| 1134 | cp $(TOP)/tool/lempar.c . |
| 1135 | |
| 1136 | # Rules to build the program that generates the source-id |
| 1137 | # |
| 1138 | mksourceid$(B.exe): $(MAKE_SANITY_CHECK) $(TOP)/tool/mksourceid.c |
| 1139 | $(B.cc) -o $@ $(TOP)/tool/mksourceid.c |
| 1140 | |
| 1141 | sqlite3.h: $(MAKE_SANITY_CHECK) $(TOP)/src/sqlite.h.in \ |
| 1142 | $(TOP)/manifest mksourceid$(B.exe) \ |
| 1143 | $(TOP)/VERSION $(B.tclsh) |
| 1144 | $(B.tclsh) $(TOP)/tool/mksqlite3h.tcl $(TOP) -o sqlite3.h |
| 1145 | |
| 1146 | sqlite3.c: .target_source sqlite3.h $(TOP)/tool/mksqlite3c.tcl src-verify$(B.exe) \ |
| 1147 | $(B.tclsh) $(EXTRA_SRC) |
| 1148 | $(B.tclsh) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_GEN_FLAGS) $(EXTRA_SRC) |
| 1149 | cp tsrc/sqlite3ext.h . |
| 1150 | cp $(TOP)/ext/session/sqlite3session.h . |
| 1151 | |
| 1152 | sqlite3r.h: sqlite3.h $(B.tclsh) |
| 1153 | $(B.tclsh) $(TOP)/tool/mksqlite3h.tcl $(TOP) --enable-recover -o sqlite3r.h |
| 1154 | |
| 1155 | sqlite3r.c: sqlite3.c sqlite3r.h $(B.tclsh) |
| 1156 | cp $(TOP)/ext/recover/sqlite3recover.c tsrc/ |
| 1157 | cp $(TOP)/ext/recover/sqlite3recover.h tsrc/ |
| 1158 | cp $(TOP)/ext/recover/dbdata.c tsrc/ |
| 1159 | $(B.tclsh) $(TOP)/tool/mksqlite3c.tcl --enable-recover $(AMALGAMATION_GEN_FLAGS) $(EXTRA_SRC) |
| 1160 | |
| 1161 | sqlite3ext.h: .target_source |
| 1162 | cp tsrc/sqlite3ext.h . |
| 1163 | |
| 1164 | # Rules to build individual *.o files from generated *.c files. This |
| 1165 | # applies to: |
| 1166 | # |
| 1167 | # parse.o |
| 1168 | # opcodes.o |
| 1169 | # |
| 1170 | DEPS_OBJ_COMMON = $(MAKE_SANITY_CHECK) $(HDR) |
| 1171 | parse.o: parse.c $(DEPS_OBJ_COMMON) |
| 1172 | $(T.cc.sqlite) -c parse.c |
| 1173 | |
| 1174 | opcodes.o: opcodes.c |
| 1175 | $(T.cc.sqlite) -c opcodes.c |
| 1176 | |
| 1177 | # Rules to build individual *.o files from files in the src directory. |
| 1178 | # |
| 1179 | alter.o: $(TOP)/src/alter.c $(DEPS_OBJ_COMMON) |
| 1180 | $(T.cc.sqlite) -c $(TOP)/src/alter.c |
| 1181 | |
| 1182 | analyze.o: $(TOP)/src/analyze.c $(DEPS_OBJ_COMMON) |
| 1183 | $(T.cc.sqlite) -c $(TOP)/src/analyze.c |
| 1184 | |
| 1185 | attach.o: $(TOP)/src/attach.c $(DEPS_OBJ_COMMON) |
| 1186 | $(T.cc.sqlite) -c $(TOP)/src/attach.c |
| 1187 | |
| 1188 | auth.o: $(TOP)/src/auth.c $(DEPS_OBJ_COMMON) |
| 1189 | $(T.cc.sqlite) -c $(TOP)/src/auth.c |
| 1190 | |
| 1191 | backup.o: $(TOP)/src/backup.c $(DEPS_OBJ_COMMON) |
| 1192 | $(T.cc.sqlite) -c $(TOP)/src/backup.c |
| 1193 | |
| 1194 | bitvec.o: $(TOP)/src/bitvec.c $(DEPS_OBJ_COMMON) |
| 1195 | $(T.cc.sqlite) -c $(TOP)/src/bitvec.c |
| 1196 | |
| 1197 | btmutex.o: $(TOP)/src/btmutex.c $(DEPS_OBJ_COMMON) |
| 1198 | $(T.cc.sqlite) -c $(TOP)/src/btmutex.c |
| 1199 | |
| 1200 | btree.o: $(TOP)/src/btree.c $(DEPS_OBJ_COMMON) $(TOP)/src/pager.h |
| 1201 | $(T.cc.sqlite) -c $(TOP)/src/btree.c |
| 1202 | |
| 1203 | build.o: $(TOP)/src/build.c $(DEPS_OBJ_COMMON) |
| 1204 | $(T.cc.sqlite) -c $(TOP)/src/build.c |
| 1205 | |
| 1206 | callback.o: $(TOP)/src/callback.c $(DEPS_OBJ_COMMON) |
| 1207 | $(T.cc.sqlite) -c $(TOP)/src/callback.c |
| 1208 | |
| 1209 | carray.o: $(TOP)/src/carray.c $(DEPS_OBJ_COMMON) |
| 1210 | $(T.cc.sqlite) -c $(TOP)/src/carray.c |
| 1211 | |
| 1212 | complete.o: $(TOP)/src/complete.c $(DEPS_OBJ_COMMON) |
| 1213 | $(T.cc.sqlite) -c $(TOP)/src/complete.c |
| 1214 | |
| 1215 | ctime.c: $(TOP)/tool/mkctimec.tcl $(B.tclsh) |
| 1216 | $(B.tclsh) $(TOP)/tool/mkctimec.tcl |
| 1217 | |
| 1218 | ctime.o: ctime.c $(DEPS_OBJ_COMMON) |
| 1219 | $(T.cc.sqlite) -c ctime.c |
| 1220 | |
| 1221 | date.o: $(TOP)/src/date.c $(DEPS_OBJ_COMMON) |
| 1222 | $(T.cc.sqlite) -c $(TOP)/src/date.c |
| 1223 | |
| 1224 | dbpage.o: $(TOP)/src/dbpage.c $(DEPS_OBJ_COMMON) |
| 1225 | $(T.cc.sqlite) -c $(TOP)/src/dbpage.c |
| 1226 | |
| 1227 | dbstat.o: $(TOP)/src/dbstat.c $(DEPS_OBJ_COMMON) |
| 1228 | $(T.cc.sqlite) -c $(TOP)/src/dbstat.c |
| 1229 | |
| 1230 | delete.o: $(TOP)/src/delete.c $(DEPS_OBJ_COMMON) |
| 1231 | $(T.cc.sqlite) -c $(TOP)/src/delete.c |
| 1232 | |
| 1233 | expr.o: $(TOP)/src/expr.c $(DEPS_OBJ_COMMON) |
| 1234 | $(T.cc.sqlite) -c $(TOP)/src/expr.c |
| 1235 | |
| 1236 | fault.o: $(TOP)/src/fault.c $(DEPS_OBJ_COMMON) |
| 1237 | $(T.cc.sqlite) -c $(TOP)/src/fault.c |
| 1238 | |
| 1239 | fkey.o: $(TOP)/src/fkey.c $(DEPS_OBJ_COMMON) |
| 1240 | $(T.cc.sqlite) -c $(TOP)/src/fkey.c |
| 1241 | |
| 1242 | func.o: $(TOP)/src/func.c $(DEPS_OBJ_COMMON) |
| 1243 | $(T.cc.sqlite) -c $(TOP)/src/func.c |
| 1244 | |
| 1245 | global.o: $(TOP)/src/global.c $(DEPS_OBJ_COMMON) |
| 1246 | $(T.cc.sqlite) -c $(TOP)/src/global.c |
| 1247 | |
| 1248 | hash.o: $(TOP)/src/hash.c $(DEPS_OBJ_COMMON) |
| 1249 | $(T.cc.sqlite) -c $(TOP)/src/hash.c |
| 1250 | |
| 1251 | insert.o: $(TOP)/src/insert.c $(DEPS_OBJ_COMMON) |
| 1252 | $(T.cc.sqlite) -c $(TOP)/src/insert.c |
| 1253 | |
| 1254 | json.o: $(TOP)/src/json.c $(DEPS_OBJ_COMMON) |
| 1255 | $(T.cc.sqlite) -c $(TOP)/src/json.c |
| 1256 | |
| 1257 | legacy.o: $(TOP)/src/legacy.c $(DEPS_OBJ_COMMON) |
| 1258 | $(T.cc.sqlite) -c $(TOP)/src/legacy.c |
| 1259 | |
| 1260 | loadext.o: $(TOP)/src/loadext.c $(DEPS_OBJ_COMMON) |
| 1261 | $(T.cc.sqlite) -c $(TOP)/src/loadext.c |
| 1262 | |
| 1263 | main.o: $(TOP)/src/main.c $(DEPS_OBJ_COMMON) |
| 1264 | $(T.cc.sqlite) -c $(TOP)/src/main.c |
| 1265 | |
| 1266 | malloc.o: $(TOP)/src/malloc.c $(DEPS_OBJ_COMMON) |
| 1267 | $(T.cc.sqlite) -c $(TOP)/src/malloc.c |
| 1268 | |
| 1269 | mem0.o: $(TOP)/src/mem0.c $(DEPS_OBJ_COMMON) |
| 1270 | $(T.cc.sqlite) -c $(TOP)/src/mem0.c |
| 1271 | |
| 1272 | mem1.o: $(TOP)/src/mem1.c $(DEPS_OBJ_COMMON) |
| 1273 | $(T.cc.sqlite) -c $(TOP)/src/mem1.c |
| 1274 | |
| 1275 | mem2.o: $(TOP)/src/mem2.c $(DEPS_OBJ_COMMON) |
| 1276 | $(T.cc.sqlite) -c $(TOP)/src/mem2.c |
| 1277 | |
| 1278 | mem3.o: $(TOP)/src/mem3.c $(DEPS_OBJ_COMMON) |
| 1279 | $(T.cc.sqlite) -c $(TOP)/src/mem3.c |
| 1280 | |
| 1281 | mem5.o: $(TOP)/src/mem5.c $(DEPS_OBJ_COMMON) |
| 1282 | $(T.cc.sqlite) -c $(TOP)/src/mem5.c |
| 1283 | |
| 1284 | memdb.o: $(TOP)/src/memdb.c $(DEPS_OBJ_COMMON) |
| 1285 | $(T.cc.sqlite) -c $(TOP)/src/memdb.c |
| 1286 | |
| 1287 | memjournal.o: $(TOP)/src/memjournal.c $(DEPS_OBJ_COMMON) |
| 1288 | $(T.cc.sqlite) -c $(TOP)/src/memjournal.c |
| 1289 | |
| 1290 | mutex.o: $(TOP)/src/mutex.c $(DEPS_OBJ_COMMON) |
| 1291 | $(T.cc.sqlite) -c $(TOP)/src/mutex.c |
| 1292 | |
| 1293 | mutex_noop.o: $(TOP)/src/mutex_noop.c $(DEPS_OBJ_COMMON) |
| 1294 | $(T.cc.sqlite) -c $(TOP)/src/mutex_noop.c |
| 1295 | |
| 1296 | mutex_unix.o: $(TOP)/src/mutex_unix.c $(DEPS_OBJ_COMMON) |
| 1297 | $(T.cc.sqlite) -c $(TOP)/src/mutex_unix.c |
| 1298 | |
| 1299 | mutex_w32.o: $(TOP)/src/mutex_w32.c $(DEPS_OBJ_COMMON) |
| 1300 | $(T.cc.sqlite) -c $(TOP)/src/mutex_w32.c |
| 1301 | |
| 1302 | notify.o: $(TOP)/src/notify.c $(DEPS_OBJ_COMMON) |
| 1303 | $(T.cc.sqlite) -c $(TOP)/src/notify.c |
| 1304 | |
| 1305 | pager.o: $(TOP)/src/pager.c $(DEPS_OBJ_COMMON) $(TOP)/src/pager.h |
| 1306 | $(T.cc.sqlite) -c $(TOP)/src/pager.c |
| 1307 | |
| 1308 | pcache.o: $(TOP)/src/pcache.c $(DEPS_OBJ_COMMON) $(TOP)/src/pcache.h |
| 1309 | $(T.cc.sqlite) -c $(TOP)/src/pcache.c |
| 1310 | |
| 1311 | pcache1.o: $(TOP)/src/pcache1.c $(DEPS_OBJ_COMMON) $(TOP)/src/pcache.h |
| 1312 | $(T.cc.sqlite) -c $(TOP)/src/pcache1.c |
| 1313 | |
| 1314 | os.o: $(TOP)/src/os.c $(DEPS_OBJ_COMMON) |
| 1315 | $(T.cc.sqlite) -c $(TOP)/src/os.c |
| 1316 | |
| 1317 | os_kv.o: $(TOP)/src/os_kv.c $(DEPS_OBJ_COMMON) |
| 1318 | $(T.cc.sqlite) -c $(TOP)/src/os_kv.c |
| 1319 | |
| 1320 | os_unix.o: $(TOP)/src/os_unix.c $(DEPS_OBJ_COMMON) |
| 1321 | $(T.cc.sqlite) -c $(TOP)/src/os_unix.c |
| 1322 | |
| 1323 | os_win.o: $(TOP)/src/os_win.c $(DEPS_OBJ_COMMON) |
| 1324 | $(T.cc.sqlite) -c $(TOP)/src/os_win.c |
| 1325 | |
| 1326 | pragma.o: $(TOP)/src/pragma.c $(DEPS_OBJ_COMMON) |
| 1327 | $(T.cc.sqlite) -c $(TOP)/src/pragma.c |
| 1328 | |
| 1329 | prepare.o: $(TOP)/src/prepare.c $(DEPS_OBJ_COMMON) |
| 1330 | $(T.cc.sqlite) -c $(TOP)/src/prepare.c |
| 1331 | |
| 1332 | printf.o: $(TOP)/src/printf.c $(DEPS_OBJ_COMMON) |
| 1333 | $(T.cc.sqlite) -c $(TOP)/src/printf.c |
| 1334 | |
| 1335 | random.o: $(TOP)/src/random.c $(DEPS_OBJ_COMMON) |
| 1336 | $(T.cc.sqlite) -c $(TOP)/src/random.c |
| 1337 | |
| 1338 | resolve.o: $(TOP)/src/resolve.c $(DEPS_OBJ_COMMON) |
| 1339 | $(T.cc.sqlite) -c $(TOP)/src/resolve.c |
| 1340 | |
| 1341 | rowset.o: $(TOP)/src/rowset.c $(DEPS_OBJ_COMMON) |
| 1342 | $(T.cc.sqlite) -c $(TOP)/src/rowset.c |
| 1343 | |
| 1344 | select.o: $(TOP)/src/select.c $(DEPS_OBJ_COMMON) |
| 1345 | $(T.cc.sqlite) -c $(TOP)/src/select.c |
| 1346 | |
| 1347 | status.o: $(TOP)/src/status.c $(DEPS_OBJ_COMMON) |
| 1348 | $(T.cc.sqlite) -c $(TOP)/src/status.c |
| 1349 | |
| 1350 | sqlite3.o: sqlite3.h sqlite3.c |
| 1351 | $(T.cc.sqlite) -c sqlite3.c |
| 1352 | |
| 1353 | table.o: $(TOP)/src/table.c $(DEPS_OBJ_COMMON) |
| 1354 | $(T.cc.sqlite) -c $(TOP)/src/table.c |
| 1355 | |
| 1356 | threads.o: $(TOP)/src/threads.c $(DEPS_OBJ_COMMON) |
| 1357 | $(T.cc.sqlite) -c $(TOP)/src/threads.c |
| 1358 | |
| 1359 | tokenize.o: $(TOP)/src/tokenize.c keywordhash.h $(DEPS_OBJ_COMMON) |
| 1360 | $(T.cc.sqlite) -c $(TOP)/src/tokenize.c |
| 1361 | |
| 1362 | treeview.o: $(TOP)/src/treeview.c $(DEPS_OBJ_COMMON) |
| 1363 | $(T.cc.sqlite) -c $(TOP)/src/treeview.c |
| 1364 | |
| 1365 | trigger.o: $(TOP)/src/trigger.c $(DEPS_OBJ_COMMON) |
| 1366 | $(T.cc.sqlite) -c $(TOP)/src/trigger.c |
| 1367 | |
| 1368 | update.o: $(TOP)/src/update.c $(DEPS_OBJ_COMMON) |
| 1369 | $(T.cc.sqlite) -c $(TOP)/src/update.c |
| 1370 | |
| 1371 | upsert.o: $(TOP)/src/upsert.c $(DEPS_OBJ_COMMON) |
| 1372 | $(T.cc.sqlite) -c $(TOP)/src/upsert.c |
| 1373 | |
| 1374 | utf.o: $(TOP)/src/utf.c $(DEPS_OBJ_COMMON) |
| 1375 | $(T.cc.sqlite) -c $(TOP)/src/utf.c |
| 1376 | |
| 1377 | util.o: $(TOP)/src/util.c $(DEPS_OBJ_COMMON) |
| 1378 | $(T.cc.sqlite) -c $(TOP)/src/util.c |
| 1379 | |
| 1380 | vacuum.o: $(TOP)/src/vacuum.c $(DEPS_OBJ_COMMON) |
| 1381 | $(T.cc.sqlite) -c $(TOP)/src/vacuum.c |
| 1382 | |
| 1383 | vdbe.o: $(TOP)/src/vdbe.c $(DEPS_OBJ_COMMON) |
| 1384 | $(T.cc.sqlite) -c $(TOP)/src/vdbe.c |
| 1385 | |
| 1386 | vdbeapi.o: $(TOP)/src/vdbeapi.c $(DEPS_OBJ_COMMON) |
| 1387 | $(T.cc.sqlite) -c $(TOP)/src/vdbeapi.c |
| 1388 | |
| 1389 | vdbeaux.o: $(TOP)/src/vdbeaux.c $(DEPS_OBJ_COMMON) |
| 1390 | $(T.cc.sqlite) -c $(TOP)/src/vdbeaux.c |
| 1391 | |
| 1392 | vdbeblob.o: $(TOP)/src/vdbeblob.c $(DEPS_OBJ_COMMON) |
| 1393 | $(T.cc.sqlite) -c $(TOP)/src/vdbeblob.c |
| 1394 | |
| 1395 | vdbemem.o: $(TOP)/src/vdbemem.c $(DEPS_OBJ_COMMON) |
| 1396 | $(T.cc.sqlite) -c $(TOP)/src/vdbemem.c |
| 1397 | |
| 1398 | vdbesort.o: $(TOP)/src/vdbesort.c $(DEPS_OBJ_COMMON) |
| 1399 | $(T.cc.sqlite) -c $(TOP)/src/vdbesort.c |
| 1400 | |
| 1401 | vdbetrace.o: $(TOP)/src/vdbetrace.c $(DEPS_OBJ_COMMON) |
| 1402 | $(T.cc.sqlite) -c $(TOP)/src/vdbetrace.c |
| 1403 | |
| 1404 | vdbevtab.o: $(TOP)/src/vdbevtab.c $(DEPS_OBJ_COMMON) |
| 1405 | $(T.cc.sqlite) -c $(TOP)/src/vdbevtab.c |
| 1406 | |
| 1407 | vtab.o: $(TOP)/src/vtab.c $(DEPS_OBJ_COMMON) |
| 1408 | $(T.cc.sqlite) -c $(TOP)/src/vtab.c |
| 1409 | |
| 1410 | wal.o: $(TOP)/src/wal.c $(DEPS_OBJ_COMMON) |
| 1411 | $(T.cc.sqlite) -c $(TOP)/src/wal.c |
| 1412 | |
| 1413 | walker.o: $(TOP)/src/walker.c $(DEPS_OBJ_COMMON) |
| 1414 | $(T.cc.sqlite) -c $(TOP)/src/walker.c |
| 1415 | |
| 1416 | where.o: $(TOP)/src/where.c $(DEPS_OBJ_COMMON) |
| 1417 | $(T.cc.sqlite) -c $(TOP)/src/where.c |
| 1418 | |
| 1419 | wherecode.o: $(TOP)/src/wherecode.c $(DEPS_OBJ_COMMON) |
| 1420 | $(T.cc.sqlite) -c $(TOP)/src/wherecode.c |
| 1421 | |
| 1422 | whereexpr.o: $(TOP)/src/whereexpr.c $(DEPS_OBJ_COMMON) |
| 1423 | $(T.cc.sqlite) -c $(TOP)/src/whereexpr.c |
| 1424 | |
| 1425 | window.o: $(TOP)/src/window.c $(DEPS_OBJ_COMMON) |
| 1426 | $(T.cc.sqlite) -c $(TOP)/src/window.c |
| 1427 | |
| 1428 | tclsqlite.o: $(T.tcl.env.sh) tclsqlite-ex.c $(DEPS_OBJ_COMMON) |
| 1429 | $(T.compile.tcl) -DUSE_TCL_STUBS=1 $$TCL_INCLUDE_SPEC \ |
| 1430 | -c tclsqlite-ex.c -o tclsqlite.o |
| 1431 | |
| 1432 | tclsqlite-shell.o: $(T.tcl.env.sh) tclsqlite-ex.c $(DEPS_OBJ_COMMON) |
| 1433 | $(T.compile.tcl) -DTCLSH -o $@ -c tclsqlite-ex.c $$TCL_INCLUDE_SPEC |
| 1434 | |
| 1435 | tclsqlite-stubs.o: $(T.tcl.env.sh) tclsqlite-ex.c $(DEPS_OBJ_COMMON) |
| 1436 | $(T.compile.tcl) -DUSE_TCL_STUBS=1 -o $@ -c tclsqlite-ex.c $$TCL_INCLUDE_SPEC |
| 1437 | |
| 1438 | # |
| 1439 | # STATIC_TCLSQLITE3 = 1 to statically link tclsqlite3, else |
| 1440 | # 0. Requires static versions of all requisite libraries. Primarily |
| 1441 | # intended for use with static-friendly environments like Alpine |
| 1442 | # Linux. It won't work on glibc-based systems. |
| 1443 | # |
| 1444 | STATIC_TCLSQLITE3 ?= 0 |
| 1445 | # |
| 1446 | # tclsqlite3.(deps|flags).N = N is $(STATIC_TCLSQLITE3) |
| 1447 | # |
| 1448 | tclsqlite3.deps.1 = sqlite3.o |
| 1449 | tclsqlite3.flags.1 = -static $(tclsqlite3.deps.1) |
| 1450 | tclsqlite3.deps.0 = $(libsqlite3.DLL) |
| 1451 | tclsqlite3.flags.0 = $(tclsqlite3.deps.0) |
| 1452 | tclsqlite3$(T.exe): $(T.tcl.env.sh) tclsqlite-shell.o $(tclsqlite3.deps.$(STATIC_TCLSQLITE3)) |
| 1453 | $(T.link.tcl) -o $@ tclsqlite-shell.o \ |
| 1454 | $(tclsqlite3.flags.$(STATIC_TCLSQLITE3)) $$TCL_INCLUDE_SPEC $$TCL_LIB_SPEC \ |
| 1455 | $(LDFLAGS.libsqlite3) |
| 1456 | tclsqlite3$(T.exe)-1: tclsqlite3$(T.exe) |
| 1457 | tclsqlite3$(T.exe)-0: |
| 1458 | tcl: tclsqlite3$(T.exe)-$(HAVE_TCL) |
| 1459 | |
| 1460 | # Rules to build opcodes.c and opcodes.h |
| 1461 | # |
| 1462 | opcodes.c: opcodes.h $(TOP)/tool/mkopcodec.tcl $(B.tclsh) |
| 1463 | $(B.tclsh) $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c |
| 1464 | |
| 1465 | opcodes.h: parse.h $(TOP)/src/vdbe.c \ |
| 1466 | $(TOP)/tool/mkopcodeh.tcl $(B.tclsh) |
| 1467 | cat parse.h $(TOP)/src/vdbe.c | $(B.tclsh) $(TOP)/tool/mkopcodeh.tcl >opcodes.h |
| 1468 | |
| 1469 | # Rules to build parse.c and parse.h - the outputs of lemon. |
| 1470 | # |
| 1471 | parse.h: parse.c |
| 1472 | |
| 1473 | parse.c: $(TOP)/src/parse.y lemon$(B.exe) |
| 1474 | cp $(TOP)/src/parse.y . |
| 1475 | ./lemon$(B.exe) $(OPT_FEATURE_FLAGS) $(OPTS) -S parse.y |
| 1476 | |
| 1477 | pragma.h: $(TOP)/tool/mkpragmatab.tcl $(B.tclsh) |
| 1478 | $(B.tclsh) $(TOP)/tool/mkpragmatab.tcl |
| 1479 | |
| 1480 | sqlite3rc.h: $(TOP)/src/sqlite3.rc $(TOP)/VERSION $(B.tclsh) |
| 1481 | echo '#ifndef SQLITE_RESOURCE_VERSION' >$@ |
| 1482 | echo -n '#define SQLITE_RESOURCE_VERSION ' >>$@ |
| 1483 | cat $(TOP)/VERSION | $(B.tclsh) $(TOP)/tool/replace.tcl exact . , >>$@ |
| 1484 | echo '#endif' >>sqlite3rc.h |
| 1485 | |
| 1486 | mkkeywordhash$(B.exe): $(TOP)/tool/mkkeywordhash.c |
| 1487 | $(B.cc) -o $@ $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)/tool/mkkeywordhash.c |
| 1488 | keywordhash.h: mkkeywordhash$(B.exe) |
| 1489 | ./mkkeywordhash$(B.exe) > $@ |
| 1490 | |
| 1491 | # |
| 1492 | # sqlite3.c split into many smaller files. |
| 1493 | # |
| 1494 | sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl $(B.tclsh) |
| 1495 | $(B.tclsh) $(TOP)/tool/split-sqlite3c.tcl |
| 1496 | |
| 1497 | # |
| 1498 | # Static libsqlite3 |
| 1499 | # |
| 1500 | $(libsqlite3.LIB): $(LIBOBJ) |
| 1501 | $(AR) $(AR.flags) $@ $(LIBOBJ) |
| 1502 | $(libsqlite3.LIB)-1: $(libsqlite3.LIB) |
| 1503 | $(libsqlite3.LIB)-0 $(libsqlite3.LIB)-: |
| 1504 | lib: $(libsqlite3.LIB)-$(ENABLE_LIB_STATIC) |
| 1505 | all: lib |
| 1506 | |
| 1507 | # |
| 1508 | # Dynamic libsqlite3 |
| 1509 | # |
| 1510 | $(libsqlite3.DLL): $(LIBOBJ) |
| 1511 | $(T.link.shared) -o $@ $(LIBOBJ) $(LDFLAGS.libsqlite3) \ |
| 1512 | $(LDFLAGS.libsqlite3.os-specific) $(LDFLAGS.libsqlite3.soname) |
| 1513 | $(libsqlite3.DLL)-1: $(libsqlite3.DLL) |
| 1514 | $(libsqlite3.DLL)-0 $(libsqlite3.DLL)-: |
| 1515 | so: $(libsqlite3.DLL)-$(ENABLE_LIB_SHARED) |
| 1516 | all: so |
| 1517 | |
| 1518 | # |
| 1519 | # DLL installation... |
| 1520 | # |
| 1521 | # On most Unix-like platforms, install the $(libsqlite3.DLL) as |
| 1522 | # $(libsqlite3.DLL).$(PACKAGE_VERSION) and create symlinks which point |
| 1523 | # to it: |
| 1524 | # |
| 1525 | # - libsqlite3.so.$(PACKAGE_VERSION) |
| 1526 | # - libsqlite3.so.0 =symlink-> libsqlite3.so.$(PACKAGE_VERSION) (see below) |
| 1527 | # - libsqlite3.so =symlink-> libsqlite3.so.3 |
| 1528 | # |
| 1529 | # Different rules apply for platforms where $(T.dll)==.dylib and for |
| 1530 | # the "Unix on Windows" environments. |
| 1531 | # |
| 1532 | # The link named libsqlite3.so.0 is provided in an attempt to reduce |
| 1533 | # downstream disruption when performing upgrades from pre-3.48 to a |
| 1534 | # version 3.48 or higher. That name is considered a legacy remnant |
| 1535 | # and may eventually be removed from this installation process. |
| 1536 | # |
| 1537 | # Historically libtool installed the library like so: |
| 1538 | # |
| 1539 | # libsqlite3.so -> libsqlite3.so.0.8.6 |
| 1540 | # libsqlite3.so.0 -> libsqlite3.so.0.8.6 |
| 1541 | # libsqlite3.so.0.8.6 |
| 1542 | # |
| 1543 | # The historical SQLite build always used a version number of 0.8.6 |
| 1544 | # for reasons lost to history but having something to do with libtool |
| 1545 | # (which is no longer used in this tree). In order to retain filename |
| 1546 | # compatibility for systems which have libraries installed using those |
| 1547 | # conventions: |
| 1548 | # |
| 1549 | # 1) If libsqlite3.so.0.8.6 is found in the target installation |
| 1550 | # directory then it is re-linked to point to the newer-style |
| 1551 | # names. We cannot retain both the old and new installation because |
| 1552 | # they both share the high-level name $(libsqlite3.DLL). The |
| 1553 | # down-side of this is that it may upset packaging tools when we |
| 1554 | # replace libsqlite3.so (from a legacy package) with a new symlink. |
| 1555 | # |
| 1556 | # 2) If INSTALL_SO_086_LINK=1 and point (1) does not apply then links |
| 1557 | # to the legacy-style names are created. The primary intent of this |
| 1558 | # is to enable chains of operations such as the hypothetical (apt |
| 1559 | # remove sqlite3-3.47.0 && apt install sqlite3-3.48.0). In such |
| 1560 | # cases, condition (1) would never trigger but applications might |
| 1561 | # still expect to see the legacy file names. |
| 1562 | # |
| 1563 | # In either case, libsqlite3.la, if found, is deleted because it would |
| 1564 | # contain stale state, referring to non-libtool-generated libraries. |
| 1565 | # |
| 1566 | |
| 1567 | install-dll-out-implib: $(install-dir.lib) $(libsqlite3.DLL) |
| 1568 | if [ x != "x$(libsqlite3.out.implib)" ] && [ -f "$(libsqlite3.out.implib)" ]; then \ |
| 1569 | $(INSTALL) $(libsqlite3.out.implib) "$(install-dir.lib)"; \ |
| 1570 | fi |
| 1571 | |
| 1572 | install-dll-unix-generic: install-dll-out-implib |
| 1573 | $(INSTALL) $(libsqlite3.DLL) "$(install-dir.lib)" |
| 1574 | @echo "Setting up $(libsqlite3.DLL) version symlinks..."; \ |
| 1575 | cd "$(install-dir.lib)" || exit $$?; \ |
| 1576 | rm -f $(libsqlite3.DLL).0 $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \ |
| 1577 | mv $(libsqlite3.DLL) $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \ |
| 1578 | ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL) || exit $$?; \ |
| 1579 | ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0 || exit $$?; \ |
| 1580 | ls -la $(libsqlite3.DLL) $(libsqlite3.DLL).[a03]*; \ |
| 1581 | if [ -e $(libsqlite3.DLL).0.8.6 ]; then \ |
| 1582 | echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \ |
| 1583 | rm -f libsqlite3.la $(libsqlite3.DLL).0.8.6 || exit $$?; \ |
| 1584 | ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \ |
| 1585 | ls -la $(libsqlite3.DLL).0.8.6; \ |
| 1586 | elif [ x1 = "x$(INSTALL_SO_086_LINK)" ]; then \ |
| 1587 | echo "ACHTUNG: installing legacy libtool-style links because INSTALL_SO_086_LINK=1"; \ |
| 1588 | rm -f libsqlite3.la $(libsqlite3.DLL).0.8.6 || exit $$?; \ |
| 1589 | ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \ |
| 1590 | ls -la $(libsqlite3.DLL).0.8.6; \ |
| 1591 | fi |
| 1592 | |
| 1593 | install-dll-msys: install-dll-out-implib $(install-dir.bin) |
| 1594 | $(INSTALL) $(libsqlite3.DLL) "$(install-dir.bin)" |
| 1595 | # ----------------------------------------------^^^ yes, bin |
| 1596 | # Each of {msys,mingw,cygwin} uses a different name for the DLL, but |
| 1597 | # that is already accounted for via $(libsqlite3.DLL). |
| 1598 | install-dll-mingw: install-dll-msys |
| 1599 | install-dll-cygwin: install-dll-msys |
| 1600 | |
| 1601 | install-dll-darwin: $(install-dir.lib) $(libsqlite3.DLL) |
| 1602 | $(INSTALL) $(libsqlite3.DLL) "$(install-dir.lib)" |
| 1603 | @echo "Setting up $(libsqlite3.DLL) version symlinks..."; \ |
| 1604 | cd "$(install-dir.lib)" || exit $$?; \ |
| 1605 | rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ |
| 1606 | dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \ |
| 1607 | mv $(libsqlite3.DLL) $$dllname || exit $$?; \ |
| 1608 | ln -s $$dllname $(libsqlite3.DLL) || exit $$?; \ |
| 1609 | ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \ |
| 1610 | ls -la $$dllname $(libsqlite3.DLL) libsqlite3.0$(T.dll) |
| 1611 | |
| 1612 | install-dll-1: install-dll-$(libsqlite3.DLL.install-rules) |
| 1613 | install-dll-0 install-dll-: |
| 1614 | install-dll: install-dll-$(ENABLE_LIB_SHARED) |
| 1615 | install: install-dll |
| 1616 | |
| 1617 | # |
| 1618 | # Install $(libsqlite3.LIB) |
| 1619 | # |
| 1620 | install-lib-1: $(install-dir.lib) $(libsqlite3.LIB) |
| 1621 | $(INSTALL.noexec) $(libsqlite3.LIB) "$(install-dir.lib)" |
| 1622 | install-lib-0 install-lib-: |
| 1623 | install-lib: install-lib-$(ENABLE_LIB_STATIC) |
| 1624 | install: install-lib |
| 1625 | |
| 1626 | # |
| 1627 | # Install C header files |
| 1628 | # |
| 1629 | install-headers: sqlite3.h $(install-dir.include) |
| 1630 | $(INSTALL.noexec) sqlite3.h "$(TOP)/src/sqlite3ext.h" "$(install-dir.include)" |
| 1631 | install: install-headers |
| 1632 | |
| 1633 | # |
| 1634 | # If TCL_EXT_DLL_BASENAME is not set then guess the Tcl extension's |
| 1635 | # DLL name depending on the Tcl version. This does not account for |
| 1636 | # Cygwin's naming - the canonical build will usually set it, but |
| 1637 | # static makefiles importing this one will need to account for that on |
| 1638 | # their own. They can do that by setting libtclsqlite3.basename-[89] |
| 1639 | # to appropriate names (cygsqlite resp. cygtcl9sqlite). |
| 1640 | # |
| 1641 | TCL_MAJOR_VERSION ?= 0 |
| 1642 | libtclsqlite3.basename-8 ?= libsqlite |
| 1643 | libtclsqlite3.basename-9 ?= libtcl9sqlite |
| 1644 | TCL_EXT_DLL_BASENAME ?= $(libtclsqlite3.basename-$(TCL_MAJOR_VERSION)) |
| 1645 | libtclsqlite3.DLL ?= $(TCL_EXT_DLL_BASENAME)$(PACKAGE_VERSION)$(T.dll) |
| 1646 | |
| 1647 | # |
| 1648 | # libtclsqlite3... |
| 1649 | # |
| 1650 | pkgIndex.tcl: $(TOP)/main.mk |
| 1651 | echo 'package ifneeded sqlite3 $(PACKAGE_VERSION) [list load [file join $$dir $(libtclsqlite3.DLL)] Sqlite3]' > $@ |
| 1652 | pkgIndex.tcl-1: pkgIndex.tcl |
| 1653 | pkgIndex.tcl-0 pkgIndex.tcl-: |
| 1654 | tcl: pkgIndex.tcl-$(HAVE_TCL) |
| 1655 | |
| 1656 | # |
| 1657 | # Tcl's proper rpath is defined as TCL_LD_SEARCH_FLAGS in |
| 1658 | # tclConfig.sh, but it's defined in such a way as to be useless for a |
| 1659 | # _static_ makefile like this one, so we're _guessing_ that the linker |
| 1660 | # supports the -rpath flag in the form hard-coded here. |
| 1661 | # |
| 1662 | libtclsqlite3.rpath-0 = |
| 1663 | libtclsqlite3.rpath-1 = -Wl,-rpath,$$TCLLIBDIR |
| 1664 | libtclsqlite3.rpath- = $(libtclsqlite3.rpath-1) |
| 1665 | |
| 1666 | $(libtclsqlite3.DLL): $(T.tcl.env.sh) tclsqlite.o $(LIBOBJ) |
| 1667 | $(T.tcl.env.source); \ |
| 1668 | $(T.link.shared) -o $@ tclsqlite.o \ |
| 1669 | $$TCL_INCLUDE_SPEC $$TCL_STUB_LIB_SPEC $(LDFLAGS.libsqlite3) \ |
| 1670 | $(LIBOBJ) $(libtclsqlite3.rpath-$(ENABLE_RPATH)) |
| 1671 | $(libtclsqlite3.DLL)-1: $(libtclsqlite3.DLL) |
| 1672 | $(libtclsqlite3.DLL)-0 $(libtclsqlite3.DLL)-: |
| 1673 | libtcl: $(libtclsqlite3.DLL)-$(HAVE_TCL) |
| 1674 | tcl: libtcl |
| 1675 | all: tcl |
| 1676 | |
| 1677 | install-tcl-1: $(libtclsqlite3.DLL) pkgIndex.tcl |
| 1678 | $(T.tcl.env.source); \ |
| 1679 | $(INSTALL) -d "$(DESTDIR)$$TCLLIBDIR"; \ |
| 1680 | $(INSTALL) $(libtclsqlite3.DLL) "$(DESTDIR)$$TCLLIBDIR"; \ |
| 1681 | $(INSTALL.noexec) pkgIndex.tcl "$(DESTDIR)$$TCLLIBDIR" |
| 1682 | install-tcl-0 install-tcl-: |
| 1683 | @echo "TCL support disabled, so not installing $(libtclsqlite3.DLL)" |
| 1684 | install-tcl: install-tcl-$(HAVE_TCL) |
| 1685 | install: install-tcl |
| 1686 | |
| 1687 | TCLSQLITEEX = \ |
| 1688 | $(TOP)/ext/qrf/qrf.h \ |
| 1689 | $(TOP)/ext/qrf/qrf.c \ |
| 1690 | $(TOP)/src/tclsqlite.c |
| 1691 | |
| 1692 | tclsqlite-ex.c: $(TCLSQLITEEX) $(TOP)/tool/mkcombo.tcl $(B.tclsh) |
| 1693 | $(B.tclsh) $(TOP)/tool/mkcombo.tcl $(TCLSQLITEEX) -o $@ |
| 1694 | |
| 1695 | tclsqlite3.c: sqlite3.c tclsqlite-ex.c |
| 1696 | echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c |
| 1697 | cat sqlite3.c >>tclsqlite3.c |
| 1698 | echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite3.c |
| 1699 | cat tclsqlite-ex.c >>tclsqlite3.c |
| 1700 | |
| 1701 | # |
| 1702 | # $(CFLAGS.tclextension) = CFLAGS for the tclextension* targets. |
| 1703 | # |
| 1704 | CFLAGS.tclextension = $(CFLAGS.intree_includes) $(CFLAGS.env) \ |
| 1705 | $(OPT_FEATURE_FLAGS) $(OPTS) $(CFLAGS.icu) |
| 1706 | # |
| 1707 | # Build the SQLite TCL extension in a way that make it compatible |
| 1708 | # with whatever version of TCL is running as $TCLSH_CMD, possibly defined |
| 1709 | # by --with-tclsh=/path/to/tclsh. |
| 1710 | # |
| 1711 | tclextension: tclsqlite3.c |
| 1712 | $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --build-only \ |
| 1713 | --tclConfig.sh $(TCL_CONFIG_SH) --cc "$(T.cc)" \ |
| 1714 | --extlibs "$(LDFLAGS.icu)" $(CFLAGS.tclextension) |
| 1715 | |
| 1716 | # |
| 1717 | # Install the SQLite TCL extension in a way that is appropriate for $TCLSH_CMD |
| 1718 | # to find it. |
| 1719 | # |
| 1720 | tclextension-install: tclsqlite3.c |
| 1721 | $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --destdir "$(DESTDIR)" \ |
| 1722 | --tclConfig.sh $(TCL_CONFIG_SH) --cc "$(T.cc)" \ |
| 1723 | --extlibs "$(LDFLAGS.icu)" $(CFLAGS.tclextension) |
| 1724 | |
| 1725 | # |
| 1726 | # Uninstall the SQLite TCL extension that is used by $TCLSH_CMD. |
| 1727 | # |
| 1728 | tclextension-uninstall: |
| 1729 | $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --uninstall \ |
| 1730 | --tclConfig.sh $(TCL_CONFIG_SH) |
| 1731 | |
| 1732 | # |
| 1733 | # List all installed the SQLite TCL extensions that is are accessible |
| 1734 | # by $TCLSH_CMD, including prior versions. |
| 1735 | # |
| 1736 | tclextension-list: |
| 1737 | @ $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --info \ |
| 1738 | --tclConfig.sh $(TCL_CONFIG_SH) |
| 1739 | |
| 1740 | # Verify that the SQLite TCL extension that is loaded by default |
| 1741 | # in $(TCLSH_CMD) is the same as the version of SQLite for the |
| 1742 | # current source tree |
| 1743 | # |
| 1744 | tclextension-verify: sqlite3.h |
| 1745 | @ $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --version-check \ |
| 1746 | --tclConfig.sh $(TCL_CONFIG_SH) |
| 1747 | |
| 1748 | # Run all of the tclextension targets in order, ending with uninstall. |
| 1749 | tclextension-all: |
| 1750 | $(MAKE) tclextension |
| 1751 | $(MAKE) tclextension-install |
| 1752 | $(MAKE) tclextension-list |
| 1753 | $(MAKE) tclextension-verify |
| 1754 | $(MAKE) tclextension-uninstall |
| 1755 | |
| 1756 | # |
| 1757 | # FTS5 things |
| 1758 | # |
| 1759 | FTS5_SRC = \ |
| 1760 | $(TOP)/ext/fts5/fts5.h \ |
| 1761 | $(TOP)/ext/fts5/fts5Int.h \ |
| 1762 | $(TOP)/ext/fts5/fts5_aux.c \ |
| 1763 | $(TOP)/ext/fts5/fts5_buffer.c \ |
| 1764 | $(TOP)/ext/fts5/fts5_main.c \ |
| 1765 | $(TOP)/ext/fts5/fts5_config.c \ |
| 1766 | $(TOP)/ext/fts5/fts5_expr.c \ |
| 1767 | $(TOP)/ext/fts5/fts5_hash.c \ |
| 1768 | $(TOP)/ext/fts5/fts5_index.c \ |
| 1769 | fts5parse.c fts5parse.h \ |
| 1770 | $(TOP)/ext/fts5/fts5_storage.c \ |
| 1771 | $(TOP)/ext/fts5/fts5_tokenize.c \ |
| 1772 | $(TOP)/ext/fts5/fts5_unicode2.c \ |
| 1773 | $(TOP)/ext/fts5/fts5_varint.c \ |
| 1774 | $(TOP)/ext/fts5/fts5_vocab.c \ |
| 1775 | |
| 1776 | fts5parse.c: $(TOP)/ext/fts5/fts5parse.y lemon$(B.exe) |
| 1777 | cp $(TOP)/ext/fts5/fts5parse.y . |
| 1778 | rm -f fts5parse.h |
| 1779 | ./lemon$(B.exe) $(OPTS) -S fts5parse.y |
| 1780 | |
| 1781 | fts5parse.h: fts5parse.c |
| 1782 | |
| 1783 | fts5.c: $(FTS5_SRC) $(B.tclsh) |
| 1784 | $(B.tclsh) $(TOP)/ext/fts5/tool/mkfts5c.tcl |
| 1785 | cp $(TOP)/ext/fts5/fts5.h . |
| 1786 | |
| 1787 | fts5.o: fts5.c $(DEPS_OBJ_COMMON) $(EXTHDR) |
| 1788 | $(T.cc.extension) -c fts5.c |
| 1789 | |
| 1790 | # |
| 1791 | # vec1 loadable extension. Not part of the amalgamation or any |
| 1792 | # distributed package; built only by explicitly running "make vec1.so". |
| 1793 | # |
| 1794 | # If $(CFLAGS.vec1.avx2) is not empty (configure sets it to "-mavx2 |
| 1795 | # -mfma" when the compiler accepts them), vec1.c is compiled twice - |
| 1796 | # once with scalar code and once with AVX2 - and both objects linked |
| 1797 | # into a single extension that picks one at runtime based on the CPU. |
| 1798 | # Otherwise a single scalar-only build is done. |
| 1799 | # |
| 1800 | # Deliberately does not use $(T.cc.extension), as that defines |
| 1801 | # SQLITE_CORE, which is wrong for a loadable extension. |
| 1802 | # |
| 1803 | # $(CFLAGS.vec1.opt) is appended after $(CFLAGS), so it overrides any |
| 1804 | # -O option there (e.g. configure's default -O2). vec1 relies on the |
| 1805 | # unrolling and inlining that -O3 provides. To build with the -O level |
| 1806 | # from $(CFLAGS) instead, pass "CFLAGS.vec1.opt=" to make. |
| 1807 | # |
| 1808 | CFLAGS.vec1.avx2 ?= |
| 1809 | CFLAGS.vec1.opt ?= -O3 |
| 1810 | T.cc.vec1 = $(T.compile) -I. -I$(TOP)/src $(CFLAGS.vec1.opt) |
| 1811 | vec1$(T.dll): $(TOP)/ext/vec1/vec1.c sqlite3.h |
| 1812 | @if test -n "$(CFLAGS.vec1.avx2)"; then set -x; \ |
| 1813 | $(T.cc.vec1) -DVEC1SIMD=SCALAR -c $(TOP)/ext/vec1/vec1.c \ |
| 1814 | -o vec1-scalar.o || exit $$?; \ |
| 1815 | $(T.cc.vec1) -DVEC1SIMD=AVX2 $(CFLAGS.vec1.avx2) \ |
| 1816 | -c $(TOP)/ext/vec1/vec1.c -o vec1-avx2.o || exit $$?; \ |
| 1817 | $(T.compile) $(LDFLAGS.shlib) -o $@ vec1-scalar.o vec1-avx2.o \ |
| 1818 | $(LDFLAGS.math) $(LDFLAGS.pthread) || exit $$?; \ |
| 1819 | else set -x; \ |
| 1820 | $(T.cc.vec1) $(LDFLAGS.shlib) -o $@ $(TOP)/ext/vec1/vec1.c \ |
| 1821 | $(LDFLAGS.math) $(LDFLAGS.pthread) || exit $$?; \ |
| 1822 | fi |
| 1823 | |
| 1824 | sqlite3rbu.o: $(TOP)/ext/rbu/sqlite3rbu.c $(DEPS_OBJ_COMMON) $(EXTHDR) |
| 1825 | $(T.cc.extension) -c $(TOP)/ext/rbu/sqlite3rbu.c |
| 1826 | |
| 1827 | |
| 1828 | # |
| 1829 | # Rules to build the 'testfixture' application. |
| 1830 | # |
| 1831 | # If using the amalgamation, use sqlite3.c directly to build the test |
| 1832 | # fixture. Otherwise link against libsqlite3.a. (This distinction is |
| 1833 | # necessary because the test fixture requires non-API symbols which are |
| 1834 | # hidden when the library is built via the amalgamation). |
| 1835 | # |
| 1836 | TESTFIXTURE_FLAGS = -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 |
| 1837 | TESTFIXTURE_FLAGS += -DTCLSH_INIT_PROC=sqlite3TestInit |
| 1838 | TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE |
| 1839 | TESTFIXTURE_FLAGS += -DBUILD_sqlite |
| 1840 | TESTFIXTURE_FLAGS += -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 |
| 1841 | TESTFIXTURE_FLAGS += -DSQLITE_DEFAULT_PAGE_SIZE=1024 |
| 1842 | TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_STMTVTAB |
| 1843 | TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_DBPAGE_VTAB |
| 1844 | TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_BYTECODE_VTAB |
| 1845 | TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_CARRAY |
| 1846 | TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_PERCENTILE |
| 1847 | TESTFIXTURE_FLAGS += -DSQLITE_CKSUMVFS_STATIC |
| 1848 | TESTFIXTURE_FLAGS += -DSQLITE_STATIC_RANDOMJSON |
| 1849 | TESTFIXTURE_FLAGS += -DSQLITE_STRICT_SUBTYPE=1 |
| 1850 | |
| 1851 | TESTFIXTURE_SRC0 = $(TESTSRC2) $(libsqlite3.LIB) |
| 1852 | TESTFIXTURE_SRC1 = sqlite3.c |
| 1853 | TESTFIXTURE_SRC = $(TESTSRC) tclsqlite-ex.c |
| 1854 | TESTFIXTURE_SRC += $(TESTFIXTURE_SRC$(USE_AMALGAMATION)) |
| 1855 | |
| 1856 | testfixture$(T.exe): $(T.tcl.env.sh) has_tclsh85 $(TESTFIXTURE_SRC) |
| 1857 | $(T.link.tcl) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \ |
| 1858 | -o $@ $(TESTFIXTURE_SRC) \ |
| 1859 | $$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC $$TCL_LIBS \ |
| 1860 | $(LDFLAGS.libsqlite3) |
| 1861 | |
| 1862 | coretestprogs: testfixture$(B.exe) sqlite3$(B.exe) |
| 1863 | |
| 1864 | testprogs: $(TESTPROGS) srcck1$(B.exe) fuzzcheck$(T.exe) sessionfuzz$(T.exe) |
| 1865 | |
| 1866 | |
| 1867 | # |
| 1868 | # Fuzz testing |
| 1869 | # |
| 1870 | # WARNING: When the "fuzztest" target is run by the testrunner.tcl script, |
| 1871 | # it does not actually run this code. Instead, it schedules equivalent |
| 1872 | # commands. Therefore, if this target is updated, then code in |
| 1873 | # testrunner_data.tcl (search for "trd_fuzztest_data") must also be updated. |
| 1874 | # |
| 1875 | fuzztest: fuzzcheck$(T.exe) $(FUZZDATA) sessionfuzz$(T.exe) |
| 1876 | ./fuzzcheck$(T.exe) $(FUZZDATA) |
| 1877 | ./sessionfuzz$(T.exe) run $(TOP)/test/sessionfuzz-data1.db |
| 1878 | |
| 1879 | valgrindfuzz: fuzzcheck$(T.exe) $(FUZZDATA) sessionfuzz$(T.exe) |
| 1880 | valgrind ./fuzzcheck$(T.exe) --cell-size-check --limit-mem 10M $(FUZZDATA) |
| 1881 | valgrind ./sessionfuzz$(T.exe) run $(TOP)/test/sessionfuzz-data1.db |
| 1882 | |
| 1883 | # |
| 1884 | # The veryquick.test TCL tests. |
| 1885 | # |
| 1886 | tcltest: ./testfixture$(T.exe) |
| 1887 | ./testfixture$(T.exe) $(TOP)/test/veryquick.test $(TESTOPTS) |
| 1888 | |
| 1889 | # |
| 1890 | # Runs all the same tests cases as the "tcltest" target but uses |
| 1891 | # the testrunner.tcl script to run them in multiple cores |
| 1892 | # concurrently. |
| 1893 | testrunner: testfixture$(T.exe) |
| 1894 | ./testfixture$(T.exe) $(TOP)/test/testrunner.tcl |
| 1895 | |
| 1896 | # |
| 1897 | # This is the testing target preferred by the core SQLite developers. |
| 1898 | # It runs tests under a standard configuration, regardless of how |
| 1899 | # ./configure was run. The devs run "make devtest" prior to each |
| 1900 | # check-in, at a minimum. Probably other tests too, but at least this |
| 1901 | # one. |
| 1902 | # |
| 1903 | devtest: srctree-check sourcetest |
| 1904 | $(TCLSH_CMD) $(TOP)/test/testrunner.tcl mdevtest $(TSTRNNR_OPTS) |
| 1905 | |
| 1906 | mdevtest: srctree-check has_tclsh85 |
| 1907 | $(TCLSH_CMD) $(TOP)/test/testrunner.tcl mdevtest $(TSTRNNR_OPTS) |
| 1908 | |
| 1909 | sdevtest: has_tclsh85 |
| 1910 | $(TCLSH_CMD) $(TOP)/test/testrunner.tcl sdevtest $(TSTRNNR_OPTS) |
| 1911 | |
| 1912 | retest: has_tclsh85 |
| 1913 | $(TCLSH_CMD) $(TOP)/test/testrunner.tcl retest |
| 1914 | |
| 1915 | errors: |
| 1916 | $(TCLSH_CMD) $(TOP)/test/testrunner.tcl errors |
| 1917 | |
| 1918 | status: |
| 1919 | $(TCLSH_CMD) $(TOP)/test/testrunner.tcl status -d 2 |
| 1920 | |
| 1921 | # Like releasetest, except it omits srctree-check and verify-source so |
| 1922 | # that it can be used on a modified source tree. |
| 1923 | # |
| 1924 | xdevtest: has_tclsh85 |
| 1925 | $(TCLSH_CMD) $(TOP)/test/testrunner.tcl release $(TSTRNNR_OPTS) |
| 1926 | |
| 1927 | # |
| 1928 | # Validate that various generated files in the source tree |
| 1929 | # are up-to-date. |
| 1930 | # |
| 1931 | srctree-check: $(TOP)/tool/srctree-check.tcl |
| 1932 | $(TCLSH_CMD) $(TOP)/tool/srctree-check.tcl |
| 1933 | |
| 1934 | # |
| 1935 | # Testing for a release |
| 1936 | # |
| 1937 | releasetest: srctree-check has_tclsh85 verify-source |
| 1938 | $(TCLSH_CMD) $(TOP)/test/testrunner.tcl release $(TSTRNNR_OPTS) |
| 1939 | |
| 1940 | # |
| 1941 | # Legacy testing targets, no longer used by the developers and |
| 1942 | # now aliased to one of the commonly used testing targets. |
| 1943 | # |
| 1944 | quicktest: devtest |
| 1945 | test: devtest |
| 1946 | fulltest: releasetest |
| 1947 | alltest: releasetest |
| 1948 | soaktest: releasetest |
| 1949 | fulltestonly: releasetest |
| 1950 | |
| 1951 | # |
| 1952 | # Run a test using valgrind. This can take a really long time |
| 1953 | # because valgrind is so much slower than a native machine. |
| 1954 | # |
| 1955 | valgrindtest: $(TESTPROGS) valgrindfuzz |
| 1956 | OMIT_MISUSE=1 valgrind -v ./testfixture$(T.exe) $(TOP)/test/permutations.test valgrind $(TESTOPTS) |
| 1957 | |
| 1958 | # |
| 1959 | # A very fast test that checks basic sanity. The name comes from |
| 1960 | # the 60s-era electronics testing: "Turn it on and see if smoke |
| 1961 | # comes out." |
| 1962 | # |
| 1963 | smoketest: $(TESTPROGS) fuzzcheck$(T.exe) |
| 1964 | ./testfixture$(T.exe) $(TOP)/test/main.test $(TESTOPTS) |
| 1965 | |
| 1966 | shelltest: |
| 1967 | $(TCLSH_CMD) $(TOP)/test/testrunner.tcl release shell |
| 1968 | |
| 1969 | # Test performance of floating-point conversions. |
| 1970 | # |
| 1971 | fp-speed-test: fp-speed-1$(T.exe) fp-speed-2$(T.exe) |
| 1972 | ./fp-speed-1 1000000 |
| 1973 | ./fp-speed-2 1000000 |
| 1974 | |
| 1975 | # |
| 1976 | # sqlite3_analyzer.c build depends on $(LINK_TOOLS_DYNAMICALLY). |
| 1977 | # |
| 1978 | sqlite3_analyzer.c.flags.0 = -DINCLUDE_SQLITE3_C=1 |
| 1979 | sqlite3_analyzer.c.flags.1 = |
| 1980 | sqlite3_analyzer.c: sqlite3.c tclsqlite-ex.c $(TOP)/tool/spaceanal.tcl \ |
| 1981 | $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in |
| 1982 | $(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in \ |
| 1983 | $(sqlite3_analyzer.c.flags.$(LINK_TOOLS_DYNAMICALLY)) \ |
| 1984 | $(OPT_FEATURE_FLAGS) \ |
| 1985 | > $@ |
| 1986 | |
| 1987 | # |
| 1988 | # sqlite3_analyzer's build mode depends on $(LINK_TOOLS_DYNAMICALLY). |
| 1989 | # |
| 1990 | sqlite3_analyzer.flags.1 = -L. -lsqlite3 |
| 1991 | sqlite3_analyzer.flags.0 = $(LDFLAGS.libsqlite3) |
| 1992 | sqlite3_analyzer.deps.1 = $(libsqlite3.DLL) |
| 1993 | sqlite3_analyzer.deps.0 = |
| 1994 | sqlite3_analyzer$(T.exe): $(T.tcl.env.sh) sqlite3_analyzer.c \ |
| 1995 | $(sqlite3_analyzer.deps.$(LINK_TOOLS_DYNAMICALLY)) |
| 1996 | $(T.link.tcl) sqlite3_analyzer.c -o $@ \ |
| 1997 | $(sqlite3_analyzer.flags.$(LINK_TOOLS_DYNAMICALLY)) \ |
| 1998 | $$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC $$TCL_LIBS |
| 1999 | # ^^^^ the order of those flags is relevant for |
| 2000 | # $(sqlite3_analyzer.flags.1): if the $$TCL_... flags come first they |
| 2001 | # can cause the $@ to link to an out-of-tree libsqlite3.so, which may |
| 2002 | # or may not fail or otherwise cause confusion. |
| 2003 | |
| 2004 | sqltclsh.c: sqlite3.c tclsqlite-ex.c $(TOP)/tool/sqltclsh.tcl \ |
| 2005 | $(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl \ |
| 2006 | $(TOP)/tool/sqltclsh.c.in |
| 2007 | $(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in >sqltclsh.c |
| 2008 | |
| 2009 | sqltclsh$(T.exe): $(T.tcl.env.sh) sqltclsh.c |
| 2010 | $(T.link.tcl) sqltclsh.c -o $@ $$TCL_INCLUDE_SPEC \ |
| 2011 | $(LDFLAGS.libsqlite3) $$TCL_LIB_SPEC $$TCL_LIBS |
| 2012 | # xbin: target for generic binaries which aren't usually built. It is |
| 2013 | # used primarily for testing the build process. |
| 2014 | xbin: sqltclsh$(T.exe) sqlite3_analyzer$(T.exe) |
| 2015 | |
| 2016 | sqlite3_expert$(T.exe): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c \ |
| 2017 | $(TOP)/ext/expert/expert.c sqlite3.c |
| 2018 | $(T.link) $(TOP)/ext/expert/sqlite3expert.c \ |
| 2019 | $(TOP)/ext/expert/expert.c sqlite3.c -o sqlite3_expert $(LDFLAGS.libsqlite3) |
| 2020 | xbin: sqlite3_expert$(T.exe) |
| 2021 | |
| 2022 | dbdump$(T.exe): $(TOP)/ext/misc/dbdump.c sqlite3.o |
| 2023 | $(T.link) -DDBDUMP_STANDALONE -o $@ \ |
| 2024 | $(TOP)/ext/misc/dbdump.c sqlite3.o $(LDFLAGS.libsqlite3) |
| 2025 | xbin: dbdump$(T.exe) |
| 2026 | |
| 2027 | dbtotxt$(T.exe): $(TOP)/tool/dbtotxt.c |
| 2028 | $(T.link)-o $@ $(TOP)/tool/dbtotxt.c $(LDFLAGS.configure) |
| 2029 | xbin: dbtotxt$(T.exe) |
| 2030 | |
| 2031 | showdb$(T.exe): $(TOP)/tool/showdb.c sqlite3.o |
| 2032 | $(T.link) -o $@ $(TOP)/tool/showdb.c sqlite3.o $(LDFLAGS.libsqlite3) |
| 2033 | xbin: showdb$(T.exe) |
| 2034 | |
| 2035 | showstat4$(T.exe): $(TOP)/tool/showstat4.c sqlite3.o |
| 2036 | $(T.link) -o $@ $(TOP)/tool/showstat4.c sqlite3.o $(LDFLAGS.libsqlite3) |
| 2037 | xbin: showstat4$(T.exe) |
| 2038 | |
| 2039 | showjournal$(T.exe): $(TOP)/tool/showjournal.c sqlite3.o |
| 2040 | $(T.link) -o $@ $(TOP)/tool/showjournal.c sqlite3.o $(LDFLAGS.libsqlite3) |
| 2041 | xbin: showjournal$(T.exe) |
| 2042 | |
| 2043 | showwal$(T.exe): $(TOP)/tool/showwal.c sqlite3.o |
| 2044 | $(T.link) -o $@ $(TOP)/tool/showwal.c sqlite3.o $(LDFLAGS.libsqlite3) |
| 2045 | xbin: showwal$(T.exe) |
| 2046 | |
| 2047 | showshm$(T.exe): $(TOP)/tool/showshm.c |
| 2048 | $(T.link) -o $@ $(TOP)/tool/showshm.c $(LDFLAGS.configure) |
| 2049 | xbin: showshm$(T.exe) |
| 2050 | |
| 2051 | showtmlog$(T.exe): $(TOP)/tool/showtmlog.c |
| 2052 | $(T.link) -o $@ $(TOP)/tool/showtmlog.c $(LDFLAGS.configure) |
| 2053 | xbin: showshm$(T.exe) |
| 2054 | |
| 2055 | index_usage$(T.exe): $(TOP)/tool/index_usage.c sqlite3.o |
| 2056 | $(T.link) $(SHELL_OPT) -o $@ $(TOP)/tool/index_usage.c sqlite3.o \ |
| 2057 | $(LDFLAGS.libsqlite3) |
| 2058 | xbin: index_usage$(T.exe) |
| 2059 | |
| 2060 | # Reminder: changeset does not build without -DSQLITE_ENABLE_SESSION |
| 2061 | changeset$(T.exe): $(TOP)/ext/session/changeset.c sqlite3.o |
| 2062 | $(T.link) -o $@ $(TOP)/ext/session/changeset.c sqlite3.o \ |
| 2063 | $(LDFLAGS.libsqlite3) |
| 2064 | xbin: changeset$(T.exe) |
| 2065 | |
| 2066 | changesetfuzz$(T.exe): $(TOP)/ext/session/changesetfuzz.c sqlite3.o |
| 2067 | $(T.link) -o $@ $(TOP)/ext/session/changesetfuzz.c sqlite3.o \ |
| 2068 | $(LDFLAGS.libsqlite3) |
| 2069 | xbin: changesetfuzz$(T.exe) |
| 2070 | |
| 2071 | rollback-test$(T.exe): $(TOP)/tool/rollback-test.c sqlite3.o |
| 2072 | $(T.link) -o $@ $(TOP)/tool/rollback-test.c sqlite3.o $(LDFLAGS.libsqlite3) |
| 2073 | xbin: rollback-test$(T.exe) |
| 2074 | |
| 2075 | atrc$(T.exe): $(TOP)/test/atrc.c sqlite3.o |
| 2076 | $(T.link) -o $@ $(TOP)/test/atrc.c sqlite3.o $(LDFLAGS.libsqlite3) |
| 2077 | xbin: atrc$(T.exe) |
| 2078 | |
| 2079 | LogEst$(T.exe): $(TOP)/tool/logest.c sqlite3.h |
| 2080 | $(T.link) -I. -o $@ $(TOP)/tool/logest.c $(LDFLAGS.configure) |
| 2081 | xbin: LogEst$(T.exe) |
| 2082 | |
| 2083 | wordcount$(T.exe): $(TOP)/test/wordcount.c sqlite3.o |
| 2084 | $(T.link) -o $@ $(TOP)/test/wordcount.c sqlite3.o $(LDFLAGS.libsqlite3) |
| 2085 | xbin: wordcount$(T.exe) |
| 2086 | |
| 2087 | speedtest1$(T.exe): $(TOP)/test/speedtest1.c sqlite3.c Makefile |
| 2088 | $(T.link) $(ST_OPT) -o $@ $(TOP)/test/speedtest1.c sqlite3.c \ |
| 2089 | $(LDFLAGS.libsqlite3) |
| 2090 | xbin: speedtest1$(T.exe) |
| 2091 | |
| 2092 | fp-speed-1$(T.exe): $(TOP)/test/fp-speed-1.c sqlite3.o Makefile |
| 2093 | $(T.link) $(ST_OPT) -o $@ $(TOP)/test/fp-speed-1.c sqlite3.o \ |
| 2094 | $(LDFLAGS.libsqlite3) |
| 2095 | |
| 2096 | fp-speed-2$(T.exe): $(TOP)/test/fp-speed-2.c sqlite3.o Makefile |
| 2097 | $(T.link) $(ST_OPT) -o $@ $(TOP)/test/fp-speed-2.c sqlite3.o \ |
| 2098 | $(LDFLAGS.libsqlite3) |
| 2099 | |
| 2100 | startup$(T.exe): $(TOP)/test/startup.c sqlite3.c |
| 2101 | $(T.link) -Os -g -USQLITE_THREADSAFE -DSQLITE_THREADSAFE=0 \ |
| 2102 | -o $@ $(TOP)/test/startup.c sqlite3.c $(LDFLAGS.libsqlite3) |
| 2103 | xbin: startup$(T.exe) |
| 2104 | |
| 2105 | KV_OPT += -DSQLITE_DIRECT_OVERFLOW_READ |
| 2106 | |
| 2107 | kvtest$(T.exe): $(TOP)/test/kvtest.c sqlite3.c |
| 2108 | $(T.link) $(KV_OPT) -o $@ $(TOP)/test/kvtest.c sqlite3.c \ |
| 2109 | $(LDFLAGS.libsqlite3) |
| 2110 | xbin: kvtest$(T.exe) |
| 2111 | |
| 2112 | # |
| 2113 | # rbu$(T.exe) requires building with -DSQLITE_ENABLE_RBU, which |
| 2114 | # specifically does not have an --enable-rbu flag in the configure |
| 2115 | # script. |
| 2116 | rbu$(T.exe): $(TOP)/ext/rbu/rbu.c $(TOP)/ext/rbu/sqlite3rbu.c sqlite3.o |
| 2117 | $(T.link) -I. -o $@ $(TOP)/ext/rbu/rbu.c sqlite3.o $(LDFLAGS.libsqlite3) |
| 2118 | |
| 2119 | loadfts$(T.exe): $(TOP)/tool/loadfts.c $(libsqlite3.LIB) |
| 2120 | $(T.link) $(TOP)/tool/loadfts.c $(libsqlite3.LIB) \ |
| 2121 | -o $@ $(LDFLAGS.libsqlite3) |
| 2122 | xbin: loadfts$(T.exe) |
| 2123 | |
| 2124 | # This target will fail if the SQLite amalgamation contains any exported |
| 2125 | # symbols that do not begin with "sqlite3_". It is run as part of the |
| 2126 | # releasetest.tcl script. |
| 2127 | # |
| 2128 | VALIDIDS=' sqlite3(changeset|changegroup|session|rebaser)?_' |
| 2129 | checksymbols: sqlite3.o |
| 2130 | nm -g --defined-only sqlite3.o |
| 2131 | nm -g --defined-only sqlite3.o | egrep -v $(VALIDIDS); test $$? -ne 0 |
| 2132 | echo '0 errors out of 1 tests' |
| 2133 | |
| 2134 | # Build the amalgamation-autoconf package. The amalgamation-tarball target builds |
| 2135 | # a tarball named for the version number. Ex: sqlite-autoconf-3110000.tar.gz. |
| 2136 | # The snapshot-tarball target builds a tarball named by the SHA3 hash |
| 2137 | # |
| 2138 | amalgamation-tarball: sqlite3.c sqlite3rc.h |
| 2139 | TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh --normal |
| 2140 | |
| 2141 | snapshot-tarball: sqlite3.c sqlite3rc.h |
| 2142 | TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh --snapshot |
| 2143 | |
| 2144 | # Build a ZIP archive snapshot of the latest check-in. |
| 2145 | # |
| 2146 | sqlite-src.zip: $(TOP)/tool/mksrczip.tcl |
| 2147 | $(TCLSH_CMD) $(TOP)/tool/mksrczip.tcl |
| 2148 | |
| 2149 | # Build a ZIP archive of the amalgamation |
| 2150 | # |
| 2151 | sqlite-amalgamation.zip: $(TOP)/tool/mkamalzip.tcl sqlite3.c sqlite3.h shell.c sqlite3ext.h |
| 2152 | $(TCLSH_CMD) $(TOP)/tool/mkamalzip.tcl |
| 2153 | |
| 2154 | # Build all the source code deliverables |
| 2155 | # |
| 2156 | src-archives: sqlite-amalgamation.zip amalgamation-tarball sqlite-src.zip |
| 2157 | ls -ltr *.zip *.tar.gz | tail -3 |
| 2158 | |
| 2159 | # Build a ZIP archive containing various command-line tools. |
| 2160 | # |
| 2161 | tool-zip: sqlite3$(T.exe) sqldiff$(T.exe) \ |
| 2162 | sqlite3_rsync$(T.exe) $(TOP)/tool/mktoolzip.tcl |
| 2163 | strip sqlite3$(T.exe) sqldiff$(T.exe) sqlite3_rsync$(T.exe) |
| 2164 | $(TCLSH_CMD) $(TOP)/tool/mktoolzip.tcl |
| 2165 | |
| 2166 | snapshot-zip: testfixture$(T.exe) sqlite3$(T.exe) sqldiff$(T.exe) \ |
| 2167 | sqlite3_rsync$(T.exe) $(TOP)/tool/mktoolzip.tcl |
| 2168 | strip sqlite3$(T.exe) sqldiff$(T.exe) sqlite3_rsync$(T.exe) |
| 2169 | $(TCLSH_CMD) $(TOP)/tool/mktoolzip.tcl --snapshot |
| 2170 | |
| 2171 | clean-tool-zip: |
| 2172 | rm -f sqlite-tools-*.zip |
| 2173 | |
| 2174 | clean: clean-tool-zip |
| 2175 | |
| 2176 | # |
| 2177 | # The next few rules are used to support the "threadtest" target. Building |
| 2178 | # threadtest runs a few thread-safety tests that are implemented in C. This |
| 2179 | # target is invoked by the releasetest.tcl script. |
| 2180 | # |
| 2181 | THREADTEST3_SRC = $(TOP)/test/threadtest3.c \ |
| 2182 | $(TOP)/test/tt3_checkpoint.c \ |
| 2183 | $(TOP)/test/tt3_index.c \ |
| 2184 | $(TOP)/test/tt3_vacuum.c \ |
| 2185 | $(TOP)/test/tt3_stress.c \ |
| 2186 | $(TOP)/test/tt3_lookaside1.c |
| 2187 | |
| 2188 | threadtest3$(T.exe): sqlite3.o $(THREADTEST3_SRC) |
| 2189 | $(T.link) $(TOP)/test/threadtest3.c $(TOP)/src/test_multiplex.c sqlite3.o \ |
| 2190 | -o $@ $(LDFLAGS.libsqlite3) |
| 2191 | xbin: threadtest3$(T.exe) |
| 2192 | |
| 2193 | threadtest: threadtest3$(T.exe) |
| 2194 | ./threadtest3$(T.exe) |
| 2195 | |
| 2196 | threadtest5: sqlite3.c $(TOP)/test/threadtest5.c |
| 2197 | $(T.link) $(TOP)/test/threadtest5.c sqlite3.c -o $@ $(LDFLAGS.libsqlite3) |
| 2198 | xbin: threadtest5 |
| 2199 | |
| 2200 | # |
| 2201 | # STATIC_CLI_SHELL = 1 to statically link sqlite3$(T.exe), else |
| 2202 | # 0. Requires static versions of all requisite libraries. Primarily |
| 2203 | # intended for use with static-friendly environments like Alpine |
| 2204 | # Linux. |
| 2205 | # |
| 2206 | STATIC_CLI_SHELL ?= 0 |
| 2207 | # |
| 2208 | # sqlite3-shell-static.flags.N = N is $(STATIC_CLI_SHELL) |
| 2209 | # |
| 2210 | sqlite3-shell-static.flags.1 = -static |
| 2211 | sqlite3-shell-static.flags.0 = |
| 2212 | # |
| 2213 | # When building sqlite3$(T.exe) we specifically embed a copy of |
| 2214 | # sqlite3.c, and not link to libsqlite3.so or libsqlite3.a, because |
| 2215 | # the shell needs to be able to enable arbitrary library features, |
| 2216 | # some of which have significant performance impacts. For example,, |
| 2217 | # SQLITE_ENABLE_EXPLAIN_COMMENTS has been measured as having a 5.2% |
| 2218 | # runtime performance hit, which is fine for use in the shell but is |
| 2219 | # not appropriate for the canonical library build. |
| 2220 | # |
| 2221 | sqlite3$(T.exe): shell.c sqlite3.c |
| 2222 | $(T.link) -o $@ \ |
| 2223 | shell.c sqlite3.c \ |
| 2224 | $(sqlite3-shell-static.flags.$(STATIC_CLI_SHELL)) \ |
| 2225 | $(CFLAGS.readline) $(SHELL_OPT) $(CFLAGS.icu) \ |
| 2226 | $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) |
| 2227 | # |
| 2228 | # Build sqlite3$(T.exe) by default except in wasi-sdk builds. Yes, the |
| 2229 | # semantics of 0 and 1 are confusingly swapped here. |
| 2230 | # |
| 2231 | sqlite3$(T.exe)-1: |
| 2232 | sqlite3$(T.exe)-0: sqlite3$(T.exe) |
| 2233 | all: sqlite3$(T.exe)-$(HAVE_WASI_SDK) |
| 2234 | |
| 2235 | # The "sqlite3d" CLI is build using separate source files. This |
| 2236 | # is useful during development and debugging. |
| 2237 | # |
| 2238 | sqlite3d$(T.exe): shell.c $(LIBOBJS0) |
| 2239 | $(T.link) -o $@ \ |
| 2240 | shell.c $(LIBOBJS0) \ |
| 2241 | $(CFLAGS.readline) $(SHELL_OPT) \ |
| 2242 | $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) |
| 2243 | |
| 2244 | install-shell-0: sqlite3$(T.exe) $(install-dir.bin) |
| 2245 | $(INSTALL) sqlite3$(T.exe) "$(install-dir.bin)" |
| 2246 | install-shell-1: |
| 2247 | install: install-shell-$(HAVE_WASI_SDK) |
| 2248 | |
| 2249 | # How to build sqldiff$(T.exe) depends on $(LINK_TOOLS_DYNAMICALLY) |
| 2250 | # |
| 2251 | sqldiff.0.deps = $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h sqlite3.o sqlite3.h |
| 2252 | sqldiff.0.rules = $(T.link) -o $@ $(TOP)/tool/sqldiff.c sqlite3.o $(LDFLAGS.libsqlite3) |
| 2253 | sqldiff.1.deps = $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h $(libsqlite3.DLL) |
| 2254 | sqldiff.1.rules = $(T.link) -o $@ $(TOP)/tool/sqldiff.c -L. -lsqlite3 $(LDFLAGS.configure) |
| 2255 | sqldiff$(T.exe): $(sqldiff.$(LINK_TOOLS_DYNAMICALLY).deps) |
| 2256 | $(sqldiff.$(LINK_TOOLS_DYNAMICALLY).rules) |
| 2257 | |
| 2258 | install-diff: sqldiff$(T.exe) $(install-dir.bin) |
| 2259 | $(INSTALL) sqldiff$(T.exe) "$(install-dir.bin)" |
| 2260 | #install: install-diff |
| 2261 | |
| 2262 | dbhash$(T.exe): $(TOP)/tool/dbhash.c sqlite3.o sqlite3.h |
| 2263 | $(T.link) -o $@ $(TOP)/tool/dbhash.c sqlite3.o $(LDFLAGS.libsqlite3) |
| 2264 | xbin: dbhash$(T.exe) |
| 2265 | |
| 2266 | RSYNC_SRC = \ |
| 2267 | $(TOP)/tool/sqlite3_rsync.c \ |
| 2268 | sqlite3.c |
| 2269 | |
| 2270 | RSYNC_OPT = \ |
| 2271 | -DSQLITE_ENABLE_DBPAGE_VTAB \ |
| 2272 | -USQLITE_THREADSAFE \ |
| 2273 | -DSQLITE_THREADSAFE=0 \ |
| 2274 | -DSQLITE_OMIT_LOAD_EXTENSION \ |
| 2275 | -DSQLITE_OMIT_DEPRECATED |
| 2276 | |
| 2277 | sqlite3_rsync$(T.exe): $(RSYNC_SRC) |
| 2278 | $(T.cc.sqlite) -o $@ $(RSYNC_OPT) $(RSYNC_SRC) $(LDFLAGS.libsqlite3) |
| 2279 | xbin: sqlite3_rsync$(T.exe) |
| 2280 | |
| 2281 | install-rsync: sqlite3_rsync$(T.exe) $(install-dir.bin) |
| 2282 | $(INSTALL) sqlite3_rsync$(T.exe) "$(install-dir.bin)" |
| 2283 | #install: install-rsync |
| 2284 | |
| 2285 | install-man1: $(install-dir.man1) |
| 2286 | $(INSTALL.noexec) "$(TOP)/sqlite3.1" "$(install-dir.man1)" |
| 2287 | install: install-man1 |
| 2288 | |
| 2289 | # |
| 2290 | # sqlite3.pc is typically generated by the configure script but could |
| 2291 | # conceivably be generated by hand. |
| 2292 | install-pc: sqlite3.pc $(install-dir.pkgconfig) |
| 2293 | $(INSTALL.noexec) sqlite3.pc "$(install-dir.pkgconfig)" |
| 2294 | |
| 2295 | srcck1$(B.exe): $(TOP)/tool/srcck1.c |
| 2296 | $(B.cc) -o srcck1$(B.exe) $(TOP)/tool/srcck1.c |
| 2297 | xbin: srcck1$(B.exe) |
| 2298 | |
| 2299 | sourcetest: srcck1$(B.exe) sqlite3.c |
| 2300 | ./srcck1$(B.exe) sqlite3.c |
| 2301 | |
| 2302 | src-verify$(B.exe): $(TOP)/tool/src-verify.c |
| 2303 | $(B.cc) -o src-verify$(B.exe) $(TOP)/tool/src-verify.c |
| 2304 | xbin: src-verify$(B.exe) |
| 2305 | |
| 2306 | verify-source: ./src-verify$(B.exe) |
| 2307 | ./src-verify$(B.exe) $(TOP) |
| 2308 | |
| 2309 | fuzzershell$(T.exe): $(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h |
| 2310 | $(T.link) -o $@ $(FUZZERSHELL_OPT) \ |
| 2311 | $(TOP)/tool/fuzzershell.c sqlite3.c $(LDFLAGS.libsqlite3) |
| 2312 | fuzzy: fuzzershell$(T.exe) |
| 2313 | xbin: fuzzershell$(T.exe) |
| 2314 | |
| 2315 | fuzzcheck$(T.exe): $(FUZZCHECK_SRC) $(FUZZCHECK_DEP) |
| 2316 | $(T.link) -o $@ $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) $(LDFLAGS.libsqlite3) |
| 2317 | fuzzy: fuzzcheck$(T.exe) |
| 2318 | xbin: fuzzcheck$(T.exe) |
| 2319 | |
| 2320 | # -fsanitize=... flags for fuzzcheck-asan. |
| 2321 | CFLAGS.fuzzcheck-asan.fsanitize ?= -fsanitize=address |
| 2322 | |
| 2323 | fuzzcheck-asan$(T.exe): $(FUZZCHECK_SRC) $(FUZZCHECK_DEP) |
| 2324 | $(T.link) -o $@ $(CFLAGS.fuzzcheck-asan.fsanitize) $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) \ |
| 2325 | $(LDFLAGS.libsqlite3) |
| 2326 | fuzzy: fuzzcheck-asan$(T.exe) |
| 2327 | xbin: fuzzcheck-asan$(T.exe) |
| 2328 | |
| 2329 | fuzzcheck-ubsan$(T.exe): $(FUZZCHECK_SRC) $(FUZZCHECK_DEP) |
| 2330 | $(T.link) -o $@ -fsanitize=undefined $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) \ |
| 2331 | $(LDFLAGS.libsqlite3) |
| 2332 | fuzzy: fuzzcheck-ubsan$(T.exe) |
| 2333 | xbin: fuzzcheck-ubsan$(T.exe) |
| 2334 | |
| 2335 | |
| 2336 | ossshell$(T.exe): $(TOP)/test/ossfuzz.c $(TOP)/test/ossshell.c sqlite3.c sqlite3.h |
| 2337 | $(T.link) -o $@ $(FUZZCHECK_OPT) $(TOP)/test/ossshell.c \ |
| 2338 | $(TOP)/test/ossfuzz.c sqlite3.c $(LDFLAGS.libsqlite3) |
| 2339 | fuzzy: ossshell$(T.exe) |
| 2340 | xbin: ossshell$(T.exe) |
| 2341 | |
| 2342 | sessionfuzz$(T.exe): $(TOP)/test/sessionfuzz.c sqlite3.c sqlite3.h |
| 2343 | $(T.link) -o $@ $(TOP)/test/sessionfuzz.c $(LDFLAGS.libsqlite3) |
| 2344 | fuzzy: sessionfuzz$(T.exe) |
| 2345 | |
| 2346 | dbfuzz$(T.exe): $(TOP)/test/dbfuzz.c sqlite3.c sqlite3.h |
| 2347 | $(T.link) -o $@ $(DBFUZZ_OPT) $(TOP)/test/dbfuzz.c sqlite3.c \ |
| 2348 | $(LDFLAGS.libsqlite3) |
| 2349 | fuzzy: dbfuzz$(T.exe) |
| 2350 | xbin: dbfuzz$(T.exe) |
| 2351 | |
| 2352 | DBFUZZ2_OPTS = \ |
| 2353 | -USQLITE_THREADSAFE \ |
| 2354 | -DSQLITE_THREADSAFE=0 \ |
| 2355 | -DSQLITE_OMIT_LOAD_EXTENSION \ |
| 2356 | -DSQLITE_DEBUG \ |
| 2357 | -DSQLITE_ENABLE_DBSTAT_VTAB \ |
| 2358 | -DSQLITE_ENABLE_BYTECODE_VTAB \ |
| 2359 | -DSQLITE_ENABLE_RTREE \ |
| 2360 | -DSQLITE_ENABLE_FTS4 \ |
| 2361 | -DSQLITE_ENABLE_FTS5 |
| 2362 | |
| 2363 | dbfuzz2$(T.exe): $(TOP)/test/dbfuzz2.c sqlite3.c sqlite3.h |
| 2364 | $(T.cc) -I. -g -O0 \ |
| 2365 | -DSTANDALONE -o dbfuzz2 \ |
| 2366 | $(DBFUZZ2_OPTS) $(TOP)/test/dbfuzz2.c sqlite3.c $(LDFLAGS.libsqlite3) |
| 2367 | mkdir -p dbfuzz2-dir |
| 2368 | cp $(TOP)/test/dbfuzz2-seed* dbfuzz2-dir |
| 2369 | fuzzy: dbfuzz2$(T.exe) |
| 2370 | xbin: dbfuzz2$(T.exe) |
| 2371 | |
| 2372 | mptester$(T.exe): $(libsqlite3.LIB) $(TOP)/mptest/mptest.c |
| 2373 | $(T.link) -o $@ -I. $(TOP)/mptest/mptest.c $(libsqlite3.LIB) \ |
| 2374 | $(LDFLAGS.libsqlite3) |
| 2375 | xbin: mptester$(T.exe) |
| 2376 | |
| 2377 | MPTEST1=./mptester$(T.exe) mptest.db $(TOP)/mptest/crash01.test --repeat 20 |
| 2378 | MPTEST2=./mptester$(T.exe) mptest.db $(TOP)/mptest/multiwrite01.test --repeat 20 |
| 2379 | mptest: mptester$(T.exe) |
| 2380 | rm -f mptest.db |
| 2381 | $(MPTEST1) --journalmode DELETE |
| 2382 | $(MPTEST2) --journalmode WAL |
| 2383 | $(MPTEST1) --journalmode WAL |
| 2384 | $(MPTEST2) --journalmode PERSIST |
| 2385 | $(MPTEST1) --journalmode PERSIST |
| 2386 | $(MPTEST2) --journalmode TRUNCATE |
| 2387 | $(MPTEST1) --journalmode TRUNCATE |
| 2388 | $(MPTEST2) --journalmode DELETE |
| 2389 | |
| 2390 | # Source and header files that shell.c depends on |
| 2391 | SHELL_DEP = \ |
| 2392 | $(TOP)/src/shell.c.in \ |
| 2393 | $(TOP)/ext/qrf/qrf.c \ |
| 2394 | $(TOP)/ext/qrf/qrf.h \ |
| 2395 | $(TOP)/ext/expert/sqlite3expert.c \ |
| 2396 | $(TOP)/ext/expert/sqlite3expert.h \ |
| 2397 | $(TOP)/ext/intck/sqlite3intck.c \ |
| 2398 | $(TOP)/ext/intck/sqlite3intck.h \ |
| 2399 | $(TOP)/ext/misc/appendvfs.c \ |
| 2400 | $(TOP)/ext/misc/base64.c \ |
| 2401 | $(TOP)/ext/misc/base85.c \ |
| 2402 | $(TOP)/ext/misc/completion.c \ |
| 2403 | $(TOP)/ext/misc/decimal.c \ |
| 2404 | $(TOP)/ext/misc/diskused.c \ |
| 2405 | $(TOP)/ext/misc/fileio.c \ |
| 2406 | $(TOP)/ext/misc/ieee754.c \ |
| 2407 | $(TOP)/ext/misc/memtrace.c \ |
| 2408 | $(TOP)/ext/misc/optname.c \ |
| 2409 | $(TOP)/ext/misc/pcachetrace.c \ |
| 2410 | $(TOP)/ext/misc/regexp.c \ |
| 2411 | $(TOP)/ext/misc/series.c \ |
| 2412 | $(TOP)/ext/misc/sha1.c \ |
| 2413 | $(TOP)/ext/misc/shathree.c \ |
| 2414 | $(TOP)/ext/misc/sqlar.c \ |
| 2415 | $(TOP)/ext/misc/strdup.c \ |
| 2416 | $(TOP)/ext/misc/uint.c \ |
| 2417 | $(TOP)/ext/misc/vfstrace.c \ |
| 2418 | $(TOP)/ext/misc/windirent.h \ |
| 2419 | $(TOP)/ext/misc/zipfile.c \ |
| 2420 | $(TOP)/ext/recover/dbdata.c \ |
| 2421 | $(TOP)/ext/recover/sqlite3recover.c \ |
| 2422 | $(TOP)/ext/recover/sqlite3recover.h |
| 2423 | |
| 2424 | |
| 2425 | shell.c: $(SHELL_DEP) $(TOP)/tool/mkshellc.tcl $(B.tclsh) |
| 2426 | $(B.tclsh) $(TOP)/tool/mkshellc.tcl shell.c |
| 2427 | |
| 2428 | # |
| 2429 | # Rules to build the extension objects. |
| 2430 | # |
| 2431 | DEPS_EXT_COMMON = $(DEPS_OBJ_COMMON) $(EXTHDR) |
| 2432 | icu.o: $(TOP)/ext/icu/icu.c $(DEPS_EXT_COMMON) |
| 2433 | $(T.cc.extension) -c $(TOP)/ext/icu/icu.c $(CFLAGS.icu) |
| 2434 | |
| 2435 | fts3.o: $(TOP)/ext/fts3/fts3.c $(DEPS_EXT_COMMON) |
| 2436 | $(T.cc.extension) -c $(TOP)/ext/fts3/fts3.c |
| 2437 | |
| 2438 | fts3_aux.o: $(TOP)/ext/fts3/fts3_aux.c $(DEPS_EXT_COMMON) |
| 2439 | $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_aux.c |
| 2440 | |
| 2441 | fts3_expr.o: $(TOP)/ext/fts3/fts3_expr.c $(DEPS_EXT_COMMON) |
| 2442 | $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_expr.c |
| 2443 | |
| 2444 | fts3_hash.o: $(TOP)/ext/fts3/fts3_hash.c $(DEPS_EXT_COMMON) |
| 2445 | $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_hash.c |
| 2446 | |
| 2447 | fts3_icu.o: $(TOP)/ext/fts3/fts3_icu.c $(DEPS_EXT_COMMON) |
| 2448 | $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_icu.c $(CFLAGS.icu) |
| 2449 | |
| 2450 | fts3_porter.o: $(TOP)/ext/fts3/fts3_porter.c $(DEPS_EXT_COMMON) |
| 2451 | $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_porter.c |
| 2452 | |
| 2453 | fts3_snippet.o: $(TOP)/ext/fts3/fts3_snippet.c $(DEPS_EXT_COMMON) |
| 2454 | $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_snippet.c |
| 2455 | |
| 2456 | fts3_tokenizer.o: $(TOP)/ext/fts3/fts3_tokenizer.c $(DEPS_EXT_COMMON) |
| 2457 | $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_tokenizer.c |
| 2458 | |
| 2459 | fts3_tokenizer1.o: $(TOP)/ext/fts3/fts3_tokenizer1.c $(DEPS_EXT_COMMON) |
| 2460 | $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_tokenizer1.c |
| 2461 | |
| 2462 | fts3_tokenize_vtab.o: $(TOP)/ext/fts3/fts3_tokenize_vtab.c $(DEPS_EXT_COMMON) |
| 2463 | $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_tokenize_vtab.c |
| 2464 | |
| 2465 | fts3_unicode.o: $(TOP)/ext/fts3/fts3_unicode.c $(DEPS_EXT_COMMON) |
| 2466 | $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_unicode.c |
| 2467 | |
| 2468 | fts3_unicode2.o: $(TOP)/ext/fts3/fts3_unicode2.c $(DEPS_EXT_COMMON) |
| 2469 | $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_unicode2.c |
| 2470 | |
| 2471 | fts3_write.o: $(TOP)/ext/fts3/fts3_write.c $(DEPS_EXT_COMMON) |
| 2472 | $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_write.c |
| 2473 | |
| 2474 | rtree.o: $(TOP)/ext/rtree/rtree.c $(DEPS_EXT_COMMON) |
| 2475 | $(T.cc.extension) -c $(TOP)/ext/rtree/rtree.c |
| 2476 | |
| 2477 | sqlite3session.o: $(TOP)/ext/session/sqlite3session.c $(DEPS_EXT_COMMON) |
| 2478 | $(T.cc.extension) -c $(TOP)/ext/session/sqlite3session.c |
| 2479 | |
| 2480 | stmt.o: $(TOP)/ext/misc/stmt.c $(DEPS_EXT_COMMON) |
| 2481 | $(T.cc.extension) -c $(TOP)/ext/misc/stmt.c |
| 2482 | |
| 2483 | $(AUXTEST): $(TOP)/test/c/$(AUXTEST).c |
| 2484 | $(T.cc.sqlite) -o $@ $(TOP)/test/c/$(AUXTEST).c sqlite3.o $(LDFLAGS.libsqlite3) |
| 2485 | |
| 2486 | |
| 2487 | # |
| 2488 | # Windows section |
| 2489 | # |
| 2490 | # 2025-03-03: sqlite3.def and sqlite3.dll might no longer be relevant |
| 2491 | # in this particular build, but that's difficult to verify. |
| 2492 | # |
| 2493 | dll: sqlite3.dll |
| 2494 | sqlite3.def: $(LIBOBJ) |
| 2495 | echo 'EXPORTS' >sqlite3.def |
| 2496 | nm $(LIBOBJ) | grep ' T ' | grep ' _sqlite3_' \ |
| 2497 | | sed 's/^.* _//' >>sqlite3.def |
| 2498 | |
| 2499 | sqlite3.dll: $(LIBOBJ) sqlite3.def |
| 2500 | $(T.cc.sqlite) $(LDFLAGS.shlib) -o $@ sqlite3.def \ |
| 2501 | -Wl,"--strip-all" $(LIBOBJ) $(LDFLAGS.configure) |
| 2502 | |
| 2503 | # |
| 2504 | # Emit a list of commonly-used targets |
| 2505 | # |
| 2506 | help: |
| 2507 | @echo; echo "Frequently-used high-level make targets:"; echo; \ |
| 2508 | echo " - all [default] = builds most components"; \ |
| 2509 | echo " - clean = cleans up most build products"; \ |
| 2510 | echo " - distclean = cleans up all build products"; \ |
| 2511 | echo " - install = installs activated components"; \ |
| 2512 | echo; echo "Testing-related targets:"; echo; \ |
| 2513 | echo " - test = a number of sanity checks"; \ |
| 2514 | echo " - quicktest = minimal tests"; \ |
| 2515 | echo " - releasetest = pre-release tests"; \ |
| 2516 | echo " - devtest = Minimum tests required before code check-ins"; \ |
| 2517 | echo " - mdevtest = A variant of devtest"; \ |
| 2518 | echo " - sdevtest = A variant of devtest"; \ |
| 2519 | echo " - tcltest = Runs test/veryquick.test"; \ |
| 2520 | echo " - testrunner = Like tcltest but spread across multiple cores"; \ |
| 2521 | echo " - fuzztest = The core fuzz tester (see target docs for important info)"; \ |
| 2522 | echo " - valgrindfuzz = Runs fuzztest under valgrind"; \ |
| 2523 | echo " - soaktest = Really, really long tests"; \ |
| 2524 | echo " - alltest = Runs most or all TCL tests"; \ |
| 2525 | echo |
| 2526 | |
| 2527 | |
| 2528 | # |
| 2529 | # Remove build products sufficient so that subsequent makes will recompile |
| 2530 | # everything from scratch. Do not remove: |
| 2531 | # |
| 2532 | # * test results and test logs |
| 2533 | # * output from ./configure |
| 2534 | # |
| 2535 | # |
| 2536 | tidy: |
| 2537 | rm -f *.o *.obj *.c *.da *.bb *.bbg gmon.* *.rws sqlite3$(T.exe) |
| 2538 | rm -f fts5.h keywordhash.h opcodes.h sqlite3.h sqlite3ext.h sqlite3session.h |
| 2539 | rm -f vec1$(T.dll) |
| 2540 | rm -rf .libs .deps tsrc .target_source |
| 2541 | rm -f lemon$(B.exe) sqlite*.tar.gz |
| 2542 | rm -f mkkeywordhash$(B.exe) mksourceid$(B.exe) |
| 2543 | rm -f parse.* fts5parse.* |
| 2544 | rm -f $(libsqlite3.DLL) $(libsqlite3.LIB) $(libtclsqlite3.DLL) libsqlite3$(T.dll).a |
| 2545 | rm -f tclsqlite3$(T.exe) $(TESTPROGS) |
| 2546 | rm -f LogEst$(T.exe) fts3view$(T.exe) rollback-test$(T.exe) showdb$(T.exe) |
| 2547 | rm -f showjournal$(T.exe) showstat4$(T.exe) showwal$(T.exe) speedtest1$(T.exe) |
| 2548 | rm -f fp-speed-1$(T.exe) fp-speed-2$(T.exe) |
| 2549 | rm -f wordcount$(T.exe) changeset$(T.exe) version-info$(T.exe) |
| 2550 | rm -f *.exp *.vsix pkgIndex.tcl |
| 2551 | rm -f sqlite3_analyzer$(T.exe) sqlite3_rsync$(T.exe) sqlite3_expert$(T.exe) |
| 2552 | rm -f mptester$(T.exe) rbu$(T.exe) srcck1$(T.exe) |
| 2553 | rm -f fuzzershell$(T.exe) fuzzcheck$(T.exe) sqldiff$(T.exe) dbhash$(T.exe) |
| 2554 | rm -f dbfuzz$(T.exe) dbfuzz2$(T.exe) |
| 2555 | rm -fr dbfuzz2-dir |
| 2556 | rm -f fuzzcheck-asan$(T.exe) fuzzcheck-ubsan$(T.exe) ossshell$(T.exe) |
| 2557 | rm -f scrub$(T.exe) showshm$(T.exe) sqlite3_checker$(T.exe) loadfts$(T.exe) |
| 2558 | rm -f index_usage$(T.exe) kvtest$(T.exe) startup$(T.exe) threadtest3$(T.exe) |
| 2559 | rm -f sessionfuzz$(T.exe) changesetfuzz$(T.exe) |
| 2560 | rm -f dbdump$(T.exe) dbtotxt$(T.exe) atrc$(T.exe) |
| 2561 | rm -f threadtest5$(T.exe) |
| 2562 | rm -f src-verify$(B.exe) |
| 2563 | rm -f tclsqlite3.c has_tclsh* $(T.tcl.env.sh) |
| 2564 | rm -f sqlite3rc.h sqlite3.def |
| 2565 | rm -f ctime.c pragma.h |
| 2566 | |
| 2567 | # |
| 2568 | # Removes build products and test logs. Retains ./configure outputs. |
| 2569 | # |
| 2570 | clean: tidy |
| 2571 | rm -rf omittest* testrunner* testrun_* testdir* |
| 2572 | |
| 2573 | # |
| 2574 | # Clean up everything. No exceptions. From an out-of-tree build which |
| 2575 | # starts in an empty directory, this should result in an empty |
| 2576 | # directory (assuming the user does not create new files in this |
| 2577 | # directory). |
| 2578 | # |
| 2579 | # The main distclean rules are in Makefile.in. |
| 2580 | # |
| 2581 | distclean: clean |
| 2582 | |
| 2583 | |
| 2584 | # |
| 2585 | # Show important variable settings. |
| 2586 | # |
| 2587 | show-variables: |
| 2588 | @echo "CC = $(CC)" |
| 2589 | @echo "B.cc = $(B.cc)" |
| 2590 | @echo "T.cc = $(T.cc)" |
| 2591 | @echo "T.cc.sqlite = $(T.cc.sqlite)" |