comparison third_party/sqlite3/tea/Makefile.in @ 173:827c6ac504cd hg-web

Merged in default here.
author MrJuneJune <me@mrjunejune.com>
date Mon, 19 Jan 2026 18:59:10 -0800
parents 589bab390fb4
children
comparison
equal deleted inserted replaced
151:c033667da5f9 173:827c6ac504cd
1 all:
2 #
3 # Unless this file is named Makefile.in, you are probably looking
4 # at an automatically generated/filtered copy and should probably not
5 # edit it.
6 #
7 # This makefile is part of the teaish framework, a tool for building
8 # Tcl extensions, conceptually related to TEA/tclconfig but using the
9 # Autosetup configuration system instead of the GNU Autotools.
10 #
11 # A copy of this makefile gets processed for each extension separately
12 # and populated with info about how to build, test, and install the
13 # extension.
14 #
15 # Maintenance reminder: this file needs to stay portable with POSIX
16 # Make, not just GNU Make. Yes, that's unfortunate because it makes
17 # some things impossible (like skipping over swathes of rules when
18 # 'make distclean' is invoked).
19 #
20
21 CC = @CC@
22 INSTALL = @BIN_INSTALL@
23 INSTALL.noexec = $(INSTALL) -m 0644
24
25 #
26 # Var name prefixes:
27 #
28 # teaish. => teaish core
29 # tx. => teaish extension
30 #
31 # Vars with a "tx." or "teaish." prefix are all "public" for purposes
32 # of the extension makefile, but the extension must not any "teaish."
33 # vars and must only modify "tx." vars where that allowance is
34 # specifically noted.
35 #
36 # Vars with a "teaish__" prefix are "private" and must not be used by
37 # the extension makefile. They may change semantics or be removed in
38 # any given teaish build.
39 #
40 tx.name = @TEAISH_NAME@
41 tx.version = @TEAISH_VERSION@
42 tx.name.pkg = @TEAISH_PKGNAME@
43 tx.libdir = @TEAISH_LIBDIR_NAME@
44 tx.loadPrefix = @TEAISH_LOAD_PREFIX@
45 tx.tcl = @TEAISH_TCL@
46 tx.makefile = @TEAISH_MAKEFILE@
47 tx.makefile.in = @TEAISH_MAKEFILE_IN@
48 tx.dll8.basename = @TEAISH_DLL8_BASENAME@
49 tx.dll9.basename = @TEAISH_DLL9_BASENAME@
50 tx.dll8 = @TEAISH_DLL8@
51 tx.dll9 = @TEAISH_DLL9@
52 tx.dll = $(tx.dll$(TCL_MAJOR_VERSION))
53 tx.dir = @TEAISH_EXT_DIR@
54 @if TEAISH_TM_TCL
55 # Input filename for tcl::tm-style module
56 tx.tm = @TEAISH_TM_TCL@
57 # Target filename for tcl::tm-style installation
58 tx.tm.tgt = $(tx.name.pkg)-$(tx.version).tm
59 @endif
60
61 @if TEAISH_DIST_NAME
62 tx.name.dist = @TEAISH_DIST_NAME@
63 @else
64 tx.name.dist = $(teaish.name)
65 @endif
66
67 teaish.dir = @abs_top_srcdir@
68 #teaish.dir.autosetup = @TEAISH_AUTOSETUP_DIR@
69 teaish.makefile = Makefile
70 teaish.makefile.in = $(teaish.dir)/Makefile.in
71 teaish__auto.def = $(teaish.dir)/auto.def
72
73 #
74 # Autotools-conventional vars. We don't actually use these in this
75 # makefile but some may be referenced by vars imported via
76 # tclConfig.sh. They are part of the public API and may be reliably
77 # depended on from teaish.make.in.
78 #
79 bindir = @bindir@
80 datadir = @datadir@
81 exec_prefix = @exec_prefix@
82 includedir = @includedir@
83 infodir = @infodir@
84 libdir = @libdir@
85 libexecdir = @libexecdir@
86 localstatedir = @localstatedir@
87 mandir = @mandir@
88 prefix = @prefix@
89 runstatedir = @runstatedir@
90 sbindir = @sbindir@
91 sharedstatedir = @sharedstatedir@
92 sysconfdir = @sysconfdir@
93
94
95 #
96 # Vars derived (mostly) from tclConfig.sh. These may be reliably
97 # used from the extension makefile.
98 #
99 TCLSH = @TCLSH_CMD@
100 TCL_CONFIG_SH = @TCL_CONFIG_SH@
101 TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@
102 TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
103 TCL_LIBS = @TCL_LIBS@
104 TCL_LIB_SPEC = @TCL_LIB_SPEC@
105 TCL_MAJOR_VERSION = @TCL_MAJOR_VERSION@
106 TCL_MINOR_VERSION = @TCL_MINOR_VERSION@
107 TCL_PATCH_LEVEL = @TCL_PATCH_LEVEL@
108 TCL_PREFIX = @TCL_PREFIX@
109 TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
110 TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
111 TCL_VERSION = @TCL_VERSION@
112 TCLLIBDIR = @TCLLIBDIR@
113
114 #
115 # CFLAGS.configure = CFLAGS as known at configure-time.
116 #
117 # This ordering is deliberate: flags populated via tcl's
118 # [teaish-cflags-add] should preceed CFLAGS and CPPFLAGS (which
119 # typically come from the ./configure command-line invocation).
120 #
121 CFLAGS.configure = @SH_CFLAGS@ @TEAISH_CFLAGS@ @CFLAGS@ @CPPFLAGS@ $(TCL_INCLUDE_SPEC)
122 CFLAGS.configure += -DUSE_TCL_STUBS=@TEAISH_USE_STUBS@
123
124 #
125 # LDFLAGS.configure = LDFLAGS as known at configure-time.
126 #
127 # This ordering is deliberate: flags populated via tcl's
128 # [teaish-ldflags-add] should precede LDFLAGS (which typically
129 # comes from the ./configure command-line invocation).
130 #
131 LDFLAGS.configure = @TEAISH_LDFLAGS@ @LDFLAGS@
132
133 #
134 # Linker flags for linkhing a shared library.
135 #
136 LDFLAGS.shlib = @SH_LDFLAGS@
137
138 #
139 # The following tx.XYZ vars may be populated/modified by teaish.tcl
140 # and/or teaish.make.
141 #
142
143 #
144 # tx.src is the list of source or object files to include in the
145 # (single) compiler/linker invocation. This will initially contain any
146 # sources passed to [teaish-src-add], but may also be appended to by
147 # teaish.make.
148 #
149 tx.src = @TEAISH_EXT_SRC@
150
151 #
152 # tx.CFLAGS is typically set by teaish.make, whereas TEAISH_CFLAGS
153 # gets set up via the configure script.
154 #
155 tx.CFLAGS =
156 tx.CPPFLAGS =
157
158 #
159 # tx.LDFLAGS is typically set by teaish.make, whereas TEAISH_LDFLAGS
160 # gets set up via the configure script.
161 #
162 tx.LDFLAGS =
163
164 #
165 # The list of 'dist' files may be appended to from teaish.make.in.
166 # It can also be set up from teaish.tcl using [teaish-dist-add]
167 # and/or [teaish-src-add -dist ...].
168 #
169 tx.dist.files = @TEAISH_DIST_FILES@
170
171 #
172 # The base name for a distribution tar/zip file.
173 #
174 tx.dist.basename = $(tx.name.dist)-$(tx.version)
175
176 # List of deps which may trigger an auto-reconfigure.
177 #
178 teaish__autogen.deps = \
179 $(tx.makefile.in) $(teaish.makefile.in) \
180 $(tx.tcl) \
181 @TEAISH_PKGINDEX_TCL_IN@ @TEAISH_TM_TCL_IN@ \
182 @AUTODEPS@
183
184 @if TEAISH_MAKEFILE_IN
185 $(tx.makefile): $(tx.makefile.in)
186 @endif
187
188 teaish.autoreconfig = \
189 @TEAISH_AUTORECONFIG@
190
191 #
192 # Problem: when more than one target can invoke TEAISH_AUTORECONFIG,
193 # we can get parallel reconfigures running. Thus, targets which
194 # may require reconfigure should depend on...
195 #
196 config.log: $(teaish__autogen.deps)
197 $(teaish.autoreconfig)
198 # ^^^ We would love to skip this when running [dist]clean, but there's
199 # no POSIX Make-portable way to do that. GNU Make can.
200 .PHONY: reconfigure
201 reconfigure:
202 $(teaish.autoreconfig)
203
204 $(teaish.makefile): $(teaish__auto.def) $(teaish.makefile.in) \
205 @AUTODEPS@
206
207 @if TEAISH_TESTER_TCL_IN
208 @TEAISH_TESTER_TCL_IN@: $(teaish__autogen.deps)
209 config.log: @TEAISH_TESTER_TCL_IN@
210 @TEAISH_TESTER_TCL@: @TEAISH_TESTER_TCL_IN@
211 @endif
212 @if TEAISH_TEST_TCL_IN
213 @TEAISH_TEST_TCL_IN@: $(teaish__autogen.deps)
214 config.log: @TEAISH_TEST_TCL_IN@
215 @TEAISH_TEST_TCL@: @TEAISH_TEST_TCL_IN@
216 @endif
217
218 #
219 # CC variant for compiling Tcl-using sources.
220 #
221 CC.tcl = \
222 $(CC) -o $@ $(CFLAGS.configure) $(CFLAGS) $(tx.CFLAGS) $(tx.CPPFLAGS)
223
224 #
225 # CC variant for linking $(tx.src) into an extension DLL. Note that
226 # $(tx.src) must come before $(LDFLAGS...) for linking to third-party
227 # libs to work.
228 #
229 CC.dll = \
230 $(CC.tcl) $(tx.src) $(LDFLAGS.shlib) \
231 $(tx.LDFLAGS) $(LDFLAGS.configure) $(LDFLAGS) $(TCL_STUB_LIB_SPEC)
232
233 @if TEAISH_ENABLE_DLL
234 #
235 # The rest of this makefile exists solely to support this brief
236 # target: the extension shared lib.
237 #
238 $(tx.dll): $(tx.src) config.log
239 @if [ "x" = "x$(tx.src)" ]; then \
240 echo "Makefile var tx.src (source/object files) is empty" 1>&2; \
241 exit 1; \
242 fi
243 $(CC.dll)
244
245 all: $(tx.dll)
246 @endif # TEAISH_ENABLE_DLL
247
248 tclsh: $(teaish.makefile) config.log
249 @{ echo "#!/bin/sh"; echo 'exec $(TCLSH) "$$@"'; } > $@
250 @chmod +x $@
251 @echo "Created $@"
252
253 #
254 # Run the generated test script.
255 #
256 .PHONY: test-pre test-prepre test-core test test-post test-extension
257 test-extension: # this name is reserved for use by teaish.make[.in]
258 @if TEAISH_ENABLE_DLL
259 test-prepre: $(tx.dll)
260 @endif
261 @if TEAISH_TESTER_TCL
262 teaish.tester.tcl = @TEAISH_TESTER_TCL@
263 test-core.args = $(teaish.tester.tcl)
264 @if TEAISH_ENABLE_DLL
265 test-core.args += '$(tx.dll)' '$(tx.loadPrefix)'
266 @else
267 test-core.args += '' ''
268 @endif
269 test-core.args += @TEAISH_TESTUTIL_TCL@
270 # Clients may pass additional args via test.args=...
271 # and ::argv will be rewritten before the test script loads, to
272 # remove $(test-core.args)
273 test.args ?=
274 test-core: test-pre
275 $(TCLSH) $(test-core.args) $(test.args)
276 test-gdb: $(teaish.tester.tcl)
277 gdb --args $(TCLSH) $(test-core.args) $(test.args)
278 test-vg.flags ?= --leak-check=full -v --show-reachable=yes --track-origins=yes
279 test-vg: $(teaish.tester.tcl)
280 valgrind $(test-vg.flags) $(TCLSH) $(test-core.args) $(test.args)
281 @else # !TEAISH_TESTER_TCL
282 test-prepre:
283 @endif # TEAISH_TESTER_TCL
284 test-pre: test-prepre
285 test-core: test-pre
286 test-post: test-core
287 test: test-post
288
289 #
290 # Cleanup rules...
291 #
292 #.PHONY: clean-pre clean-core clean-post clean-extension
293 #
294 clean-pre:
295 clean-core: clean-pre
296 rm -f $(tx.dll8) $(tx.dll9) tclsh
297 clean-post: clean-core
298 clean: clean-post
299
300 .PHONY: distclean-pre distclean-core distclean-post clean-extension
301 distclean-pre: clean
302 distclean-core: distclean-pre
303 rm -f Makefile
304 rm -f config.log config.defines.txt
305 @if TEAISH_MAKEFILE_IN
306 @if TEAISH_MAKEFILE
307 rm -f @TEAISH_MAKEFILE@
308 @endif
309 @endif
310 @if TEAISH_TESTER_TCL_IN
311 rm -f $(teaish.tester.tcl)
312 @endif
313 @if TEAISH_PKGINDEX_TCL_IN
314 rm -f @TEAISH_PKGINDEX_TCL@
315 @endif
316 @if TEAISH_PKGINIT_TCL_IN
317 rm -f @TEAISH_PKGINIT_TCL@
318 @endif
319 @if TEAISH_TEST_TCL_IN
320 rm -f @TEAISH_TEST_TCL@
321 @endif
322 distclean-post: distclean-core
323 distclean: distclean-post
324 #
325 # The (dist)clean-extension targets are reserved for use by
326 # client-side teaish.make.
327 #
328 # Client code which wants to clean up extra stuff should do so by
329 # adding their cleanup target (e.g. clean-extension) as a dependency
330 # to the 'clean' target, like so:
331 #
332 # clean: distclean-extension
333 # distclean: distclean-extension
334 #
335 distclean-extension:
336 clean-extension:
337
338 #
339 # Installation rules...
340 #
341 @if TEAISH_ENABLE_INSTALL
342 .PHONY: install-pre install-core install-post install-test install-prepre install-extension
343 install-extension: # this name is reserved for use by teaish.make
344
345 @if TEAISH_ENABLE_DLL
346 install-prepre: $(tx.dll)
347 @else
348 install-prepre:
349 @endif
350
351 @if TEAISH_TM_TCL
352 install-core.tmdir = $(DESTDIR)@TEAISH_TCL_TM_DIR@
353 @endif
354
355 install-pre: install-prepre
356 install-core: install-pre
357 @if [ ! -d "$(DESTDIR)$(TCLLIBDIR)" ]; then \
358 set -x; $(INSTALL) -d "$(DESTDIR)$(TCLLIBDIR)"; \
359 fi
360 # ^^^^ on some platforms, install -d fails if the target already exists.
361 @if TEAISH_ENABLE_DLL
362 $(INSTALL) $(tx.dll) "$(DESTDIR)$(TCLLIBDIR)"
363 @endif
364 @if TEAISH_PKGINDEX_TCL
365 $(INSTALL.noexec) "@TEAISH_PKGINDEX_TCL@" "$(DESTDIR)$(TCLLIBDIR)"
366 @endif
367 @if TEAISH_PKGINIT_TCL
368 $(INSTALL.noexec) "@TEAISH_PKGINIT_TCL@" "$(DESTDIR)$(TCLLIBDIR)"
369 @endif
370 @if TEAISH_TM_TCL
371 @if [ ! -d "$(install-core.tmdir)" ]; then \
372 set -x; $(INSTALL) -d "$(install-core.tmdir)"; \
373 fi
374 $(INSTALL.noexec) "@TEAISH_TM_TCL@" "$(install-core.tmdir)/$(tx.tm.tgt)"
375 @endif
376 install-test: install-core
377 @echo "Post-install test of [package require $(tx.name.pkg) $(tx.version)]..."; \
378 set xtra=""; \
379 if [ x != "x$(DESTDIR)" ]; then \
380 xtra='set ::auto_path [linsert $$::auto_path 0 [file normalize $(DESTDIR)$(TCLLIBDIR)/..]];'; \
381 fi; \
382 if echo \
383 'set c 0; ' $$xtra \
384 '@TEAISH_POSTINST_PREREQUIRE@' \
385 'if {[catch {package require $(tx.name.pkg) $(tx.version)} xc]} {incr c};' \
386 'if {$$c && "" ne $$xc} {puts $$xc; puts "auto_path=$$::auto_path"};' \
387 'exit $$c' \
388 | $(TCLSH) ; then \
389 echo "passed"; \
390 else \
391 echo "FAILED"; \
392 exit 1; \
393 fi
394 install-post: install-test
395 install: install-post
396
397 #
398 # Uninstall rules...
399 #
400 .PHONY: uninstall uninstall-pre uninstall-core uninstall-post uninstall-extension
401 uninstall-extension: # this name is reserved for use by teaish.make
402 uninstall-pre:
403 uninstall-core: uninstall-pre
404 @if TEAISH_ENABLE_DLL
405 rm -fr "$(DESTDIR)$(TCLLIBDIR)"
406 @endif
407 @if TEAISH_TM_TCL
408 rm -f "$(DESTDIR)$(install-core.tmdir)/$(tx.tm.tgt)"
409 @endif
410
411 uninstall-post: uninstall-core
412 @echo "Uninstalled Tcl extension $(tx.name) $(tx.version)"
413 uninstall: uninstall-post
414 @endif # TEAISH_ENABLE_INSTALL
415
416 @if TEAISH_MAKEFILE_IN
417 Makefile: $(tx.makefile.in)
418 config.log: $(teaish.makefile.in)
419 @endif
420
421 #
422 # Package archive generation ("dist") rules...
423 #
424 @if TEAISH_ENABLE_DIST
425 @if BIN_TAR
426 @if BIN_ZIP
427
428 # When installing teaish as part of "make dist", we need to run
429 # configure with similar flags to what we last configured with but we
430 # must not pass on any extension-specific flags, as those won't be
431 # recognized when running in --teaish-install mode, causing
432 # the sub-configure to fail.
433 dist.flags = --with-tclsh=$(TCLSH)
434 dist.reconfig = $(teaish.dir)/configure $(tx.dist.reconfig-flags) $(dist.flags)
435
436 # Temp dir for dist.zip. Must be different than dist.tgz or else
437 # parallel builds may hose the dist.
438 teaish__dist.tmp.zip = teaish__dist_zip
439 #
440 # Make a distribution zip file...
441 #
442 dist.zip = $(tx.dist.basename).zip
443 .PHONY: dist.zip dist.zip-core dist.zip-post
444 #dist.zip-pre:
445 # We apparently can't add a pre-hook here, else "make dist" rebuilds
446 # the archive each time it's run.
447 $(dist.zip): $(tx.dist.files)
448 @rm -fr $(teaish__dist.tmp.zip)
449 @mkdir -p $(teaish__dist.tmp.zip)/$(tx.dist.basename)
450 @tar cf $(teaish__dist.tmp.zip)/tmp.tar $(tx.dist.files)
451 @tar xf $(teaish__dist.tmp.zip)/tmp.tar -C $(teaish__dist.tmp.zip)/$(tx.dist.basename)
452 @if TEAISH_DIST_FULL
453 @$(dist.reconfig) \
454 --teaish-install=$(teaish__dist.tmp.zip)/$(tx.dist.basename) \
455 --t-e-d=$(teaish__dist.tmp.zip)/$(tx.dist.basename) >/dev/null
456 @endif
457 @rm -f $(tx.dist.basename)/tmp.tar $(dist.zip)
458 @cd $(teaish__dist.tmp.zip) && zip -q -r ../$(dist.zip) $(tx.dist.basename)
459 @rm -fr $(teaish__dist.tmp.zip)
460 @ls -la $(dist.zip)
461 dist.zip-core: $(dist.zip)
462 dist.zip-post: dist.zip-core
463 dist.zip: dist.zip-post
464 dist: dist.zip
465 undist-zip:
466 rm -f $(dist.zip)
467 undist: undist-zip
468 @endif #BIN_ZIP
469
470 #
471 # Make a distribution tarball...
472 #
473 teaish__dist.tmp.tgz = teaish__dist_tgz
474 dist.tgz = $(tx.dist.basename).tar.gz
475 .PHONY: dist.tgz dist.tgz-core dist.tgz-post
476 # dist.tgz-pre:
477 # see notes in dist.zip
478 $(dist.tgz): $(tx.dist.files)
479 @rm -fr $(teaish__dist.tmp.tgz)
480 @mkdir -p $(teaish__dist.tmp.tgz)/$(tx.dist.basename)
481 @tar cf $(teaish__dist.tmp.tgz)/tmp.tar $(tx.dist.files)
482 @tar xf $(teaish__dist.tmp.tgz)/tmp.tar -C $(teaish__dist.tmp.tgz)/$(tx.dist.basename)
483 @if TEAISH_DIST_FULL
484 @rm -f $(teaish__dist.tmp.tgz)/$(tx.dist.basename)/pkgIndex.tcl.in; # kludge
485 @$(dist.reconfig) \
486 --teaish-install=$(teaish__dist.tmp.tgz)/$(tx.dist.basename) \
487 --t-e-d=$(teaish__dist.tmp.zip)/$(tx.dist.basename) >/dev/null
488 @endif
489 @rm -f $(tx.dist.basename)/tmp.tar $(dist.tgz)
490 @cd $(teaish__dist.tmp.tgz) && tar czf ../$(dist.tgz) $(tx.dist.basename)
491 @rm -fr $(teaish__dist.tmp.tgz)
492 @ls -la $(dist.tgz)
493 dist.tgz-core: $(dist.tgz)
494 dist.tgz-post: dist.tgz-core
495 dist.tgz: dist.tgz-post
496 dist: dist.tgz
497 undist-tgz:
498 rm -f $(dist.tgz)
499 undist: undist-tgz
500 @else #!BIN_TAR
501 dist:
502 @echo "The dist rules require tar, which configure did not find." 1>&2; exit 1
503 @endif #BIN_TAR
504 @else #!TEAISH_ENABLE_DIST
505 undist:
506 dist:
507 @if TEAISH_OUT_OF_EXT_TREE
508 @echo "'dist' can only be used from an extension's home dir" 1>&2; \
509 echo "In this case: @TEAISH_EXT_DIR@" 1>&2; exit 1
510 @endif
511 @endif #TEAISH_ENABLE_DIST
512
513 Makefile: @TEAISH_TCL@
514
515 @if TEAISH_MAKEFILE_CODE
516 #
517 # TEAISH_MAKEFILE_CODE may contain literal makefile code, which
518 # gets pasted verbatim here. Either [define TEAISH_MAKEFILE_CODE
519 # ...] or use [teaish-make-add] to incrementally build up this
520 # content.
521 #
522 # <TEAISH_MAKEFILE_CODE>
523 @TEAISH_MAKEFILE_CODE@
524 # </TEAISH_MAKEFILE_CODE>
525 @endif
526
527 @if TEAISH_MAKEFILE
528 #
529 # TEAISH_MAKEFILE[_IN] defines any extension-specific state this file
530 # needs.
531 #
532 # It must set the following vars if they're not already accounted for
533 # via teaish.tcl.
534 #
535 # - tx.src = list of the extension's source files, being sure to
536 # prefix each with $(tx.dir) (if it's in the same dir as the
537 # extension) so that out-of-tree builds can find them. Optionally,
538 # [define] TEAISH_EXT_SRC or pass them to [teaish-src-add].
539 #
540 # It may optionally set the following vars:
541 #
542 # - tx.CFLAGS = CFLAGS/CPPFLAGS. Optionally, [define] TEAISH_CFLAGS
543 # or pass them to [teaish-cflags-add].
544 #
545 # - tx.LDFLAGS = LDFLAGS. Optionally, [define] TEAISH_LDFLAGS or
546 # pass them to [teaish-ldflags-add].
547 #
548 # It may optionally hook into various targets as documented in
549 # /doc/extensions.md in the canonical teaish source tree.
550 #
551 # Interestingly, we don't have to pre-filter teaish.makefile.in - we
552 # can just @include it here. That skips its teaish-specific validation
553 # though. Hmm.
554 #
555 # <TEAISH_MAKEFILE>
556 Makefile: @TEAISH_MAKEFILE@
557 @include @TEAISH_MAKEFILE@
558 # </TEAISH_MAKEFILE>
559 @endif