Makefile.in 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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 = @LDFLAGS_MAC_CVERSION@ @LDFLAGS_OUT_IMPLIB@
  122. # os-specific: see
  123. # - https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7
  124. # - https://sqlite.org/forum/forumpost/0c7fc097b2
  125. libsqlite3.DLL.basename = @SQLITE_DLL_BASENAME@
  126. # DLL.basename: see https://sqlite.org/forum/forumpost/828fdfe904
  127. libsqlite3.out.implib = @SQLITE_OUT_IMPLIB@
  128. # libsqlite3.out.implib => the output filename part of LDFLAGS_OUT_IMPLIB.
  129. ENABLE_LIB_SHARED = @ENABLE_LIB_SHARED@
  130. ENABLE_LIB_STATIC = @ENABLE_LIB_STATIC@
  131. HAVE_WASI_SDK = @HAVE_WASI_SDK@
  132. libsqlite3.DLL.install-rules = @SQLITE_DLL_INSTALL_RULES@
  133. T.cc.sqlite = $(T.cc) @TARGET_DEBUG@
  134. #
  135. # Define -D_HAVE_SQLITE_CONFIG_H so that the code knows it
  136. # can include the generated sqlite_cfg.h.
  137. #
  138. # main.mk will fill out T.cc.sqlite with additional flags common to
  139. # all builds.
  140. #
  141. T.cc.sqlite += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite
  142. #
  143. # $(JIMSH) and $(CFLAGS.jimsh) are documented in main.mk. $(JIMSH)
  144. # must start with a path component so that it can be invoked as a
  145. # shell command.
  146. #
  147. CFLAGS.jimsh = @CFLAGS_JIMSH@
  148. JIMSH = ./jimsh$(T.exe)
  149. #
  150. # $(B.tclsh) is documented in main.mk.
  151. #
  152. B.tclsh = @BTCLSH@
  153. $(B.tclsh):
  154. #
  155. # $(OPT_FEATURE_FLAGS) is documented in main.mk.
  156. #
  157. # The appending of $(OPTIONS) to $(OPT_FEATURE_FLAGS) is historical
  158. # and somewhat confusing because there's another var, $(OPTS), which
  159. # has a similar (but not identical) role.
  160. #
  161. OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@ $(OPTIONS)
  162. #
  163. # Version (X.Y.Z) number for the SQLite being compiled.
  164. #
  165. PACKAGE_VERSION = @PACKAGE_VERSION@
  166. #
  167. # Filename extensions for binaries and libraries
  168. #
  169. B.exe = @BUILD_EXEEXT@
  170. T.exe = @TARGET_EXEEXT@
  171. B.dll = @BUILD_DLLEXT@
  172. T.dll = @TARGET_DLLEXT@
  173. B.lib = @BUILD_LIBEXT@
  174. T.lib = @TARGET_LIBEXT@
  175. #
  176. # $(HAVE_TCL) is 1 if the configure script was able to locate the
  177. # tclConfig.sh file, else it is 0. When this variable is 1, the TCL
  178. # extension library (libtclsqlite3.so) and related testing apps are
  179. # built.
  180. #
  181. HAVE_TCL = @HAVE_TCL@
  182. #
  183. # $(TCLSH_CMD) is the command to use for tclsh - normally just
  184. # "tclsh", but we may know the specific version we want to use. This
  185. # must point to a canonical TCL interpreter, not JimTCL.
  186. #
  187. TCLSH_CMD = @TCLSH_CMD@
  188. TCL_CONFIG_SH = @TCL_CONFIG_SH@
  189. #
  190. # TCL config info from tclConfig.sh
  191. #
  192. # We have to inject this differently in main.mk to accommodate static
  193. # makefiles, so we don't currently bother to export it here. This
  194. # block is retained in case we decide that we do indeed need to export
  195. # it at configure-time instead of calculate it at make-time.
  196. #
  197. #TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
  198. #TCL_LIB_SPEC = @TCL_LIB_SPEC@
  199. #TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
  200. #TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@
  201. #TCL_VERSION = @TCL_VERSION@
  202. #
  203. # $(TCLLIBDIR) = where to install the tcl plugin. If this is empty, it
  204. # is calculated at make-time by the targets which need it but we
  205. # export it here so that it can be set at configure-time, so that
  206. # clients are not required to pass it at make-time, or may set it in
  207. # their environment to override it.
  208. #
  209. TCLLIBDIR = @TCLLIBDIR@
  210. #
  211. # Additional options when running tests using testrunner.tcl
  212. # This is usually either blank or --status.
  213. #
  214. TSTRNNR_OPTS = @TSTRNNR_OPTS@
  215. #
  216. # If gcov support was enabled by the configure script, add the appropriate
  217. # flags here. It's not always as easy as just having the user add the right
  218. # CFLAGS / LDFLAGS, because libtool wants to use CFLAGS when linking, which
  219. # causes build errors with -fprofile-arcs -ftest-coverage with some GCCs.
  220. # Supposedly GCC does the right thing if you use --coverage, but in
  221. # practice it still fails. See:
  222. #
  223. # http://www.mail-archive.com/debian-gcc@lists.debian.org/msg26197.html
  224. #
  225. # for more info.
  226. #
  227. CFLAGS.gcov1 = -DSQLITE_COVERAGE_TEST=1 -fprofile-arcs -ftest-coverage
  228. LDFLAGS.gcov1 = -lgcov
  229. USE_GCOV = @USE_GCOV@
  230. T.compile.extras = $(CFLAGS.gcov$(USE_GCOV))
  231. T.link.extras = $(LDFLAGS.gcov$(USE_GCOV))
  232. #
  233. # Vars with the AS_ prefix are specifically related to AutoSetup.
  234. #
  235. # AS_AUTO_DEF is the main configure script.
  236. #
  237. AS_AUTO_DEF = $(TOP)/auto.def
  238. #
  239. # Shell commands to re-run $(TOP)/configure with the same args it was
  240. # invoked with to produce this makefile.
  241. #
  242. AS_AUTORECONFIG = @SQLITE_AUTORECONFIG@
  243. USE_AMALGAMATION ?= @USE_AMALGAMATION@
  244. LINK_TOOLS_DYNAMICALLY ?= @LINK_TOOLS_DYNAMICALLY@
  245. AMALGAMATION_GEN_FLAGS ?= --linemacros=@AMALGAMATION_LINE_MACROS@
  246. EXTRA_SRC ?= @AMALGAMATION_EXTRA_SRC@
  247. #
  248. # CFLAGS for sqlite3$(T.exe)
  249. #
  250. SHELL_OPT ?= @OPT_SHELL@
  251. Makefile: $(TOP)/Makefile.in $(AS_AUTO_DEF)
  252. $(AS_AUTORECONFIG)
  253. @touch $@
  254. sqlite3.pc: $(TOP)/sqlite3.pc.in $(AS_AUTO_DEF)
  255. $(AS_AUTORECONFIG)
  256. @touch $@
  257. install: install-pc # defined in main.mk
  258. sqlite_cfg.h: $(AS_AUTO_DEF)
  259. $(AS_AUTORECONFIG)
  260. @touch $@
  261. #
  262. # Fiddle app
  263. #
  264. # EMCC_WRAPPER must refer to the genuine emcc binary, or a
  265. # call-compatible wrapper, e.g. $(TOP)/tool/emcc.sh. If it's empty,
  266. # build components requiring Emscripten will not build.
  267. #
  268. # Achtung: though _this_ makefile is POSIX-make compatible, the fiddle
  269. # build requires GNU make.
  270. #
  271. EMCC_WRAPPER = @EMCC_WRAPPER@
  272. fiddle: sqlite3.c shell.c
  273. @if [ x = "x$(EMCC_WRAPPER)" ]; then \
  274. echo "Emscripten SDK not found by configure. Cannot build fiddle." 1&>2; \
  275. exit 1; \
  276. fi
  277. $(MAKE) -C ext/wasm fiddle emcc_opt=-Os
  278. #
  279. # Spell-checking for source comments
  280. # The sources checked are either C sources or C source templates.
  281. # Their comments are extracted and processed through aspell using
  282. # a custom dictionary that contains scads of odd identifiers that
  283. # find their way into the comments.
  284. #
  285. # Currently, this target is setup to be "made" in-tree only.
  286. # The output is ephemeral. Redirect it to guide spelling fixups,
  287. # either to correct spelling or add words to tool/custom.txt.
  288. #
  289. ./custom.rws: ./tool/custom.txt
  290. @echo 'Updating custom dictionary from tool/custom.txt'
  291. aspell --lang=en create master ./custom.rws < ./tool/custom.txt
  292. # Note that jimsh does not work here:
  293. # https://github.com/msteveb/jimtcl/issues/319
  294. misspell: ./custom.rws has_tclsh84
  295. $(TCLSH_CMD) ./tool/spellsift.tcl ./src/*.c ./src/*.h ./src/*.in
  296. #
  297. # clean/distclean are mostly defined in main.mk. In this makefile we
  298. # perform cleanup known to be relevant to (only) the autosetup-driven
  299. # build.
  300. #
  301. distclean-autosetup:
  302. rm -f sqlite_cfg.h config.log config.status config.defines.* Makefile sqlite3.pc
  303. rm -f $(TOP)/tool/emcc.sh
  304. rm -f libsqlite3*$(T.dll)
  305. rm -f jimsh0*
  306. distclean: distclean-autosetup
  307. #
  308. # tool/version-info: a utility for emitting sqlite3 version info
  309. # in various forms.
  310. #
  311. version-info$(T.exe): $(TOP)/tool/version-info.c Makefile sqlite3.h
  312. $(T.link) $(ST_OPT) -o $@ $(TOP)/tool/version-info.c
  313. IS_CROSS_COMPILING = @IS_CROSS_COMPILING@
  314. include $(TOP)/main.mk