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 / Makefile.in
| 1 | #!/usr/bin/make |
| 2 | # ^^^^ help out editors which guess this file's type. |
| 3 | # |
| 4 | # Makefile for SQLITE |
| 5 | # |
| 6 | # This makefile is intended to be configured automatically using the |
| 7 | # configure script. |
| 8 | # |
| 9 | # The docs for many of its variables are in the primary static |
| 10 | # makefile, main.mk (which this one includes at runtime). |
| 11 | # |
| 12 | all: |
| 13 | ######################################################################## |
| 14 | # Maintenance reminders: |
| 15 | # |
| 16 | # - This makefile should remain as POSIX-make-compatible as possible: |
| 17 | # https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html |
| 18 | # |
| 19 | # - The naming convention of some vars, using periods instead of |
| 20 | # underscores, though unconventional, was selected for a couple of |
| 21 | # reasons: 1) Personal taste (for which there is no accounting). 2) |
| 22 | # It is thought to help defend against inadvertent injection of |
| 23 | # those vars via environment variables (because X.Y is not a legal |
| 24 | # environment variable name). "Feature or bug?" is debatable and |
| 25 | # this naming convention may be reverted if it causes any grief. |
| 26 | # |
| 27 | |
| 28 | # |
| 29 | # The top-most directory of the source tree. This is the directory |
| 30 | # that contains this "Makefile.in" and the "configure" script. |
| 31 | # |
| 32 | TOP = @abs_top_srcdir@ |
| 33 | |
| 34 | # |
| 35 | # Autotools-conventional vars which are used by package installation |
| 36 | # rules in main.mk. To get sane handling when a user overrides only |
| 37 | # a subset of these, we perform some acrobatics with these vars |
| 38 | # in the configure script: see [proj-remap-autoconf-dir-vars] for |
| 39 | # full details. |
| 40 | # |
| 41 | # For completeness's sake, the aforementioned conventional vars which |
| 42 | # are relevant to our installation rules are: |
| 43 | # |
| 44 | # datadir = $(prefix)/share |
| 45 | # mandir = $(datadir)/man |
| 46 | # includedir = $(prefix)/include |
| 47 | # exec_prefix = $(prefix) |
| 48 | # bindir = $(exec_prefix)/bin |
| 49 | # libdir = $(exec_prefix)/lib |
| 50 | # |
| 51 | # Our builds do not require any of their relatives: |
| 52 | # |
| 53 | # sbindir = $(exec_prefix)/sbin |
| 54 | # sysconfdir = /etc |
| 55 | # sharedstatedir = $(prefix)/com |
| 56 | # localstatedir = /var |
| 57 | # runstatedir = /run |
| 58 | # infodir = $(datadir)/info |
| 59 | # libexecdir = $(exec_prefix)/libexec |
| 60 | # |
| 61 | prefix = @prefix@ |
| 62 | datadir = @datadir@ |
| 63 | mandir = @mandir@ |
| 64 | includedir = @includedir@ |
| 65 | exec_prefix = @exec_prefix@ |
| 66 | bindir = @bindir@ |
| 67 | libdir = @libdir@ |
| 68 | |
| 69 | INSTALL = @BIN_INSTALL@ |
| 70 | AR = @AR@ |
| 71 | AR.flags = cr |
| 72 | CC = @CC@ |
| 73 | B.cc = @CC_FOR_BUILD@ @BUILD_CFLAGS@ |
| 74 | T.cc = $(CC) |
| 75 | # |
| 76 | # $(CFLAGS) is problematic because it is frequently overridden when |
| 77 | # invoking make, which loses things like -fPIC. So... we avoid using |
| 78 | # it directly and instead add a level of indirection. We combine |
| 79 | # $(CFLAGS) and $(CPPFLAGS) here because that's the way the legacy |
| 80 | # build did it and many builds rely on that. See main.mk for more |
| 81 | # details. |
| 82 | # |
| 83 | # Historical note: the pre-3.48 build only honored CPPFLAGS at |
| 84 | # configure-time, and expanded them into the generated Makefile. There |
| 85 | # are, in that build, no uses of CPPFLAGS in the configure-expanded |
| 86 | # Makefile. Ergo: if a client configures with CPPFLAGS=... and then |
| 87 | # explicitly passes CFLAGS=... to make, the CPPFLAGS will be |
| 88 | # lost. That behavior is retained in 3.48+. |
| 89 | # |
| 90 | CFLAGS = @CFLAGS@ @CPPFLAGS@ |
| 91 | # |
| 92 | # $(LDFLAGS.configure) represents any LDFLAGS=... the client passes to |
| 93 | # configure. See main.mk. |
| 94 | # |
| 95 | LDFLAGS.configure = @LDFLAGS@ |
| 96 | |
| 97 | # |
| 98 | # CFLAGS.core is documented in main.mk. |
| 99 | # |
| 100 | CFLAGS.core = @SH_CFLAGS@ |
| 101 | LDFLAGS.shlib = @SH_LDFLAGS@ |
| 102 | LDFLAGS.zlib = @LDFLAGS_ZLIB@ |
| 103 | LDFLAGS.math = @LDFLAGS_MATH@ |
| 104 | LDFLAGS.rpath = @LDFLAGS_RPATH@ |
| 105 | LDFLAGS.pthread = @LDFLAGS_PTHREAD@ |
| 106 | LDFLAGS.dlopen = @LDFLAGS_DLOPEN@ |
| 107 | LDFLAGS.readline = @LDFLAGS_READLINE@ |
| 108 | CFLAGS.readline = @CFLAGS_READLINE@ |
| 109 | LDFLAGS.icu = @LDFLAGS_ICU@ |
| 110 | LDFLAGS.rt = @LDFLAGS_RT@ |
| 111 | CFLAGS.vec1.avx2 = @CFLAGS_VEC1_AVX2@ |
| 112 | CFLAGS.icu = @CFLAGS_ICU@ |
| 113 | LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@ |
| 114 | # soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded |
| 115 | LDFLAGS.libsqlite3.os-specific = \ |
| 116 | @LDFLAGS_MAC_CVERSION@ @LDFLAGS_MAC_INSTALL_NAME@ @LDFLAGS_OUT_IMPLIB@ |
| 117 | # os-specific: see |
| 118 | # - https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7 |
| 119 | # - https://sqlite.org/forum/forumpost/0c7fc097b2 |
| 120 | # - https://sqlite.org/forum/forumpost/5651662b8875ec0a |
| 121 | |
| 122 | libsqlite3.DLL.basename = @SQLITE_DLL_BASENAME@ |
| 123 | # DLL.basename: see https://sqlite.org/forum/forumpost/828fdfe904 |
| 124 | libsqlite3.out.implib = @SQLITE_OUT_IMPLIB@ |
| 125 | # libsqlite3.out.implib => the output filename part of LDFLAGS_OUT_IMPLIB. |
| 126 | ENABLE_LIB_SHARED = @ENABLE_LIB_SHARED@ |
| 127 | ENABLE_LIB_STATIC = @ENABLE_LIB_STATIC@ |
| 128 | HAVE_WASI_SDK = @HAVE_WASI_SDK@ |
| 129 | libsqlite3.DLL.install-rules = @SQLITE_DLL_INSTALL_RULES@ |
| 130 | |
| 131 | # -fsanitize flags for the fuzzcheck-asap app |
| 132 | CFLAGS.fuzzcheck-asan.fsanitize = @CFLAGS_ASAN_FSANITIZE@ |
| 133 | |
| 134 | # |
| 135 | # TARGET_DEBUG is intended to either be empty or be set to -g |
| 136 | # -DSQLITE_DEBUG=1, plus any other flags relevant for debug-only |
| 137 | # builds. These get added near the front of $(T.cc) so that they can |
| 138 | # be overridden by CFLAGS passed directly to make. Historically (prior |
| 139 | # to 2026-03-30) these were at/near the end of the flags but that made |
| 140 | # it impossible to pass custom -O* flags to specific binaries without |
| 141 | # reconfiguring. |
| 142 | # |
| 143 | T.cc += @TARGET_DEBUG@ |
| 144 | |
| 145 | # |
| 146 | # $(JIMSH) and $(CFLAGS.jimsh) are documented in main.mk. $(JIMSH) |
| 147 | # must start with a path component so that it can be invoked as a |
| 148 | # shell command. |
| 149 | # |
| 150 | CFLAGS.jimsh = @CFLAGS_JIMSH@ |
| 151 | JIMSH = ./jimsh$(T.exe) |
| 152 | |
| 153 | # |
| 154 | # $(B.tclsh) is documented in main.mk. |
| 155 | # |
| 156 | B.tclsh = @BTCLSH@ |
| 157 | $(B.tclsh): |
| 158 | |
| 159 | # |
| 160 | # $(OPT_FEATURE_FLAGS) is documented in main.mk. |
| 161 | # |
| 162 | # The appending of $(OPTIONS) to $(OPT_FEATURE_FLAGS) is historical |
| 163 | # and somewhat confusing because there's another var, $(OPTS), which |
| 164 | # has a similar (but not identical) role. |
| 165 | # |
| 166 | OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@ $(OPTIONS) |
| 167 | |
| 168 | # |
| 169 | # Version (X.Y.Z) number for the SQLite being compiled. |
| 170 | # |
| 171 | PACKAGE_VERSION = @PACKAGE_VERSION@ |
| 172 | |
| 173 | # |
| 174 | # Filename extensions for binaries and libraries. B.* are for the |
| 175 | # being-built-on platform and T.* are for the build's target platform. |
| 176 | # i.e. B.* is for build-time tooling and T.* is for deliverables. |
| 177 | # |
| 178 | B.exe = @BUILD_EXEEXT@ |
| 179 | T.exe = @TARGET_EXEEXT@ |
| 180 | B.dll = @BUILD_DLLEXT@ |
| 181 | T.dll = @TARGET_DLLEXT@ |
| 182 | B.lib = @BUILD_LIBEXT@ |
| 183 | T.lib = @TARGET_LIBEXT@ |
| 184 | |
| 185 | # |
| 186 | # $(HAVE_TCL) is 1 if the configure script was able to locate the |
| 187 | # tclConfig.sh file, else it is 0. When this variable is 1, the TCL |
| 188 | # extension library (libtclsqlite3.so) and related testing apps are |
| 189 | # built. |
| 190 | # |
| 191 | HAVE_TCL = @HAVE_TCL@ |
| 192 | @if LDFLAGS_RPATH |
| 193 | # https://sqlite.org/forum/forumpost/fa8f7d00ea748982 |
| 194 | # and notes in ./main.mk. |
| 195 | ENABLE_RPATH = 1 |
| 196 | @else |
| 197 | ENABLE_RPATH = 0 |
| 198 | @endif |
| 199 | |
| 200 | # |
| 201 | # $(TCLSH_CMD) is the command to use for tclsh - normally just |
| 202 | # "tclsh", but we may know the specific version we want to use. This |
| 203 | # must point to a canonical TCL interpreter, not JimTCL. |
| 204 | # |
| 205 | TCLSH_CMD = @TCLSH_CMD@ |
| 206 | TCL_CONFIG_SH = @TCL_CONFIG_SH@ |
| 207 | |
| 208 | # |
| 209 | # TCL config info from tclConfig.sh |
| 210 | # |
| 211 | # We have to inject this differently in main.mk to accommodate static |
| 212 | # makefiles, so we don't currently bother to export it here. This |
| 213 | # block is retained in case we decide that we do indeed need to export |
| 214 | # it at configure-time instead of calculate it at make-time. |
| 215 | # |
| 216 | #TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ |
| 217 | #TCL_LIB_SPEC = @TCL_LIB_SPEC@ |
| 218 | #TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ |
| 219 | #TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ |
| 220 | #TCL_VERSION = @TCL_VERSION@ |
| 221 | TCL_MAJOR_VERSION = @TCL_MAJOR_VERSION@ |
| 222 | # ^^^ main.mk optionally uses this for determining the Tcl extension's |
| 223 | # DLL name. |
| 224 | TCL_EXT_DLL_BASENAME = @TCL_EXT_DLL_BASENAME@ |
| 225 | # ^^^ base name of the Tcl extension DLL. It varies by platform and |
| 226 | # Tcl version. |
| 227 | |
| 228 | # |
| 229 | # $(TCLLIBDIR) = where to install the tcl plugin. If this is empty, it |
| 230 | # is calculated at make-time by the targets which need it but we |
| 231 | # export it here so that it can be set at configure-time, so that |
| 232 | # clients are not required to pass it at make-time, or may set it in |
| 233 | # their environment to override it. |
| 234 | # |
| 235 | TCLLIBDIR = @TCLLIBDIR@ |
| 236 | |
| 237 | # |
| 238 | # Additional options when running tests using testrunner.tcl |
| 239 | # This is usually either blank or --status. |
| 240 | # |
| 241 | TSTRNNR_OPTS = @TSTRNNR_OPTS@ |
| 242 | |
| 243 | # |
| 244 | # If gcov support was enabled by the configure script, add the appropriate |
| 245 | # flags here. It's not always as easy as just having the user add the right |
| 246 | # CFLAGS / LDFLAGS, because libtool wants to use CFLAGS when linking, which |
| 247 | # causes build errors with -fprofile-arcs -ftest-coverage with some GCCs. |
| 248 | # Supposedly GCC does the right thing if you use --coverage, but in |
| 249 | # practice it still fails. See: |
| 250 | # |
| 251 | # http://www.mail-archive.com/debian-gcc@lists.debian.org/msg26197.html |
| 252 | # |
| 253 | # for more info. |
| 254 | # |
| 255 | CFLAGS.gcov1 = -DSQLITE_COVERAGE_TEST=1 -fprofile-arcs -ftest-coverage |
| 256 | LDFLAGS.gcov1 = -lgcov |
| 257 | USE_GCOV = @USE_GCOV@ |
| 258 | T.compile.gcov = $(CFLAGS.gcov$(USE_GCOV)) |
| 259 | T.link.gcov = $(LDFLAGS.gcov$(USE_GCOV)) |
| 260 | |
| 261 | # |
| 262 | # Vars with the AS_ prefix are specifically related to AutoSetup. |
| 263 | # |
| 264 | # AS_AUTO_DEF is the main configure script. |
| 265 | # |
| 266 | AS_AUTO_DEF = $(TOP)/auto.def |
| 267 | # |
| 268 | # Shell commands to re-run $(TOP)/configure with the same args it was |
| 269 | # invoked with to produce this makefile. |
| 270 | # |
| 271 | AS_AUTORECONFIG = @SQLITE_AUTORECONFIG@ |
| 272 | .PHONY: config reconfigure |
| 273 | config reconfigure: |
| 274 | $(AS_AUTORECONFIG) |
| 275 | USE_AMALGAMATION ?= @USE_AMALGAMATION@ |
| 276 | LINK_TOOLS_DYNAMICALLY ?= @LINK_TOOLS_DYNAMICALLY@ |
| 277 | AMALGAMATION_GEN_FLAGS ?= --linemacros=@AMALGAMATION_LINE_MACROS@ |
| 278 | EXTRA_SRC ?= @AMALGAMATION_EXTRA_SRC@ |
| 279 | STATIC_TCLSQLITE3 = @STATIC_TCLSQLITE3@ |
| 280 | STATIC_CLI_SHELL = @STATIC_CLI_SHELL@ |
| 281 | |
| 282 | # |
| 283 | # CFLAGS for sqlite3$(T.exe) |
| 284 | # |
| 285 | SHELL_OPT ?= @OPT_SHELL@ |
| 286 | |
| 287 | Makefile: $(TOP)/Makefile.in $(AS_AUTO_DEF) |
| 288 | $(AS_AUTORECONFIG) |
| 289 | @touch $@ |
| 290 | |
| 291 | sqlite3.pc: $(TOP)/sqlite3.pc.in $(AS_AUTO_DEF) |
| 292 | $(AS_AUTORECONFIG) |
| 293 | @touch $@ |
| 294 | install: install-pc # defined in main.mk |
| 295 | |
| 296 | sqlite_cfg.h: $(AS_AUTO_DEF) |
| 297 | $(AS_AUTORECONFIG) |
| 298 | @touch $@ |
| 299 | |
| 300 | # |
| 301 | # Fiddle app |
| 302 | # |
| 303 | # EMCC_WRAPPER must refer to the genuine emcc binary, or a |
| 304 | # call-compatible wrapper, e.g. $(TOP)/tool/emcc.sh. If it's empty, |
| 305 | # build components requiring Emscripten will not build. |
| 306 | # |
| 307 | # Achtung: though _this_ makefile is POSIX-make compatible, the fiddle |
| 308 | # build requires GNU make. |
| 309 | # |
| 310 | EMCC_WRAPPER = @EMCC_WRAPPER@ |
| 311 | fiddle: sqlite3.c shell.c |
| 312 | @if [ x = "x$(EMCC_WRAPPER)" ]; then \ |
| 313 | echo "Emscripten SDK not found by configure. Cannot build fiddle." 1&>2; \ |
| 314 | exit 1; \ |
| 315 | fi |
| 316 | $(MAKE) -C ext/wasm fiddle emcc_opt=-Os |
| 317 | |
| 318 | # |
| 319 | # Spell-checking for source comments |
| 320 | # The sources checked are either C sources or C source templates. |
| 321 | # Their comments are extracted and processed through aspell using |
| 322 | # a custom dictionary that contains scads of odd identifiers that |
| 323 | # find their way into the comments. |
| 324 | # |
| 325 | # Currently, this target is setup to be "made" in-tree only. |
| 326 | # The output is ephemeral. Redirect it to guide spelling fixups, |
| 327 | # either to correct spelling or add words to tool/custom.txt. |
| 328 | # |
| 329 | ./custom.rws: ./tool/custom.txt |
| 330 | @echo 'Updating custom dictionary from tool/custom.txt' |
| 331 | aspell --lang=en create master ./custom.rws < ./tool/custom.txt |
| 332 | misspell: ./custom.rws has_tclsh84 |
| 333 | # $(JIMSH) does not work with spellsift.tcl |
| 334 | $(TCLSH_CMD) ./tool/spellsift.tcl ./src/*.c ./src/*.h ./src/*.in |
| 335 | |
| 336 | # |
| 337 | # clean/distclean are mostly defined in main.mk. In this makefile we |
| 338 | # perform cleanup known to be relevant to (only) the autosetup-driven |
| 339 | # build. |
| 340 | # |
| 341 | distclean-autosetup: |
| 342 | rm -f sqlite_cfg.h config.log config.status config.defines.* Makefile sqlite3.pc |
| 343 | rm -f $(TOP)/tool/emcc.sh |
| 344 | rm -f libsqlite3*$(T.dll) |
| 345 | rm -f jimsh0* |
| 346 | distclean: distclean-autosetup |
| 347 | |
| 348 | # |
| 349 | # tool/version-info: a utility for emitting sqlite3 version info |
| 350 | # in various forms. It's used by ext/wasm/. |
| 351 | # |
| 352 | version-info$(T.exe): $(TOP)/tool/version-info.c Makefile sqlite3.h |
| 353 | $(T.link) $(ST_OPT) -o $@ $(TOP)/tool/version-info.c |
| 354 | |
| 355 | include $(TOP)/main.mk |