AryaWu/sqlite
0
1#!/usr/bin/make2# ^^^^ help out editors which guess this file's type.3#4# Makefile for SQLITE5#6# This makefile is intended to be configured automatically using the7# configure script.8#9# The docs for many of its variables are in the primary static10# makefile, main.mk (which this one includes at runtime).11#12all:13########################################################################14# Maintenance reminders:15#16# - This makefile should remain as POSIX-make-compatible as possible:17# https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html18#19# - The naming convention of some vars, using periods instead of20# underscores, though unconventional, was selected for a couple of21# reasons: 1) Personal taste (for which there is no accounting). 2)22# It is thought to help defend against inadvertent injection of23# those vars via environment variables (because X.Y is not a legal24# environment variable name). "Feature or bug?" is debatable and25# this naming convention may be reverted if it causes any grief.26#27 28#29# The top-most directory of the source tree. This is the directory30# that contains this "Makefile.in" and the "configure" script.31#32TOP = @abs_top_srcdir@33 34#35# Autotools-conventional vars which are used by package installation36# rules in main.mk. To get sane handling when a user overrides only37# a subset of these, we perform some acrobatics with these vars38# in the configure script: see [proj-remap-autoconf-dir-vars] for39# full details.40#41# For completeness's sake, the aforementioned conventional vars which42# are relevant to our installation rules are:43#44# datadir = $(prefix)/share45# mandir = $(datadir)/man46# includedir = $(prefix)/include47# exec_prefix = $(prefix)48# bindir = $(exec_prefix)/bin49# libdir = $(exec_prefix)/lib50#51# Our builds do not require any of their relatives:52#53# sbindir = $(exec_prefix)/sbin54# sysconfdir = /etc55# sharedstatedir = $(prefix)/com56# localstatedir = /var57# runstatedir = /run58# infodir = $(datadir)/info59# libexecdir = $(exec_prefix)/libexec60#61prefix = @prefix@62datadir = @datadir@63mandir = @mandir@64includedir = @includedir@65exec_prefix = @exec_prefix@66bindir = @bindir@67libdir = @libdir@68 69INSTALL = @BIN_INSTALL@70AR = @AR@71AR.flags = cr72CC = @CC@73B.cc = @CC_FOR_BUILD@ @BUILD_CFLAGS@74T.cc = $(CC)75#76# $(CFLAGS) is problematic because it is frequently overridden when77# invoking make, which loses things like -fPIC. So... we avoid using78# it directly and instead add a level of indirection. We combine79# $(CFLAGS) and $(CPPFLAGS) here because that's the way the legacy80# build did it and many builds rely on that. See main.mk for more81# details.82#83# Historical note: the pre-3.48 build only honored CPPFLAGS at84# configure-time, and expanded them into the generated Makefile. There85# are, in that build, no uses of CPPFLAGS in the configure-expanded86# Makefile. Ergo: if a client configures with CPPFLAGS=... and then87# explicitly passes CFLAGS=... to make, the CPPFLAGS will be88# lost. That behavior is retained in 3.48+.89#90CFLAGS = @CFLAGS@ @CPPFLAGS@91#92# $(LDFLAGS.configure) represents any LDFLAGS=... the client passes to93# configure. See main.mk.94#95LDFLAGS.configure = @LDFLAGS@96 97#98# CFLAGS.core is documented in main.mk.99#100CFLAGS.core = @SH_CFLAGS@101LDFLAGS.shlib = @SH_LDFLAGS@102LDFLAGS.zlib = @LDFLAGS_ZLIB@103LDFLAGS.math = @LDFLAGS_MATH@104LDFLAGS.rpath = @LDFLAGS_RPATH@105LDFLAGS.pthread = @LDFLAGS_PTHREAD@106LDFLAGS.dlopen = @LDFLAGS_DLOPEN@107LDFLAGS.readline = @LDFLAGS_READLINE@108CFLAGS.readline = @CFLAGS_READLINE@109LDFLAGS.icu = @LDFLAGS_ICU@110LDFLAGS.rt = @LDFLAGS_RT@111CFLAGS.icu = @CFLAGS_ICU@112LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@113# soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded114LDFLAGS.libsqlite3.os-specific = \115 @LDFLAGS_MAC_CVERSION@ @LDFLAGS_MAC_INSTALL_NAME@ @LDFLAGS_OUT_IMPLIB@116# os-specific: see117# - https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7118# - https://sqlite.org/forum/forumpost/0c7fc097b2119# - https://sqlite.org/forum/forumpost/5651662b8875ec0a120 121libsqlite3.DLL.basename = @SQLITE_DLL_BASENAME@122# DLL.basename: see https://sqlite.org/forum/forumpost/828fdfe904123libsqlite3.out.implib = @SQLITE_OUT_IMPLIB@124# libsqlite3.out.implib => the output filename part of LDFLAGS_OUT_IMPLIB.125ENABLE_LIB_SHARED = @ENABLE_LIB_SHARED@126ENABLE_LIB_STATIC = @ENABLE_LIB_STATIC@127HAVE_WASI_SDK = @HAVE_WASI_SDK@128libsqlite3.DLL.install-rules = @SQLITE_DLL_INSTALL_RULES@129 130# -fsanitize flags for the fuzzcheck-asap app131CFLAGS.fuzzcheck-asan.fsanitize = @CFLAGS_ASAN_FSANITIZE@132 133#134# Intended to either be empty or be set to -g -DSQLITE_DEBUG=1.135#136T.cc.TARGET_DEBUG = @TARGET_DEBUG@137 138#139# $(JIMSH) and $(CFLAGS.jimsh) are documented in main.mk. $(JIMSH)140# must start with a path component so that it can be invoked as a141# shell command.142#143CFLAGS.jimsh = @CFLAGS_JIMSH@144JIMSH = ./jimsh$(T.exe)145 146#147# $(B.tclsh) is documented in main.mk.148#149B.tclsh = @BTCLSH@150$(B.tclsh):151 152#153# $(OPT_FEATURE_FLAGS) is documented in main.mk.154#155# The appending of $(OPTIONS) to $(OPT_FEATURE_FLAGS) is historical156# and somewhat confusing because there's another var, $(OPTS), which157# has a similar (but not identical) role.158#159OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@ $(OPTIONS)160 161#162# Version (X.Y.Z) number for the SQLite being compiled.163#164PACKAGE_VERSION = @PACKAGE_VERSION@165 166#167# Filename extensions for binaries and libraries168#169B.exe = @BUILD_EXEEXT@170T.exe = @TARGET_EXEEXT@171B.dll = @BUILD_DLLEXT@172T.dll = @TARGET_DLLEXT@173B.lib = @BUILD_LIBEXT@174T.lib = @TARGET_LIBEXT@175 176#177# $(HAVE_TCL) is 1 if the configure script was able to locate the178# tclConfig.sh file, else it is 0. When this variable is 1, the TCL179# extension library (libtclsqlite3.so) and related testing apps are180# built.181#182HAVE_TCL = @HAVE_TCL@183 184#185# $(TCLSH_CMD) is the command to use for tclsh - normally just186# "tclsh", but we may know the specific version we want to use. This187# must point to a canonical TCL interpreter, not JimTCL.188#189TCLSH_CMD = @TCLSH_CMD@190TCL_CONFIG_SH = @TCL_CONFIG_SH@191 192#193# TCL config info from tclConfig.sh194#195# We have to inject this differently in main.mk to accommodate static196# makefiles, so we don't currently bother to export it here. This197# block is retained in case we decide that we do indeed need to export198# it at configure-time instead of calculate it at make-time.199#200#TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@201#TCL_LIB_SPEC = @TCL_LIB_SPEC@202#TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@203#TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@204#TCL_VERSION = @TCL_VERSION@205TCL_MAJOR_VERSION = @TCL_MAJOR_VERSION@206# ^^^ main.mk optionally uses this for determining the Tcl extension's207# DLL name.208TCL_EXT_DLL_BASENAME = @TCL_EXT_DLL_BASENAME@209# ^^^ base name of the Tcl extension DLL. It varies by platform and210# Tcl version.211 212#213# $(TCLLIBDIR) = where to install the tcl plugin. If this is empty, it214# is calculated at make-time by the targets which need it but we215# export it here so that it can be set at configure-time, so that216# clients are not required to pass it at make-time, or may set it in217# their environment to override it.218#219TCLLIBDIR = @TCLLIBDIR@220 221#222# Additional options when running tests using testrunner.tcl223# This is usually either blank or --status.224#225TSTRNNR_OPTS = @TSTRNNR_OPTS@226 227#228# If gcov support was enabled by the configure script, add the appropriate229# flags here. It's not always as easy as just having the user add the right230# CFLAGS / LDFLAGS, because libtool wants to use CFLAGS when linking, which231# causes build errors with -fprofile-arcs -ftest-coverage with some GCCs.232# Supposedly GCC does the right thing if you use --coverage, but in233# practice it still fails. See:234#235# http://www.mail-archive.com/debian-gcc@lists.debian.org/msg26197.html236#237# for more info.238#239CFLAGS.gcov1 = -DSQLITE_COVERAGE_TEST=1 -fprofile-arcs -ftest-coverage240LDFLAGS.gcov1 = -lgcov241USE_GCOV = @USE_GCOV@242T.compile.gcov = $(CFLAGS.gcov$(USE_GCOV))243T.link.gcov = $(LDFLAGS.gcov$(USE_GCOV))244 245#246# Vars with the AS_ prefix are specifically related to AutoSetup.247#248# AS_AUTO_DEF is the main configure script.249#250AS_AUTO_DEF = $(TOP)/auto.def251#252# Shell commands to re-run $(TOP)/configure with the same args it was253# invoked with to produce this makefile.254#255AS_AUTORECONFIG = @SQLITE_AUTORECONFIG@256.PHONY: config reconfigure257config reconfigure:258 $(AS_AUTORECONFIG)259USE_AMALGAMATION ?= @USE_AMALGAMATION@260LINK_TOOLS_DYNAMICALLY ?= @LINK_TOOLS_DYNAMICALLY@261AMALGAMATION_GEN_FLAGS ?= --linemacros=@AMALGAMATION_LINE_MACROS@262EXTRA_SRC ?= @AMALGAMATION_EXTRA_SRC@263STATIC_TCLSQLITE3 = @STATIC_TCLSQLITE3@264STATIC_CLI_SHELL = @STATIC_CLI_SHELL@265 266#267# CFLAGS for sqlite3$(T.exe)268#269SHELL_OPT ?= @OPT_SHELL@270 271Makefile: $(TOP)/Makefile.in $(AS_AUTO_DEF)272 $(AS_AUTORECONFIG)273 @touch $@274 275sqlite3.pc: $(TOP)/sqlite3.pc.in $(AS_AUTO_DEF)276 $(AS_AUTORECONFIG)277 @touch $@278install: install-pc # defined in main.mk279 280sqlite_cfg.h: $(AS_AUTO_DEF)281 $(AS_AUTORECONFIG)282 @touch $@283 284#285# Fiddle app286#287# EMCC_WRAPPER must refer to the genuine emcc binary, or a288# call-compatible wrapper, e.g. $(TOP)/tool/emcc.sh. If it's empty,289# build components requiring Emscripten will not build.290#291# Achtung: though _this_ makefile is POSIX-make compatible, the fiddle292# build requires GNU make.293#294EMCC_WRAPPER = @EMCC_WRAPPER@295fiddle: sqlite3.c shell.c296 @if [ x = "x$(EMCC_WRAPPER)" ]; then \297 echo "Emscripten SDK not found by configure. Cannot build fiddle." 1&>2; \298 exit 1; \299 fi300 $(MAKE) -C ext/wasm fiddle emcc_opt=-Os301 302#303# Spell-checking for source comments304# The sources checked are either C sources or C source templates.305# Their comments are extracted and processed through aspell using306# a custom dictionary that contains scads of odd identifiers that307# find their way into the comments.308#309# Currently, this target is setup to be "made" in-tree only.310# The output is ephemeral. Redirect it to guide spelling fixups,311# either to correct spelling or add words to tool/custom.txt.312#313./custom.rws: ./tool/custom.txt314 @echo 'Updating custom dictionary from tool/custom.txt'315 aspell --lang=en create master ./custom.rws < ./tool/custom.txt316misspell: ./custom.rws has_tclsh84317# $(JIMSH) does not work with spellsift.tcl318 $(TCLSH_CMD) ./tool/spellsift.tcl ./src/*.c ./src/*.h ./src/*.in319 320#321# clean/distclean are mostly defined in main.mk. In this makefile we322# perform cleanup known to be relevant to (only) the autosetup-driven323# build.324#325distclean-autosetup:326 rm -f sqlite_cfg.h config.log config.status config.defines.* Makefile sqlite3.pc327 rm -f $(TOP)/tool/emcc.sh328 rm -f libsqlite3*$(T.dll)329 rm -f jimsh0*330distclean: distclean-autosetup331 332#333# tool/version-info: a utility for emitting sqlite3 version info334# in various forms. It's used by ext/wasm/.335#336version-info$(T.exe): $(TOP)/tool/version-info.c Makefile sqlite3.h337 $(T.link) $(ST_OPT) -o $@ $(TOP)/tool/version-info.c338 339include $(TOP)/main.mk340 