build: work around a report of (install -d DIR) failing in one environment if DIR...
[sqlite/sqlite-manifest.git] / Makefile.in
blobf514046e00aa6515a184e2a067c671be8798b20a
1 #!/usr/bin/make
2 # ^^^^ help out editors which guess this file's type.
4 # Makefile for SQLITE
6 # This makefile is intended to be configured automatically using the
7 # configure script.
9 # The docs for many of its variables are in the primary static
10 # makefile, main.mk (which this one includes at runtime).
12 all:
13 ########################################################################
15 # Known TODOs/FIXMEs/TOIMPROVEs for the autosetup port, in no
16 # particular order...
18 # - TEA pieces.
20 # - Replace the autotools-specific distribution deliverable(s).
22 # - Confirm whether cross-compilation works and patch it
23 # appropriately.
25 # Maintenance reminders:
27 # - This makefile should remain as POSIX-make-compatible as possible:
28 # https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html
30 # - The naming convention of some vars, using periods instead of
31 # underscores, though unconventional, was selected for a couple of
32 # reasons: 1) Personal taste (for which there is no accounting). 2)
33 # It is thought to help defend against inadvertent injection of
34 # those vars via environment variables (because X.Y is not a legal
35 # environment variable name). "Feature or bug?" is debatable and
36 # this naming convention may be reverted if it causes any grief.
40 # The top-most directory of the source tree. This is the directory
41 # that contains this "Makefile.in" and the "configure" script.
43 TOP = @abs_top_srcdir@
46 # Autotools-conventional vars which are used by package installation
47 # rules in main.mk. To get sane handling when a user overrides only
48 # a subset of these, we perform some acrobatics with these vars
49 # in the configure script: see [proj-remap-autoconf-dir-vars] for
50 # full details.
52 # For completeness's sake, the aforementioned conventional vars which
53 # are relevant to our installation rules are:
55 # datadir = $(prefix)/share
56 # mandir = $(datadir)/man
57 # includedir = $(prefix)/include
58 # exec_prefix = $(prefix)
59 # bindir = $(exec_prefix)/bin
60 # libdir = $(exec_prefix)/lib
62 # Our builds do not require any of their relatives:
64 # sbindir = $(exec_prefix)/sbin
65 # sysconfdir = /etc
66 # sharedstatedir = $(prefix)/com
67 # localstatedir = /var
68 # runstatedir = /run
69 # infodir = $(datadir)/info
70 # libexecdir = $(exec_prefix)/libexec
72 prefix = @prefix@
73 datadir = @datadir@
74 mandir = @mandir@
75 includedir = @includedir@
76 exec_prefix = @exec_prefix@
77 bindir = @bindir@
78 libdir = @libdir@
80 INSTALL = @BIN_INSTALL@
81 AR = @AR@
82 AR.flags = cr # TODO? Add a configure test to determine this?
83 CC = @CC@
84 B.cc = @CC_FOR_BUILD@ @BUILD_CFLAGS@
85 T.cc = $(CC)
87 # $(CFLAGS) is problematic because it is frequently overridden when
88 # invoking make, which loses things like -fPIC. So... we avoid using
89 # it directly and instead add a level of indirection. We combine
90 # $(CFLAGS) and $(CPPFLAGS) here because that's the way the legacy
91 # build did it and many builds rely on that. See main.mk for more
92 # details.
94 # Historical note: the pre-3.48 build only honored CPPFLAGS at
95 # configure-time, and expanded them into the generated Makefile. There
96 # are, in that build, no uses of CPPFLAGS in the configure-expanded
97 # Makefile. Ergo: if a client configures with CPPFLAGS=... and then
98 # explicitly passes CFLAGS=... to make, the CPPFLAGS will be
99 # lost. That behavior is retained in 3.48+.
101 CFLAGS = @CFLAGS@ @CPPFLAGS@
103 # $(LDFLAGS.configure) represents any LDFLAGS=... the client passes to
104 # configure. See main.mk.
106 LDFLAGS.configure = @LDFLAGS@
109 # CFLAGS.core is documented in main.mk.
111 CFLAGS.core = @SH_CFLAGS@
112 LDFLAGS.shlib = @SH_LDFLAGS@
113 LDFLAGS.zlib = @LDFLAGS_ZLIB@
114 LDFLAGS.math = @LDFLAGS_MATH@
115 LDFLAGS.rpath = @LDFLAGS_RPATH@
116 LDFLAGS.pthread = @LDFLAGS_PTHREAD@
117 LDFLAGS.dlopen = @LDFLAGS_DLOPEN@
118 LDFLAGS.readline = @LDFLAGS_READLINE@
119 CFLAGS.readline = @CFLAGS_READLINE@
120 LDFLAGS.icu = @LDFLAGS_ICU@
121 CFLAGS.icu = @CFLAGS_ICU@
122 LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@
123 # soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded
124 LDFLAGS.libsqlite3.os-specific = @LDFLAGS_MAC_CVERSION@
125 # os-specific: see https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7
126 ENABLE_SHARED = @ENABLE_SHARED@
127 ENABLE_STATIC = @ENABLE_STATIC@
128 HAVE_WASI_SDK = @HAVE_WASI_SDK@
130 T.cc.sqlite = $(T.cc) @TARGET_DEBUG@
133 # Define -D_HAVE_SQLITE_CONFIG_H so that the code knows it
134 # can include the generated sqlite_cfg.h.
136 # main.mk will fill out T.cc.sqlite with additional flags common to
137 # all builds.
139 T.cc.sqlite += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite
142 # $(JIMSH) and $(CFLAGS.jimsh) are documented in main.mk. $(JIMSH)
143 # must start with a path component so that it can be invoked as a
144 # shell command.
146 CFLAGS.jimsh = @CFLAGS_JIMSH@
147 JIMSH = ./jimsh$(TEXE)
150 # $(B.tclsh) is documented in main.mk.
152 B.tclsh = @BTCLSH@
153 $(B.tclsh):
156 # $(OPT_FEATURE_FLAGS) is documented in main.mk.
158 # The appending of $(OPTIONS) to $(OPT_FEATURE_FLAGS) is historical
159 # and somewhat confusing because there's another var, $(OPTS), which
160 # has a similar (but not identical) role.
162 OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@ $(OPTIONS)
165 # Version (X.Y.Z) number for the SQLite being compiled.
167 PACKAGE_VERSION = @PACKAGE_VERSION@
170 # Filename extensions for binaries and libraries
172 B.exe = @BUILD_EXEEXT@
173 T.exe = @TARGET_EXEEXT@
174 B.dll = @BUILD_DLLEXT@
175 T.dll = @TARGET_DLLEXT@
176 B.lib = @BUILD_LIBEXT@
177 T.lib = @TARGET_LIBEXT@
180 # $(HAVE_TCL) is 1 if the configure script was able to locate the
181 # tclConfig.sh file, else it is 0. When this variable is 1, the TCL
182 # extension library (libtclsqlite3.so) and related testing apps are
183 # built.
185 HAVE_TCL = @HAVE_TCL@
188 # $(TCLSH_CMD) is the command to use for tclsh - normally just
189 # "tclsh", but we may know the specific version we want to use. This
190 # must point to a canonical TCL interpreter, not JimTCL.
192 TCLSH_CMD = @TCLSH_CMD@
193 TCL_CONFIG_SH = @TCL_CONFIG_SH@
196 # TCL config info from tclConfig.sh
198 # We have to inject this differently in main.mk to accommodate static
199 # makefiles, so we don't currently bother to export it here. This
200 # block is retained in case we decide that we do indeed need to export
201 # it at configure-time instead of calculate it at make-time.
203 #TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
204 #TCL_LIB_SPEC = @TCL_LIB_SPEC@
205 #TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
206 #TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@
207 #TCL_VERSION = @TCL_VERSION@
209 # $(TCLLIBDIR) = where to install the tcl plugin. If this is empty, it
210 # is calculated at make-time by the targets which need it but we
211 # export it here so that it can be set at configure-time, so that
212 # clients are not required to pass it at make-time, or may set it in
213 # their environment to override it.
215 TCLLIBDIR = @TCLLIBDIR@
218 # Additional options when running tests using testrunner.tcl
219 # This is usually either blank or --status.
221 TSTRNNR_OPTS = @TSTRNNR_OPTS@
224 # If gcov support was enabled by the configure script, add the appropriate
225 # flags here. It's not always as easy as just having the user add the right
226 # CFLAGS / LDFLAGS, because libtool wants to use CFLAGS when linking, which
227 # causes build errors with -fprofile-arcs -ftest-coverage with some GCCs.
228 # Supposedly GCC does the right thing if you use --coverage, but in
229 # practice it still fails. See:
231 # http://www.mail-archive.com/debian-gcc@lists.debian.org/msg26197.html
233 # for more info.
235 CFLAGS.gcov1 = -DSQLITE_COVERAGE_TEST=1 -fprofile-arcs -ftest-coverage
236 LDFLAGS.gcov1 = -lgcov
237 USE_GCOV = @USE_GCOV@
238 T.compile.extras = $(CFLAGS.gcov$(USE_GCOV))
239 T.link.extras = $(LDFLAGS.gcov$(USE_GCOV))
242 # Vars with the AS_ prefix are specifically related to AutoSetup.
244 # AS_AUTO_DEF is the main configure script.
246 AS_AUTO_DEF = $(TOP)/auto.def
248 # Shell commands to re-run $(TOP)/configure with the same args it was
249 # invoked with to produce this makefile.
251 AS_AUTORECONFIG = @SQLITE_AUTORECONFIG@
253 USE_AMALGAMATION ?= @USE_AMALGAMATION@
254 LINK_TOOLS_DYNAMICALLY ?= @LINK_TOOLS_DYNAMICALLY@
255 AMALGAMATION_GEN_FLAGS ?= --linemacros=@AMALGAMATION_LINE_MACROS@
258 # CFLAGS for sqlite3$(T.exe)
260 SHELL_OPT ?= @OPT_SHELL@
262 Makefile: $(TOP)/Makefile.in $(AS_AUTO_DEF)
263 $(AS_AUTORECONFIG)
264 @touch $@
266 sqlite3.pc: $(TOP)/sqlite3.pc.in $(AS_AUTO_DEF)
267 $(AS_AUTORECONFIG)
268 @touch $@
269 install: install-pc # defined in main.mk
271 sqlite_cfg.h: $(AS_AUTO_DEF)
272 $(AS_AUTORECONFIG)
273 @touch $@
276 # Fiddle app
278 # EMCC_WRAPPER must refer to the genuine emcc binary, or a
279 # call-compatible wrapper, e.g. $(TOP)/tool/emcc.sh. If it's empty,
280 # build components requiring Emscripten will not build.
282 # Achtung: though _this_ makefile is POSIX-make compatible, the fiddle
283 # build requires GNU make.
285 EMCC_WRAPPER = @EMCC_WRAPPER@
286 fiddle: sqlite3.c shell.c
287 @if [ x = "x$(EMCC_WRAPPER)" ]; then \
288 echo "Emscripten SDK not found by configure. Cannot build fiddle." 1&>2; \
289 exit 1; \
291 $(MAKE) -C ext/wasm fiddle emcc_opt=-Os
294 # Spell-checking for source comments
295 # The sources checked are either C sources or C source templates.
296 # Their comments are extracted and processed through aspell using
297 # a custom dictionary that contains scads of odd identifiers that
298 # find their way into the comments.
300 # Currently, this target is setup to be "made" in-tree only.
301 # The output is ephemeral. Redirect it to guide spelling fixups,
302 # either to correct spelling or add words to tool/custom.txt.
304 ./custom.rws: ./tool/custom.txt
305 @echo 'Updating custom dictionary from tool/custom.txt'
306 aspell --lang=en create master ./custom.rws < ./tool/custom.txt
307 # Note that jimsh does not work here:
308 # https://github.com/msteveb/jimtcl/issues/319
309 misspell: ./custom.rws has_tclsh84
310 $(TCLSH_CMD) ./tool/spellsift.tcl ./src/*.c ./src/*.h ./src/*.in
313 # clean/distclean are mostly defined in main.mk. In this makefile we
314 # perform cleanup known to be relevant to (only) the autosetup-driven
315 # build.
317 #clean-autosetup:
318 # -if [ -f ext/wasm/GNUmakefile ]; then \
319 # gmake --no-print-directory --ignore-errors -C ext/wasm clean; \
320 # fi >/dev/null 2>&1; true
321 #clean: clean-autosetup
323 distclean-autosetup: clean
324 rm -f sqlite_cfg.h config.log config.status config.defines.* Makefile sqlite3.pc
325 rm -f $(TOP)/tool/emcc.sh
326 rm -f libsqlite3*$(T.dll)
327 rm -f jimsh0*
328 distclean: distclean-autosetup
331 # tool/version-info: a utility for emitting sqlite3 version info
332 # in various forms.
334 version-info$(T.exe): $(TOP)/tool/version-info.c Makefile sqlite3.h
335 $(T.link) $(ST_OPT) -o $@ $(TOP)/tool/version-info.c
337 IS_CROSS_COMPILING = @IS_CROSS_COMPILING@
338 include $(TOP)/main.mk