forked from mackyle/sqlite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
358 lines (328 loc) · 11.1 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
#!/usr/bin/make
# ^^^^ help out editors which guess this file's type.
#
# Makefile for SQLITE
#
# This makefile is intended to be configured automatically using the
# configure script. Hand editing may not work as expected because
# certain blocks are added or removed depending on configure-time
# information.
#
# The docs for many of its variables are in the primary static
# makefile, main.mk (which this one includes at runtime).
#
all:
clean:
########################################################################
#XX# Lines starting with #XX# are TODOs for the port to autosetup.
#
# Known TODOs/FIXMEs/TOIMPROVEs for the autosetup port, in no
# particular order...
#
# - libreadline detection and handling of its -I, -L, and -l flags.
# These can vary considerably across systems. e.g. some need -lncurses,
# and some don't know what an -lncurses is.
#
# - TEA pieces.
#
# - Replace the autotools-specific distribution deliverable(s).
#
# - Provide Makefile.msc, Makefile.linux-gcc, and any required similar
# makefile stubs for environments where the configure script will not
# run. The core makefile rules in main.mk "should" apply as-is for
# most platforms. We can potentially generate those makefiles, along
# with main.mk, like we do in the Fossil project.
#
# - Confirm whether cross-compilation works and patch it
# appropriately.
#
# - There are some lingering dependencies issues which cause a
# re-configure to trigger more often than it should. This is
# especially a problem in parallel builds, which may launch multiple
# re-configures in parallel. GNU Make offers ways of controlling
# that, but we're limited to POSIX Make compatibility here. The
# automatic reconfigures are not too onerous, though, because they're
# much, much faster than Autotools configure runs.
#
# - Add target(s) to dump out specific vars, e.g. SQLITE_OPT, as
# requested at https://sqlite.org/forum/forumpost/75cb3179216f8d86.
# This would also be useful for the ext/wasm build, which fishes
# SHELL_OPT out of the makefile.
#
#
# Maintenance reminders:
#
# - When using the X?=Y variable assignment formulation, please test
# the build with both GNU make and a POSIX make (e.g. BSD make,
# a.k.a. bmake). On at least one occassion, that formulation has led
# to inconsistent behavior between the two major make flavors when
# used with variable names which might sensibly be in the
# developer's environment (namely CC).
#
# - The naming convention of some vars, using periods instead of
# underscores, though unconventional, was selected for a couple of
# reasons: 1) Personal taste (for which there is no accounting). 2)
# It is thought to help defend against inadvertent injection of
# those vars via environment variables (because X.Y is not a legal
# environment variable name). "Feature or bug?" is debatable and
# this naming convention may be reverted if it causes any grief.
#
#
# The top-most directory of the source tree. This is the directory
# that contains this "Makefile.in" and the "configure" script.
#
TOP = @abs_top_srcdir@
#
# Some standard variables and programs
#
prefix ?= @prefix@
exec_prefix ?= @exec_prefix@
libdir ?= @libdir@
pkgconfigdir ?= $(libdir)/pkgconfig
bindir ?= @bindir@
includedir ?= @includedir@
#
# Just testing some default dir expansions...
# srcdir = @srcdir@
# builddir = @builddir@
# top_srcdir = @top_srcdir@
# abs_top_srcdir = @abs_top_srcdir@
# abs_top_builddir = @abs_top_builddir@
#
INSTALL = @BIN_INSTALL@
AR = @AR@
AR.flags = cr # TODO? Add a configure test to determine this?
CC = @CC@
B.cc = @CC_FOR_BUILD@ @BUILD_CFLAGS@
T.cc = @CC@
#
# CFLAGS is problematic because it is frequently overridden when
# invoking make, which loses things like -fPIC. So... let's avoid
# using it directly and instead add a level of indirection. We
# combine CFLAGS and CPPFLAGS here because that's the way the legacy
# build did it.
#
CFLAGS = @CFLAGS@ @CPPFLAGS@
#
# CFLAGS.core is documented in main.mk.
#
CFLAGS.core = @SH_CFLAGS@
LDFLAGS.shobj = @SHOBJ_LDFLAGS@
LDFLAGS.zlib = @LDFLAGS_ZLIB@
LDFLAGS.math = @LDFLAGS_MATH@
LDFLAGS.rpath = @LDFLAGS_RPATH@
LDFLAGS.pthread = @LDFLAGS_PTHREAD@
LDFLAGS.dlopen = @LDFLAGS_DLOPEN@
LDFLAGS.readline = @LDFLAGS_READLINE@
CFLAGS.readline = @CFLAGS_READLINE@
LDFLAGS.icu = @LDFLAGS_ICU@
ENABLE_SHARED = @ENABLE_SHARED@
ENABLE_STATIC = @ENABLE_STATIC@
HAVE_WASI_SDK = @HAVE_WASI_SDK@
T.cc.sqlite = $(T.cc) @TARGET_DEBUG@
#
# Define -D_HAVE_SQLITE_CONFIG_H so that the code knows it
# can include the generated sqlite_cfg.h.
#
T.cc.sqlite += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite
#
# -I$(prefix)/include is primarily so that the ICU
# headers can be found.
#
T.cc.sqlite += -I$(prefix)/include
#
# main.mk will fill out T.cc.sqlite with some flags common to all builds.
#XX#CFLAGS.readline += -DHAVE_EDITLINE=@TARGET_HAVE_EDITLINE@
#XX#CFLAGS.readline += -DHAVE_LINENOISE=@TARGET_HAVE_LINENOISE@
#XX#
#XX## The library that programs using readline() must link against.
#XX##
#XX#LIBREADLINE = @TARGET_READLINE_LIBS@
#XX#
#XX## Should the database engine be compiled threadsafe
#XX##
#XX#T.cc += -DSQLITE_THREADSAFE=@SQLITE_THREADSAFE@
#
# $(JIMSH) and $(CFLAGS.JIMSH) are documented in main.mk. $(JIMSH)
# must start with a path component so that it can be invoked as a
# shell command.
#
CFLAGS.JIMSH = @CFLAGS_JIMSH@
JIMSH = ./jimsh$(TEXE)
#
# $(B.tclsh) is documented in main.mk.
#
B.tclsh = @BTCLSH@
$(B.tclsh):
#
# $(CFLAGS.libsqlite3) is documented in main.mk.
#
CFLAGS.libsqlite3 = -DSQLITE_TEMP_STORE=@TEMP_STORE@
#
# $(OPT_FEATURE_FLAGS) is documented in main.mk.
#
# The appending of $(OPTIONS) to $(OPT_FEATURE_FLAGS) is historical
# and somewhat confusing because there's another var, $(OPTS), which
# has a similar (but not identical) role.
#
OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@ $(OPTIONS)
#
# Version (X.Y.Z) number for the SQLite being compiled.
#
PACKAGE_VERSION = @PACKAGE_VERSION@
#
# Filename extensions for binaries and libraries
#
B.exe = @BUILD_EXEEXT@
T.exe = @TARGET_EXEEXT@
B.dll = @BUILD_DLLEXT@
T.dll = @TARGET_DLLEXT@
B.lib = @BUILD_LIBEXT@
T.lib = @TARGET_LIBEXT@
#
# $(HAVE_TCL) is 1 if the configure script was able to locate the
# tclConfig.sh file, else it is 0. When this variable is 1, the TCL
# extension library (libtclsqlite3.so) and related testing apps are
# built.
#
HAVE_TCL = @HAVE_TCL@
#
# $(TCLSH_CMD) is the command to use for tclsh - normally just
# "tclsh", but we may know the specific version we want to use. This
# must point to a canonical TCL interpreter, not JimTCL.
#
TCLSH_CMD = @TCLSH_CMD@
TCL_CONFIG_SH = @TCL_CONFIG_SH@
#
# TCL config info from tclConfig.sh
#
# We have to inject this differently in main.mk to accommodate static
# makefiles, so we don't currently bother to export it here. This
# block is retained in case we decide that we do indeed need to export
# it at configure-time instead of calculate it at make-time.
#
#TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
#TCL_LIB_SPEC = @TCL_LIB_SPEC@
#TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
#TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@
#TCL_VERSION = @TCL_VERSION@
#
# $(TCLLIB_RPATH) is calculated by the configure script. Its counterpart
# in tclConfig.sh (TCL_LD_SEARCH_FLAGS) is defined in such a way as to
# make it incompatible with static makefiles.
#
#TCLLIB_RPATH = @TCLLIB_RPATH@
#
# $(TCLLIBDIR) = where to install the tcl plugin. If this is empty, it
# is calculated at make-time by the targets which need it but we
# export it here so that it can be set at configure-time, so that
# clients are not required to pass it at make-time, or set it in their
# environment, to override it.
#
TCLLIBDIR = @TCLLIBDIR@
#
# Additional options when running tests using testrunner.tcl
# This is usually either blank, or else --status
#
TSTRNNR_OPTS = @TSTRNNR_OPTS@
#
# If gcov support was enabled by the configure script, add the appropriate
# flags here. It's not always as easy as just having the user add the right
# CFLAGS / LDFLAGS, because libtool wants to use CFLAGS when linking, which
# causes build errors with -fprofile-arcs -ftest-coverage with some GCCs.
# Supposedly GCC does the right thing if you use --coverage, but in
# practice it still fails. See:
#
# https://www.mail-archive.com/[email protected]/msg26197.html
#
# for more info.
#
CFLAGS.gcov1 = -DSQLITE_COVERAGE_TEST=1 -fprofile-arcs -ftest-coverage
LDFLAGS.gcov1 = -lgcov
USE_GCOV = @USE_GCOV@
T.compile.extras = $(CFLAGS.gcov$(USE_GCOV))
T.link.extras = $(LDFLAGS.gcov$(USE_GCOV))
#
# Vars with the AS_ prefix are specifically related to AutoSetup.
#
# AS_AUTO_DEF is the main configure script.
#
AS_AUTO_DEF = $(TOP)/auto.def
#
# Shell commands to re-run $(TOP)/configure with the same args it was
# invoked with to produce this makefile.
#
AS_AUTORECONFIG = @SQLITE_AUTORECONFIG@
USE_AMALGAMATION ?= @USE_AMALGAMATION@
AMALGAMATION_GEN_FLAGS ?= --linemacros=@AMALGAMATION_LINE_MACROS@
#
# CFLAGS for sqlite3$(T.exe)
#
SHELL_OPT ?= @OPT_SHELL@
Makefile: $(TOP)/Makefile.in $(AS_AUTO_DEF)
$(AS_AUTORECONFIG)
@touch $@
sqlite3.pc: $(TOP)/sqlite3.pc.in $(AS_AUTO_DEF)
$(AS_AUTORECONFIG)
@touch $@
install: install-pc # defined in main.mk
sqlite_cfg.h: $(TOP)/sqlite_cfg.h.in $(AS_AUTO_DEF)
$(AS_AUTORECONFIG)
@touch $@
#
# Fiddle app
#
# EMCC_WRAPPER must refer to the genuine emcc binary, or a
# call-compatible wrapper, e.g. $(TOP)/tool/emcc.sh. If it's empty,
# build components requiring Emscripten will not build.
#
# Achtung: though _this_ makefile is POSIX-make compatible, the fiddle
# build requires GNU make.
#
EMCC_WRAPPER = @EMCC_WRAPPER@
fiddle: sqlite3.c shell.c
@if [ x = "x$(EMCC_WRAPPER)" ]; then \
echo "Emscripten SDK not found by configure. Cannot build fiddle." 1&>2; \
exit 1; \
fi
$(MAKE) -C ext/wasm fiddle emcc_opt=-Os
#
# Spell-checking for source comments
# The sources checked are either C sources or C source templates.
# Their comments are extracted and processed through aspell using
# a custom dictionary that contains scads of odd identifiers that
# find their way into the comments.
#
# Currently, this target is setup to be "made" in-tree only.
# The output is ephemeral. Redirect it to guide spelling fixups,
# either to correct spelling or add words to tool/custom.txt.
#
./custom.rws: ./tool/custom.txt
@echo 'Updating custom dictionary from tool/custom.txt'
aspell --lang=en create master ./custom.rws < ./tool/custom.txt
# Note that jimsh does not work here:
# https://github.com/msteveb/jimtcl/issues/319
misspell: ./custom.rws has_tclsh84
$(TCLSH_CMD) ./tool/spellsift.tcl ./src/*.c ./src/*.h ./src/*.in
#
# clean/distclean are mostly defined in main.mk. In this makefile we
# perform cleanup known to be relevant to (only) the autosetup-driven
# build.
#
clean-autosetup:
-gmake -C ext/wasm distclean 2>/dev/null; true
clean: clean-autosetup
distclean-autosetup: clean
rm -f sqlite_cfg.h config.log config.status config.defines.* Makefile sqlite3.pc
rm -f $(TOP)/tool/emcc.sh
rm -f libsqlite3*$(T.dll)
rm -f jimsh0*
-gmake -C ext/wasm distclean 2>/dev/null; true
distclean: distclean-autosetup
#
# tool/version-info: a utility for emitting sqlite3 version info
# in various forms.
#
version-info$(T.exe): $(TOP)/tool/version-info.c Makefile sqlite3.h
$(T.link) $(ST_OPT) -o $@ $(TOP)/tool/version-info.c
include $(TOP)/main.mk