interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / autoconf / tea / Makefile.in

559 lines · 16310 bytes Raw Blame History
1all:
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
21CC = @CC@
22INSTALL = @BIN_INSTALL@
23INSTALL.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#
40tx.name = @TEAISH_NAME@
41tx.version = @TEAISH_VERSION@
42tx.name.pkg = @TEAISH_PKGNAME@
43tx.libdir = @TEAISH_LIBDIR_NAME@
44tx.loadPrefix = @TEAISH_LOAD_PREFIX@
45tx.tcl = @TEAISH_TCL@
46tx.makefile = @TEAISH_MAKEFILE@
47tx.makefile.in = @TEAISH_MAKEFILE_IN@
48tx.dll8.basename = @TEAISH_DLL8_BASENAME@
49tx.dll9.basename = @TEAISH_DLL9_BASENAME@
50tx.dll8 = @TEAISH_DLL8@
51tx.dll9 = @TEAISH_DLL9@
52tx.dll = $(tx.dll$(TCL_MAJOR_VERSION))
53tx.dir = @TEAISH_EXT_DIR@
54@if TEAISH_TM_TCL
55# Input filename for tcl::tm-style module
56tx.tm = @TEAISH_TM_TCL@
57# Target filename for tcl::tm-style installation
58tx.tm.tgt = $(tx.name.pkg)-$(tx.version).tm
59@endif
60
61@if TEAISH_DIST_NAME
62tx.name.dist = @TEAISH_DIST_NAME@
63@else
64tx.name.dist = $(teaish.name)
65@endif
66
67teaish.dir = @abs_top_srcdir@
68#teaish.dir.autosetup = @TEAISH_AUTOSETUP_DIR@
69teaish.makefile = Makefile
70teaish.makefile.in = $(teaish.dir)/Makefile.in
71teaish__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#
79bindir = @bindir@
80datadir = @datadir@
81exec_prefix = @exec_prefix@
82includedir = @includedir@
83infodir = @infodir@
84libdir = @libdir@
85libexecdir = @libexecdir@
86localstatedir = @localstatedir@
87mandir = @mandir@
88prefix = @prefix@
89runstatedir = @runstatedir@
90sbindir = @sbindir@
91sharedstatedir = @sharedstatedir@
92sysconfdir = @sysconfdir@
93
94
95#
96# Vars derived (mostly) from tclConfig.sh. These may be reliably
97# used from the extension makefile.
98#
99TCLSH = @TCLSH_CMD@
100TCL_CONFIG_SH = @TCL_CONFIG_SH@
101TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@
102TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
103TCL_LIBS = @TCL_LIBS@
104TCL_LIB_SPEC = @TCL_LIB_SPEC@
105TCL_MAJOR_VERSION = @TCL_MAJOR_VERSION@
106TCL_MINOR_VERSION = @TCL_MINOR_VERSION@
107TCL_PATCH_LEVEL = @TCL_PATCH_LEVEL@
108TCL_PREFIX = @TCL_PREFIX@
109TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
110TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
111TCL_VERSION = @TCL_VERSION@
112TCLLIBDIR = @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#
121CFLAGS.configure = @SH_CFLAGS@ @TEAISH_CFLAGS@ @CFLAGS@ @CPPFLAGS@ $(TCL_INCLUDE_SPEC)
122CFLAGS.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#
131LDFLAGS.configure = @TEAISH_LDFLAGS@ @LDFLAGS@
132
133#
134# Linker flags for linkhing a shared library.
135#
136LDFLAGS.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#
149tx.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#
155tx.CFLAGS =
156tx.CPPFLAGS =
157
158#
159# tx.LDFLAGS is typically set by teaish.make, whereas TEAISH_LDFLAGS
160# gets set up via the configure script.
161#
162tx.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#
169tx.dist.files = @TEAISH_DIST_FILES@
170
171#
172# The base name for a distribution tar/zip file.
173#
174tx.dist.basename = $(tx.name.dist)-$(tx.version)
175
176# List of deps which may trigger an auto-reconfigure.
177#
178teaish__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
188teaish.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#
196config.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
201reconfigure:
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)
209config.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)
214config.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#
221CC.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#
229CC.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
245all: $(tx.dll)
246@endif # TEAISH_ENABLE_DLL
247
248tclsh: $(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
257test-extension: # this name is reserved for use by teaish.make[.in]
258@if TEAISH_ENABLE_DLL
259test-prepre: $(tx.dll)
260@endif
261@if TEAISH_TESTER_TCL
262teaish.tester.tcl = @TEAISH_TESTER_TCL@
263test-core.args = $(teaish.tester.tcl)
264@if TEAISH_ENABLE_DLL
265test-core.args += '$(tx.dll)' '$(tx.loadPrefix)'
266@else
267test-core.args += '' ''
268@endif
269test-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)
273test.args ?=
274test-core: test-pre
275 $(TCLSH) $(test-core.args) $(test.args)
276test-gdb: $(teaish.tester.tcl)
277 gdb --args $(TCLSH) $(test-core.args) $(test.args)
278test-vg.flags ?= --leak-check=full -v --show-reachable=yes --track-origins=yes
279test-vg: $(teaish.tester.tcl)
280 valgrind $(test-vg.flags) $(TCLSH) $(test-core.args) $(test.args)
281@else # !TEAISH_TESTER_TCL
282test-prepre:
283@endif # TEAISH_TESTER_TCL
284test-pre: test-prepre
285test-core: test-pre
286test-post: test-core
287test: test-post
288
289#
290# Cleanup rules...
291#
292#.PHONY: clean-pre clean-core clean-post clean-extension
293#
294clean-pre:
295clean-core: clean-pre
296 rm -f $(tx.dll8) $(tx.dll9) tclsh
297clean-post: clean-core
298clean: clean-post
299
300.PHONY: distclean-pre distclean-core distclean-post clean-extension
301distclean-pre: clean
302distclean-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
322distclean-post: distclean-core
323distclean: 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#
335distclean-extension:
336clean-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
343install-extension: # this name is reserved for use by teaish.make
344
345@if TEAISH_ENABLE_DLL
346install-prepre: $(tx.dll)
347@else
348install-prepre:
349@endif
350
351@if TEAISH_TM_TCL
352install-core.tmdir = $(DESTDIR)@TEAISH_TCL_TM_DIR@
353@endif
354
355install-pre: install-prepre
356install-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
376install-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
394install-post: install-test
395install: install-post
396
397#
398# Uninstall rules...
399#
400.PHONY: uninstall uninstall-pre uninstall-core uninstall-post uninstall-extension
401uninstall-extension: # this name is reserved for use by teaish.make
402uninstall-pre:
403uninstall-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
411uninstall-post: uninstall-core
412 @echo "Uninstalled Tcl extension $(tx.name) $(tx.version)"
413uninstall: uninstall-post
414@endif # TEAISH_ENABLE_INSTALL
415
416@if TEAISH_MAKEFILE_IN
417Makefile: $(tx.makefile.in)
418config.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.
433dist.flags = --with-tclsh=$(TCLSH)
434dist.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.
438teaish__dist.tmp.zip = teaish__dist_zip
439#
440# Make a distribution zip file...
441#
442dist.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)
461dist.zip-core: $(dist.zip)
462dist.zip-post: dist.zip-core
463dist.zip: dist.zip-post
464dist: dist.zip
465undist-zip:
466 rm -f $(dist.zip)
467undist: undist-zip
468@endif #BIN_ZIP
469
470#
471# Make a distribution tarball...
472#
473teaish__dist.tmp.tgz = teaish__dist_tgz
474dist.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)
493dist.tgz-core: $(dist.tgz)
494dist.tgz-post: dist.tgz-core
495dist.tgz: dist.tgz-post
496dist: dist.tgz
497undist-tgz:
498 rm -f $(dist.tgz)
499undist: undist-tgz
500@else #!BIN_TAR
501dist:
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
505undist:
506dist:
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
513Makefile: @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>
556Makefile: @TEAISH_MAKEFILE@
557@include @TEAISH_MAKEFILE@
558# </TEAISH_MAKEFILE>
559@endif