Makefile.in 11 KB

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