2 # ^^^^ help out editors which guess this file's type.
6 # This makefile is intended to be configured automatically using the
7 # configure script. Hand editing may not work as expected because
8 # certain blocks are added or removed depending on configure-time
11 # The docs for many of its variables are in the primary static
12 # makefile, main.mk (which this one includes at runtime).
14 .POSIX
: #maintenance reminder: X:=Y is not POSIX-portable
16 ########################################################################
18 # Known TODOs/FIXMEs/TOIMPROVEs for the autosetup port, in no
21 # - libreadline detection and handling of its -I, -L, and -l flags.
22 # These can vary considerably across systems. e.g. some need -lncurses,
23 # and some don't know what an -lncurses is.
27 # - Replace the autotools-specific distribution deliverable(s).
29 # - Confirm whether cross-compilation works and patch it
32 # Maintenance reminders:
34 # - This makefile should remain as POSIX-make-compatible as possible:
35 # https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html
37 # - When using the X?=Y variable assignment formulation, please test
38 # the build with both GNU make and a POSIX make (e.g. BSD make,
39 # a.k.a. bmake). On at least one occassion, that formulation has led
40 # to inconsistent behavior between the two major make flavors when
41 # used with variable names which might sensibly be in the
42 # developer's environment (namely CC).
44 # - The naming convention of some vars, using periods instead of
45 # underscores, though unconventional, was selected for a couple of
46 # reasons: 1) Personal taste (for which there is no accounting). 2)
47 # It is thought to help defend against inadvertent injection of
48 # those vars via environment variables (because X.Y is not a legal
49 # environment variable name). "Feature or bug?" is debatable and
50 # this naming convention may be reverted if it causes any grief.
54 # The top-most directory of the source tree. This is the directory
55 # that contains this "Makefile.in" and the "configure" script.
57 TOP
= @abs_top_srcdir@
59 # Just testing some default dir expansions...
61 # builddir = @builddir@
62 # top_srcdir = @top_srcdir@
63 # abs_top_srcdir = @abs_top_srcdir@
64 # abs_top_builddir = @abs_top_builddir@
68 # Autotools-conventional vars which are used by package installation
71 # Autosetup allows the various XYZdir vars to be overridden at
72 # configure-time with, e.g. --libdir=X and --mandir=Y. However,
73 # defining them at configure-time, instead of at make-time, leads to
76 # $ ./configure --prefix=/usr
79 # In that invocation, libdir will be /usr/foo, not /bar/foo as it
80 # normally should, unless the user _also_ passes libdir=... to make.
82 # In 99%+ of use cases, setting prefix=X has the desired effect of
83 # calculating conventional defaults for various other dirs, like
84 # $prefix/lib, $prefix/include, etc. If, however, we export those at
85 # configure-time, the passing prefix=... to make will update only
86 # $prefix and none of its derived dirs.
88 # Because it is more important (for our use cases) that these vars be
89 # overridable via a make invocation than a configure invocation, and
90 # they conventionally derive from $(prefix) in all but the most exotic
91 # of use cases, we do not export the configure-defined overrides of
92 # those vars to this makefile. Instead, we export only $prefix and
93 # its derived vars are set to their conventional default values in
94 # main.mk, which users can then override at make-time as needed.
95 # Overriding $prefix via make will also calculate any derived vars, as
96 # one would expect, unless each is specifically overridden.
98 # For completeness's sake, the aforementioned conventional vars which
99 # are relevant to our installation rules are:
101 # datadir = $(prefix)/share
102 # mandir = $(datadir)/man
103 # includedir = $(prefix)/include
104 # exec_prefix = $(prefix)
105 # bindir = $(exec_prefix)/bin
106 # libdir = $(exec_prefix)/lib
108 # Our builds do not require any of their relatives:
110 # sbindir = $(exec_prefix)/sbin
112 # sharedstatedir = $(prefix)/com
113 # localstatedir = /var
115 # infodir = $(datadir)/info
116 # libexecdir = $(exec_prefix)/libexec
121 includedir = @
includedir@
122 exec_prefix = @
exec_prefix@
126 INSTALL
= @BIN_INSTALL@
128 AR.flags
= cr
# TODO? Add a configure test to determine this?
130 B.
cc = @CC_FOR_BUILD@ @BUILD_CFLAGS@
133 # CFLAGS is problematic because it is frequently overridden when
134 # invoking make, which loses things like -fPIC. So... let's avoid
135 # using it directly and instead add a level of indirection. We
136 # combine CFLAGS and CPPFLAGS here because that's the way the legacy
139 CFLAGS
= @CFLAGS@ @CPPFLAGS@
141 # CFLAGS.core is documented in main.mk.
143 CFLAGS.core
= @SH_CFLAGS@
144 LDFLAGS.shobj
= @SHOBJ_LDFLAGS@
145 LDFLAGS.zlib
= @LDFLAGS_ZLIB@
146 LDFLAGS.math
= @LDFLAGS_MATH@
147 LDFLAGS.rpath
= @LDFLAGS_RPATH@
148 LDFLAGS.pthread
= @LDFLAGS_PTHREAD@
149 LDFLAGS.dlopen
= @LDFLAGS_DLOPEN@
150 LDFLAGS.readline
= @LDFLAGS_READLINE@
151 CFLAGS.readline
= @CFLAGS_READLINE@
152 LDFLAGS.icu
= @LDFLAGS_ICU@
153 LDFLAGS.soname.libsqlite3
= @LDFLAGS_SONAME_LIBSQLITE3@
154 ENABLE_SHARED
= @ENABLE_SHARED@
155 ENABLE_STATIC
= @ENABLE_STATIC@
156 HAVE_WASI_SDK
= @HAVE_WASI_SDK@
158 T.
cc.sqlite
= $(T.
cc) @TARGET_DEBUG@
161 # Define -D_HAVE_SQLITE_CONFIG_H so that the code knows it
162 # can include the generated sqlite_cfg.h.
164 T.
cc.sqlite
+= -D_HAVE_SQLITE_CONFIG_H
-DBUILD_sqlite
166 # -I$(prefix)/include is primarily so that the ICU
167 # headers can be found.
169 T.
cc.sqlite
+= -I
$(prefix)/include
172 # main.mk will fill out T.cc.sqlite with some flags common to all builds.
175 # $(JIMSH) and $(CFLAGS.jimsh) are documented in main.mk. $(JIMSH)
176 # must start with a path component so that it can be invoked as a
179 CFLAGS.jimsh
= @CFLAGS_JIMSH@
180 JIMSH
= .
/jimsh
$(TEXE
)
183 # $(B.tclsh) is documented in main.mk.
189 # $(CFLAGS.libsqlite3) is documented in main.mk.
191 CFLAGS.libsqlite3
= -DSQLITE_TEMP_STORE
=@TEMP_STORE@
194 # $(OPT_FEATURE_FLAGS) is documented in main.mk.
196 # The appending of $(OPTIONS) to $(OPT_FEATURE_FLAGS) is historical
197 # and somewhat confusing because there's another var, $(OPTS), which
198 # has a similar (but not identical) role.
200 OPT_FEATURE_FLAGS
= @OPT_FEATURE_FLAGS@
$(OPTIONS
)
203 # Version (X.Y.Z) number for the SQLite being compiled.
205 PACKAGE_VERSION
= @PACKAGE_VERSION@
208 # Filename extensions for binaries and libraries
210 B.exe
= @BUILD_EXEEXT@
211 T.exe
= @TARGET_EXEEXT@
212 B.dll
= @BUILD_DLLEXT@
213 T.dll
= @TARGET_DLLEXT@
214 B.lib
= @BUILD_LIBEXT@
215 T.lib
= @TARGET_LIBEXT@
218 # $(HAVE_TCL) is 1 if the configure script was able to locate the
219 # tclConfig.sh file, else it is 0. When this variable is 1, the TCL
220 # extension library (libtclsqlite3.so) and related testing apps are
223 HAVE_TCL
= @HAVE_TCL@
226 # $(TCLSH_CMD) is the command to use for tclsh - normally just
227 # "tclsh", but we may know the specific version we want to use. This
228 # must point to a canonical TCL interpreter, not JimTCL.
230 TCLSH_CMD
= @TCLSH_CMD@
231 TCL_CONFIG_SH
= @TCL_CONFIG_SH@
234 # TCL config info from tclConfig.sh
236 # We have to inject this differently in main.mk to accommodate static
237 # makefiles, so we don't currently bother to export it here. This
238 # block is retained in case we decide that we do indeed need to export
239 # it at configure-time instead of calculate it at make-time.
241 #TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
242 #TCL_LIB_SPEC = @TCL_LIB_SPEC@
243 #TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
244 #TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@
245 #TCL_VERSION = @TCL_VERSION@
247 # $(TCLLIB_RPATH) is calculated by the configure script. Its counterpart
248 # in tclConfig.sh (TCL_LD_SEARCH_FLAGS) is defined in such a way as to
249 # make it incompatible with static makefiles.
251 #TCLLIB_RPATH = @TCLLIB_RPATH@
253 # $(TCLLIBDIR) = where to install the tcl plugin. If this is empty, it
254 # is calculated at make-time by the targets which need it but we
255 # export it here so that it can be set at configure-time, so that
256 # clients are not required to pass it at make-time, or set it in their
257 # environment, to override it.
259 TCLLIBDIR
= @TCLLIBDIR@
262 # Additional options when running tests using testrunner.tcl
263 # This is usually either blank, or else --status
265 TSTRNNR_OPTS
= @TSTRNNR_OPTS@
268 # If gcov support was enabled by the configure script, add the appropriate
269 # flags here. It's not always as easy as just having the user add the right
270 # CFLAGS / LDFLAGS, because libtool wants to use CFLAGS when linking, which
271 # causes build errors with -fprofile-arcs -ftest-coverage with some GCCs.
272 # Supposedly GCC does the right thing if you use --coverage, but in
273 # practice it still fails. See:
275 # http://www.mail-archive.com/debian-gcc@lists.debian.org/msg26197.html
279 CFLAGS.gcov1
= -DSQLITE_COVERAGE_TEST
=1 -fprofile-arcs
-ftest-coverage
280 LDFLAGS.gcov1
= -lgcov
281 USE_GCOV
= @USE_GCOV@
282 T.compile.extras
= $(CFLAGS.gcov
$(USE_GCOV
))
283 T.link.extras
= $(LDFLAGS.gcov
$(USE_GCOV
))
286 # Vars with the AS_ prefix are specifically related to AutoSetup.
288 # AS_AUTO_DEF is the main configure script.
290 AS_AUTO_DEF
= $(TOP
)/auto.def
292 # Shell commands to re-run $(TOP)/configure with the same args it was
293 # invoked with to produce this makefile.
295 AS_AUTORECONFIG
= @SQLITE_AUTORECONFIG@
297 USE_AMALGAMATION ?
= @USE_AMALGAMATION@
298 AMALGAMATION_GEN_FLAGS ?
= --linemacros
=@AMALGAMATION_LINE_MACROS@
301 # CFLAGS for sqlite3$(T.exe)
303 SHELL_OPT ?
= @OPT_SHELL@
305 Makefile
: $(TOP
)/Makefile.in
$(AS_AUTO_DEF
)
309 sqlite3.
pc: $(TOP
)/sqlite3.
pc.in
$(AS_AUTO_DEF
)
312 install: install-pc
# defined in main.mk
314 sqlite_cfg.h
: $(TOP
)/sqlite_cfg.h.in
$(AS_AUTO_DEF
)
321 # EMCC_WRAPPER must refer to the genuine emcc binary, or a
322 # call-compatible wrapper, e.g. $(TOP)/tool/emcc.sh. If it's empty,
323 # build components requiring Emscripten will not build.
325 # Achtung: though _this_ makefile is POSIX-make compatible, the fiddle
326 # build requires GNU make.
328 EMCC_WRAPPER
= @EMCC_WRAPPER@
329 fiddle
: sqlite3.c
shell.c
330 @if
[ x
= "x$(EMCC_WRAPPER)" ]; then \
331 echo
"Emscripten SDK not found by configure. Cannot build fiddle." 1&>2; \
334 $(MAKE
) -C ext
/wasm fiddle emcc_opt
=-Os
337 # Spell-checking for source comments
338 # The sources checked are either C sources or C source templates.
339 # Their comments are extracted and processed through aspell using
340 # a custom dictionary that contains scads of odd identifiers that
341 # find their way into the comments.
343 # Currently, this target is setup to be "made" in-tree only.
344 # The output is ephemeral. Redirect it to guide spelling fixups,
345 # either to correct spelling or add words to tool/custom.txt.
347 .
/custom.rws
: .
/tool
/custom.txt
348 @echo
'Updating custom dictionary from tool/custom.txt'
349 aspell
--lang
=en create master .
/custom.rws
< .
/tool
/custom.txt
350 # Note that jimsh does not work here:
351 # https://github.com/msteveb/jimtcl/issues/319
352 misspell
: .
/custom.rws has_tclsh84
353 $(TCLSH_CMD
) .
/tool
/spellsift.tcl .
/src
/*.c .
/src
/*.h .
/src
/*.in
356 # clean/distclean are mostly defined in main.mk. In this makefile we
357 # perform cleanup known to be relevant to (only) the autosetup-driven
361 -gmake
-C ext
/wasm
distclean 2>/dev
/null || true
362 clean: clean-autosetup
364 distclean-autosetup
: clean
365 rm -f sqlite_cfg.h config.log config.status config.defines.
* Makefile sqlite3.
pc
366 rm -f
$(TOP
)/tool
/emcc.sh
367 rm -f libsqlite3
*$(T.dll
)
369 -gmake
-C ext
/wasm
distclean 2>/dev
/null
; true
370 distclean: distclean-autosetup
373 # tool/version-info: a utility for emitting sqlite3 version info
376 version-info
$(T.exe
): $(TOP
)/tool
/version-info.c Makefile sqlite3.h
377 $(T.link
) $(ST_OPT
) -o
$@
$(TOP
)/tool
/version-info.c
379 include $(TOP
)/main.mk