main.mk 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338
  1. #!/do/not/make
  2. # ^^^^ help out editors which guess this file's type.
  3. ###############################################################################
  4. # This is the main makefile for sqlite. It expects to be included from
  5. # a higher-level makefile which configures any dynamic state needed by
  6. # this one (as documented below).
  7. #
  8. # Maintenance reminders:
  9. #
  10. # - This file must remain devoid of GNU Make-isms. i.e. it must be
  11. # POSIX Make compatible. "bmake" (BSD make) is available on most
  12. # Linux systems, so compatibility is relatively easy to test. As a
  13. # harmless exception, this file sometimes uses $(MAKEFILE_LIST) as a
  14. # dependency. That var, in GNU Make, lists all of the makefile
  15. # currently loaded.
  16. #
  17. # The variables listed below must be defined before this script is
  18. # invoked. This file will use defaults, very possibly invalid, for any
  19. # which are not defined.
  20. ########################################################################
  21. all:
  22. #
  23. # $(TOP) =
  24. #
  25. # The toplevel directory of the source tree. For canonical builds
  26. # this is the directory that contains this "Makefile.in" and the
  27. # "configure.in" script. For out-of-tree builds, this will differ
  28. # from $(PWD).
  29. #
  30. TOP ?= $(PWD)
  31. #
  32. # $(PACKAGE_VERSION) =
  33. #
  34. # The MAJOR.MINOR.PATCH version number of this build.
  35. #
  36. PACKAGE_VERSION ?=
  37. #
  38. # $(B.cc) =
  39. #
  40. # C Compiler and options for use in building executables that will run
  41. # on the platform that is doing the build.
  42. #
  43. B.cc ?= $(CC)
  44. #
  45. # $(T.cc) =
  46. #
  47. # C Compiler and options for use in building executables that will run
  48. # on the target platform. This is usually the same as B.cc, unless you
  49. # are cross-compiling. Note that it should only contain flags which
  50. # are used by _all_ build targets. Flags needed only by specific
  51. # targets are defined elsewhere and applied on a per-target basis.
  52. #
  53. T.cc ?= $(B.cc)
  54. #
  55. # $(AR) =
  56. #
  57. # Tool used to build a static library from object files, without its
  58. # arguments. $(AR.flags) are its flags for creating a lib.
  59. #
  60. AR ?= ar
  61. AR.flags ?= cr
  62. #
  63. # $(B.exe) =
  64. #
  65. # File extension for executables on the build platform. ".exe" for
  66. # Windows and "" everywhere else.
  67. #
  68. B.exe ?=
  69. #
  70. # $(B.dll) and $(B.lib) =
  71. #
  72. # The DLL resp. static library counterparts of $(B.exe).
  73. #
  74. B.dll ?= .so
  75. B.lib ?= .a
  76. #
  77. # $(T.exe) =
  78. #
  79. # File extension for executables on the target platform. ".exe" for
  80. # Windows and "" everywhere else.
  81. #
  82. T.exe ?= $(B.exe)
  83. #
  84. # $(T.dll) and $(T.lib) =
  85. #
  86. # The DLL resp. static library counterparts of $(T.exe).
  87. #
  88. T.dll ?= $(B.dll)
  89. T.lib ?= $(B.lib)
  90. #
  91. # $(TCLSH_CMD) =
  92. #
  93. # The canonical tclsh.
  94. #
  95. TCLSH_CMD ?= tclsh
  96. #
  97. # JimTCL is part of the autosetup suite and is suitable for all
  98. # current in-tree code-generation TCL jobs, but it requires that we
  99. # build it with non-default flags. Note that the build tree will, if
  100. # no system-level tclsh is found, also have a ./jimsh0 binary. That
  101. # one is a bare-bones build for the configure process, whereas we need
  102. # to build it with another option enabled for use with the various
  103. # code generators.
  104. #
  105. # JIMSH requires a leading path component, even if it's ./, so that it
  106. # can be used as a shell command.
  107. #
  108. # On Windows platforms, if -DHAVE_REALPATH does not work then try
  109. # -DHAVE__FULLPATH (note the double-underscore).
  110. #
  111. CFLAGS.jimsh ?= -DHAVE_REALPATH
  112. JIMSH ?= ./jimsh$(T.exe)
  113. #
  114. # $(B.tclsh) =
  115. #
  116. # The TCL interpreter for in-tree code generation. May be either the
  117. # in-tree JimTCL ($(JIMSH)) or the canonical TCL ($(TCLSH_CMD). If
  118. # it's JimTCL, it must be compiled with -DHAVE_REALPATH or
  119. # -DHAVE__FULLPATH.
  120. #
  121. B.tclsh ?= $(JIMSH)
  122. #
  123. # Autotools-conventional vars which are (in this tree) used only by
  124. # package installation rules and for generating sqlite3.pc (pkg-config
  125. # data file).
  126. #
  127. # The following ${XYZdir} vars are provided for the sake of clients
  128. # who expect to be able to override these using autotools-conventional
  129. # dir name vars.
  130. #
  131. prefix ?= /usr/local
  132. datadir ?= $(prefix)/share
  133. mandir ?= $(datadir)/man
  134. includedir ?= $(prefix)/include
  135. exec_prefix ?= $(prefix)
  136. bindir ?= $(exec_prefix)/bin
  137. libdir ?= $(exec_prefix)/lib
  138. # This makefile does not use any of:
  139. # sbindir ?= $(exec_prefix)/sbin
  140. # sysconfdir ?= /etc
  141. # sharedstatedir ?= $(prefix)/com
  142. # localstatedir ?= /var
  143. # runstatedir ?= /run
  144. # infodir ?= $(datadir)/info
  145. # libexecdir ?= $(exec_prefix)/libexec
  146. ### end of autotools-compatible install dir vars
  147. #
  148. # $(LDFLAGS.{feature}) and $(CFLAGS.{feature}) =
  149. #
  150. # Linker resp. C/CPP flags required by a specific feature, e.g.
  151. # $(LDFLAGS.pthread) or $(CFLAGS.readline).
  152. #
  153. # Rather that stuffing all CFLAGS and LDFLAGS into a single set, we
  154. # break them down on a per-feature basis and expect the build targets
  155. # to use the one(s) it needs.
  156. #
  157. LDFLAGS.zlib ?= -lz
  158. LDFLAGS.math ?= -lm
  159. LDFLAGS.rpath ?= -Wl,-rpath -Wl,$(prefix)/lib
  160. LDFLAGS.pthread ?= -lpthread
  161. LDFLAGS.dlopen ?= -ldl
  162. LDFLAGS.shlib ?= -shared
  163. LDFLAGS.icu ?= # -licui18n -licuuc -licudata
  164. CFLAGS.icu ?=
  165. LDFLAGS.libsqlite3.soname ?= # see https://sqlite.org/src/forumpost/5a3b44f510df8ded
  166. # libreadline (or a workalike):
  167. # To activate readline in the shell: SHELL_OPT = -DHAVE_READLINE=1
  168. LDFLAGS.readline ?= -lreadline # these vary across platforms
  169. CFLAGS.readline ?= -I$(prefix)/include
  170. # ^^^ When using linenoise instead of readline, do something like:
  171. # SHELL_OPT += -DHAVE_LINENOISE=1
  172. # CFLAGS.readline = -I$(HOME)/linenoise $(HOME)/linenoise/linenoise.c
  173. # LDFLAGS.readline = # empty
  174. #
  175. #
  176. # $(INSTALL) =
  177. #
  178. # Tool for installing files and directories. It must be compatible
  179. # with conventional Unix /usr/bin/install. Note that libtool's
  180. # install-sh is _not_ compatible with this because it _moves_ targets
  181. # during installation, which may break the build of targets which are
  182. # built after others are installed.
  183. #
  184. INSTALL ?= install
  185. #
  186. # $(ENABLE_SHARED) =
  187. #
  188. # 1 if libsqlite3.$(T.dll) should be built.
  189. #
  190. ENABLE_SHARED ?= 1
  191. #
  192. # $(ENABLE_STATIC) =
  193. #
  194. # 1 if libsqlite3.$(T.lib) should be built. Some components,
  195. # e.g. libtclsqlite3 and some test apps, implicitly require the static
  196. # library and will ignore this preference.
  197. #
  198. ENABLE_STATIC ?= 1
  199. #
  200. # $(USE_AMALGAMATION)
  201. #
  202. # 1 if the amalgamation (sqlite3.c/h) should be built/used, otherwise
  203. # the library is built from all of its original source files.
  204. # Certaint tools, like sqlite3$(T.exe), require the amalgamation and
  205. # will ignore this preference.
  206. #
  207. USE_AMALGAMATION ?= 1
  208. #
  209. # $(LINK_TOOLS_DYNAMICALLY)
  210. #
  211. # If 1, certain binaries which typically statically link against
  212. # libsqlite3 or its component object files will instead link against
  213. # the DLL. The caveat is that running such builds from the source tree
  214. # may require that the user specifically prepend "." to their
  215. # $LD_LIBRARY_PATH so that the dynamic linker does not pick up a
  216. # libsqlite3.so from outside the source tree. Alternately, symlinking
  217. # the in-build-tree $(libsqlite3.SO) to some dir in the system's
  218. # library path will work for giving the apps access to the in-tree
  219. # DLL.
  220. #
  221. LINK_TOOLS_DYNAMICALLY ?= 0
  222. #
  223. # $(AMALGAMATION_GEN_FLAGS) =
  224. #
  225. # Optional flags for the amalgamation generator.
  226. #
  227. AMALGAMATION_GEN_FLAGS ?= --linemacros=0
  228. #
  229. # $(OPT_FEATURE_FLAGS) =
  230. #
  231. # Preprocessor flags for enabling and disabling specific libsqlite3
  232. # features (-DSQLITE_OMIT*, -DSQLITE_ENABLE*). The same set of OMIT
  233. # and ENABLE flags must be passed to the LEMON parser generator and
  234. # the mkkeywordhash tool as well. This is normally set by the
  235. # configure process, and passing a custom value to a
  236. # coonfigure-filtered Makefile may not work.
  237. #
  238. # When using the canonical makefile, add $(OPTIONS)=... on the make
  239. # command line to append additional options to the
  240. # $(OPT_FEATURE_FLAGS). Note that some flags, because they influence
  241. # generation of the SQL parser, only work if the build is specifically
  242. # configured to account for them. Adding them later, when compiling
  243. # the amalgamation separately, may or may not work.
  244. #
  245. # $(OPTS)=... is another way of influencing C compilation. It is
  246. # distinctly separate from $(OPTIONS) and $(OPT_FEATURE_FLAGS) but,
  247. # like those, $(OPTS) applies to all invocations of $(T.cc). The
  248. # configure process does not set either of $(OPTIONS) or $(OPTS).
  249. #
  250. OPT_FEATURE_FLAGS ?=
  251. #
  252. # $(SHELL_OPT) =
  253. #
  254. # CFLAGS specific to the sqlite3 CLI shell app and its close cousins.
  255. #
  256. SHELL_OPT ?=
  257. #
  258. # TCL_CONFIG_SH must, for some of the build targets, refer to a valid
  259. # tclConfig.sh. That script will be used to populate most of the other
  260. # TCL-related vars the build needs. The core library does not require
  261. # TCL, but TCL is needed for running tests and certain tools, e.g.
  262. # sqlite3_analyzer.
  263. #
  264. TCL_CONFIG_SH ?=
  265. #
  266. # $(HAVE_WASI_SDK) =
  267. #
  268. # Set to 1 when building with the WASI SDK. This disables certain
  269. # build targets. It is expected that the invoker sets $(CC), $(LD),
  270. # and $(AR) to their counterparts from the wasi-sdk.
  271. #
  272. HAVE_WASI_SDK ?= 0
  273. #
  274. # ... and many, many more. Sane defaults are selected where possible.
  275. #
  276. # With the above-described defined, the rest of this make script will
  277. # build the project's deliverables and testing tools.
  278. ################################################################################
  279. all: sqlite3.h sqlite3.c
  280. ########################################################################
  281. ########################################################################
  282. # Modifying anything after this point should not be necessary for most
  283. # builds.
  284. ########################################################################
  285. ########################################################################
  286. #
  287. # $(CFLAGS.env) holds the any $(CFLAGS) provided at configure- or
  288. # make-time (the latter overriding the former).
  289. #
  290. # $(CFLAGS) should ideally only contain flags which are relevant for
  291. # all binaries built for the target platform. However, many people
  292. # like to pass it to "make" without realizing that it applies to
  293. # dozens of deliverables, and they override core flags (like -fPIC)
  294. # when doing so. To help work around that, we expect all core-most
  295. # CFLAGS, e.g. -fPIC, to be set in $(CFLAGS.core). That enables people
  296. # to pass their other CFLAGS without triggering, e.g., "recompile with
  297. # -fPIC" errors.
  298. #
  299. # Historical note: the pre-3.48 build does not honor CPPFLAGS passed
  300. # to make, so we do not do so here. Both the legacy and 3.48+ builds
  301. # support CPPFLAGS passed at configure-time, and combines them with
  302. # the configure-time CFLAGS.
  303. #
  304. CFLAGS.core ?=
  305. CFLAGS.env = $(CFLAGS)
  306. T.cc += $(CFLAGS.core) $(CFLAGS.env)
  307. #
  308. # $(LDFLAGS.configure) represents any LDFLAGS=... the client passes to
  309. # the configure process. The historical build enabled passing-on of
  310. # user-provided LDFLAGS at configure-time but not make-time. That
  311. # behavior is not possible to fully emulate here because this makefile
  312. # is not filtered by the configure script, so we instead
  313. # "soft-enforce" it by using a level of indirection, which clients who
  314. # read this can (but are not advised to!) bypass by passing
  315. # LDFLAGS.configure=... to this makefile. (We do not guaranty this
  316. # variable name to be stable, so do not rely on that capability!)
  317. #
  318. # A significant difference from the legacy build:
  319. #
  320. # The legacy build applied such LDFLAGS to all link operations for all
  321. # deliverables. The 3.48+ build applies them (as of this writing) more
  322. # selectively: search this file LDFLAGS.configure to see where they're
  323. # set.
  324. #
  325. LDFLAGS.configure ?=
  326. #
  327. # The difference between $(OPT_FEATURE_FLAGS) and $(OPTS) is that the
  328. # former is historically provided by the configure script, whereas
  329. # $(OPTS) is intended to be provided as arguments to the make
  330. # invocation.
  331. #
  332. T.cc += $(OPT_FEATURE_FLAGS)
  333. #
  334. # Add in any optional global compilation flags on the make command
  335. # line i.e. make "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1".
  336. #
  337. T.cc += $(OPTS)
  338. #
  339. # $(INSTALL) invocation for use with non-executable files.
  340. #
  341. INSTALL.noexec = $(INSTALL) -m 0644
  342. # ^^^ do not use GNU-specific flags to $(INSTALL), e.g. --mode=...
  343. #
  344. # $(T.compile) = generic target platform compiler invocation,
  345. # differing only from $(T.cc) in that it appends $(T.compile.extras),
  346. # which are primarily intended for use with gcov-related flags.
  347. #
  348. T.compile = $(T.cc) $(T.compile.extras)
  349. #
  350. # $(T.cc.sqlite) is $(T.cc) plus any flags which are desired for the
  351. # library as a whole, but not necessarily needed for every binary. It
  352. # will normally get initially populated with flags by the
  353. # configure-generated makefile.
  354. #
  355. T.cc.sqlite ?= $(T.cc)
  356. #
  357. # $(CFLAGS.intree_includes) = -I... flags relevant specifically to
  358. # this tree, including any subdirectories commonly needed for building
  359. # various tools.
  360. #
  361. CFLAGS.intree_includes = \
  362. -I. -I$(TOP)/src -I$(TOP)/ext/rtree -I$(TOP)/ext/icu \
  363. -I$(TOP)/ext/fts3 -I$(TOP)/ext/session \
  364. -I$(TOP)/ext/misc
  365. T.cc.sqlite += $(CFLAGS.intree_includes)
  366. #
  367. # $(T.cc.extension) = compiler invocation for loadable extensions.
  368. #
  369. T.cc.extension = $(T.compile) -I. -I$(TOP)/src -DSQLITE_CORE
  370. #
  371. # $(T.link) = compiler invocation for when the target will be an
  372. # executable.
  373. #
  374. # $(T.link.extras) = optional config-specific flags for $(T.link),
  375. # primarily intended for use with gcov-related flags.
  376. #
  377. T.link = $(T.cc.sqlite) $(T.link.extras)
  378. #
  379. # $(T.link.shared) = $(T.link) invocation specifically for shared libraries
  380. #
  381. T.link.shared = $(T.link) $(LDFLAGS.shlib)
  382. #
  383. # $(LDFLAGS.libsqlite3) should be used with any deliverable for which
  384. # any of the following apply:
  385. #
  386. # - Results in building libsqlite3.so
  387. # - Compiles sqlite3.c in to an application
  388. # - Links with libsqlite3.a
  389. # - Links in either of $(LIBOBJSO) or $(LIBOBJS1)
  390. #
  391. # Note that these flags are for the target build platform, not
  392. # necessarily localhost. i.e. it should be used with $(T.cc.sqlite)
  393. # or $(T.link) but not $(B.cc).
  394. #
  395. LDFLAGS.libsqlite3 = \
  396. $(LDFLAGS.rpath) $(LDFLAGS.pthread) \
  397. $(LDFLAGS.math) $(LDFLAGS.dlopen) \
  398. $(LDFLAGS.zlib) $(LDFLAGS.icu) \
  399. $(LDFLAGS.configure)
  400. #
  401. # $(install-dir.XYZ) = dirs for installation.
  402. #
  403. # Design note: these should arguably all be defined with surrounding
  404. # double-quotes so that targets which have spaces in their paths will
  405. # work, but that leads to Make treating the quotes as part of the dir
  406. # name, which in turn leads to it never finding a matching name in the
  407. # filesystem and always invoking ($(INSTALL) -d ...) for them. The
  408. # moral of this story is that spaces in installation paths will break
  409. # the install process.
  410. #
  411. install-dir.bin = $(DESTDIR)$(bindir)
  412. install-dir.lib = $(DESTDIR)$(libdir)
  413. install-dir.include = $(DESTDIR)$(includedir)
  414. install-dir.pkgconfig = $(DESTDIR)$(libdir)/pkgconfig
  415. install-dir.man1 = $(DESTDIR)$(mandir)/man1
  416. install-dir.all = $(install-dir.bin) $(install-dir.include) \
  417. $(install-dir.lib) $(install-dir.man1) \
  418. $(install-dir.pkgconfig)
  419. $(install-dir.all):
  420. $(INSTALL) -d "$@"
  421. #
  422. # After jimsh is compiled, we run some sanity checks to ensure that
  423. # it was built in a way compatible with this project's scripts:
  424. #
  425. # 1) Ensure that it was built with realpath() or _fullpath() support.
  426. # Without that flag the [file normalize] command will always resolve
  427. # to an empty string.
  428. #
  429. # 2) Ensure that it is built with -DJIM_COMPAT (which may be
  430. # hard-coded into jimsh0.c). Without this, the [expr] command
  431. # accepts only a single argument.
  432. #
  433. $(JIMSH): $(TOP)/autosetup/jimsh0.c
  434. $(B.cc) -o $@ $(CFLAGS.jimsh) $(TOP)/autosetup/jimsh0.c
  435. @if [ x = "x$$($(JIMSH) -e 'file normalize $(JIMSH)' 2>/dev/null)" ]; then \
  436. echo "$(JIMSH) was built without -DHAVE_REALPATH or -DHAVE__FULLPATH." 1>&2; \
  437. exit 1; \
  438. fi
  439. @if [ x3 != "x$$($(JIMSH) -e 'expr 1 + 2' 2>/dev/null)" ]; then \
  440. echo "$(JIMSH) was built without -DJIM_COMPAT." 1>&2; \
  441. exit 1; \
  442. fi
  443. distclean-jimsh:
  444. rm -f $(JIMSH)
  445. distclean: distclean-jimsh
  446. #
  447. # $(MAKE_SANITY_CHECK) = a set of checks for various make vars which
  448. # must be provided to this file before including it. If any are
  449. # missing, this target fails. It does (almost) no semantic validation,
  450. # only checks to see that appropriate vars are not empty.
  451. #
  452. # Note that $(MAKEFILE_LIST) is a GNU-make-ism but its use is harmless
  453. # in other flavors of Make.
  454. #
  455. MAKE_SANITY_CHECK = .main.mk.checks
  456. $(MAKE_SANITY_CHECK): $(MAKEFILE_LIST) $(TOP)/auto.def
  457. @if [ x = "x$(TOP)" ]; then echo "Missing TOP var" 1>&2; exit 1; fi
  458. @if [ ! -d "$(TOP)" ]; then echo "$(TOP) is not a directory" 1>&2; exit 1; fi
  459. @if [ ! -f "$(TOP)/auto.def" ]; then echo "$(TOP) does not appear to be the top-most source dir" 1>&2; exit 1; fi
  460. @if [ x = "x$(PACKAGE_VERSION)" ]; then echo "PACKAGE_VERSION must be set to the library's X.Y.Z-format version number" 1>&2; exit 1; fi
  461. @if [ x = "x$(B.cc)" ]; then echo "Missing B.cc var" 1>&2; exit 1; fi
  462. @if [ x = "x$(T.cc)" ]; then echo "Missing T.cc var" 1>&2; exit 1; fi
  463. @if [ x = "x$(B.tclsh)" ]; then echo "Missing B.tclsh var" 1>&2; exit 1; fi
  464. @if [ x = "x$(AR)" ]; then echo "Missing AR var" 1>&2; exit 1; fi
  465. touch $@
  466. clean-sanity-check:
  467. rm -f $(MAKE_SANITY_CHECK)
  468. clean: clean-sanity-check
  469. #
  470. # Object files for the SQLite library (non-amalgamation).
  471. #
  472. LIBOBJS0 = alter.o analyze.o attach.o auth.o \
  473. backup.o bitvec.o btmutex.o btree.o build.o \
  474. callback.o complete.o ctime.o \
  475. date.o dbpage.o dbstat.o delete.o \
  476. expr.o fault.o fkey.o \
  477. fts3.o fts3_aux.o fts3_expr.o fts3_hash.o fts3_icu.o \
  478. fts3_porter.o fts3_snippet.o fts3_tokenizer.o fts3_tokenizer1.o \
  479. fts3_tokenize_vtab.o \
  480. fts3_unicode.o fts3_unicode2.o fts3_write.o \
  481. fts5.o \
  482. func.o global.o hash.o \
  483. icu.o insert.o json.o legacy.o loadext.o \
  484. main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \
  485. memdb.o memjournal.o \
  486. mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \
  487. notify.o opcodes.o os.o os_kv.o os_unix.o os_win.o \
  488. pager.o parse.o pcache.o pcache1.o pragma.o prepare.o printf.o \
  489. random.o resolve.o rowset.o rtree.o \
  490. sqlite3session.o select.o sqlite3rbu.o status.o stmt.o \
  491. table.o threads.o tokenize.o treeview.o trigger.o \
  492. update.o upsert.o utf.o util.o vacuum.o \
  493. vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \
  494. vdbetrace.o vdbevtab.o vtab.o \
  495. wal.o walker.o where.o wherecode.o whereexpr.o \
  496. window.o
  497. LIBOBJS = $(LIBOBJS0)
  498. #
  499. # Object files for the amalgamation.
  500. #
  501. LIBOBJS1 = sqlite3.o
  502. #
  503. # Determine the real value of LIBOBJ based on whether the amalgamation
  504. # is enabled or not.
  505. #
  506. LIBOBJ = $(LIBOBJS$(USE_AMALGAMATION))
  507. $(LIBOBJ): $(MAKE_SANITY_CHECK)
  508. #
  509. # All of the source code files.
  510. #
  511. SRC = \
  512. $(TOP)/src/alter.c \
  513. $(TOP)/src/analyze.c \
  514. $(TOP)/src/attach.c \
  515. $(TOP)/src/auth.c \
  516. $(TOP)/src/backup.c \
  517. $(TOP)/src/bitvec.c \
  518. $(TOP)/src/btmutex.c \
  519. $(TOP)/src/btree.c \
  520. $(TOP)/src/btree.h \
  521. $(TOP)/src/btreeInt.h \
  522. $(TOP)/src/build.c \
  523. $(TOP)/src/callback.c \
  524. $(TOP)/src/complete.c \
  525. $(TOP)/src/ctime.c \
  526. $(TOP)/src/date.c \
  527. $(TOP)/src/dbpage.c \
  528. $(TOP)/src/dbstat.c \
  529. $(TOP)/src/delete.c \
  530. $(TOP)/src/expr.c \
  531. $(TOP)/src/fault.c \
  532. $(TOP)/src/fkey.c \
  533. $(TOP)/src/func.c \
  534. $(TOP)/src/global.c \
  535. $(TOP)/src/hash.c \
  536. $(TOP)/src/hash.h \
  537. $(TOP)/src/hwtime.h \
  538. $(TOP)/src/insert.c \
  539. $(TOP)/src/json.c \
  540. $(TOP)/src/legacy.c \
  541. $(TOP)/src/loadext.c \
  542. $(TOP)/src/main.c \
  543. $(TOP)/src/malloc.c \
  544. $(TOP)/src/mem0.c \
  545. $(TOP)/src/mem1.c \
  546. $(TOP)/src/mem2.c \
  547. $(TOP)/src/mem3.c \
  548. $(TOP)/src/mem5.c \
  549. $(TOP)/src/memdb.c \
  550. $(TOP)/src/memjournal.c \
  551. $(TOP)/src/msvc.h \
  552. $(TOP)/src/mutex.c \
  553. $(TOP)/src/mutex.h \
  554. $(TOP)/src/mutex_noop.c \
  555. $(TOP)/src/mutex_unix.c \
  556. $(TOP)/src/mutex_w32.c \
  557. $(TOP)/src/notify.c \
  558. $(TOP)/src/os.c \
  559. $(TOP)/src/os.h \
  560. $(TOP)/src/os_common.h \
  561. $(TOP)/src/os_setup.h \
  562. $(TOP)/src/os_kv.c \
  563. $(TOP)/src/os_unix.c \
  564. $(TOP)/src/os_win.c \
  565. $(TOP)/src/os_win.h \
  566. $(TOP)/src/pager.c \
  567. $(TOP)/src/pager.h \
  568. $(TOP)/src/parse.y \
  569. $(TOP)/src/pcache.c \
  570. $(TOP)/src/pcache.h \
  571. $(TOP)/src/pcache1.c \
  572. $(TOP)/src/pragma.c \
  573. $(TOP)/src/pragma.h \
  574. $(TOP)/src/prepare.c \
  575. $(TOP)/src/printf.c \
  576. $(TOP)/src/random.c \
  577. $(TOP)/src/resolve.c \
  578. $(TOP)/src/rowset.c \
  579. $(TOP)/src/select.c \
  580. $(TOP)/src/status.c \
  581. $(TOP)/src/shell.c.in \
  582. $(TOP)/src/sqlite.h.in \
  583. $(TOP)/src/sqlite3ext.h \
  584. $(TOP)/src/sqliteInt.h \
  585. $(TOP)/src/sqliteLimit.h \
  586. $(TOP)/src/table.c \
  587. $(TOP)/src/tclsqlite.c \
  588. $(TOP)/src/threads.c \
  589. $(TOP)/src/tokenize.c \
  590. $(TOP)/src/treeview.c \
  591. $(TOP)/src/trigger.c \
  592. $(TOP)/src/utf.c \
  593. $(TOP)/src/update.c \
  594. $(TOP)/src/upsert.c \
  595. $(TOP)/src/util.c \
  596. $(TOP)/src/vacuum.c \
  597. $(TOP)/src/vdbe.c \
  598. $(TOP)/src/vdbe.h \
  599. $(TOP)/src/vdbeapi.c \
  600. $(TOP)/src/vdbeaux.c \
  601. $(TOP)/src/vdbeblob.c \
  602. $(TOP)/src/vdbemem.c \
  603. $(TOP)/src/vdbesort.c \
  604. $(TOP)/src/vdbetrace.c \
  605. $(TOP)/src/vdbevtab.c \
  606. $(TOP)/src/vdbeInt.h \
  607. $(TOP)/src/vtab.c \
  608. $(TOP)/src/vxworks.h \
  609. $(TOP)/src/wal.c \
  610. $(TOP)/src/wal.h \
  611. $(TOP)/src/walker.c \
  612. $(TOP)/src/where.c \
  613. $(TOP)/src/wherecode.c \
  614. $(TOP)/src/whereexpr.c \
  615. $(TOP)/src/whereInt.h \
  616. $(TOP)/src/window.c
  617. # Source code for extensions
  618. #
  619. SRC += \
  620. $(TOP)/ext/fts3/fts3.c \
  621. $(TOP)/ext/fts3/fts3.h \
  622. $(TOP)/ext/fts3/fts3Int.h \
  623. $(TOP)/ext/fts3/fts3_aux.c \
  624. $(TOP)/ext/fts3/fts3_expr.c \
  625. $(TOP)/ext/fts3/fts3_hash.c \
  626. $(TOP)/ext/fts3/fts3_hash.h \
  627. $(TOP)/ext/fts3/fts3_icu.c \
  628. $(TOP)/ext/fts3/fts3_porter.c \
  629. $(TOP)/ext/fts3/fts3_snippet.c \
  630. $(TOP)/ext/fts3/fts3_tokenizer.h \
  631. $(TOP)/ext/fts3/fts3_tokenizer.c \
  632. $(TOP)/ext/fts3/fts3_tokenizer1.c \
  633. $(TOP)/ext/fts3/fts3_tokenize_vtab.c \
  634. $(TOP)/ext/fts3/fts3_unicode.c \
  635. $(TOP)/ext/fts3/fts3_unicode2.c \
  636. $(TOP)/ext/fts3/fts3_write.c
  637. SRC += \
  638. $(TOP)/ext/icu/sqliteicu.h \
  639. $(TOP)/ext/icu/icu.c
  640. SRC += \
  641. $(TOP)/ext/rtree/rtree.h \
  642. $(TOP)/ext/rtree/rtree.c \
  643. $(TOP)/ext/rtree/geopoly.c
  644. SRC += \
  645. $(TOP)/ext/session/sqlite3session.c \
  646. $(TOP)/ext/session/sqlite3session.h
  647. SRC += \
  648. $(TOP)/ext/rbu/sqlite3rbu.h \
  649. $(TOP)/ext/rbu/sqlite3rbu.c
  650. SRC += \
  651. $(TOP)/ext/misc/stmt.c
  652. # Generated source code files
  653. #
  654. SRC += \
  655. keywordhash.h \
  656. opcodes.c \
  657. opcodes.h \
  658. parse.c \
  659. parse.h \
  660. sqlite_cfg.h \
  661. shell.c \
  662. sqlite3.h
  663. # Source code to the test files.
  664. #
  665. TESTSRC = \
  666. $(TOP)/src/test1.c \
  667. $(TOP)/src/test2.c \
  668. $(TOP)/src/test3.c \
  669. $(TOP)/src/test4.c \
  670. $(TOP)/src/test5.c \
  671. $(TOP)/src/test6.c \
  672. $(TOP)/src/test8.c \
  673. $(TOP)/src/test9.c \
  674. $(TOP)/src/test_autoext.c \
  675. $(TOP)/src/test_backup.c \
  676. $(TOP)/src/test_bestindex.c \
  677. $(TOP)/src/test_blob.c \
  678. $(TOP)/src/test_btree.c \
  679. $(TOP)/src/test_config.c \
  680. $(TOP)/src/test_delete.c \
  681. $(TOP)/src/test_demovfs.c \
  682. $(TOP)/src/test_devsym.c \
  683. $(TOP)/src/test_fs.c \
  684. $(TOP)/src/test_func.c \
  685. $(TOP)/src/test_hexio.c \
  686. $(TOP)/src/test_init.c \
  687. $(TOP)/src/test_intarray.c \
  688. $(TOP)/src/test_journal.c \
  689. $(TOP)/src/test_malloc.c \
  690. $(TOP)/src/test_md5.c \
  691. $(TOP)/src/test_multiplex.c \
  692. $(TOP)/src/test_mutex.c \
  693. $(TOP)/src/test_onefile.c \
  694. $(TOP)/src/test_osinst.c \
  695. $(TOP)/src/test_pcache.c \
  696. $(TOP)/src/test_quota.c \
  697. $(TOP)/src/test_rtree.c \
  698. $(TOP)/src/test_schema.c \
  699. $(TOP)/src/test_superlock.c \
  700. $(TOP)/src/test_syscall.c \
  701. $(TOP)/src/test_tclsh.c \
  702. $(TOP)/src/test_tclvar.c \
  703. $(TOP)/src/test_thread.c \
  704. $(TOP)/src/test_vdbecov.c \
  705. $(TOP)/src/test_vfs.c \
  706. $(TOP)/src/test_windirent.c \
  707. $(TOP)/src/test_window.c \
  708. $(TOP)/src/test_wsd.c \
  709. $(TOP)/ext/fts3/fts3_term.c \
  710. $(TOP)/ext/fts3/fts3_test.c \
  711. $(TOP)/ext/session/test_session.c \
  712. $(TOP)/ext/recover/sqlite3recover.c \
  713. $(TOP)/ext/recover/dbdata.c \
  714. $(TOP)/ext/recover/test_recover.c \
  715. $(TOP)/ext/intck/test_intck.c \
  716. $(TOP)/ext/intck/sqlite3intck.c \
  717. $(TOP)/ext/rbu/test_rbu.c
  718. # Statically linked extensions
  719. #
  720. TESTSRC += \
  721. $(TOP)/ext/expert/sqlite3expert.c \
  722. $(TOP)/ext/expert/test_expert.c \
  723. $(TOP)/ext/misc/amatch.c \
  724. $(TOP)/ext/misc/appendvfs.c \
  725. $(TOP)/ext/misc/basexx.c \
  726. $(TOP)/ext/misc/carray.c \
  727. $(TOP)/ext/misc/cksumvfs.c \
  728. $(TOP)/ext/misc/closure.c \
  729. $(TOP)/ext/misc/csv.c \
  730. $(TOP)/ext/misc/decimal.c \
  731. $(TOP)/ext/misc/eval.c \
  732. $(TOP)/ext/misc/explain.c \
  733. $(TOP)/ext/misc/fileio.c \
  734. $(TOP)/ext/misc/fuzzer.c \
  735. $(TOP)/ext/fts5/fts5_tcl.c \
  736. $(TOP)/ext/fts5/fts5_test_mi.c \
  737. $(TOP)/ext/fts5/fts5_test_tok.c \
  738. $(TOP)/ext/misc/ieee754.c \
  739. $(TOP)/ext/misc/mmapwarm.c \
  740. $(TOP)/ext/misc/nextchar.c \
  741. $(TOP)/ext/misc/normalize.c \
  742. $(TOP)/ext/misc/percentile.c \
  743. $(TOP)/ext/misc/prefixes.c \
  744. $(TOP)/ext/misc/qpvtab.c \
  745. $(TOP)/ext/misc/randomjson.c \
  746. $(TOP)/ext/misc/regexp.c \
  747. $(TOP)/ext/misc/remember.c \
  748. $(TOP)/ext/misc/series.c \
  749. $(TOP)/ext/misc/spellfix.c \
  750. $(TOP)/ext/misc/stmtrand.c \
  751. $(TOP)/ext/misc/totype.c \
  752. $(TOP)/ext/misc/unionvtab.c \
  753. $(TOP)/ext/misc/wholenumber.c \
  754. $(TOP)/ext/misc/zipfile.c \
  755. $(TOP)/ext/rtree/test_rtreedoc.c
  756. # Source code to the library files needed by the test fixture
  757. #
  758. TESTSRC2 = \
  759. $(TOP)/src/attach.c \
  760. $(TOP)/src/backup.c \
  761. $(TOP)/src/bitvec.c \
  762. $(TOP)/src/btree.c \
  763. $(TOP)/src/build.c \
  764. $(TOP)/src/ctime.c \
  765. $(TOP)/src/date.c \
  766. $(TOP)/src/dbpage.c \
  767. $(TOP)/src/dbstat.c \
  768. $(TOP)/src/expr.c \
  769. $(TOP)/src/func.c \
  770. $(TOP)/src/global.c \
  771. $(TOP)/src/insert.c \
  772. $(TOP)/src/wal.c \
  773. $(TOP)/src/main.c \
  774. $(TOP)/src/mem5.c \
  775. $(TOP)/src/os.c \
  776. $(TOP)/src/os_kv.c \
  777. $(TOP)/src/os_unix.c \
  778. $(TOP)/src/os_win.c \
  779. $(TOP)/src/pager.c \
  780. $(TOP)/src/pragma.c \
  781. $(TOP)/src/prepare.c \
  782. $(TOP)/src/printf.c \
  783. $(TOP)/src/random.c \
  784. $(TOP)/src/pcache.c \
  785. $(TOP)/src/pcache1.c \
  786. $(TOP)/src/select.c \
  787. $(TOP)/src/tokenize.c \
  788. $(TOP)/src/treeview.c \
  789. $(TOP)/src/utf.c \
  790. $(TOP)/src/util.c \
  791. $(TOP)/src/vdbeapi.c \
  792. $(TOP)/src/vdbeaux.c \
  793. $(TOP)/src/vdbe.c \
  794. $(TOP)/src/vdbemem.c \
  795. $(TOP)/src/vdbetrace.c \
  796. $(TOP)/src/vdbevtab.c \
  797. $(TOP)/src/where.c \
  798. $(TOP)/src/wherecode.c \
  799. $(TOP)/src/whereexpr.c \
  800. $(TOP)/src/window.c \
  801. parse.c \
  802. $(TOP)/ext/fts3/fts3.c \
  803. $(TOP)/ext/fts3/fts3_aux.c \
  804. $(TOP)/ext/fts3/fts3_expr.c \
  805. $(TOP)/ext/fts3/fts3_tokenizer.c \
  806. $(TOP)/ext/fts3/fts3_write.c \
  807. $(TOP)/ext/session/sqlite3session.c \
  808. $(TOP)/ext/misc/stmt.c \
  809. fts5.c
  810. # Header files used by all library source files.
  811. #
  812. HDR = \
  813. $(TOP)/src/btree.h \
  814. $(TOP)/src/btreeInt.h \
  815. $(TOP)/src/hash.h \
  816. $(TOP)/src/hwtime.h \
  817. keywordhash.h \
  818. $(TOP)/src/msvc.h \
  819. $(TOP)/src/mutex.h \
  820. opcodes.h \
  821. $(TOP)/src/os.h \
  822. $(TOP)/src/os_common.h \
  823. $(TOP)/src/os_setup.h \
  824. $(TOP)/src/os_win.h \
  825. $(TOP)/src/pager.h \
  826. $(TOP)/src/pcache.h \
  827. parse.h \
  828. $(TOP)/src/pragma.h \
  829. sqlite3.h \
  830. $(TOP)/src/sqlite3ext.h \
  831. $(TOP)/src/sqliteInt.h \
  832. $(TOP)/src/sqliteLimit.h \
  833. $(TOP)/src/vdbe.h \
  834. $(TOP)/src/vdbeInt.h \
  835. $(TOP)/src/vxworks.h \
  836. $(TOP)/src/whereInt.h \
  837. sqlite_cfg.h
  838. # Reminder: sqlite_cfg.h is typically created by the configure script
  839. # Header files used by extensions
  840. #
  841. EXTHDR += \
  842. $(TOP)/ext/fts3/fts3.h \
  843. $(TOP)/ext/fts3/fts3Int.h \
  844. $(TOP)/ext/fts3/fts3_hash.h \
  845. $(TOP)/ext/fts3/fts3_tokenizer.h
  846. EXTHDR += \
  847. $(TOP)/ext/rtree/rtree.h \
  848. $(TOP)/ext/rtree/geopoly.c
  849. EXTHDR += \
  850. $(TOP)/ext/icu/sqliteicu.h
  851. EXTHDR += \
  852. $(TOP)/ext/rtree/sqlite3rtree.h
  853. #
  854. # Executables needed for testing
  855. #
  856. TESTPROGS = \
  857. testfixture$(T.exe) \
  858. sqlite3$(T.exe) \
  859. sqlite3_analyzer$(T.exe) \
  860. sqldiff$(T.exe) \
  861. dbhash$(T.exe) \
  862. sqltclsh$(T.exe)
  863. # Databases containing fuzzer test cases
  864. #
  865. FUZZDATA = \
  866. $(TOP)/test/fuzzdata1.db \
  867. $(TOP)/test/fuzzdata2.db \
  868. $(TOP)/test/fuzzdata3.db \
  869. $(TOP)/test/fuzzdata4.db \
  870. $(TOP)/test/fuzzdata5.db \
  871. $(TOP)/test/fuzzdata6.db \
  872. $(TOP)/test/fuzzdata7.db \
  873. $(TOP)/test/fuzzdata8.db
  874. #
  875. # Standard options to testfixture
  876. #
  877. TESTOPTS = --verbose=file --output=test-out.txt
  878. #
  879. # Extra compiler options for various shell tools
  880. #
  881. # Note that some of these will only apply when embedding sqlite3.c
  882. # into the shell, as these flags are not otherwise passed on to the
  883. # library.
  884. SHELL_OPT += -DSQLITE_DQS=0
  885. SHELL_OPT += -DSQLITE_ENABLE_FTS4
  886. #SHELL_OPT += -DSQLITE_ENABLE_FTS5
  887. SHELL_OPT += -DSQLITE_ENABLE_RTREE
  888. SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS
  889. SHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
  890. SHELL_OPT += -DSQLITE_ENABLE_STMTVTAB
  891. SHELL_OPT += -DSQLITE_ENABLE_DBPAGE_VTAB
  892. SHELL_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
  893. SHELL_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB
  894. SHELL_OPT += -DSQLITE_ENABLE_OFFSET_SQL_FUNC
  895. SHELL_OPT += -DSQLITE_STRICT_SUBTYPE=1
  896. FUZZERSHELL_OPT =
  897. FUZZCHECK_OPT += -I$(TOP)/test
  898. FUZZCHECK_OPT += -I$(TOP)/ext/recover
  899. FUZZCHECK_OPT += \
  900. -DSQLITE_OSS_FUZZ \
  901. -DSQLITE_ENABLE_BYTECODE_VTAB \
  902. -DSQLITE_ENABLE_DBPAGE_VTAB \
  903. -DSQLITE_ENABLE_DBSTAT_VTAB \
  904. -DSQLITE_ENABLE_BYTECODE_VTAB \
  905. -DSQLITE_ENABLE_DESERIALIZE \
  906. -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
  907. -DSQLITE_ENABLE_FTS3_PARENTHESIS \
  908. -DSQLITE_ENABLE_FTS4 \
  909. -DSQLITE_ENABLE_FTS5 \
  910. -DSQLITE_ENABLE_GEOPOLY \
  911. -DSQLITE_ENABLE_MATH_FUNCTIONS \
  912. -DSQLITE_ENABLE_MEMSYS5 \
  913. -DSQLITE_ENABLE_NORMALIZE \
  914. -DSQLITE_ENABLE_OFFSET_SQL_FUNC \
  915. -DSQLITE_ENABLE_PREUPDATE_HOOK \
  916. -DSQLITE_ENABLE_RTREE \
  917. -DSQLITE_ENABLE_SESSION \
  918. -DSQLITE_ENABLE_STMTVTAB \
  919. -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION \
  920. -DSQLITE_ENABLE_STAT4 \
  921. -DSQLITE_ENABLE_STMT_SCANSTATUS \
  922. -DSQLITE_MAX_MEMORY=50000000 \
  923. -DSQLITE_MAX_MMAP_SIZE=0 \
  924. -DSQLITE_OMIT_LOAD_EXTENSION \
  925. -DSQLITE_PRINTF_PRECISION_LIMIT=1000 \
  926. -DSQLITE_PRIVATE="" \
  927. -DSQLITE_STRICT_SUBTYPE=1 \
  928. -DSQLITE_STATIC_RANDOMJSON
  929. FUZZCHECK_SRC += $(TOP)/test/fuzzcheck.c
  930. FUZZCHECK_SRC += $(TOP)/test/ossfuzz.c
  931. FUZZCHECK_SRC += $(TOP)/test/fuzzinvariants.c
  932. FUZZCHECK_SRC += $(TOP)/ext/recover/dbdata.c
  933. FUZZCHECK_SRC += $(TOP)/ext/recover/sqlite3recover.c
  934. FUZZCHECK_SRC += $(TOP)/test/vt02.c
  935. FUZZCHECK_SRC += $(TOP)/ext/misc/percentile.c
  936. FUZZCHECK_SRC += $(TOP)/ext/misc/randomjson.c
  937. DBFUZZ_OPT =
  938. ST_OPT = -DSQLITE_OS_KV_OPTIONAL
  939. $(TCLSH_CMD):
  940. has_tclsh84:
  941. sh $(TOP)/tool/cktclsh.sh 8.4 $(TCLSH_CMD)
  942. touch has_tclsh84
  943. has_tclsh85:
  944. sh $(TOP)/tool/cktclsh.sh 8.5 $(TCLSH_CMD)
  945. touch has_tclsh85
  946. #
  947. # $(T.tcl.env.sh) is a shell script intended for source'ing to set
  948. # various TCL config info in the current shell context:
  949. #
  950. # - All info exported by tclConfig.sh
  951. #
  952. # - TCLLIBDIR = the first entry from TCL's $auto_path which refers to
  953. # an existing dir, then append /sqlite3 to it. If TCLLIBDIR is
  954. # provided via the environment, that value is used instead.
  955. #
  956. # Maintenance reminder: the ./ at the start of the name is required or /bin/sh
  957. # refuses to source it:
  958. #
  959. # . .tclenv.sh ==> .tclenv.sh: not found
  960. # . ./.tclenv.sh ==> fine
  961. #
  962. # It took half an hour to figure that out.
  963. #
  964. T.tcl.env.sh = ./.tclenv.sh
  965. $(T.tcl.env.sh): $(TCLSH_CMD) $(TCL_CONFIG_SH) $(MAKEFILE_LIST)
  966. @if [ x = "x$(TCL_CONFIG_SH)" ]; then \
  967. echo 'TCL_CONFIG_SH must be set to point to a "tclConfig.sh"' 1>&2; exit 1; \
  968. fi; \
  969. if [ x != "x$(TCLLIBDIR)" ]; then echo TCLLIBDIR="$(TCLLIBDIR)"; else \
  970. ld= ; \
  971. for d in `echo "puts stdout \\$$auto_path" | $(TCLSH_CMD)`; do \
  972. if [ -d "$$d" ]; then ld=$$d; break; fi; \
  973. done; \
  974. if [ x = "x$$ld" ]; then echo "Cannot determine TCLLIBDIR" 1>&2; exit 1; fi; \
  975. echo "TCLLIBDIR=$$ld/sqlite3"; \
  976. fi > $@; \
  977. echo ". \"$(TCL_CONFIG_SH)\" || exit \$$?" >> $@; \
  978. echo "Created $@"
  979. #
  980. # $(T.tcl.env.source) is shell code to be run as part of any
  981. # compilation or link step which requires vars from
  982. # $(TCL_CONFIG_SH). All targets which use this should also have a
  983. # dependency on $(T.tcl.env.sh).
  984. #
  985. T.tcl.env.source = . $(T.tcl.env.sh) || exit $$?
  986. #
  987. # $(T.compile.tcl) and $(T.link.tcl) are TCL-specific counterparts for $(T.compile)
  988. # and $(T.link) which first invoke $(T.tcl.env.source). Any targets which used them
  989. # must have a dependency on $(T.tcl.env.sh)
  990. #
  991. T.compile.tcl = $(T.tcl.env.source); $(T.compile) $(CFLAGS.intree_includes)
  992. T.link.tcl = $(T.tcl.env.source); $(T.link)
  993. #
  994. # This target creates a directory named "tsrc" and fills it with
  995. # copies of all of the C source code and header files needed to
  996. # build on the target system. Some of the C source code and header
  997. # files are automatically generated. This target takes care of
  998. # all that automatic generation.
  999. #
  1000. .target_source: $(MAKE_SANITY_CHECK) $(SRC) $(TOP)/tool/vdbe-compress.tcl \
  1001. fts5.c $(B.tclsh)
  1002. rm -rf tsrc
  1003. mkdir tsrc
  1004. cp -f $(SRC) tsrc
  1005. rm tsrc/sqlite.h.in tsrc/parse.y
  1006. $(B.tclsh) $(TOP)/tool/vdbe-compress.tcl $(OPTS) <tsrc/vdbe.c >vdbe.new
  1007. mv vdbe.new tsrc/vdbe.c
  1008. cp fts5.c fts5.h tsrc
  1009. touch .target_source
  1010. libsqlite3.LIB = libsqlite3$(T.lib)
  1011. libsqlite3.SO = libsqlite3$(T.dll)
  1012. # Rules to build the LEMON compiler generator
  1013. #
  1014. lemon$(B.exe): $(MAKE_SANITY_CHECK) $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
  1015. $(B.cc) -o $@ $(TOP)/tool/lemon.c
  1016. cp $(TOP)/tool/lempar.c .
  1017. # Rules to build the program that generates the source-id
  1018. #
  1019. mksourceid$(B.exe): $(MAKE_SANITY_CHECK) $(TOP)/tool/mksourceid.c
  1020. $(B.cc) -o $@ $(TOP)/tool/mksourceid.c
  1021. sqlite3.h: $(MAKE_SANITY_CHECK) $(TOP)/src/sqlite.h.in \
  1022. $(TOP)/manifest mksourceid$(B.exe) \
  1023. $(TOP)/VERSION $(B.tclsh)
  1024. $(B.tclsh) $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
  1025. sqlite3.c: .target_source sqlite3.h $(TOP)/tool/mksqlite3c.tcl src-verify$(B.exe) \
  1026. $(B.tclsh)
  1027. $(B.tclsh) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_GEN_FLAGS) $(EXTRA_SRC)
  1028. cp tsrc/sqlite3ext.h .
  1029. cp $(TOP)/ext/session/sqlite3session.h .
  1030. sqlite3r.h: sqlite3.h $(B.tclsh)
  1031. $(B.tclsh) $(TOP)/tool/mksqlite3h.tcl $(TOP) --enable-recover >sqlite3r.h
  1032. sqlite3r.c: sqlite3.c sqlite3r.h $(B.tclsh)
  1033. cp $(TOP)/ext/recover/sqlite3recover.c tsrc/
  1034. cp $(TOP)/ext/recover/sqlite3recover.h tsrc/
  1035. cp $(TOP)/ext/recover/dbdata.c tsrc/
  1036. $(B.tclsh) $(TOP)/tool/mksqlite3c.tcl --enable-recover $(AMALGAMATION_GEN_FLAGS) $(EXTRA_SRC)
  1037. sqlite3ext.h: .target_source
  1038. cp tsrc/sqlite3ext.h .
  1039. # Rules to build individual *.o files from generated *.c files. This
  1040. # applies to:
  1041. #
  1042. # parse.o
  1043. # opcodes.o
  1044. #
  1045. DEPS_OBJ_COMMON = $(MAKE_SANITY_CHECK) $(HDR)
  1046. parse.o: parse.c $(DEPS_OBJ_COMMON)
  1047. $(T.cc.sqlite) -c parse.c
  1048. opcodes.o: opcodes.c
  1049. $(T.cc.sqlite) -c opcodes.c
  1050. # Rules to build individual *.o files from files in the src directory.
  1051. #
  1052. alter.o: $(TOP)/src/alter.c $(DEPS_OBJ_COMMON)
  1053. $(T.cc.sqlite) -c $(TOP)/src/alter.c
  1054. analyze.o: $(TOP)/src/analyze.c $(DEPS_OBJ_COMMON)
  1055. $(T.cc.sqlite) -c $(TOP)/src/analyze.c
  1056. attach.o: $(TOP)/src/attach.c $(DEPS_OBJ_COMMON)
  1057. $(T.cc.sqlite) -c $(TOP)/src/attach.c
  1058. auth.o: $(TOP)/src/auth.c $(DEPS_OBJ_COMMON)
  1059. $(T.cc.sqlite) -c $(TOP)/src/auth.c
  1060. backup.o: $(TOP)/src/backup.c $(DEPS_OBJ_COMMON)
  1061. $(T.cc.sqlite) -c $(TOP)/src/backup.c
  1062. bitvec.o: $(TOP)/src/bitvec.c $(DEPS_OBJ_COMMON)
  1063. $(T.cc.sqlite) -c $(TOP)/src/bitvec.c
  1064. btmutex.o: $(TOP)/src/btmutex.c $(DEPS_OBJ_COMMON)
  1065. $(T.cc.sqlite) -c $(TOP)/src/btmutex.c
  1066. btree.o: $(TOP)/src/btree.c $(DEPS_OBJ_COMMON) $(TOP)/src/pager.h
  1067. $(T.cc.sqlite) -c $(TOP)/src/btree.c
  1068. build.o: $(TOP)/src/build.c $(DEPS_OBJ_COMMON)
  1069. $(T.cc.sqlite) -c $(TOP)/src/build.c
  1070. callback.o: $(TOP)/src/callback.c $(DEPS_OBJ_COMMON)
  1071. $(T.cc.sqlite) -c $(TOP)/src/callback.c
  1072. complete.o: $(TOP)/src/complete.c $(DEPS_OBJ_COMMON)
  1073. $(T.cc.sqlite) -c $(TOP)/src/complete.c
  1074. ctime.o: $(TOP)/src/ctime.c $(DEPS_OBJ_COMMON)
  1075. $(T.cc.sqlite) -c $(TOP)/src/ctime.c
  1076. date.o: $(TOP)/src/date.c $(DEPS_OBJ_COMMON)
  1077. $(T.cc.sqlite) -c $(TOP)/src/date.c
  1078. dbpage.o: $(TOP)/src/dbpage.c $(DEPS_OBJ_COMMON)
  1079. $(T.cc.sqlite) -c $(TOP)/src/dbpage.c
  1080. dbstat.o: $(TOP)/src/dbstat.c $(DEPS_OBJ_COMMON)
  1081. $(T.cc.sqlite) -c $(TOP)/src/dbstat.c
  1082. delete.o: $(TOP)/src/delete.c $(DEPS_OBJ_COMMON)
  1083. $(T.cc.sqlite) -c $(TOP)/src/delete.c
  1084. expr.o: $(TOP)/src/expr.c $(DEPS_OBJ_COMMON)
  1085. $(T.cc.sqlite) -c $(TOP)/src/expr.c
  1086. fault.o: $(TOP)/src/fault.c $(DEPS_OBJ_COMMON)
  1087. $(T.cc.sqlite) -c $(TOP)/src/fault.c
  1088. fkey.o: $(TOP)/src/fkey.c $(DEPS_OBJ_COMMON)
  1089. $(T.cc.sqlite) -c $(TOP)/src/fkey.c
  1090. func.o: $(TOP)/src/func.c $(DEPS_OBJ_COMMON)
  1091. $(T.cc.sqlite) -c $(TOP)/src/func.c
  1092. global.o: $(TOP)/src/global.c $(DEPS_OBJ_COMMON)
  1093. $(T.cc.sqlite) -c $(TOP)/src/global.c
  1094. hash.o: $(TOP)/src/hash.c $(DEPS_OBJ_COMMON)
  1095. $(T.cc.sqlite) -c $(TOP)/src/hash.c
  1096. insert.o: $(TOP)/src/insert.c $(DEPS_OBJ_COMMON)
  1097. $(T.cc.sqlite) -c $(TOP)/src/insert.c
  1098. json.o: $(TOP)/src/json.c $(DEPS_OBJ_COMMON)
  1099. $(T.cc.sqlite) -c $(TOP)/src/json.c
  1100. legacy.o: $(TOP)/src/legacy.c $(DEPS_OBJ_COMMON)
  1101. $(T.cc.sqlite) -c $(TOP)/src/legacy.c
  1102. loadext.o: $(TOP)/src/loadext.c $(DEPS_OBJ_COMMON)
  1103. $(T.cc.sqlite) -c $(TOP)/src/loadext.c
  1104. main.o: $(TOP)/src/main.c $(DEPS_OBJ_COMMON)
  1105. $(T.cc.sqlite) -c $(TOP)/src/main.c
  1106. malloc.o: $(TOP)/src/malloc.c $(DEPS_OBJ_COMMON)
  1107. $(T.cc.sqlite) -c $(TOP)/src/malloc.c
  1108. mem0.o: $(TOP)/src/mem0.c $(DEPS_OBJ_COMMON)
  1109. $(T.cc.sqlite) -c $(TOP)/src/mem0.c
  1110. mem1.o: $(TOP)/src/mem1.c $(DEPS_OBJ_COMMON)
  1111. $(T.cc.sqlite) -c $(TOP)/src/mem1.c
  1112. mem2.o: $(TOP)/src/mem2.c $(DEPS_OBJ_COMMON)
  1113. $(T.cc.sqlite) -c $(TOP)/src/mem2.c
  1114. mem3.o: $(TOP)/src/mem3.c $(DEPS_OBJ_COMMON)
  1115. $(T.cc.sqlite) -c $(TOP)/src/mem3.c
  1116. mem5.o: $(TOP)/src/mem5.c $(DEPS_OBJ_COMMON)
  1117. $(T.cc.sqlite) -c $(TOP)/src/mem5.c
  1118. memdb.o: $(TOP)/src/memdb.c $(DEPS_OBJ_COMMON)
  1119. $(T.cc.sqlite) -c $(TOP)/src/memdb.c
  1120. memjournal.o: $(TOP)/src/memjournal.c $(DEPS_OBJ_COMMON)
  1121. $(T.cc.sqlite) -c $(TOP)/src/memjournal.c
  1122. mutex.o: $(TOP)/src/mutex.c $(DEPS_OBJ_COMMON)
  1123. $(T.cc.sqlite) -c $(TOP)/src/mutex.c
  1124. mutex_noop.o: $(TOP)/src/mutex_noop.c $(DEPS_OBJ_COMMON)
  1125. $(T.cc.sqlite) -c $(TOP)/src/mutex_noop.c
  1126. mutex_unix.o: $(TOP)/src/mutex_unix.c $(DEPS_OBJ_COMMON)
  1127. $(T.cc.sqlite) -c $(TOP)/src/mutex_unix.c
  1128. mutex_w32.o: $(TOP)/src/mutex_w32.c $(DEPS_OBJ_COMMON)
  1129. $(T.cc.sqlite) -c $(TOP)/src/mutex_w32.c
  1130. notify.o: $(TOP)/src/notify.c $(DEPS_OBJ_COMMON)
  1131. $(T.cc.sqlite) -c $(TOP)/src/notify.c
  1132. pager.o: $(TOP)/src/pager.c $(DEPS_OBJ_COMMON) $(TOP)/src/pager.h
  1133. $(T.cc.sqlite) -c $(TOP)/src/pager.c
  1134. pcache.o: $(TOP)/src/pcache.c $(DEPS_OBJ_COMMON) $(TOP)/src/pcache.h
  1135. $(T.cc.sqlite) -c $(TOP)/src/pcache.c
  1136. pcache1.o: $(TOP)/src/pcache1.c $(DEPS_OBJ_COMMON) $(TOP)/src/pcache.h
  1137. $(T.cc.sqlite) -c $(TOP)/src/pcache1.c
  1138. os.o: $(TOP)/src/os.c $(DEPS_OBJ_COMMON)
  1139. $(T.cc.sqlite) -c $(TOP)/src/os.c
  1140. os_kv.o: $(TOP)/src/os_kv.c $(DEPS_OBJ_COMMON)
  1141. $(T.cc.sqlite) -c $(TOP)/src/os_kv.c
  1142. os_unix.o: $(TOP)/src/os_unix.c $(DEPS_OBJ_COMMON)
  1143. $(T.cc.sqlite) -c $(TOP)/src/os_unix.c
  1144. os_win.o: $(TOP)/src/os_win.c $(DEPS_OBJ_COMMON)
  1145. $(T.cc.sqlite) -c $(TOP)/src/os_win.c
  1146. pragma.o: $(TOP)/src/pragma.c $(DEPS_OBJ_COMMON)
  1147. $(T.cc.sqlite) -c $(TOP)/src/pragma.c
  1148. prepare.o: $(TOP)/src/prepare.c $(DEPS_OBJ_COMMON)
  1149. $(T.cc.sqlite) -c $(TOP)/src/prepare.c
  1150. printf.o: $(TOP)/src/printf.c $(DEPS_OBJ_COMMON)
  1151. $(T.cc.sqlite) -c $(TOP)/src/printf.c
  1152. random.o: $(TOP)/src/random.c $(DEPS_OBJ_COMMON)
  1153. $(T.cc.sqlite) -c $(TOP)/src/random.c
  1154. resolve.o: $(TOP)/src/resolve.c $(DEPS_OBJ_COMMON)
  1155. $(T.cc.sqlite) -c $(TOP)/src/resolve.c
  1156. rowset.o: $(TOP)/src/rowset.c $(DEPS_OBJ_COMMON)
  1157. $(T.cc.sqlite) -c $(TOP)/src/rowset.c
  1158. select.o: $(TOP)/src/select.c $(DEPS_OBJ_COMMON)
  1159. $(T.cc.sqlite) -c $(TOP)/src/select.c
  1160. status.o: $(TOP)/src/status.c $(DEPS_OBJ_COMMON)
  1161. $(T.cc.sqlite) -c $(TOP)/src/status.c
  1162. sqlite3.o: sqlite3.h sqlite3.c
  1163. $(T.cc.sqlite) -c sqlite3.c
  1164. table.o: $(TOP)/src/table.c $(DEPS_OBJ_COMMON)
  1165. $(T.cc.sqlite) -c $(TOP)/src/table.c
  1166. threads.o: $(TOP)/src/threads.c $(DEPS_OBJ_COMMON)
  1167. $(T.cc.sqlite) -c $(TOP)/src/threads.c
  1168. tokenize.o: $(TOP)/src/tokenize.c keywordhash.h $(DEPS_OBJ_COMMON)
  1169. $(T.cc.sqlite) -c $(TOP)/src/tokenize.c
  1170. treeview.o: $(TOP)/src/treeview.c $(DEPS_OBJ_COMMON)
  1171. $(T.cc.sqlite) -c $(TOP)/src/treeview.c
  1172. trigger.o: $(TOP)/src/trigger.c $(DEPS_OBJ_COMMON)
  1173. $(T.cc.sqlite) -c $(TOP)/src/trigger.c
  1174. update.o: $(TOP)/src/update.c $(DEPS_OBJ_COMMON)
  1175. $(T.cc.sqlite) -c $(TOP)/src/update.c
  1176. upsert.o: $(TOP)/src/upsert.c $(DEPS_OBJ_COMMON)
  1177. $(T.cc.sqlite) -c $(TOP)/src/upsert.c
  1178. utf.o: $(TOP)/src/utf.c $(DEPS_OBJ_COMMON)
  1179. $(T.cc.sqlite) -c $(TOP)/src/utf.c
  1180. util.o: $(TOP)/src/util.c $(DEPS_OBJ_COMMON)
  1181. $(T.cc.sqlite) -c $(TOP)/src/util.c
  1182. vacuum.o: $(TOP)/src/vacuum.c $(DEPS_OBJ_COMMON)
  1183. $(T.cc.sqlite) -c $(TOP)/src/vacuum.c
  1184. vdbe.o: $(TOP)/src/vdbe.c $(DEPS_OBJ_COMMON)
  1185. $(T.cc.sqlite) -c $(TOP)/src/vdbe.c
  1186. vdbeapi.o: $(TOP)/src/vdbeapi.c $(DEPS_OBJ_COMMON)
  1187. $(T.cc.sqlite) -c $(TOP)/src/vdbeapi.c
  1188. vdbeaux.o: $(TOP)/src/vdbeaux.c $(DEPS_OBJ_COMMON)
  1189. $(T.cc.sqlite) -c $(TOP)/src/vdbeaux.c
  1190. vdbeblob.o: $(TOP)/src/vdbeblob.c $(DEPS_OBJ_COMMON)
  1191. $(T.cc.sqlite) -c $(TOP)/src/vdbeblob.c
  1192. vdbemem.o: $(TOP)/src/vdbemem.c $(DEPS_OBJ_COMMON)
  1193. $(T.cc.sqlite) -c $(TOP)/src/vdbemem.c
  1194. vdbesort.o: $(TOP)/src/vdbesort.c $(DEPS_OBJ_COMMON)
  1195. $(T.cc.sqlite) -c $(TOP)/src/vdbesort.c
  1196. vdbetrace.o: $(TOP)/src/vdbetrace.c $(DEPS_OBJ_COMMON)
  1197. $(T.cc.sqlite) -c $(TOP)/src/vdbetrace.c
  1198. vdbevtab.o: $(TOP)/src/vdbevtab.c $(DEPS_OBJ_COMMON)
  1199. $(T.cc.sqlite) -c $(TOP)/src/vdbevtab.c
  1200. vtab.o: $(TOP)/src/vtab.c $(DEPS_OBJ_COMMON)
  1201. $(T.cc.sqlite) -c $(TOP)/src/vtab.c
  1202. wal.o: $(TOP)/src/wal.c $(DEPS_OBJ_COMMON)
  1203. $(T.cc.sqlite) -c $(TOP)/src/wal.c
  1204. walker.o: $(TOP)/src/walker.c $(DEPS_OBJ_COMMON)
  1205. $(T.cc.sqlite) -c $(TOP)/src/walker.c
  1206. where.o: $(TOP)/src/where.c $(DEPS_OBJ_COMMON)
  1207. $(T.cc.sqlite) -c $(TOP)/src/where.c
  1208. wherecode.o: $(TOP)/src/wherecode.c $(DEPS_OBJ_COMMON)
  1209. $(T.cc.sqlite) -c $(TOP)/src/wherecode.c
  1210. whereexpr.o: $(TOP)/src/whereexpr.c $(DEPS_OBJ_COMMON)
  1211. $(T.cc.sqlite) -c $(TOP)/src/whereexpr.c
  1212. window.o: $(TOP)/src/window.c $(DEPS_OBJ_COMMON)
  1213. $(T.cc.sqlite) -c $(TOP)/src/window.c
  1214. tclsqlite.o: $(T.tcl.env.sh) $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
  1215. $(T.compile.tcl) -DUSE_TCL_STUBS=1 $$TCL_INCLUDE_SPEC \
  1216. -c $(TOP)/src/tclsqlite.c
  1217. tclsqlite-shell.o: $(T.tcl.env.sh) $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
  1218. $(T.compile.tcl) -DTCLSH -o $@ -c $(TOP)/src/tclsqlite.c $$TCL_INCLUDE_SPEC
  1219. tclsqlite-stubs.o: $(T.tcl.env.sh) $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
  1220. $(T.compile.tcl) -DUSE_TCL_STUBS=1 -o $@ -c $(TOP)/src/tclsqlite.c $$TCL_INCLUDE_SPEC
  1221. tclsqlite3$(T.exe): $(T.tcl.env.sh) tclsqlite-shell.o $(libsqlite3.SO)
  1222. $(T.link.tcl) -o $@ tclsqlite-shell.o \
  1223. $(libsqlite3.SO) $$TCL_INCLUDE_SPEC $$TCL_LIB_SPEC \
  1224. $(LDFLAGS.libsqlite3)
  1225. tclsqlite3$(T.exe)-1: tclsqlite3$(T.exe)
  1226. tclsqlite3$(T.exe)-0 tclsqlite3$(T.exe)-:
  1227. tcl: tclsqlite3$(T.exe)-$(HAVE_TCL)
  1228. # Rules to build opcodes.c and opcodes.h
  1229. #
  1230. opcodes.c: opcodes.h $(TOP)/tool/mkopcodec.tcl $(B.tclsh)
  1231. $(B.tclsh) $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c
  1232. opcodes.h: parse.h $(TOP)/src/vdbe.c \
  1233. $(TOP)/tool/mkopcodeh.tcl $(B.tclsh)
  1234. cat parse.h $(TOP)/src/vdbe.c | $(B.tclsh) $(TOP)/tool/mkopcodeh.tcl >opcodes.h
  1235. # Rules to build parse.c and parse.h - the outputs of lemon.
  1236. #
  1237. parse.h: parse.c
  1238. parse.c: $(TOP)/src/parse.y lemon$(B.exe)
  1239. cp $(TOP)/src/parse.y .
  1240. ./lemon$(B.exe) $(OPT_FEATURE_FLAGS) $(OPTS) -S parse.y
  1241. sqlite3rc.h: $(TOP)/src/sqlite3.rc $(TOP)/VERSION $(B.tclsh)
  1242. echo '#ifndef SQLITE_RESOURCE_VERSION' >$@
  1243. echo -n '#define SQLITE_RESOURCE_VERSION ' >>$@
  1244. cat $(TOP)/VERSION | $(B.tclsh) $(TOP)/tool/replace.tcl exact . , >>$@
  1245. echo '#endif' >>sqlite3rc.h
  1246. mkkeywordhash$(B.exe): $(TOP)/tool/mkkeywordhash.c
  1247. $(B.cc) -o $@ $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)/tool/mkkeywordhash.c
  1248. keywordhash.h: mkkeywordhash$(B.exe)
  1249. ./mkkeywordhash$(B.exe) > $@
  1250. #
  1251. # sqlite3.c split into many smaller files.
  1252. #
  1253. sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl $(B.tclsh)
  1254. $(B.tclsh) $(TOP)/tool/split-sqlite3c.tcl
  1255. #
  1256. # Static libsqlite3
  1257. #
  1258. $(libsqlite3.LIB): $(LIBOBJ)
  1259. $(AR) $(AR.flags) $@ $(LIBOBJ)
  1260. $(libsqlite3.LIB)-1: $(libsqlite3.LIB)
  1261. $(libsqlite3.LIB)-0 $(libsqlite3.LIB)-:
  1262. lib: $(libsqlite3.LIB)-$(ENABLE_STATIC)
  1263. all: lib
  1264. #
  1265. # Dynamic libsqlite3
  1266. #
  1267. $(libsqlite3.SO): $(LIBOBJ)
  1268. $(T.link.shared) -o $@ $(LIBOBJ) $(LDFLAGS.libsqlite3) \
  1269. $(LDFLAGS.libsqlite3.soname)
  1270. $(libsqlite3.SO)-1: $(libsqlite3.SO)
  1271. $(libsqlite3.SO)-0 $(libsqlite3.SO)-:
  1272. so: $(libsqlite3.SO)-$(ENABLE_SHARED)
  1273. all: so
  1274. #
  1275. # Install the $(libsqlite3.SO) as $(libsqlite3.SO).$(PACKAGE_VERSION)
  1276. # and create symlinks which point to it:
  1277. #
  1278. # - libsqlite3.so.$(PACKAGE_VERSION)
  1279. # - libsqlite3.so.0 =symlink-> libsqlite3.so.$(PACKAGE_VERSION) (see below)
  1280. # - libsqlite3.so =symlink-> libsqlite3.so.3
  1281. #
  1282. # N.B. we initially had a link named libsqlite3.so.3 but it's
  1283. # unnecessary unless we want to set SONAME to libsqlite3.so.3, which
  1284. # is also unnecessary.
  1285. #
  1286. # The link named libsqlite3.so.0 is provided in an attempt to reduce
  1287. # downstream disruption when performing upgrades from pre-3.48 to a
  1288. # version 3.48 or higher. That name is considered a legacy remnant
  1289. # and will eventually be removed from this installation process.
  1290. #
  1291. # Historically libtool installed the library like so:
  1292. #
  1293. # libsqlite3.so -> libsqlite3.so.0.8.6
  1294. # libsqlite3.so.0 -> libsqlite3.so.0.8.6
  1295. # libsqlite3.so.0.8.6
  1296. #
  1297. # The historical SQLite build always used a version number of 0.8.6
  1298. # for reasons lost to history but having something to do with libtool
  1299. # (which is no longer used in this tree). In order to retain filename
  1300. # compatibility for systems which have libraries installed using those
  1301. # conventions:
  1302. #
  1303. # 1) If libsqlite3.so.0.8.6 is found in the target installation
  1304. # directory then it is re-linked to point to the newer-style
  1305. # names. We cannot retain both the old and new installation because
  1306. # they both share the high-level name $(libsqlite3.SO). The
  1307. # down-side of this is that it may upset packaging tools when we
  1308. # replace libsqlite3.so (from a legacy package) with a new symlink.
  1309. #
  1310. # 2) If INSTALL_SO_086_LINK=1 and point (1) does not apply then links
  1311. # to the legacy-style names are created. The primary intent of this
  1312. # is to enable chains of operations such as the hypothetical (apt
  1313. # remove sqlite3-3.47.0 && apt install sqlite3-3.48.0). In such
  1314. # cases, condition (1) would never trigger but applications might
  1315. # still expect to see the legacy file names.
  1316. #
  1317. # In either case, libsqlite3.la, if found, is deleted because it would
  1318. # contain stale state, refering to non-libtool-generated libraries.
  1319. #
  1320. install-so-1: $(install-dir.lib) $(libsqlite3.SO)
  1321. $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)"
  1322. @echo "Setting up $(libsqlite3.SO) symlinks..."; \
  1323. cd "$(install-dir.lib)" || exit $$?; \
  1324. rm -f $(libsqlite3.SO).0 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \
  1325. mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \
  1326. ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \
  1327. ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0 || exit $$?; \
  1328. ls -la $(libsqlite3.SO) $(libsqlite3.SO).[03]*; \
  1329. if [ -e $(libsqlite3.SO).0.8.6 ]; then \
  1330. echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \
  1331. rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \
  1332. ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \
  1333. ls -la $(libsqlite3.SO).0.8.6; \
  1334. elif [ x1 = "x$(INSTALL_SO_086_LINK)" ]; then \
  1335. echo "ACHTUNG: installing legacy libtool-style links because INSTALL_SO_086_LINK=1"; \
  1336. rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \
  1337. ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \
  1338. ls -la $(libsqlite3.SO).0.8.6; \
  1339. fi
  1340. install-so-0 install-so-:
  1341. install-so: install-so-$(ENABLE_SHARED)
  1342. install: install-so
  1343. #
  1344. # Install $(libsqlite3.LIB)
  1345. #
  1346. install-lib-1: $(install-dir.lib) $(libsqlite3.LIB)
  1347. $(INSTALL.noexec) $(libsqlite3.LIB) "$(install-dir.lib)"
  1348. install-lib-0 install-lib-:
  1349. install-lib: install-lib-$(ENABLE_STATIC)
  1350. install: install-lib
  1351. #
  1352. # Install C header files
  1353. #
  1354. install-headers: sqlite3.h $(install-dir.include)
  1355. $(INSTALL.noexec) sqlite3.h "$(TOP)/src/sqlite3ext.h" "$(install-dir.include)"
  1356. install: install-headers
  1357. #
  1358. # libtclsqlite3...
  1359. #
  1360. pkgIndex.tcl:
  1361. echo 'package ifneeded sqlite3 $(PACKAGE_VERSION) [list load [file join $$dir libtclsqlite3[info sharedlibextension]] sqlite3]' > $@
  1362. pkgIndex.tcl-1: pkgIndex.tcl
  1363. pkgIndex.tcl-0 pkgIndex.tcl-:
  1364. tcl: pkgIndex.tcl-$(HAVE_TCL)
  1365. libtclsqlite3.SO = libtclsqlite3$(T.dll)
  1366. $(libtclsqlite3.SO): $(T.tcl.env.sh) tclsqlite.o $(LIBOBJ)
  1367. $(T.tcl.env.source); \
  1368. $(T.link.shared) -o $@ tclsqlite.o \
  1369. $$TCL_INCLUDE_SPEC $$TCL_STUB_LIB_SPEC $(LDFLAGS.libsqlite3) \
  1370. $(LIBOBJ) -Wl,-rpath,$$TCLLIBDIR
  1371. # ^^^ that rpath bit is defined as TCL_LD_SEARCH_FLAGS in
  1372. # tclConfig.sh, but it's defined in such a way as to be useless for a
  1373. # _static_ makefile.
  1374. $(libtclsqlite3.SO)-1: $(libtclsqlite3.SO)
  1375. $(libtclsqlite3.SO)-0 $(libtclsqlite3.SO)-:
  1376. libtcl: $(libtclsqlite3.SO)-$(HAVE_TCL)
  1377. tcl: libtcl
  1378. all: tcl
  1379. install-tcl-1: $(libtclsqlite3.SO) pkgIndex.tcl
  1380. $(T.tcl.env.source); \
  1381. $(INSTALL) -d "$(DESTDIR)$$TCLLIBDIR"; \
  1382. $(INSTALL) $(libtclsqlite3.SO) "$(DESTDIR)$$TCLLIBDIR"; \
  1383. $(INSTALL.noexec) pkgIndex.tcl "$(DESTDIR)$$TCLLIBDIR"
  1384. install-tcl-0 install-tcl-:
  1385. @echo "TCL support disabled, so not installing $(libtclsqlite3.SO)"
  1386. install-tcl: install-tcl-$(HAVE_TCL)
  1387. install: install-tcl
  1388. tclsqlite3.c: sqlite3.c
  1389. echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c
  1390. cat sqlite3.c >>tclsqlite3.c
  1391. echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite3.c
  1392. cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
  1393. #
  1394. # $(CFLAGS.tclextension) = CFLAGS for the tclextension* targets.
  1395. #
  1396. CFLAGS.tclextension = $(CFLAGS.intree_includes) $(CFLAGS.env) $(OPT_FEATURE_FLAGS) $(OPTS)
  1397. #
  1398. # Build the SQLite TCL extension in a way that make it compatible
  1399. # with whatever version of TCL is running as $TCLSH_CMD, possibly defined
  1400. # by --with-tclsh=
  1401. #
  1402. tclextension: tclsqlite3.c
  1403. $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --build-only --cc "$(T.cc)" $(CFLAGS.tclextension)
  1404. #
  1405. # Install the SQLite TCL extension in a way that is appropriate for $TCLSH_CMD
  1406. # to find it.
  1407. #
  1408. tclextension-install: tclsqlite3.c
  1409. $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --destdir "$(DESTDIR)" --cc "$(T.cc)" $(CFLAGS.tclextension)
  1410. #
  1411. # Uninstall the SQLite TCL extension that is used by $TCLSH_CMD.
  1412. #
  1413. tclextension-uninstall:
  1414. $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --uninstall
  1415. #
  1416. # List all installed the SQLite TCL extensions that is are accessible
  1417. # by $TCLSH_CMD, including prior versions.
  1418. #
  1419. tclextension-list:
  1420. $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --info
  1421. #
  1422. # FTS5 things
  1423. #
  1424. FTS5_SRC = \
  1425. $(TOP)/ext/fts5/fts5.h \
  1426. $(TOP)/ext/fts5/fts5Int.h \
  1427. $(TOP)/ext/fts5/fts5_aux.c \
  1428. $(TOP)/ext/fts5/fts5_buffer.c \
  1429. $(TOP)/ext/fts5/fts5_main.c \
  1430. $(TOP)/ext/fts5/fts5_config.c \
  1431. $(TOP)/ext/fts5/fts5_expr.c \
  1432. $(TOP)/ext/fts5/fts5_hash.c \
  1433. $(TOP)/ext/fts5/fts5_index.c \
  1434. fts5parse.c fts5parse.h \
  1435. $(TOP)/ext/fts5/fts5_storage.c \
  1436. $(TOP)/ext/fts5/fts5_tokenize.c \
  1437. $(TOP)/ext/fts5/fts5_unicode2.c \
  1438. $(TOP)/ext/fts5/fts5_varint.c \
  1439. $(TOP)/ext/fts5/fts5_vocab.c \
  1440. fts5parse.c: $(TOP)/ext/fts5/fts5parse.y lemon$(B.exe)
  1441. cp $(TOP)/ext/fts5/fts5parse.y .
  1442. rm -f fts5parse.h
  1443. ./lemon$(B.exe) $(OPTS) -S fts5parse.y
  1444. fts5parse.h: fts5parse.c
  1445. fts5.c: $(FTS5_SRC) $(B.tclsh)
  1446. $(B.tclsh) $(TOP)/ext/fts5/tool/mkfts5c.tcl
  1447. cp $(TOP)/ext/fts5/fts5.h .
  1448. fts5.o: fts5.c $(DEPS_OBJ_COMMON) $(EXTHDR)
  1449. $(T.cc.extension) -c fts5.c
  1450. sqlite3rbu.o: $(TOP)/ext/rbu/sqlite3rbu.c $(DEPS_OBJ_COMMON) $(EXTHDR)
  1451. $(T.cc.extension) -c $(TOP)/ext/rbu/sqlite3rbu.c
  1452. #
  1453. # Rules to build the 'testfixture' application.
  1454. #
  1455. # If using the amalgamation, use sqlite3.c directly to build the test
  1456. # fixture. Otherwise link against libsqlite3.a. (This distinction is
  1457. # necessary because the test fixture requires non-API symbols which are
  1458. # hidden when the library is built via the amalgamation).
  1459. #
  1460. TESTFIXTURE_FLAGS = -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
  1461. TESTFIXTURE_FLAGS += -DTCLSH_INIT_PROC=sqlite3TestInit
  1462. TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
  1463. TESTFIXTURE_FLAGS += -DBUILD_sqlite
  1464. TESTFIXTURE_FLAGS += -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
  1465. TESTFIXTURE_FLAGS += -DSQLITE_DEFAULT_PAGE_SIZE=1024
  1466. TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_STMTVTAB
  1467. TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_DBPAGE_VTAB
  1468. TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_BYTECODE_VTAB
  1469. TESTFIXTURE_FLAGS += -DSQLITE_CKSUMVFS_STATIC
  1470. TESTFIXTURE_FLAGS += -DSQLITE_STATIC_RANDOMJSON
  1471. TESTFIXTURE_FLAGS += -DSQLITE_STRICT_SUBTYPE=1
  1472. TESTFIXTURE_SRC0 = $(TESTSRC2) $(libsqlite3.LIB)
  1473. TESTFIXTURE_SRC1 = sqlite3.c
  1474. TESTFIXTURE_SRC = $(TESTSRC) $(TOP)/src/tclsqlite.c
  1475. TESTFIXTURE_SRC += $(TESTFIXTURE_SRC$(USE_AMALGAMATION))
  1476. testfixture$(T.exe): $(T.tcl.env.sh) has_tclsh85 $(TESTFIXTURE_SRC)
  1477. $(T.link.tcl) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
  1478. -o $@ $(TESTFIXTURE_SRC) \
  1479. $$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC \
  1480. $(LDFLAGS.libsqlite3)
  1481. coretestprogs: testfixture$(B.exe) sqlite3$(B.exe)
  1482. testprogs: $(TESTPROGS) srcck1$(B.exe) fuzzcheck$(T.exe) sessionfuzz$(T.exe)
  1483. # A very detailed test running most or all test cases
  1484. fulltest: alltest fuzztest
  1485. # Run most or all tcl test cases
  1486. alltest: $(TESTPROGS)
  1487. ./testfixture$(T.exe) $(TOP)/test/all.test $(TESTOPTS)
  1488. # Really really long testing
  1489. soaktest: $(TESTPROGS)
  1490. ./testfixture$(T.exe) $(TOP)/test/all.test -soak=1 $(TESTOPTS)
  1491. # Do extra testing but not everything.
  1492. fulltestonly: $(TESTPROGS) fuzztest
  1493. ./testfixture$(T.exe) $(TOP)/test/full.test
  1494. #
  1495. # Fuzz testing
  1496. #
  1497. # WARNING: When the "fuzztest" target is run by the testrunner.tcl script,
  1498. # it does not actually run this code. Instead, it schedules equivalent
  1499. # commands. Therefore, if this target is updated, then code in
  1500. # testrunner_data.tcl (search for "trd_fuzztest_data") must also be updated.
  1501. #
  1502. fuzztest: fuzzcheck$(T.exe) $(FUZZDATA) sessionfuzz$(T.exe)
  1503. ./fuzzcheck$(T.exe) $(FUZZDATA)
  1504. ./sessionfuzz$(T.exe) run $(TOP)/test/sessionfuzz-data1.db
  1505. valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA) sessionfuzz$(T.exe)
  1506. valgrind ./fuzzcheck$(T.exe) --cell-size-check --limit-mem 10M $(FUZZDATA)
  1507. valgrind ./sessionfuzz$(T.exe) run $(TOP)/test/sessionfuzz-data1.db
  1508. #
  1509. # The veryquick.test TCL tests.
  1510. #
  1511. tcltest: ./testfixture$(T.exe)
  1512. ./testfixture$(T.exe) $(TOP)/test/veryquick.test $(TESTOPTS)
  1513. #
  1514. # Runs all the same tests cases as the "tcltest" target but uses
  1515. # the testrunner.tcl script to run them in multiple cores
  1516. # concurrently.
  1517. testrunner: testfixture$(T.exe)
  1518. ./testfixture$(T.exe) $(TOP)/test/testrunner.tcl
  1519. #
  1520. # This is the testing target preferred by the core SQLite developers.
  1521. # It runs tests under a standard configuration, regardless of how
  1522. # ./configure was run. The devs run "make devtest" prior to each
  1523. # check-in, at a minimum. Probably other tests too, but at least this
  1524. # one.
  1525. #
  1526. devtest: srctree-check sourcetest
  1527. $(TCLSH_CMD) $(TOP)/test/testrunner.tcl mdevtest $(TSTRNNR_OPTS)
  1528. mdevtest: srctree-check has_tclsh85
  1529. $(TCLSH_CMD) $(TOP)/test/testrunner.tcl mdevtest $(TSTRNNR_OPTS)
  1530. sdevtest: has_tclsh85
  1531. $(TCLSH_CMD) $(TOP)/test/testrunner.tcl sdevtest $(TSTRNNR_OPTS)
  1532. #
  1533. # Validate that various generated files in the source tree
  1534. # are up-to-date.
  1535. #
  1536. srctree-check: $(TOP)/tool/srctree-check.tcl
  1537. $(TCLSH_CMD) $(TOP)/tool/srctree-check.tcl
  1538. #
  1539. # Testing for a release
  1540. #
  1541. releasetest: srctree-check has_tclsh85 verify-source
  1542. $(TCLSH_CMD) $(TOP)/test/testrunner.tcl release $(TSTRNNR_OPTS)
  1543. #
  1544. # Minimal testing that runs in less than 3 minutes
  1545. #
  1546. quicktest: ./testfixture$(T.exe)
  1547. ./testfixture$(T.exe) $(TOP)/test/extraquick.test $(TESTOPTS)
  1548. #
  1549. # Try to run tests on whatever options are specified by the
  1550. # ./configure. The developers seldom use this target. Instead
  1551. # they use "make devtest" which runs tests on a standard set of
  1552. # options regardless of how SQLite is configured. This "test"
  1553. # target is provided for legacy only.
  1554. #
  1555. test: srctree-check fuzztest sourcetest $(TESTPROGS) tcltest
  1556. #
  1557. # Run a test using valgrind. This can take a really long time
  1558. # because valgrind is so much slower than a native machine.
  1559. #
  1560. valgrindtest: $(TESTPROGS) valgrindfuzz
  1561. OMIT_MISUSE=1 valgrind -v ./testfixture$(T.exe) $(TOP)/test/permutations.test valgrind $(TESTOPTS)
  1562. #
  1563. # A very fast test that checks basic sanity. The name comes from
  1564. # the 60s-era electronics testing: "Turn it on and see if smoke
  1565. # comes out."
  1566. #
  1567. smoketest: $(TESTPROGS) fuzzcheck$(T.exe)
  1568. ./testfixture$(T.exe) $(TOP)/test/main.test $(TESTOPTS)
  1569. shelltest:
  1570. $(TCLSH_CMD) $(TOP)/test/testrunner.tcl release shell
  1571. #
  1572. # sqlite3_analyzer.c build depends on $(LINK_TOOLS_DYNAMICALLY).
  1573. #
  1574. sqlite3_analyzer.c.flags.0 = -DINCLUDE_SQLITE3_C=1
  1575. sqlite3_analyzer.c.flags.1 =
  1576. sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl \
  1577. $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in
  1578. $(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in \
  1579. $(sqlite3_analyzer.c.flags.$(LINK_TOOLS_DYNAMICALLY)) \
  1580. $(OPT_FEATURE_FLAGS) \
  1581. > $@
  1582. #
  1583. # sqlite3_analyzer's build mode depends on $(LINK_TOOLS_DYNAMICALLY).
  1584. #
  1585. sqlite3_analyzer.flags.1 = -L. -lsqlite3
  1586. sqlite3_analyzer.flags.0 = $(LDFLAGS.libsqlite3)
  1587. sqlite3_analyzer.deps.1 = $(libsqlite3.SO)
  1588. sqlite3_analyzer.deps.0 =
  1589. sqlite3_analyzer$(T.exe): $(T.tcl.env.sh) sqlite3_analyzer.c \
  1590. $(sqlite3_analyzer.deps.$(LINK_TOOLS_DYNAMICALLY))
  1591. $(T.link.tcl) sqlite3_analyzer.c -o $@ \
  1592. $(sqlite3_analyzer.flags.$(LINK_TOOLS_DYNAMICALLY)) \
  1593. $$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC $$TCL_LIBS
  1594. # ^^^^ the order of those flags is relevant for
  1595. # $(sqlite3_analyzer.flags.1): if the $$TCL_... flags come first they
  1596. # can cause the $@ to link to an out-of-tree libsqlite3.so, which may
  1597. # or may not fail or otherwise cause confusion.
  1598. sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl \
  1599. $(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl \
  1600. $(TOP)/tool/sqltclsh.c.in
  1601. $(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in >sqltclsh.c
  1602. sqltclsh$(T.exe): $(T.tcl.env.sh) sqltclsh.c
  1603. $(T.link.tcl) sqltclsh.c -o $@ $$TCL_INCLUDE_SPEC \
  1604. $(LDFLAGS.libsqlite3) $$TCL_LIB_SPEC $$TCL_LIBS
  1605. # xbin: target for generic binaries which aren't usually built. It is
  1606. # used primarily for testing the build process.
  1607. xbin: sqltclsh$(T.exe) sqlite3_analyzer$(T.exe)
  1608. sqlite3_expert$(T.exe): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c \
  1609. $(TOP)/ext/expert/expert.c sqlite3.c
  1610. $(T.link) $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c \
  1611. $(TOP)/ext/expert/expert.c sqlite3.c -o sqlite3_expert $(LDFLAGS.libsqlite3)
  1612. xbin: sqlite3_expert$(T.exe)
  1613. CHECKER_DEPS =\
  1614. $(TOP)/tool/mkccode.tcl \
  1615. sqlite3.c \
  1616. $(TOP)/src/tclsqlite.c \
  1617. $(TOP)/ext/repair/sqlite3_checker.tcl \
  1618. $(TOP)/ext/repair/checkindex.c \
  1619. $(TOP)/ext/repair/checkfreelist.c \
  1620. $(TOP)/ext/misc/btreeinfo.c \
  1621. $(TOP)/ext/repair/sqlite3_checker.c.in
  1622. sqlite3_checker.c: $(CHECKER_DEPS)
  1623. $(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/ext/repair/sqlite3_checker.c.in >$@
  1624. sqlite3_checker$(T.exe): $(T.tcl.env.sh) sqlite3_checker.c
  1625. $(T.link.tcl) sqlite3_checker.c -o $@ $$TCL_INCLUDE_SPEC \
  1626. $$TCL_LIB_SPEC $(LDFLAGS.libsqlite3)
  1627. xbin: sqlite3_checker$(T.exe)
  1628. dbdump$(T.exe): $(TOP)/ext/misc/dbdump.c sqlite3.o
  1629. $(T.link) -DDBDUMP_STANDALONE -o $@ \
  1630. $(TOP)/ext/misc/dbdump.c sqlite3.o $(LDFLAGS.libsqlite3)
  1631. xbin: dbdump$(T.exe)
  1632. dbtotxt$(T.exe): $(TOP)/tool/dbtotxt.c
  1633. $(T.link)-o $@ $(TOP)/tool/dbtotxt.c $(LDFLAGS.configure)
  1634. xbin: dbtotxt$(T.exe)
  1635. showdb$(T.exe): $(TOP)/tool/showdb.c sqlite3.o
  1636. $(T.link) -o $@ $(TOP)/tool/showdb.c sqlite3.o $(LDFLAGS.libsqlite3)
  1637. xbin: showdb$(T.exe)
  1638. showstat4$(T.exe): $(TOP)/tool/showstat4.c sqlite3.o
  1639. $(T.link) -o $@ $(TOP)/tool/showstat4.c sqlite3.o $(LDFLAGS.libsqlite3)
  1640. xbin: showstat4$(T.exe)
  1641. showjournal$(T.exe): $(TOP)/tool/showjournal.c sqlite3.o
  1642. $(T.link) -o $@ $(TOP)/tool/showjournal.c sqlite3.o $(LDFLAGS.libsqlite3)
  1643. xbin: showjournal$(T.exe)
  1644. showwal$(T.exe): $(TOP)/tool/showwal.c sqlite3.o
  1645. $(T.link) -o $@ $(TOP)/tool/showwal.c sqlite3.o $(LDFLAGS.libsqlite3)
  1646. xbin: showwal$(T.exe)
  1647. showshm$(T.exe): $(TOP)/tool/showshm.c
  1648. $(T.link) -o $@ $(TOP)/tool/showshm.c $(LDFLAGS.configure)
  1649. xbin: showshm$(T.exe)
  1650. index_usage$(T.exe): $(TOP)/tool/index_usage.c sqlite3.o
  1651. $(T.link) $(SHELL_OPT) -o $@ $(TOP)/tool/index_usage.c sqlite3.o \
  1652. $(LDFLAGS.libsqlite3)
  1653. xbin: index_usage$(T.exe)
  1654. # Reminder: changeset does not build without -DSQLITE_ENABLE_SESSION
  1655. changeset$(T.exe): $(TOP)/ext/session/changeset.c sqlite3.o
  1656. $(T.link) -o $@ $(TOP)/ext/session/changeset.c sqlite3.o \
  1657. $(LDFLAGS.libsqlite3)
  1658. xbin: changeset$(T.exe)
  1659. changesetfuzz$(T.exe): $(TOP)/ext/session/changesetfuzz.c sqlite3.o
  1660. $(T.link) -o $@ $(TOP)/ext/session/changesetfuzz.c sqlite3.o \
  1661. $(LDFLAGS.libsqlite3)
  1662. xbin: changesetfuzz$(T.exe)
  1663. rollback-test$(T.exe): $(TOP)/tool/rollback-test.c sqlite3.o
  1664. $(T.link) -o $@ $(TOP)/tool/rollback-test.c sqlite3.o $(LDFLAGS.libsqlite3)
  1665. xbin: rollback-test$(T.exe)
  1666. atrc$(T.exe): $(TOP)/test/atrc.c sqlite3.o
  1667. $(T.link) -o $@ $(TOP)/test/atrc.c sqlite3.o $(LDFLAGS.libsqlite3)
  1668. xbin: atrc$(T.exe)
  1669. LogEst$(T.exe): $(TOP)/tool/logest.c sqlite3.h
  1670. $(T.link) -I. -o $@ $(TOP)/tool/logest.c $(LDFLAGS.configure)
  1671. xbin: LogEst$(T.exe)
  1672. wordcount$(T.exe): $(TOP)/test/wordcount.c sqlite3.o
  1673. $(T.link) -o $@ $(TOP)/test/wordcount.c sqlite3.o $(LDFLAGS.libsqlite3)
  1674. xbin: wordcount$(T.exe)
  1675. speedtest1$(T.exe): $(TOP)/test/speedtest1.c sqlite3.c Makefile
  1676. $(T.link) $(ST_OPT) -o $@ $(TOP)/test/speedtest1.c sqlite3.c \
  1677. $(LDFLAGS.libsqlite3)
  1678. xbin: speedtest1$(T.exe)
  1679. startup$(T.exe): $(TOP)/test/startup.c sqlite3.c
  1680. $(T.link) -Os -g -USQLITE_THREADSAFE -DSQLITE_THREADSAFE=0 \
  1681. -o $@ $(TOP)/test/startup.c sqlite3.c $(LDFLAGS.libsqlite3)
  1682. xbin: startup$(T.exe)
  1683. KV_OPT += -DSQLITE_DIRECT_OVERFLOW_READ
  1684. kvtest$(T.exe): $(TOP)/test/kvtest.c sqlite3.c
  1685. $(T.link) $(KV_OPT) -o $@ $(TOP)/test/kvtest.c sqlite3.c \
  1686. $(LDFLAGS.libsqlite3)
  1687. xbin: kvtest$(T.exe)
  1688. #
  1689. # rbu$(T.exe) requires building with -DSQLITE_ENABLE_RBU, which
  1690. # specifically does not have an --enable-rbu flag in the configure
  1691. # script.
  1692. rbu$(T.exe): $(TOP)/ext/rbu/rbu.c $(TOP)/ext/rbu/sqlite3rbu.c sqlite3.o
  1693. $(T.link) -I. -o $@ $(TOP)/ext/rbu/rbu.c sqlite3.o $(LDFLAGS.libsqlite3)
  1694. loadfts$(T.exe): $(TOP)/tool/loadfts.c $(libsqlite3.LIB)
  1695. $(T.link) $(TOP)/tool/loadfts.c $(libsqlite3.LIB) \
  1696. -o $@ $(LDFLAGS.libsqlite3)
  1697. xbin: loadfts$(T.exe)
  1698. # This target will fail if the SQLite amalgamation contains any exported
  1699. # symbols that do not begin with "sqlite3_". It is run as part of the
  1700. # releasetest.tcl script.
  1701. #
  1702. VALIDIDS=' sqlite3(changeset|changegroup|session|rebaser)?_'
  1703. checksymbols: sqlite3.o
  1704. nm -g --defined-only sqlite3.o
  1705. nm -g --defined-only sqlite3.o | egrep -v $(VALIDIDS); test $$? -ne 0
  1706. echo '0 errors out of 1 tests'
  1707. # Build the amalgamation-autoconf package. The amalamgation-tarball target builds
  1708. # a tarball named for the version number. Ex: sqlite-autoconf-3110000.tar.gz.
  1709. # The snapshot-tarball target builds a tarball named by the SHA3 hash
  1710. #
  1711. amalgamation-tarball: sqlite3.c sqlite3rc.h
  1712. TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh --normal
  1713. snapshot-tarball: sqlite3.c sqlite3rc.h
  1714. TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh --snapshot
  1715. # Build a ZIP archive containing various command-line tools.
  1716. #
  1717. tool-zip: testfixture$(T.exe) sqlite3$(T.exe) sqldiff$(T.exe) \
  1718. sqlite3_analyzer$(T.exe) sqlite3_rsync$(T.exe) $(TOP)/tool/mktoolzip.tcl
  1719. strip sqlite3$(T.exe) sqldiff$(T.exe) sqlite3_analyzer$(T.exe) sqlite3_rsync$(T.exe)
  1720. ./testfixture$(T.exe) $(TOP)/tool/mktoolzip.tcl
  1721. clean-tool-zip:
  1722. rm -f sqlite-tools-*.zip
  1723. clean: clean-tool-zip
  1724. #
  1725. # The next few rules are used to support the "threadtest" target. Building
  1726. # threadtest runs a few thread-safety tests that are implemented in C. This
  1727. # target is invoked by the releasetest.tcl script.
  1728. #
  1729. THREADTEST3_SRC = $(TOP)/test/threadtest3.c \
  1730. $(TOP)/test/tt3_checkpoint.c \
  1731. $(TOP)/test/tt3_index.c \
  1732. $(TOP)/test/tt3_vacuum.c \
  1733. $(TOP)/test/tt3_stress.c \
  1734. $(TOP)/test/tt3_lookaside1.c
  1735. threadtest3$(T.exe): sqlite3.o $(THREADTEST3_SRC)
  1736. $(T.link) $(TOP)/test/threadtest3.c $(TOP)/src/test_multiplex.c sqlite3.o \
  1737. -o $@ $(LDFLAGS.libsqlite3)
  1738. xbin: threadtest3$(T.exe)
  1739. threadtest: threadtest3$(T.exe)
  1740. ./threadtest3$(T.exe)
  1741. threadtest5: sqlite3.c $(TOP)/test/threadtest5.c
  1742. $(T.link) $(TOP)/test/threadtest5.c sqlite3.c -o $@ $(LDFLAGS.libsqlite3)
  1743. xbin: threadtest5
  1744. #
  1745. # When building sqlite3$(T.exe) we specifically embed a copy of
  1746. # sqlite3.c, and not link to libsqlite3.so or libsqlite3.a, because
  1747. # the shell needs to be able to enable arbitrary library features,
  1748. # some of which have significant performance impacts. For example,,
  1749. # SQLITE_ENABLE_EXPLAIN_COMMENTS has been measured as having a 5.2%
  1750. # runtime performance hit, which is fine for use in the shell but is
  1751. # not appropriate for the canonical library build.
  1752. #
  1753. sqlite3$(T.exe): shell.c sqlite3.c
  1754. $(T.link) -o $@ \
  1755. shell.c sqlite3.c \
  1756. $(CFLAGS.readline) $(SHELL_OPT) $(CFLAGS.icu) \
  1757. $(LDFLAGS.libsqlite3) $(LDFLAGS.readline)
  1758. #
  1759. # Build sqlite3$(T.exe) by default except in wasi-sdk builds. Yes, the
  1760. # semantics of 0 and 1 are confusingly swapped here.
  1761. #
  1762. sqlite3$(T.exe)-1:
  1763. sqlite3$(T.exe)-0: sqlite3$(T.exe)
  1764. all: sqlite3$(T.exe)-$(HAVE_WASI_SDK)
  1765. # The "sqlite3d" CLI is build using separate source files. This
  1766. # is useful during development and debugging.
  1767. #
  1768. sqlite3d$(T.exe): shell.c $(LIBOBJS0)
  1769. $(T.link) -o $@ \
  1770. shell.c $(LIBOBJS0) \
  1771. $(CFLAGS.readline) $(SHELL_OPT) \
  1772. $(LDFLAGS.libsqlite3) $(LDFLAGS.readline)
  1773. install-shell-0: sqlite3$(T.exe) $(install-dir.bin)
  1774. $(INSTALL) -s sqlite3$(T.exe) "$(install-dir.bin)"
  1775. install-shell-1:
  1776. install: install-shell-$(HAVE_WASI_SDK)
  1777. # How to build sqldiff$(T.exe) depends on $(LINK_TOOLS_DYNAMICALLY)
  1778. #
  1779. sqldiff.0.deps = $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h sqlite3.o sqlite3.h
  1780. sqldiff.0.rules = $(T.link) -o $@ $(TOP)/tool/sqldiff.c sqlite3.o $(LDFLAGS.libsqlite3)
  1781. sqldiff.1.deps = $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h $(libsqlite3.SO)
  1782. sqldiff.1.rules = $(T.link) -o $@ $(TOP)/tool/sqldiff.c -L. -lsqlite3 $(LDFLAGS.configure)
  1783. sqldiff$(T.exe): $(sqldiff.$(LINK_TOOLS_DYNAMICALLY).deps)
  1784. $(sqldiff.$(LINK_TOOLS_DYNAMICALLY).rules)
  1785. install-diff: sqldiff$(T.exe) $(install-dir.bin)
  1786. $(INSTALL) -s sqldiff$(T.exe) "$(install-dir.bin)"
  1787. #install: install-diff
  1788. dbhash$(T.exe): $(TOP)/tool/dbhash.c sqlite3.o sqlite3.h
  1789. $(T.link) -o $@ $(TOP)/tool/dbhash.c sqlite3.o $(LDFLAGS.libsqlite3)
  1790. xbin: dbhash$(T.exe)
  1791. RSYNC_SRC = \
  1792. $(TOP)/tool/sqlite3_rsync.c \
  1793. sqlite3.c
  1794. RSYNC_OPT = \
  1795. -DSQLITE_ENABLE_DBPAGE_VTAB \
  1796. -USQLITE_THREADSAFE \
  1797. -DSQLITE_THREADSAFE=0 \
  1798. -DSQLITE_OMIT_LOAD_EXTENSION \
  1799. -DSQLITE_OMIT_DEPRECATED
  1800. sqlite3_rsync$(T.exe): $(RSYNC_SRC)
  1801. $(T.cc.sqlite) -o $@ $(RSYNC_OPT) $(RSYNC_SRC) $(LDFLAGS.libsqlite3)
  1802. xbin: sqlite3_rsync$(T.exe)
  1803. install-rsync: sqlite3_rsync$(T.exe) $(install-dir.bin)
  1804. $(INSTALL) sqlite3_rsync$(T.exe) "$(install-dir.bin)"
  1805. #install: install-rsync
  1806. install-man1: $(install-dir.man1)
  1807. $(INSTALL.noexec) "$(TOP)/sqlite3.1" "$(install-dir.man1)"
  1808. install: install-man1
  1809. #
  1810. # sqlite3.pc is typically generated by the configure script but could
  1811. # conceivably be generated by hand.
  1812. install-pc: sqlite3.pc $(install-dir.pkgconfig)
  1813. $(INSTALL.noexec) sqlite3.pc "$(install-dir.pkgconfig)"
  1814. scrub$(T.exe): $(TOP)/ext/misc/scrub.c sqlite3.o
  1815. $(T.link) -o $@ -I. -DSCRUB_STANDALONE \
  1816. $(TOP)/ext/misc/scrub.c sqlite3.o $(LDFLAGS.libsqlite3)
  1817. xbin: scrub$(T.exe)
  1818. srcck1$(B.exe): $(TOP)/tool/srcck1.c
  1819. $(B.cc) -o srcck1$(B.exe) $(TOP)/tool/srcck1.c
  1820. xbin: srcck1$(B.exe)
  1821. sourcetest: srcck1$(B.exe) sqlite3.c
  1822. ./srcck1$(B.exe) sqlite3.c
  1823. src-verify$(B.exe): $(TOP)/tool/src-verify.c
  1824. $(B.cc) -o src-verify$(B.exe) $(TOP)/tool/src-verify.c
  1825. xbin: src-verify$(B.exe)
  1826. verify-source: ./src-verify$(B.exe)
  1827. ./src-verify$(B.exe) $(TOP)
  1828. fuzzershell$(T.exe): $(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h
  1829. $(T.link) -o $@ $(FUZZERSHELL_OPT) \
  1830. $(TOP)/tool/fuzzershell.c sqlite3.c $(LDFLAGS.libsqlite3)
  1831. fuzzy: fuzzershell$(T.exe)
  1832. xbin: fuzzershell$(T.exe)
  1833. fuzzcheck$(T.exe): $(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP)
  1834. $(T.link) -o $@ $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) sqlite3.c $(LDFLAGS.libsqlite3)
  1835. fuzzy: fuzzcheck$(T.exe)
  1836. xbin: fuzzcheck$(T.exe)
  1837. fuzzcheck-asan$(T.exe): $(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP)
  1838. $(T.link) -o $@ -fsanitize=address $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) \
  1839. sqlite3.c $(LDFLAGS.libsqlite3)
  1840. fuzzy: fuzzcheck-asan$(T.exe)
  1841. xbin: fuzzcheck-asan$(T.exe)
  1842. fuzzcheck-ubsan$(T.exe): $(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP)
  1843. $(T.link) -o $@ -fsanitize=undefined $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) \
  1844. sqlite3.c $(LDFLAGS.libsqlite3)
  1845. fuzzy: fuzzcheck-ubsan$(T.exe)
  1846. xbin: fuzzcheck-ubsan$(T.exe)
  1847. # Usage: FUZZDB=filename make run-fuzzcheck
  1848. #
  1849. # Where filename is a fuzzcheck database, this target builds and runs
  1850. # fuzzcheck, fuzzcheck-asan, and fuzzcheck-ubsan on that database.
  1851. #
  1852. # FUZZDB can be a glob pattern of two or more databases. Example:
  1853. #
  1854. # FUZZDB=test/fuzzdata*.db make run-fuzzcheck
  1855. #
  1856. run-fuzzcheck: fuzzcheck$(T.exe) fuzzcheck-asan$(T.exe) fuzzcheck-ubsan$(T.exe)
  1857. @if test "$(FUZZDB)" = ""; then echo 'ERROR: No FUZZDB specified. Rerun with FUZZDB=filename'; exit 1; fi
  1858. ./fuzzcheck$(T.exe) --spinner $(FUZZDB)
  1859. ./fuzzcheck-asan$(T.exe) --spinner $(FUZZDB)
  1860. ./fuzzcheck-ubsan$(T.exe) --spinner $(FUZZDB)
  1861. ossshell$(T.exe): $(TOP)/test/ossfuzz.c $(TOP)/test/ossshell.c sqlite3.c sqlite3.h
  1862. $(T.link) -o $@ $(FUZZCHECK_OPT) $(TOP)/test/ossshell.c \
  1863. $(TOP)/test/ossfuzz.c sqlite3.c $(LDFLAGS.libsqlite3)
  1864. fuzzy: ossshell$(T.exe)
  1865. xbin: ossshell$(T.exe)
  1866. sessionfuzz$(T.exe): $(TOP)/test/sessionfuzz.c sqlite3.c sqlite3.h
  1867. $(T.link) -o $@ $(TOP)/test/sessionfuzz.c $(LDFLAGS.libsqlite3)
  1868. fuzzy: sessionfuzz$(T.exe)
  1869. dbfuzz$(T.exe): $(TOP)/test/dbfuzz.c sqlite3.c sqlite3.h
  1870. $(T.link) -o $@ $(DBFUZZ_OPT) $(TOP)/test/dbfuzz.c sqlite3.c \
  1871. $(LDFLAGS.libsqlite3)
  1872. fuzzy: dbfuzz$(T.exe)
  1873. xbin: dbfuzz$(T.exe)
  1874. DBFUZZ2_OPTS = \
  1875. -USQLITE_THREADSAFE \
  1876. -DSQLITE_THREADSAFE=0 \
  1877. -DSQLITE_OMIT_LOAD_EXTENSION \
  1878. -DSQLITE_DEBUG \
  1879. -DSQLITE_ENABLE_DBSTAT_VTAB \
  1880. -DSQLITE_ENABLE_BYTECODE_VTAB \
  1881. -DSQLITE_ENABLE_RTREE \
  1882. -DSQLITE_ENABLE_FTS4 \
  1883. -DSQLITE_ENABLE_FTS5
  1884. dbfuzz2$(T.exe): $(TOP)/test/dbfuzz2.c sqlite3.c sqlite3.h
  1885. $(T.cc) -I. -g -O0 \
  1886. -DSTANDALONE -o dbfuzz2 \
  1887. $(DBFUZZ2_OPTS) $(TOP)/test/dbfuzz2.c sqlite3.c $(LDFLAGS.libsqlite3)
  1888. mkdir -p dbfuzz2-dir
  1889. cp $(TOP)/test/dbfuzz2-seed* dbfuzz2-dir
  1890. fuzzy: dbfuzz2$(T.exe)
  1891. xbin: dbfuzz2$(T.exe)
  1892. mptester$(T.exe): $(libsqlite3.LIB) $(TOP)/mptest/mptest.c
  1893. $(T.link) -o $@ -I. $(TOP)/mptest/mptest.c $(libsqlite3.LIB) \
  1894. $(LDFLAGS.libsqlite3)
  1895. xbin: mptester$(T.exe)
  1896. MPTEST1=./mptester$(T.exe) mptest.db $(TOP)/mptest/crash01.test --repeat 20
  1897. MPTEST2=./mptester$(T.exe) mptest.db $(TOP)/mptest/multiwrite01.test --repeat 20
  1898. mptest: mptester$(T.exe)
  1899. rm -f mptest.db
  1900. $(MPTEST1) --journalmode DELETE
  1901. $(MPTEST2) --journalmode WAL
  1902. $(MPTEST1) --journalmode WAL
  1903. $(MPTEST2) --journalmode PERSIST
  1904. $(MPTEST1) --journalmode PERSIST
  1905. $(MPTEST2) --journalmode TRUNCATE
  1906. $(MPTEST1) --journalmode TRUNCATE
  1907. $(MPTEST2) --journalmode DELETE
  1908. # Source and header files that shell.c depends on
  1909. SHELL_DEP = \
  1910. $(TOP)/src/shell.c.in \
  1911. $(TOP)/ext/expert/sqlite3expert.c \
  1912. $(TOP)/ext/expert/sqlite3expert.h \
  1913. $(TOP)/ext/intck/sqlite3intck.c \
  1914. $(TOP)/ext/intck/sqlite3intck.h \
  1915. $(TOP)/ext/misc/appendvfs.c \
  1916. $(TOP)/ext/misc/base64.c \
  1917. $(TOP)/ext/misc/base85.c \
  1918. $(TOP)/ext/misc/completion.c \
  1919. $(TOP)/ext/misc/decimal.c \
  1920. $(TOP)/ext/misc/fileio.c \
  1921. $(TOP)/ext/misc/ieee754.c \
  1922. $(TOP)/ext/misc/memtrace.c \
  1923. $(TOP)/ext/misc/pcachetrace.c \
  1924. $(TOP)/ext/misc/percentile.c \
  1925. $(TOP)/ext/misc/regexp.c \
  1926. $(TOP)/ext/misc/series.c \
  1927. $(TOP)/ext/misc/sha1.c \
  1928. $(TOP)/ext/misc/shathree.c \
  1929. $(TOP)/ext/misc/sqlar.c \
  1930. $(TOP)/ext/misc/uint.c \
  1931. $(TOP)/ext/misc/vfstrace.c \
  1932. $(TOP)/ext/misc/zipfile.c \
  1933. $(TOP)/ext/recover/dbdata.c \
  1934. $(TOP)/ext/recover/sqlite3recover.c \
  1935. $(TOP)/ext/recover/sqlite3recover.h \
  1936. $(TOP)/src/test_windirent.c \
  1937. $(TOP)/src/test_windirent.h
  1938. shell.c: $(SHELL_DEP) $(TOP)/tool/mkshellc.tcl $(B.tclsh)
  1939. $(B.tclsh) $(TOP)/tool/mkshellc.tcl >shell.c
  1940. #
  1941. # Rules to build the extension objects.
  1942. #
  1943. DEPS_EXT_COMMON = $(DEPS_OBJ_COMMON) $(EXTHDR)
  1944. icu.o: $(TOP)/ext/icu/icu.c $(DEPS_EXT_COMMON)
  1945. $(T.cc.extension) -c $(TOP)/ext/icu/icu.c $(CFLAGS.icu)
  1946. fts3.o: $(TOP)/ext/fts3/fts3.c $(DEPS_EXT_COMMON)
  1947. $(T.cc.extension) -c $(TOP)/ext/fts3/fts3.c
  1948. fts3_aux.o: $(TOP)/ext/fts3/fts3_aux.c $(DEPS_EXT_COMMON)
  1949. $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_aux.c
  1950. fts3_expr.o: $(TOP)/ext/fts3/fts3_expr.c $(DEPS_EXT_COMMON)
  1951. $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_expr.c
  1952. fts3_hash.o: $(TOP)/ext/fts3/fts3_hash.c $(DEPS_EXT_COMMON)
  1953. $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_hash.c
  1954. fts3_icu.o: $(TOP)/ext/fts3/fts3_icu.c $(DEPS_EXT_COMMON)
  1955. $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_icu.c $(CFLAGS.icu)
  1956. fts3_porter.o: $(TOP)/ext/fts3/fts3_porter.c $(DEPS_EXT_COMMON)
  1957. $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_porter.c
  1958. fts3_snippet.o: $(TOP)/ext/fts3/fts3_snippet.c $(DEPS_EXT_COMMON)
  1959. $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_snippet.c
  1960. fts3_tokenizer.o: $(TOP)/ext/fts3/fts3_tokenizer.c $(DEPS_EXT_COMMON)
  1961. $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_tokenizer.c
  1962. fts3_tokenizer1.o: $(TOP)/ext/fts3/fts3_tokenizer1.c $(DEPS_EXT_COMMON)
  1963. $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_tokenizer1.c
  1964. fts3_tokenize_vtab.o: $(TOP)/ext/fts3/fts3_tokenize_vtab.c $(DEPS_EXT_COMMON)
  1965. $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_tokenize_vtab.c
  1966. fts3_unicode.o: $(TOP)/ext/fts3/fts3_unicode.c $(DEPS_EXT_COMMON)
  1967. $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_unicode.c
  1968. fts3_unicode2.o: $(TOP)/ext/fts3/fts3_unicode2.c $(DEPS_EXT_COMMON)
  1969. $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_unicode2.c
  1970. fts3_write.o: $(TOP)/ext/fts3/fts3_write.c $(DEPS_EXT_COMMON)
  1971. $(T.cc.extension) -c $(TOP)/ext/fts3/fts3_write.c
  1972. rtree.o: $(TOP)/ext/rtree/rtree.c $(DEPS_EXT_COMMON)
  1973. $(T.cc.extension) -c $(TOP)/ext/rtree/rtree.c
  1974. sqlite3session.o: $(TOP)/ext/session/sqlite3session.c $(DEPS_EXT_COMMON)
  1975. $(T.cc.extension) -c $(TOP)/ext/session/sqlite3session.c
  1976. stmt.o: $(TOP)/ext/misc/stmt.c $(DEPS_EXT_COMMON)
  1977. $(T.cc.extension) -c $(TOP)/ext/misc/stmt.c
  1978. #
  1979. # Windows section
  1980. #
  1981. dll: sqlite3.dll
  1982. sqlite3.def: $(LIBOBJ)
  1983. echo 'EXPORTS' >sqlite3.def
  1984. nm $(LIBOBJ) | grep ' T ' | grep ' _sqlite3_' \
  1985. | sed 's/^.* _//' >>sqlite3.def
  1986. sqlite3.dll: $(LIBOBJ) sqlite3.def
  1987. $(T.cc.sqlite) $(LDFLAGS.shlib) -o $@ sqlite3.def \
  1988. -Wl,"--strip-all" $(LIBOBJ) $(LDFLAGS.configure)
  1989. #
  1990. # Emit a list of commonly-used targets
  1991. help:
  1992. @echo; echo "Frequently-used high-level make targets:"; echo; \
  1993. echo " - all [default] = builds most components"; \
  1994. echo " - clean = cleans up most build products"; \
  1995. echo " - distclean = cleans up all build products"; \
  1996. echo " - install = installs activated components"; \
  1997. echo; echo "Testing-related targets:"; echo; \
  1998. echo " - test = a number of sanity checks"; \
  1999. echo " - quicktest = minimal tests"; \
  2000. echo " - releasetest = pre-release tests"; \
  2001. echo " - devtest = Minimum tests required before code check-ins"; \
  2002. echo " - mdevtest = A variant of devtest"; \
  2003. echo " - sdevtest = A variant of devtest"; \
  2004. echo " - tcltest = Runs test/veryquick.test"; \
  2005. echo " - testrunner = Like tcltest but spread across multiple cores"; \
  2006. echo " - fuzztest = The core fuzz tester (see target docs for important info)"; \
  2007. echo " - valgrindfuzz = Runs fuzztest under valgrind"; \
  2008. echo " - soaktest = Really, really long tests"; \
  2009. echo " - alltest = Runs most or all TCL tests"; \
  2010. echo
  2011. # Remove build products sufficient so that subsequent makes will recompile
  2012. # everything from scratch. Do not remove:
  2013. #
  2014. # * test results and test logs
  2015. # * output from ./configure
  2016. #
  2017. tidy-.:
  2018. tidy: tidy-.
  2019. rm -f *.o *.c *.da *.bb *.bbg gmon.* *.rws sqlite3$(T.exe)
  2020. rm -f fts5.h keywordhash.h opcodes.h sqlite3.h sqlite3ext.h sqlite3session.h
  2021. rm -rf .libs .deps tsrc .target_source
  2022. rm -f lemon$(B.exe) sqlite*.tar.gz
  2023. rm -f mkkeywordhash$(B.exe) mksourceid$(B.exe)
  2024. rm -f parse.* fts5parse.*
  2025. rm -f $(libsqlite3.SO) $(libsqlite3.LIB) $(libtclsqlite3.SO)
  2026. rm -f tclsqlite3$(T.exe) $(TESTPROGS)
  2027. rm -f LogEst$(T.exe) fts3view$(T.exe) rollback-test$(T.exe) showdb$(T.exe)
  2028. rm -f showjournal$(T.exe) showstat4$(T.exe) showwal$(T.exe) speedtest1$(T.exe)
  2029. rm -f wordcount$(T.exe) changeset$(T.exe) version-info$(T.exe)
  2030. rm -f *.exp *.vsix pkgIndex.tcl
  2031. rm -f sqlite3_analyzer$(T.exe) sqlite3_rsync$(T.exe) sqlite3_expert$(T.exe)
  2032. rm -f mptester$(T.exe) rbu$(T.exe) srcck1$(T.exe)
  2033. rm -f fuzzershell$(T.exe) fuzzcheck$(T.exe) sqldiff$(T.exe) dbhash$(T.exe)
  2034. rm -f dbfuzz$(T.exe) dbfuzz2$(T.exe)
  2035. rm -fr dbfuzz2-dir
  2036. rm -f fuzzcheck-asan$(T.exe) fuzzcheck-ubsan$(T.exe) ossshell$(T.exe)
  2037. rm -f scrub$(T.exe) showshm$(T.exe) sqlite3_checker$(T.exe) loadfts$(T.exe)
  2038. rm -f index_usage$(T.exe) kvtest$(T.exe) startup$(T.exe) threadtest3$(T.exe)
  2039. rm -f sessionfuzz$(T.exe) changesetfuzz$(T.exe)
  2040. rm -f dbdump$(T.exe) dbtotxt$(T.exe) atrc$(T.exe)
  2041. rm -f threadtest5$(T.exe)
  2042. rm -f src-verify$(B.exe)
  2043. rm -f tclsqlite3.c has_tclsh* $(T.tcl.env.sh)
  2044. rm -f sqlite3rc.h sqlite3.def
  2045. #
  2046. # Removes build products and test logs. Retains ./configure outputs.
  2047. #
  2048. clean-.:
  2049. clean: clean-. tidy
  2050. rm -rf omittest* testrunner* testdir*
  2051. # Clean up everything. No exceptions.
  2052. distclean-.:
  2053. distclean: distclean-. clean
  2054. # Show important variable settings.
  2055. show-variables:
  2056. @echo "CC = $(CC)"
  2057. @echo "B.cc = $(B.cc)"
  2058. @echo "T.cc = $(T.cc)"
  2059. @echo "T.cc.sqlite = $(T.cc.sqlite)"