0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-11-21 19:29:09 +01:00

Factor out all autosetup-processed @if/@else blocks from Makefile.in in prep for moving most of the makefile code into main.mk (which has, so far, been completely overlooked in this port but will now become the main basis for the static parts of the build). The idea is that all build configuration goes into a platform-dependent makefile which then includes main.mk.

FossilOrigin-Name: 707e0f5857d58ec8b457270f988126b1dd0f01b5a3445a43ff7b5429324b1b3d
This commit is contained in:
stephan 2024-10-19 18:31:47 +00:00
parent 816f4b9cc1
commit abf470d7a3
5 changed files with 128 additions and 1261 deletions

View File

@ -19,13 +19,15 @@ TOP = @abs_top_srcdir@
# top_srcdir = @top_srcdir@
# abs_top_srcdir = @abs_top_srcdir@
# abs_top_builddir = @abs_top_builddir@
LDFLAGS_ZLIB = @LDFLAGS_ZLIB@
LDFLAGS_MATH = @LDFLAGS_MATH@
LDFLAGS_RPATH = @LDFLAGS_RPATH@
LDFLAGS_READLINE = @LDFLAGS_READLINE@
LDFLAGS_PTHREAD = @LDFLAGS_PTHREAD@
LD = @LD@
AR = @AR@
LDFLAGS_ZLIB ?= @LDFLAGS_ZLIB@
LDFLAGS_MATH ?= @LDFLAGS_MATH@
LDFLAGS_RPATH ?= @LDFLAGS_RPATH@
LDFLAGS_READLINE ?= @LDFLAGS_READLINE@
LDFLAGS_PTHREAD ?= @LDFLAGS_PTHREAD@
ENABLE_SHARED ?= @ENABLE_SHARED@
HAVE_WASI_SDK ?= @HAVE_WASI_SDK@
AR ?= @AR@
CC ?= @CC@
# C Compiler and options for use in building executables that
# will run on the platform that is doing the build.
@ -38,12 +40,8 @@ BCC = @BUILD_CC@ @BUILD_CFLAGS@
# 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"
#
CC = @CC@
CFLAGS ?= @CFLAGS@
CFLAGS ?= @CFLAGS@ @SH_CFLAGS@
CPPFLAGS ?= @CPPFLAGS@
@if SH_CFLAGS
CFLAGS += @SH_CFLAGS@
@endif
# CFLAGS_stdio3 ==> for sqlite3_stdio.h
CFLAGS_stdio3 := -I${TOP}/ext/misc
TCC = ${CC} ${CFLAGS}
@ -91,7 +89,8 @@ CFLAGS_readline = -DHAVE_READLINE=@HAVE_READLINE@ @CFLAGS_READLINE@
# 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.
TLIBS = @LIBS@ $(LIBS)
LIBS += @LIBS@
TLIBS = $(LIBS)
#
# JimTCL is part of the autosetup suite and is suitable for all
@ -103,10 +102,9 @@ TLIBS = @LIBS@ $(LIBS)
# generators.
#
JIMSH = @srcdir@/jimsh
@if CFLAGS_JIMSH
CFLAGS_JIMSH ?= @CFLAGS_JIMSH@
$(JIMSH): $(TOP)/autosetup/jimsh0.c
$(BCC) -o $(JIMSH) @CFLAGS_JIMSH@ $<
@endif
$(BCC) -o $(JIMSH) $(CFLAGS_JIMSH) $<
# BTCLSH is the tclsh-compatible app used for running various code
# generators and other in-tree tools, as opposed to the TCL-based
@ -177,6 +175,13 @@ 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@
# 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@
# Additional options when running tests using testrunner.tcl
@ -210,12 +215,12 @@ TLINK_EXTRAS += $(GCOV_LDFLAGS$(USE_GCOV))
# Some standard variables and programs
#
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
pkgconfigdir = $(libdir)/pkgconfig
bindir = @bindir@
includedir = @includedir@
prefix ?= @prefix@
exec_prefix ?= @exec_prefix@
libdir ?= @libdir@
pkgconfigdir ?= $(libdir)/pkgconfig
bindir ?= @bindir@
includedir ?= @includedir@
INSTALL = @BIN_INSTALL@
INSTALL_noexec = $(INSTALL) -m 0644
# ^^^ do not use GNU-specific flags to $(INSTALL), e.g. --mode=...
@ -230,11 +235,6 @@ install.pkgconfigdir = "$(DESTDIR)$(pkgconfigdir)"
$(install.bindir) $(install.libdir) $(install.includedir) $(install.pkgconfigdir):
$(INSTALL) -d $@
#XX## libtool compile/link/install
#XX#TCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(TCC) $(TCOMPILE_EXTRAS)
#XX#TLINK = $(LIBTOOL) --mode=link $(TCC) $(TCOMPILE_EXTRAS) @LDFLAGS@ $(TLINK_EXTRAS)
#XX#LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
# TCOMPILE = generic target platform compiler invocation
TCOMPILE = $(TCC) $(TCOMPILE_EXTRAS)
# TLINK = compiler invocation for when the target will be an executable
@ -741,90 +741,83 @@ ST_OPT = -DSQLITE_OS_KV_OPTIONAL
# In wasi-sdk builds, remove the CLI shell build from 'all'.
@if HAVE_WASI_SDK
SQLITE3_SHELL_TARGET =
@else
SQLITE3_SHELL_TARGET = sqlite3$(TEXE)
@endif
@if HAVE_TCL
libtclsqlite3.SO = libtclsqlite3$(TDLL)
@else
libtclsqlite3.SO =
@endif
target_sqlite3_shell_1 =
target_sqlite3_shell_0 = sqlite3$(TEXE)
target_sqlite3_shell = $(target_sqlite3_shell_$(HAVE_WASI_SDK))
#
# This is the default Makefile target. The objects listed here
# are what get build when you type just "make" with no arguments.
#
all: sqlite3.h sqlite3.c shell.c $(SQLITE3_SHELL_TARGET)
all: sqlite3.h sqlite3.c shell.c $(target_sqlite3_shell)
# Re-run $(TOP)/configure with the same args invoked to produce this
# makefile.
#
AUTOREMAKE = @SQLITE_AUTOREMAKE@
AS_AUTOREMAKE = @SQLITE_AUTOREMAKE@
Makefile: $(TOP)/Makefile.in $(AS_AUTO_DEF)
$(AUTOREMAKE)
$(AS_AUTOREMAKE)
@touch $@
sqlite3.pc: $(TOP)/sqlite3.pc.in $(AS_AUTO_DEF)
$(AUTOREMAKE)
$(AS_AUTOREMAKE)
@touch $@
install-pc: sqlite3.pc $(install.pkgconfigdir)
$(INSTALL_noexec) sqlite3.pc $(install.pkgconfigdir)
install: install-pc
sqlite_cfg.h: $(TOP)/sqlite_cfg.h.in $(AS_AUTO_DEF)
$(AUTOREMAKE)
$(AS_AUTOREMAKE)
@touch $@
libsqlite3.SO = libsqlite3$(TDLL)
libsqlite3.LIB = libsqlite3$(TLIB)
# LDFLAGS_libsqlite3 should be used with any target which either
# results in building libsqlite3.so, compiles sqlite3.c directly, or
# links in either of $(LIBOBJSO) or $(LIBOBJS1). Note that these
# flags are for the target build platform, not necessarily localhost.
# i.e. it should be used with $(TCC) or $(TLINK) but not $(BCC).
LDFLAGS_libsqlite3 = \
$(LDFLAGS_RPATH) @LIBS@ $(LIBS) $(LDFLAGS_PTHREAD) \
$(LDFLAGS_MATH) $(LDFLAGS_ZLIB)
@if ENABLE_SHARED
$(libsqlite3.SO): $(LIBOBJ)
$(TLINK_shared) -o $@ \
$(LIBOBJ) $(TLIBS) $(LDFLAGS_libsqlite3)
so: $(libsqlite3.SO)
all: so
@else
$(libsqlite3.SO):
@echo "Build of $@ was explicitly disabled."; exit 1
@endif
$(libsqlite3.LIB): $(LIBOBJ)
$(AR) crs $@ $(LIBOBJ)
lib: $(libsqlite3.LIB)
all: lib
# Install the $(libsqlite3.SO) as $(libsqlite3.SO).@RELEASE@ and
# LDFLAGS_libsqlite3 should be used with any target which either
# results in building libsqlite3.so, compiles sqlite3.c directly, or
# links in either of $(LIBOBJSO) or $(LIBOBJS1). Note that these
# flags are for the target build platform, not necessarily localhost.
# i.e. it should be used with $(TCC) or $(TLINK) but not $(BCC).
LDFLAGS_libsqlite3 = \
$(LDFLAGS_RPATH) $(TLIBS) $(LDFLAGS_PTHREAD) \
$(LDFLAGS_MATH) $(LDFLAGS_ZLIB)
libsqlite3.SO = libsqlite3$(TDLL)
target_libsqlite3_so_0 =
target_libsqlite3_so_1 = $(libsqlite3.SO)
target_libsqlite3_so = $(target_libsqlite3_so_$(ENABLE_SHARED))
$(libsqlite3.SO): $(LIBOBJ)
@if [ "x1" != "x$(ENABLE_SHARED)" ]; then echo "Shared lib build is disabled." 1>&2; exit 1; fi
$(TLINK_shared) -o $@ \
$(LIBOBJ) $(TLIBS) $(LDFLAGS_libsqlite3)
so: $(target_libsqlite3_so)
all: so
# Install the $(libsqlite3.SO) as $(libsqlite3.SO).$(RELEASE) and
# create symlinks which point to it. Do we really need all of this
# hoop-jumping? Can we not simply install the .so as-is to
# libsqlite3.so (without the versioned bits)?
#
# The historical SQLite build always used a version number of 0.8.6
# for reasons lost to history.
# for reasons lost to history but having something to do with libtool
# (which is not longer used in this tree).
#
install-so: $(install.libdir) $(libsqlite3.SO)
$(INSTALL) $(libsqlite3.SO) $(install.libdir)
install-so-1: $(install.libdir) $(libsqlite3.SO)
$(INSTALL) $(libsqlite3.SO) $(install.libdir); \
cd $(install.libdir); \
rm -f $(libsqlite3.SO).3 $(libsqlite3.SO).@RELEASE@; \
mv $(libsqlite3.SO) $(libsqlite3.SO).@RELEASE@; \
ln -s $(libsqlite3.SO).@RELEASE@ $(libsqlite3.SO).3; \
rm -f $(libsqlite3.SO).3 $(libsqlite3.SO).$(RELEASE); \
mv $(libsqlite3.SO) $(libsqlite3.SO).$(RELEASE); \
ln -s $(libsqlite3.SO).$(RELEASE) $(libsqlite3.SO).3; \
ln -s $(libsqlite3.SO).3 $(libsqlite3.SO)
@if ENABLE_SHARED
install: install-so
@endif
install-so-0:
install: install-so-$(ENABLE_SHARED)
# Install $(libsqlite3.LIB)
#
@ -838,26 +831,31 @@ install-includes: sqlite3.h $(install.includedir)
$(INSTALL_noexec) sqlite3.h "$(TOP)/src/sqlite3ext.h" $(install.includedir)
install: install-includes
@if HAVE_TCL
# libtclsqlite3...
#
libtclsqlite3.SO = libtclsqlite3$(TDLL)
target_libtclsqlite3_1 = $(libtclsqlite3.SO)
target_libtclsqlite3_0 =
target_libtclsqlite3 = $(target_libtclsqlite3_$(HAVE_TCL))
$(libtclsqlite3.SO): tclsqlite.o $(libsqlite3.LIB)
$(TLINK_shared) -o $@ tclsqlite.o \
$(TCL_INCLUDE_SPEC) $(TCL_STUB_LIB_SPEC) $(LDFLAGS_libsqlite3) \
$(libsqlite3.LIB) @TCLLIB_RPATH@
libtcl: $(libtclsqlite3.SO)
$(libsqlite3.LIB) $(TCLLIB_RPATH)
all: $(libtclsqlite3.SO)
libtcl: $(target_libtclsqlite3)
all: $(target_libtclsqlite3)
pkgIndex.tcl:
echo 'package ifneeded sqlite3 $(RELEASE) [list load [file join $$dir libtclsqlite3[info sharedlibextension]] sqlite3]' > $@
@if TCLLIBDIR
install.tcldir = "$(DESTDIR)@TCLLIBDIR@"
install-tcl: install-lib $(libtclsqlite3.SO) pkgIndex.tcl
install.tcldir = "$(DESTDIR)$(TCLLIBDIR)"
install-tcl: install-lib $(target_libtclsqlite3) pkgIndex.tcl
@if [ "x$(DESTDIR)" = "x$(install.tcldir)" ]; then echo "TCLLIBDIR is not set." 1>&2; exit 1; fi
$(INSTALL) -d $(install.tcldir)
$(INSTALL) $(libtclsqlite3.SO) $(install.tcldir)
$(INSTALL_noexec) pkgIndex.tcl $(install.tcldir)
install: install-tcl
@endif
tclsqlite3.c: sqlite3.c
echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c
@ -892,21 +890,15 @@ tclextension-uninstall:
tclextension-list:
$(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --info
# end of @if HAVE_TCL
@endif
sqlite3$(TEXE): shell.c sqlite3.c
$(TCC) $(CFLAGS_readline) $(SHELL_OPT) -o $@ \
shell.c sqlite3.c \
$(LDFLAGS_libsqlite3) $(LDFLAGS_READLINE)
cli: sqlite3$(TEXE)
@if !HAVE_WASI_SDK
all: cli
@endif
install-cli: sqlite3$(TEXT) $(install.bindir)
install-cli-0: sqlite3$(TEXT) $(install.bindir)
$(INSTALL) -s sqlite3$(TEXT) $(install.bindir)
install: install-cli
install-cli-1:
install: install-cli-$(HAVE_WASI_SDK)
sqldiff$(TEXE): $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h sqlite3.o sqlite3.h
$(TLINK) $(CFLAGS_stdio3) -o $@ $(TOP)/tool/sqldiff.c sqlite3.o $(LDFLAGS_libsqlite3)
@ -1045,11 +1037,10 @@ has_tclsh85:
touch has_tclsh85
has_tclconfig:
@if !TCL_CONFIG_SH
@echo 'ERROR: Requires access to "tclConfig.sh" which "configure" was not able to locate'; exit 1;
@else
@if [ x = "x$(TCL_CONFIG_SH)" ]; then
echo 'TCL_CONFIG_SH must be set to point to a "tclConfig.sh"' 1>&2; exit 1; \
fi
touch has_tclconfig
@endif
#
# This target creates a directory named "tsrc" and fills it with
@ -1819,13 +1810,12 @@ sqlite3.dll: $(LIBOBJ) sqlite3.def
#
# Fiddle app
#
@if 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
@else
fiddle:
@echo "Configure script did not find emcc, so fiddle build is not available." 2>&1; exit 1
@endif
#
# Spell-checking for source comments

View File

@ -82,8 +82,7 @@ define RELEASE $RELEASE
puts "RELEASE = $RELEASE"
puts "VERSION = $VERSION"
define SQLITE_AUTOREMAKE cd
define-append SQLITE_AUTOREMAKE $autosetup(srcdir) && $top_srcdir/configure {*}$autosetup(argv)
define-append SQLITE_AUTOREMAKE cd $autosetup(srcdir) && $top_srcdir/configure {*}$autosetup(argv)
set outOfTreeBuild 0
if {![file exists sqlite3.pc.in]} {
@ -188,9 +187,14 @@ if {"" eq [hwaci-bin-define install]} {
msg-result "Cannot find install binary, so 'make install' will not work."
# Reminder: we historically have ./install-sh in the source tree.
# Can we not simply use that?
#
# define BIN_INSTALL "$top_srcdir/install-sh"
# Nope: it MOVES its source files over the target, which
# break the installation in some cases.
#
# Nope: it MOVES its source files over the target, which breaks the
# installation in some cases. It's easy to hack to copy instead of
# mv (simply replace the instcmd=... bit) but that won't retain the
# source timestamp and permissions unless we use cp's -p flag, which
# may not be portable enough.
}
@ -222,6 +226,7 @@ define BUILD_CFLAGS [get-env CFLAGS {-g}]
#
# It's unclear whether we can actually get away with making these
# changes to the autosetup environment.
define HAVE_WASI_SDK 0
if {1} {
set wasiSdkDir [opt-val with-wasi-sdk] ; # ??? [lindex [opt-val with-wasi-sdk] end]
#puts "x wasiSdkDir=$wasiSdkDir foo=[lindex [opt-val with-wasi-sdk] end]"
@ -319,7 +324,7 @@ msg-checking "Debug build? "
hwaci-if-opt-truthy with-debug {
define SQLITE_DEBUG 1
define TARGET_DEBUG {-DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0 -Wall}
define TARGET_DEBUG {-g -DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0 -Wall}
msg-result yes
} {
define TARGET_DEBUG {-DNDEBUG}
@ -848,6 +853,11 @@ if {0 && "" ne [get-define CFLAGS_JIMSH]} {
define-append CFLAGS_JIMSH -DHAVE_LONG_LONG; # SQLite relies on long long, so we know it's available
}; # JimTCL
if {"" eq [get-define CFLAGS_JIMSH]} {
define USE_OWN_JIMSH 0
} else {
define USE_OWN_JIMSH 1
}
########################################################################
# Determine proper rpath-handling flags

1163
main.mk

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
C Generic\sbuild\scleanups.
D 2024-10-19T16:58:17.870
C Factor\sout\sall\sautosetup-processed\s@if/@else\sblocks\sfrom\sMakefile.in\sin\sprep\sfor\smoving\smost\sof\sthe\smakefile\scode\sinto\smain.mk\s(which\shas,\sso\sfar,\sbeen\scompletely\soverlooked\sin\sthis\sport\sbut\swill\snow\sbecome\sthe\smain\sbasis\sfor\sthe\sstatic\sparts\sof\sthe\sbuild).\sThe\sidea\sis\sthat\sall\sbuild\sconfiguration\sgoes\sinto\sa\splatform-dependent\smakefile\swhich\sthen\sincludes\smain.mk.
D 2024-10-19T18:31:47.423
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F Makefile.in b9de6145692620a3176e9a0e6a1317a049d6bf2559896f642ae9fdc6aba3a627
F Makefile.in 799e30c5ea3622e4909e2befa455bfa4e90ec214cb06a714c469897da3166b9e
F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6
F Makefile.msc 58b69eda1faad5d475092b8aeffab9156ee4901a82db089b166607f2ec907ee4
F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159
@ -14,7 +14,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 c212e2066f75941113296d1120b3375388816eaee7f04e1342f0a8e82dec03fc
F auto.def 3ee0c65b809262dab45d3a92c8af29a584fe0799cbe65c545214cabc2191f1ff
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
@ -711,7 +711,7 @@ F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b5
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
F main.mk c6501abe2d915ed1a2ec3d074e652c096177f93c50ac91f815c831e3417f9019
F main.mk ea3f49474ea443c294ca75820839fb43db4a9f72cd4b14b895ddc9fa73a4e9b0
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
@ -2240,8 +2240,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 2923a8924c92f62d07cb130462a8e6f4662837bad1a02bda53e630b64c692f60
R e27a73e275f999d0b19f7fb9f885c617
P 510afccf02dc9c3e3b928c64c34d10bee66a2343ecec6e24c4770cb0f139cd65
R 7a8eadbb3ae7a887d98a01ebf4e8c64c
U stephan
Z 78428a8bc6db32b4f76584c8d3747578
Z 7236fe64030e3971014f63694120dff4
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
510afccf02dc9c3e3b928c64c34d10bee66a2343ecec6e24c4770cb0f139cd65
707e0f5857d58ec8b457270f988126b1dd0f01b5a3445a43ff7b5429324b1b3d