sqlite/Makefile.in
stephan 857bcb6035 Minor doc updates.
FossilOrigin-Name: 6578a8d59e351182ee16a1f4e4b2c88a042a92dd8b32049947aa0436464b8588
2024-10-20 01:34:13 +00:00

354 lines
11 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.
#
########################################################################
#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.
#
all:
clean:
#
# 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@
#
# Just testing some default dir expansions...
# srcdir = @srcdir@
# top_srcdir = @top_srcdir@
# abs_top_srcdir = @abs_top_srcdir@
# abs_top_builddir = @abs_top_builddir@
#
#
# Some standard variables and programs
#
prefix ?= @prefix@
exec_prefix ?= @exec_prefix@
libdir ?= @libdir@
pkgconfigdir ?= $(libdir)/pkgconfig
bindir ?= @bindir@
includedir ?= @includedir@
INSTALL = @BIN_INSTALL@
AR = @AR@
CC = @CC@
#LD = @LD@ # isn't actually needed, at least on modern Unixes.
#
# C Compiler and options for use in building executables that
# will run on the platform that is doing the build.
#
BCC = @BUILD_CC@ @BUILD_CFLAGS@
#
# Rather that stuffing all CFLAGS and LDFLAGS into a single set, we
# break them down on a per-feature basis and expect the build targets
# to use the one(s) it needs.
#
LDFLAGS_ZLIB = @LDFLAGS_ZLIB@
LDFLAGS_MATH = @LDFLAGS_MATH@
LDFLAGS_RPATH = @LDFLAGS_RPATH@
LDFLAGS_READLINE = @LDFLAGS_READLINE@
LDFLAGS_PTHREAD = @LDFLAGS_PTHREAD@
LDFLAGS_SHOBJ = @SHOBJ_LDFLAGS@
ENABLE_SHARED = @ENABLE_SHARED@
HAVE_WASI_SDK = @HAVE_WASI_SDK@
#
# TCC is the C Compile and options for use in building executables that
# will run on the target platform. (BCC and TCC are usually the
# same unless your are cross-compiling.) Separate CC and CFLAGS macros
# are provide so that these aspects of the build process can be changed
# on the "make" command-line. Ex: "make CC=clang CFLAGS=-fsanitize=undefined"
#
CFLAGS = @CFLAGS@ @SH_CFLAGS@
TCC = $(CC) $(CFLAGS)
# Define -DNDEBUG to compile without debugging (i.e., for production usage)
# Omitting the define will cause extra debugging code to be inserted and
# includes extra comments when "EXPLAIN stmt" is used.
#
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.
#
# Compiler options needed for programs that use the readline() library.
#
CFLAGS_READLINE = -DHAVE_READLINE=@HAVE_READLINE@ @CFLAGS_READLINE@
#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@
#
# Any target libraries which libsqlite must be linked against
#
# With the autosetup build, the intended way to do this is to set
# those in $(LDFLAGS_libsqlite3) and include those flags for both
# $(libsqlite3.SO) and any apps which directly link in either
# sqlite3.o or its origin sources.
LIBS += @LIBS@
TLIBS = $(LIBS)
#
# 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. 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) must contain any CFLAGS which are relevant for
# compiling the library's own sources, including (sometimes) when
# compiling sqlite3.c directly in to another app. Most notably, it
# should always contain -DSQLITE_TEMP_STORE=N for the sake of
# historical build expecations.
#
# SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1
# to default to file, 2 to default to memory, and 3 to force temporary
# tables to always be in memory.
#
CFLAGS_libsqlite3 = -DSQLITE_TEMP_STORE=@TEMP_STORE@
#
# Enable/disable loadable extensions, and other optional features
# based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*).
# The same set of OMIT and ENABLE flags should be passed to the
# LEMON parser generator and the mkkeywordhash tool as well.
#
# Add OPTIONS=... on the command line to append additional options
# to the OPT_FEATURE_FLAGS. Note that some flags only work if
# the build is specifically configured to account for them.
#
OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@ $(OPTIONS)
TCC += $(OPT_FEATURE_FLAGS)
# Add in any optional parameters specified on the make commane line
# ie. make "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1".
TCC += $(OPTS)
# Add in compile-time options for some libraries used by extensions
#TCC += @CFLAGS_ZLIB@
# 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.
#
GCOV_CFLAGS1 = -DSQLITE_COVERAGE_TEST=1 -fprofile-arcs -ftest-coverage
GCOV_LDFLAGS1 = -lgcov
USE_GCOV = @USE_GCOV@
TCOMPILE_EXTRAS += $(GCOV_CFLAGS$(USE_GCOV))
TLINK_EXTRAS += $(GCOV_LDFLAGS$(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_LINE_MACROS ?= --linemacros=@AMALGAMATION_LINE_MACROS@
#
# CFLAGS for sqlite3$(TEXE)
#
SHELL_OPT ?= @OPT_SHELL@
#
# This is the default Makefile target. The objects listed here
# are what get build when you type just "make" with no arguments.
#
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
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