Various build cleanups centered around straightening out various uses of CFLAGS and its cousins. Teach Makefile.linux-generic to figure out the TOP dir on its own (a GNU Make-ism, but it's a Linux-specific makefile).
FossilOrigin-Name: 58a0f7e79ce913b432dfd4db018e5a92efa8a6bd8a50bd78ab705ceac0322e9c
This commit is contained in:
parent
30b20563e4
commit
4cd85bda4a
32
Makefile.in
32
Makefile.in
@ -95,7 +95,7 @@ INSTALL = @BIN_INSTALL@
|
||||
AR = @AR@
|
||||
CC = @CC@
|
||||
B.cc = @BUILD_CC@ @BUILD_CFLAGS@
|
||||
T.cc = $(CC) $(CFLAGS)
|
||||
T.cc = $(CC)
|
||||
CFLAGS = @CFLAGS@ @SH_CFLAGS@
|
||||
|
||||
LDFLAGS.shobj = @SHOBJ_LDFLAGS@
|
||||
@ -105,7 +105,7 @@ LDFLAGS.rpath = @LDFLAGS_RPATH@
|
||||
LDFLAGS.pthread = @LDFLAGS_PTHREAD@
|
||||
LDFLAGS.dlopen = @LDFLAGS_DLOPEN@
|
||||
LDFLAGS.readline = @LDFLAGS_READLINE@
|
||||
CFLAGS.readline = -DHAVE_READLINE=@HAVE_READLINE@ @CFLAGS_READLINE@
|
||||
CFLAGS.readline = @CFLAGS_READLINE@
|
||||
|
||||
ENABLE_SHARED = @ENABLE_SHARED@
|
||||
HAVE_WASI_SDK = @HAVE_WASI_SDK@
|
||||
@ -146,20 +146,17 @@ $(B.tclsh):
|
||||
#
|
||||
# $(CFLAGS.libsqlite3) is documented in main.mk.
|
||||
#
|
||||
CFLAGS.libsqlite3 = $(CFLAGS) -DSQLITE_TEMP_STORE=@TEMP_STORE@
|
||||
CFLAGS.libsqlite3 = -DSQLITE_TEMP_STORE=@TEMP_STORE@
|
||||
|
||||
#
|
||||
# $(OPT_FEATURE_FLAGS) is documented in main.mk.
|
||||
#
|
||||
# The appending of $(OPTIONS) to $(OPT_FEATURE_FLAGS) is historical
|
||||
# and somewhat confusing because there's another var, $(OPTS), which
|
||||
# has a similar (but not identical) role.
|
||||
#
|
||||
OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@ $(OPTIONS)
|
||||
|
||||
T.cc += $(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.
|
||||
T.cc += $(OPTS)
|
||||
|
||||
#
|
||||
# Release (X.Y.Z) and version (X.Y) numbers for the SQLite being
|
||||
# compiled.
|
||||
@ -227,12 +224,11 @@ TCLLIBDIR = @TCLLIBDIR@
|
||||
#
|
||||
# for more info.
|
||||
#
|
||||
|
||||
CFLAGS.GCOV1 = -DSQLITE_COVERAGE_TEST=1 -fprofile-arcs -ftest-coverage
|
||||
LDFLAGS.GCOV1 = -lgcov
|
||||
CFLAGS.gcov1 = -DSQLITE_COVERAGE_TEST=1 -fprofile-arcs -ftest-coverage
|
||||
LDFLAGS.gcov1 = -lgcov
|
||||
USE_GCOV = @USE_GCOV@
|
||||
T.compile.extras += $(CFLAGS.GCOV$(USE_GCOV))
|
||||
T.link.extras += $(LDFLAGS.GCOV$(USE_GCOV))
|
||||
T.compile.extras = $(CFLAGS.gcov$(USE_GCOV))
|
||||
T.link.extras = $(LDFLAGS.gcov$(USE_GCOV))
|
||||
|
||||
#
|
||||
# Vars with the AS_ prefix are specifically related to AutoSetup.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/make
|
||||
all:
|
||||
#
|
||||
# Makefile for SQLITE
|
||||
#
|
||||
@ -17,35 +18,42 @@
|
||||
####
|
||||
#
|
||||
# $(TOP) = The toplevel directory of the source tree. This is the
|
||||
# directory that contains this "Makefile.in" and "auto.def".
|
||||
# directory that contains "Makefile.in" and "auto.def".
|
||||
#
|
||||
TOP ?= .
|
||||
TOP ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
#
|
||||
# $(CFLAGS) will be used when compiling the library and most
|
||||
# utilities. Generally speaking, it must contain -fPIC on Linux
|
||||
# systems.
|
||||
# utilities. It must normally contain -fPIC on Linux systems.
|
||||
#
|
||||
CFLAGS += -fPIC
|
||||
CFLAGS = -fPIC
|
||||
|
||||
#
|
||||
# $(SHELL_OPT) contains CFLAGS for building the sqlite3 CLI shell.
|
||||
# See main.mk for other potentially-relevant vars which may need
|
||||
# tweaking, like $(LDFLAGS_READLINE).
|
||||
#
|
||||
SHELL_OPT ?= -DHAVE_READLINE=1
|
||||
SHELL_OPT += -DHAVE_READLINE=1
|
||||
SHELL_OPT += -DSQLITE_HAVE_ZLIB=1
|
||||
LDFLAGS.readline = -lreadline # may need -lcurses etc, depending on the system
|
||||
CFLAGS.readline = # needs -I... if readline.h is in an unusual place.
|
||||
LDFLAGS.zlib = -lz
|
||||
|
||||
#
|
||||
# Library's version number.
|
||||
#
|
||||
VERSION.XYZ ?= $(shell cat $(TOP)/VERSION 2>/dev/null)
|
||||
$(info VERSION.XYZ=$(VERSION.XYZ))
|
||||
|
||||
# You should not have to change anything below this line
|
||||
###############################################################################
|
||||
include $(TOP)/main.mk
|
||||
|
||||
# sqlite_cfg.h is typically created by the configure script. It's
|
||||
# commonly not needed but main.mk does not know that so we have to
|
||||
# create a dummy if we don't already have one.
|
||||
sqlite_cfg.h:
|
||||
touch $@
|
||||
distclean-.:
|
||||
rm -f sqlite_cfg.h
|
||||
|
||||
#
|
||||
# With the above in place, we can now import the rules make use of
|
||||
# it...
|
||||
#
|
||||
include $(TOP)/main.mk
|
||||
|
9
auto.def
9
auto.def
@ -381,14 +381,13 @@ if {[cc-check-includes zlib.h] && [hwaci-check-function-in-lib deflate z]} {
|
||||
# TODO: port over the more sophisticated zlib search from the fossil auto.def
|
||||
define HAVE_ZLIB 1; # "-DSQLITE_HAVE_ZLIB=1"
|
||||
define LDFLAGS_ZLIB -lz
|
||||
# -DSQLITE_HAVE_ZLIB=1 is handled separately from the other feature
|
||||
# flags in the autotools build
|
||||
# add-feature-flag -DSQLITE_HAVE_ZLIB=1
|
||||
define CFLAGS_ZLIB -DSQLITE_HAVE_ZLIB=1
|
||||
# Note that -DSQLITE_HAVE_ZLIB=1 is handled separately from the
|
||||
# other feature flags in the autotools build. Do we need to emulate
|
||||
# that?
|
||||
add-shell-opt -DSQLITE_HAVE_ZLIB=1
|
||||
} else {
|
||||
define HAVE_ZLIB 0
|
||||
define LDFLAGS_ZLIB ""
|
||||
define CFLAGS_ZLIB ""
|
||||
}
|
||||
|
||||
hwaci-define-if-opt-truthy amalgamation USE_AMALGAMATION \
|
||||
|
79
main.mk
79
main.mk
@ -98,7 +98,7 @@ TCLSH_CMD ?= tclsh
|
||||
# JIMSH requires a leading path component, even if it's ./, so that it
|
||||
# can be used as a shell command.
|
||||
#
|
||||
CFLAGS.JIMSH ?= -DHAVE_REALPATH
|
||||
CFLAGS.jimsh ?= -DHAVE_REALPATH
|
||||
JIMSH ?= ./jimsh$(T.exe)
|
||||
#
|
||||
# $(B.tclsh) =
|
||||
@ -175,10 +175,14 @@ AMALGAMATION_GEN_FLAGS ?= --linemacros=0
|
||||
# and ENABLE flags must 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. Adding them later,
|
||||
# when compiling the amalgamation, may or may not work.
|
||||
# Add OPTIONS=... on the make 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. Adding them
|
||||
# later, when compiling the amalgamation, may or may not work.
|
||||
#
|
||||
# TO CLARIFY: OPTS=... has historically been expected in some
|
||||
# contexts, and is distinctly different from OPTIONS and
|
||||
# OPT_FEATURE_FLAGS, but its name is confusingly close to $(OPTIONS).
|
||||
#
|
||||
OPT_FEATURE_FLAGS ?=
|
||||
#
|
||||
@ -214,19 +218,6 @@ TCLLIB_RPATH ?=
|
||||
#
|
||||
HAVE_WASI_SDK ?= 0
|
||||
#
|
||||
# $(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.
|
||||
#
|
||||
CFLAGS.libsqlite3 ?= $(CFLAGS)
|
||||
#
|
||||
# $(T.cc.sqlite) is $(T.cc) plus any flags which are desired for the
|
||||
# library as a whole, but not necessarily needed for every binary. It
|
||||
# will normally get initially populated with flags by the
|
||||
# configure-generated makefile.
|
||||
#
|
||||
T.cc.sqlite ?= $(T.cc)
|
||||
#
|
||||
# ... and many, many more. Sane defaults are selected where possible.
|
||||
#
|
||||
# With the above-described defined, the rest of this make script will
|
||||
@ -241,6 +232,26 @@ all: sqlite3.h sqlite3.c
|
||||
########################################################################
|
||||
########################################################################
|
||||
|
||||
#
|
||||
# $(CFLAGS) should ideally only contain flags which are relevant for
|
||||
# all binaries built for the target platform.
|
||||
#
|
||||
T.cc += $(CFLAGS)
|
||||
|
||||
#
|
||||
# The difference between $(OPT_FEATURE_FLAGS) and $(OPTS) is that the
|
||||
# former is historically provided by the configure script, whereas the
|
||||
# latter is intended to be provided as arguments to the make
|
||||
# invocation.
|
||||
#
|
||||
T.cc += $(OPT_FEATURE_FLAGS)
|
||||
|
||||
#
|
||||
# Add in any optional global compilation flags on the make command
|
||||
# line ie. make "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1".
|
||||
#
|
||||
T.cc += $(OPTS)
|
||||
|
||||
#
|
||||
# $(INSTALL) invocation for use with non-executable files.
|
||||
#
|
||||
@ -248,11 +259,26 @@ INSTALL.noexec = $(INSTALL) -m 0644
|
||||
# ^^^ do not use GNU-specific flags to $(INSTALL), e.g. --mode=...
|
||||
|
||||
#
|
||||
# $(T.compile) = generic target platform compiler invocation
|
||||
# $(T.compile.extras) = config-specific flags for $(T.compile)
|
||||
# $(T.compile) = generic target platform compiler invocation,
|
||||
# differing only from $(T.cc) in that it appends $(T.compile.extras),
|
||||
# which are primarily intended for use with gcov-related flags.
|
||||
#
|
||||
T.compile = $(T.cc) $(T.compile.extras)
|
||||
|
||||
#
|
||||
# $(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.
|
||||
#
|
||||
CFLAGS.libsqlite3 ?=
|
||||
#
|
||||
# $(T.cc.sqlite) is $(T.cc) plus any flags which are desired for the
|
||||
# library as a whole, but not necessarily needed for every binary. It
|
||||
# will normally get initially populated with flags by the
|
||||
# configure-generated makefile.
|
||||
#
|
||||
T.cc.sqlite ?= $(T.cc)
|
||||
|
||||
#
|
||||
# $(CFLAGS.intree_includes) = -I... flags relevant specifically to
|
||||
# this tree, including any subdirectories commonly needed for building
|
||||
@ -273,7 +299,8 @@ T.cc.extension = $(T.compile) -I. -I$(TOP)/src -DSQLITE_CORE
|
||||
# $(T.link) = compiler invocation for when the target will be an
|
||||
# executable.
|
||||
#
|
||||
# $(T.link.extras) = optional config-specific flags for $(T.link)
|
||||
# $(T.link.extras) = optional config-specific flags for $(T.link),
|
||||
# primarily intended for use with gcov-related flags.
|
||||
#
|
||||
T.link = $(T.cc.sqlite) $(T.link.extras)
|
||||
#
|
||||
@ -328,7 +355,7 @@ $(install-dir.all):
|
||||
# accepts only a single argument.
|
||||
#
|
||||
$(JIMSH): $(TOP)/autosetup/jimsh0.c
|
||||
$(B.cc) -o $@ $(CFLAGS.JIMSH) $(TOP)/autosetup/jimsh0.c
|
||||
$(B.cc) -o $@ $(CFLAGS.jimsh) $(TOP)/autosetup/jimsh0.c
|
||||
@if [ x = "x$$($(JIMSH) -e 'file normalize $(JIMSH)' 2>/dev/null)" ]; then \
|
||||
echo "$(JIMSH) was built without -DHAVE_REALPATH or -DHAVE__FULLPATH." 1>&2; \
|
||||
exit 1; \
|
||||
@ -358,8 +385,8 @@ $(MAKE_SANITY_CHECK): $(MAKEFILE_LIST)
|
||||
@if [ x = "x$(VERSION.XYZ)" ]; then echo "VERSION.XYZ must be set to the library's X.Y.Z-format version number" 1>&2; exit 1; fi
|
||||
@if [ x = "x$(B.cc)" ]; then echo "Missing B.cc var" 1>&2; exit 1; fi
|
||||
@if [ x = "x$(T.cc)" ]; then echo "Missing T.cc var" 1>&2; exit 1; fi
|
||||
@if [ x = "x$(VERSION.XYZ)" ]; then echo "Missing VERSION.XYZ var" 1>&2; exit 1; fi
|
||||
@if [ x = "x$(B.tclsh)" ]; then echo "Missing B.tclsh var" 1>&2; exit 1; fi
|
||||
@if [ x = "x$(AR)" ]; then echo "Missing AR var" 1>&2; exit 1; fi
|
||||
touch $@
|
||||
clean-sanity-check:
|
||||
rm -f $(MAKE_SANITY_CHECK)
|
||||
@ -1699,9 +1726,11 @@ threadtest5: sqlite3.c $(TOP)/test/threadtest5.c
|
||||
xbin: threadtest5
|
||||
|
||||
sqlite3$(T.exe): shell.c sqlite3.c
|
||||
$(T.link) $(CFLAGS.readline) $(SHELL_OPT) -o $@ \
|
||||
$(T.link) -o $@ \
|
||||
shell.c sqlite3.c \
|
||||
$(CFLAGS.readline) $(SHELL_OPT) \
|
||||
$(LDFLAGS.libsqlite3) $(LDFLAGS.readline)
|
||||
|
||||
#
|
||||
# Build sqlite3$(T.exe) by default except in wasi-sdk builds. Yes, the
|
||||
# semantics of 0 and 1 are confusingly swapped here.
|
||||
@ -1839,7 +1868,7 @@ DBFUZZ2_OPTS = \
|
||||
-DSQLITE_ENABLE_FTS5
|
||||
|
||||
dbfuzz2$(T.exe): $(TOP)/test/dbfuzz2.c sqlite3.c sqlite3.h
|
||||
$(T.cc) $(OPT_FEATURE_FLAGS) $(OPTS) -I. -g -O0 \
|
||||
$(T.cc) -I. -g -O0 \
|
||||
-DSTANDALONE -o dbfuzz2 \
|
||||
$(DBFUZZ2_OPTS) $(TOP)/test/dbfuzz2.c sqlite3.c $(LDFLAGS.libsqlite3)
|
||||
mkdir -p dbfuzz2-dir
|
||||
|
18
manifest
18
manifest
@ -1,10 +1,10 @@
|
||||
C More\spotentially-controversial\smakefile\ssymbol\srenaming.\sThis\sis\ssimply\smore\sreadable\sto\smy\seyes.
|
||||
D 2024-10-24T05:33:30.843
|
||||
C Various\sbuild\scleanups\scentered\saround\sstraightening\sout\svarious\suses\sof\sCFLAGS\sand\sits\scousins.\sTeach\sMakefile.linux-generic\sto\sfigure\sout\sthe\sTOP\sdir\son\sits\sown\s(a\sGNU\sMake-ism,\sbut\sit's\sa\sLinux-specific\smakefile).
|
||||
D 2024-10-24T07:31:39.328
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
F Makefile.in 52f39f64dd0b5d925987adf433695db1a6bf7a5b009c8231303741a7620616d0
|
||||
F Makefile.linux-generic eb13e3e981a1950c99ce26c177fe2c2d2a268da4c0b1fcba85bfdf56142be298
|
||||
F Makefile.in c9c7aa417b8f012f35ec3e4661f258f7fc415ddd75a55acc7f501a50ec39bb26
|
||||
F Makefile.linux-generic 8df0e6ee5e4671f844caf27f88d2be7421e904639f7a0ffdce0e2cd4ea11e8c0
|
||||
F Makefile.msc 58b69eda1faad5d475092b8aeffab9156ee4901a82db089b166607f2ec907ee4
|
||||
F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159
|
||||
F VERSION 8dc0c3df15fd5ff0622f88fc483533fce990b1cbb2f5fb9fdfb4dbd71eef2889
|
||||
@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d
|
||||
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
|
||||
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
|
||||
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
|
||||
F auto.def 610865aa878f3367977b5c4d74ffa9b74d097d1f0e76ffa4a8c286322e0d4e63
|
||||
F auto.def d120d07a0fb42193224bcfb6b658804fdd609bb3b77196d436783b7536426394
|
||||
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
|
||||
F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
|
||||
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
|
||||
@ -707,7 +707,7 @@ F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b5
|
||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
|
||||
F main.mk c75886e8126c083e85fabc287d9d4649305f8c90e8d98fde23e8e1f338884e0f
|
||||
F main.mk ece1eba12f6f0bba61a77a196abd88f665dd37124f767a28c2138d4860245059
|
||||
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
|
||||
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
|
||||
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
|
||||
@ -2236,8 +2236,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 4193d90f2158e25fe25f9bcf579ae38a6e0ab6c26f52cd07a777d67b87107632
|
||||
R 4feb62569d5755832ec6d50a1a994ac9
|
||||
P 6d4d1d5fefb82ec7458efc2e93c933d9dc415dfa06fa46ff4725c30fc920ca5a
|
||||
R bb709993bdd1e18592edf968cb2f2be0
|
||||
U stephan
|
||||
Z fdd999fe051cb1883eb5d46f2f11b028
|
||||
Z 980b41dc4221bf4da6aefdf6906d7934
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
6d4d1d5fefb82ec7458efc2e93c933d9dc415dfa06fa46ff4725c30fc920ca5a
|
||||
58a0f7e79ce913b432dfd4db018e5a92efa8a6bd8a50bd78ab705ceac0322e9c
|
||||
|
Loading…
Reference in New Issue
Block a user