sqlite/Makefile.in

308 lines
9.6 KiB
Makefile

#!/usr/bin/make
# ^^^^ help out editors which guess this file's type.
#
# Makefile for SQLITE
#
# This makefile is intended to be configured automatically using the
# configure script. Hand editing may not work as expected because
# certain blocks are added or removed depending on configure-time
# information.
#
# The docs for many of its variables are in the primary static
# makefile, main.mk (which this one includes at runtime).
#
all:
clean:
########################################################################
#XX# Lines starting with #XX# are TODOs for the port to autosetup.
#
# Known TODOs/FIXMEs/TOIMPROVEs for the autosetup port, in no
# particular order...
#
# - libreadline detection and handling of its -I, -L, and -l flags.
# These can vary considerably across systems. e.g. some need -lncurses,
# and some don't know what an -lncurses is.
#
# - TEA pieces.
#
# - Replace the autotools-specific distribution deliverable(s).
#
# - Provide Makefile.msc, Makefile.linux-gcc, and any required similar
# makefile stubs for environments where the configure script will not
# run. The core makefile rules in main.mk "should" apply as-is for
# most platforms. We can potentially generate those makefiles, along
# with main.mk, like we do in the Fossil project.
#
# - Confirm whether cross-compilation works and patch it
# appropriately.
#
# - There are some lingering dependencies issues which cause a
# re-configure to trigger more often than it should. This is
# especially a problem in parallel builds, which may launch multiple
# re-configures in parallel. GNU Make offers ways of controlling
# that, but we're limited to POSIX Make compatibility here. The
# automatic reconfigures are not too onerous, though, because they're
# much, much faster than Autotools configure runs.
#
# - Add target(s) to dump out specific vars, e.g. SQLITE_OPT, as
# requested at https://sqlite.org/forum/forumpost/75cb3179216f8d86.
# This would also be useful for the ext/wasm build, which fishes
# SHELL_OPT out of the makefile.
#
#
# Maintenance reminder: When using the X?=Y variable assignment
# formulation, please test the build with both GNU make and a POSIX
# make (e.g. BSD make, a.k.a. bmake). On at least one occassion, that
# formulation has led to inconsistent behavior between the two major
# make flavors when used with variable names which might sensibly be
# in the developer's environment (namely CC).
#
#
# The top-most directory of the source tree. This is the directory
# that contains this "Makefile.in" and the "configure" script.
#
TOP = @abs_top_srcdir@
#
# Some standard variables and programs
#
prefix ?= @prefix@
exec_prefix ?= @exec_prefix@
libdir ?= @libdir@
pkgconfigdir ?= $(libdir)/pkgconfig
bindir ?= @bindir@
includedir ?= @includedir@
#
# Just testing some default dir expansions...
# srcdir = @srcdir@
# top_srcdir = @top_srcdir@
# abs_top_srcdir = @abs_top_srcdir@
# abs_top_builddir = @abs_top_builddir@
#
INSTALL = @BIN_INSTALL@
AR = @AR@
CC = @CC@
BCC = @BUILD_CC@ @BUILD_CFLAGS@
TCC = $(CC) $(CFLAGS)
CFLAGS = @CFLAGS@ @SH_CFLAGS@
LDFLAGS_SHOBJ = @SHOBJ_LDFLAGS@
LDFLAGS_ZLIB = @LDFLAGS_ZLIB@
LDFLAGS_MATH = @LDFLAGS_MATH@
LDFLAGS_RPATH = @LDFLAGS_RPATH@
LDFLAGS_PTHREAD = @LDFLAGS_PTHREAD@
LDFLAGS_READLINE = @LDFLAGS_READLINE@
CFLAGS_READLINE = -DHAVE_READLINE=@HAVE_READLINE@ @CFLAGS_READLINE@
ENABLE_SHARED = @ENABLE_SHARED@
HAVE_WASI_SDK = @HAVE_WASI_SDK@
TCCX = $(TCC) @TARGET_DEBUG@
# Define this for the autoconf-based build, so that the code knows it
# can include the generated sqlite_cfg.h.
#
TCCX += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite
#
# main.mk will fill out TCCX with some flags common to all builds.
#XX#CFLAGS_READLINE += -DHAVE_EDITLINE=@TARGET_HAVE_EDITLINE@
#XX#CFLAGS_READLINE += -DHAVE_LINENOISE=@TARGET_HAVE_LINENOISE@
#XX#
#XX## The library that programs using readline() must link against.
#XX##
#XX#LIBREADLINE = @TARGET_READLINE_LIBS@
#XX#
#XX## Should the database engine be compiled threadsafe
#XX##
#XX#TCC += -DSQLITE_THREADSAFE=@SQLITE_THREADSAFE@
#
# JimTCL is part of the autosetup suite and is suitable for all
# current in-tree code-generation TCL jobs, but it requires that we
# build it with non-default flags. Note that the build tree will, if
# no system-level tclsh is found, also have a ./jimsh0 binary. That
# one is a bare-bones build for the configure process, whereas we need
# to build it with another option enabled for use with the various
# code generators.
#
JIMSH = @srcdir@/jimsh
CFLAGS_JIMSH ?= @CFLAGS_JIMSH@
$(JIMSH): $(TOP)/autosetup/jimsh0.c
$(BCC) -o $(JIMSH) $(CFLAGS_JIMSH) $(TOP)/autosetup/jimsh0.c
# BTCLSH is the tclsh-compatible app used for running various code
# generators and other in-tree tools, as opposed to the TCL-based
# tests, which must be built and run using the canonical TCL
# distribution.
BTCLSH = @BTCLSH@
$(BTCLSH):
# $(CFLAGS_libsqlite3) is documented in main.mk.
CFLAGS_libsqlite3 = -DSQLITE_TEMP_STORE=@TEMP_STORE@
OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@ $(OPTIONS)
TCC += $(OPT_FEATURE_FLAGS)
#
# Add in any optional global compilation flags on the make commane
# line ie. make "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1".
#
#XX# FIXME: rename one or the other of $(OPTS) and $(OPTIONS), as they
#XX# serve different purposes.
TCC += $(OPTS)
# Version numbers and release number for the SQLite being compiled.
#
# VERSION = @VERSION@
RELEASE = @RELEASE@
# Filename extensions for binaries and libraries
#
BEXE = @BUILD_EXEEXT@
TEXE = @TARGET_EXEEXT@
BDLL = @BUILD_DLLEXT@
TDLL = @TARGET_DLLEXT@
BLIB = @BUILD_LIBEXT@
TLIB = @TARGET_LIBEXT@
# The following variable is "1" if the configure script was able to locate
# the tclConfig.sh file. It is an empty string otherwise. When this
# variable is "1", the TCL extension library (libtclsqlite3.so) is built
# and installed.
#
HAVE_TCL = @HAVE_TCL@
# This is the command to use for tclsh - normally just "tclsh", but we may
# know the specific version we want to use. This must point to the canonical
# TCL interpreter, not JimTCL.
#
TCLSH_CMD = @TCLSH_CMD@
TCL_CONFIG_SH = @TCL_CONFIG_SH@
# TCL config info from tclConfig.sh
TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
TCL_LIB_SPEC = @TCL_LIB_SPEC@
TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@
TCL_VERSION = @TCL_VERSION@
TCLLIB_RPATH = @TCLLIB_RPATH@
TCLLIBDIR = @TCLLIBDIR@
# Additional options when running tests using testrunner.tcl
# This is usually either blank, or else --status
#
TSTRNNR_OPTS = @TSTRNNR_OPTS@
# Where do we want to install the tcl plugin
#
TCLLIBDIR = @TCLLIBDIR@
#
# If gcov support was enabled by the configure script, add the appropriate
# flags here. It's not always as easy as just having the user add the right
# CFLAGS / LDFLAGS, because libtool wants to use CFLAGS when linking, which
# causes build errors with -fprofile-arcs -ftest-coverage with some GCCs.
# Supposedly GCC does the right thing if you use --coverage, but in
# practice it still fails. See:
#
# http://www.mail-archive.com/debian-gcc@lists.debian.org/msg26197.html
#
# for more info.
#
CFLAGS_GCOV1 = -DSQLITE_COVERAGE_TEST=1 -fprofile-arcs -ftest-coverage
LDFLAGS_GCOV1 = -lgcov
USE_GCOV = @USE_GCOV@
TCOMPILE_EXTRAS += $(CFLAGS_GCOV$(USE_GCOV))
TLINK_EXTRAS += $(LDFLAGS_GCOV$(USE_GCOV))
#
# You should not have to change anything below this line
################################################################################
#
# Vars with the AS_ prefix are specifically related to AutoSetup.
#
# AS_AUTO_DEF is the main configure script.
#
AS_AUTO_DEF = $(TOP)/auto.def
#
# Shell commands to re-run $(TOP)/configure with the same args it was
# invoked with to produce this makefile.
#
AS_AUTOREMAKE = @SQLITE_AUTOREMAKE@
USE_AMALGAMATION ?= @USE_AMALGAMATION@
AMALGAMATION_GEN_FLAGS ?= --linemacros=@AMALGAMATION_LINE_MACROS@
#
# CFLAGS for sqlite3$(TEXE)
#
SHELL_OPT ?= @OPT_SHELL@
Makefile: $(TOP)/Makefile.in $(AS_AUTO_DEF)
$(AS_AUTOREMAKE)
@touch $@
sqlite3.pc: $(TOP)/sqlite3.pc.in $(AS_AUTO_DEF)
$(AS_AUTOREMAKE)
@touch $@
install: install-pc # defined in main.mk
sqlite_cfg.h: $(TOP)/sqlite_cfg.h.in $(AS_AUTO_DEF)
$(AS_AUTOREMAKE)
@touch $@
#
# Fiddle app
#
# EMCC_WRAPPER must refer to the genuine emcc binary, or a
# call-compatible wrapper, e.g. $(TOP)/tool/emcc.sh. If it's empty,
# build components requiring Emscripten will not build.
#
EMCC_WRAPPER = @EMCC_WRAPPER@
fiddle: sqlite3.c shell.c
@if [ x = "x$(EMCC_WRAPPER)" ]; then \
echo "Emscripten's emcc not found. Cannot build fiddle." 1&>2; \
exit 1; \
fi
$(MAKE) -C ext/wasm fiddle emcc_opt=-Os
#
# Spell-checking for source comments
# The sources checked are either C sources or C source templates.
# Their comments are extracted and processed through aspell using
# a custom dictionary that contains scads of odd identifiers that
# find their way into the comments.
#
# Currently, this target is setup to be "made" in-tree only.
# The output is ephemeral. Redirect it to guide spelling fixups,
# either to correct spelling or add words to tool/custom.txt.
#
./custom.rws: ./tool/custom.txt
@echo 'Updating custom dictionary from tool/custom.txt'
aspell --lang=en create master ./custom.rws < ./tool/custom.txt
# Note that jimsh does not work here:
# https://github.com/msteveb/jimtcl/issues/319
misspell: ./custom.rws has_tclsh84
$(TCLSH_CMD) ./tool/spellsift.tcl ./src/*.c ./src/*.h ./src/*.in
#
# clean/distclean are mostly defined in main.mk. In this makefile we
# perform cleanup known to be relevant to (only) the autosetup-driven
# build.
#
clean-autosetup:
-gmake -C ext/wasm distclean 2>/dev/null; true
clean: clean-autosetup
distclean-autosetup: clean
rm -f sqlite_cfg.h config.log config.status $(JIMSH) Makefile sqlite3.pc
rm -f $(TOP)/tool/emcc.sh
-gmake -C ext/wasm distclean 2>/dev/null; true
distclean: distclean-autosetup
include $(TOP)/main.mk