main.mk 76 KB

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