0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-11-23 23:57:41 +01:00

Split the core-most CFLAGS, which should not be overridable (like -fPIC), into CFLAGS.core, so that went CFLAGS=... is passed on in a make invocation the -fPIC flag is not lost (as reported in [forum:39f8c54391d38c72 | forum post 39f8c543]).

FossilOrigin-Name: f5899d22c6c2e65383d7e1ca43da740d3a56fb87daa204a642ce1dc963a98de2
This commit is contained in:
stephan 2024-10-29 23:42:24 +00:00
parent 691e7eceb6
commit 5be33f7b3f
6 changed files with 39 additions and 18 deletions

View File

@ -97,8 +97,18 @@ AR.flags = cr # TODO? Add a configure test to determine this?
CC = @CC@
B.cc = @CC_FOR_BUILD@ @BUILD_CFLAGS@
T.cc = @CC@
CFLAGS = @CPPFLAGS@ @CFLAGS@ @SH_CFLAGS@
#
# CFLAGS is problematic because it is frequently overridden when
# invoking make, which loses things like -fPIC. So... let's avoid
# using it directly and instead add a level of indirection. We
# combine CFLAGS and CPPFLAGS here because that's the way the legacy
# build did it.
#
CFLAGS = @CFLAGS@ @CPPFLAGS@
#
# CFLAGS.core is documented in main.mk.
#
CFLAGS.core = @SH_CFLAGS@
LDFLAGS.shobj = @SHOBJ_LDFLAGS@
LDFLAGS.zlib = @LDFLAGS_ZLIB@
LDFLAGS.math = @LDFLAGS_MATH@

View File

@ -24,9 +24,14 @@ TOP ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
#
# $(CFLAGS) will be used when compiling the library and most
# utilities. It must normally contain -fPIC on Linux systems.
# utilities. It must normally contain -fPIC on Linux systems,
# but overriding CFLAGS is an easy way for users to inadvertently
# remove -fPIC from their builds, so we generally expect to see
# -fPIC in $(CFLAGS.core), which main.mk will integrate with
# the CFLAGS where needed.
#
CFLAGS = -fPIC
CFLAGS =
CFLAGS.core = -fPIC
#
# $(SHELL_OPT) contains CFLAGS for building the sqlite3 CLI shell.

View File

@ -851,7 +851,7 @@ proc sqlite-check-line-editing {} {
}
}
} elseif {"" ne $rlInc && ![string match *-I* $rlInc]} {
proj-fatal "Argument to --with-readline-cflag is intended to be CFLAGS and contain -I..."
proj-fatal "Argument to --with-readline-cflags is intended to be CFLAGS and contain -I..."
}
# If readline.h was found/specified, look for lib(readline|edit)...

12
main.mk
View File

@ -221,7 +221,7 @@ TCL_CONFIG_SH ?=
# $(TCLLIB_RPATH) is the -rpath flag for libtclsqlite3, not
# libsqlite3, and will usually differ from $(LDFLAGS.rpath).
#
TCLLIB_RPATH ?=
#TCLLIB_RPATH ?=
#
# $(HAVE_WASI_SDK) =
#
@ -247,9 +247,15 @@ all: sqlite3.h sqlite3.c
#
# $(CFLAGS) should ideally only contain flags which are relevant for
# all binaries built for the target platform.
# all binaries built for the target platform. However, many people
# like to pass it to "make" without realizing that it applies to
# dozens of apps, and they override core flags when doing so. To help
# work around that, we expect core-most CFLAGS (only), e.g. -fPIC, to
# be set in $(CFLAGS.core). That enables people to pass their other
# CFLAGS without triggering, e.g., "recompile with -fPIC" errors.
#
T.cc += $(CFLAGS)
CFLAGS.core ?=
T.cc += $(CFLAGS.core) $(CFLAGS)
#
# The difference between $(OPT_FEATURE_FLAGS) and $(OPTS) is that the

View File

@ -1,10 +1,10 @@
C Try\sto\sdetect\sif\s--with-readline-cflags\sis\spassed\sa\snon-cflags\svalue,\se.g.\sreadline/readline.h,\sand\sfail\sloudly\sif\sit\sis.\sThe\slegacy\sconfigure\saccepted\sthat\sformulation\sbut\ssilently\sdid\snothing\suseful\swith\sit\sand\sthat\sformulation\snow\scauses\sthe\sauto-completion\stest\sto\sfail,\sas\sreported\sin\s[forum:f13b8e8f38402367\s|\sforum\spost\sf13b8e8f38402367].
D 2024-10-29T23:19:29.053
C Split\sthe\score-most\sCFLAGS,\swhich\sshould\snot\sbe\soverridable\s(like\s-fPIC),\sinto\sCFLAGS.core,\sso\sthat\swent\sCFLAGS=...\sis\spassed\son\sin\sa\smake\sinvocation\sthe\s-fPIC\sflag\sis\snot\slost\s(as\sreported\sin\s[forum:39f8c54391d38c72\s|\sforum\spost\s39f8c543]).
D 2024-10-29T23:42:24.491
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md c5b4009dca54d127d2d6033c22fd9cc34f53bedb6ef12c7cbaa468381c74ab28
F Makefile.in 064898709d63e882764d2011522f0898c42a5dc2e7663ff4f4ed8fcfe6b7b067
F Makefile.linux-generic 69b54c58ab2424a0d30f340d9defd7e87c25690a55b77acb9bdc657bd9a223f1
F Makefile.in 4d261854ba83b66a790271b2d0e390f94be8fe49b3e5ae6c1596abe7917c65a3
F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0
F Makefile.msc a92237976eb92c5efaa0dd2524746aec12c196e12df8d4dbff9543a4648c3312
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 b617eeed76cfc37c16462b77cc214646313df96ff904d2328042e496f2b0c9f4
F auto.def 532d2b8d2d0a384476ca60144329ac12bceda654e9edd8178a88e4571dc43431
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
@ -697,7 +697,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
F main.mk 46f98320780c72a025bed1a5f8af3355fb2186691617f2b8d41221f9aa564494
F main.mk 933f21c0d62076382981df123cebad08a0b4a5980629efea46d5bd81791687a7
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P e2f41c2540d8ff7686bfe22336598896de9083d139fc5a291c0f19896b9c1d20
R b6d32adaf9573d4cf76554f18adf8ffd
P c97f34d064c1fc1e6860761a417aaab2a79bd3871bcd1dad1d0d3b6f4b692a1e
R b6e862fcb5d5e7896f9f768e1edf8f0e
U stephan
Z 0e7364863ba936108ce5c81e5e566b82
Z 8441426a564a87d0438ac80a3d2d09b1
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
c97f34d064c1fc1e6860761a417aaab2a79bd3871bcd1dad1d0d3b6f4b692a1e
f5899d22c6c2e65383d7e1ca43da740d3a56fb87daa204a642ce1dc963a98de2