main.mk 79 KB

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