sqlite3.canonical.c := $(dir.top)/sqlite3.c
sqlite3.c ?= $(firstword $(wildcard $(dir.top)/sqlite3-see.c) $(sqlite3.canonical.c))
sqlite3.h := $(dir.top)/sqlite3.h
-ifeq (,$(shell grep sqlite3_activate_see $(sqlite3.c) 2>/dev/null))
- SQLITE_C_IS_SEE := 0
+
+########################################################################@
+# It's important that sqlite3.h be built to completion before any
+# other parts of the build run, thus we use .NOTPARALLEL to disable
+# parallel build of that file and its dependants.
+.NOTPARALLEL: $(sqlite3.h)
+$(sqlite3.h):
+ $(MAKE) -C $(dir.top) sqlite3.c
+$(sqlite3.c): $(sqlite3.h)
+
+########################################################################
+# .gen.make is generated by a shell script and holds certain parts
+# of the makefile, some of which are relatively expensive to calculate
+# on each run (that is, they can take a human-visible amount of time).
+#
+# Sidebar: three attempts have been made to move much of the
+# $(eval)-generated makefile code into make-make.sh but the result is
+# even less legible/maintainable than make-side $(eval).
+ifeq (0,$(MAKING_CLEAN))
+.gen.make: $(MAKEFILE) $(sqlite3.c)
+ rm -f $@
+ $(SHELL) make-make.sh $(sqlite3.c) > $@
+ chmod -w $@
+-include .gen.make
+endif
+
+ifeq (,$(filter release snapshot,$(MAKECMDGOALS)))
+ $(info Development build. Use 'release' or 'snapshot' target for a smaller release build.)
+endif
+
+########################################################################
- # minimal=1 disables all "extraneous" stuff from sqlite3-wasm.c, the
++# barebones=1 disables all "extraneous" stuff from sqlite3-wasm.c, the
+# goal being to create a WASM file with only the core APIs.
- ifeq (1,$(minimal))
++ifeq (1,$(barebones))
+ wasm-bare-bones := 1
else
- SQLITE_C_IS_SEE := 1
- $(info This is an SEE build.)
+ wasm-bare-bones := 0
endif
- undefine minimal
-# Most SQLITE_OPT flags are set in sqlite3-wasm.c but we need them
-# made explicit here for building speedtest1.c.
-SQLITE_OPT = \
- -DSQLITE_ENABLE_FTS5 \
- -DSQLITE_ENABLE_RTREE \
- -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
- -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION \
- -DSQLITE_ENABLE_STMTVTAB \
- -DSQLITE_ENABLE_DBPAGE_VTAB \
- -DSQLITE_ENABLE_DBSTAT_VTAB \
- -DSQLITE_ENABLE_BYTECODE_VTAB \
- -DSQLITE_ENABLE_OFFSET_SQL_FUNC \
- -DSQLITE_OMIT_LOAD_EXTENSION \
- -DSQLITE_OMIT_DEPRECATED \
- -DSQLITE_OMIT_UTF16 \
- -DSQLITE_OMIT_SHARED_CACHE \
++undefine barebones
+
+# Common options for building sqlite3-wasm.c and speedtest1.c.
+# Explicit ENABLEs...
+SQLITE_OPT.common := \
-DSQLITE_THREADSAFE=0 \
-DSQLITE_TEMP_STORE=2 \
+ -DSQLITE_ENABLE_MATH_FUNCTIONS \
-DSQLITE_OS_KV_OPTIONAL=1 \
'-DSQLITE_DEFAULT_UNIX_VFS="unix-none"' \
-DSQLITE_USE_URI=1 \
########################################################################
# EXPORTED_FUNCTIONS.* = files for use with Emscripten's
# -sEXPORTED_FUNCTION flag.
-EXPORTED_FUNCTIONS.api.core := $(abspath $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-core)
+EXPORTED_FUNCTIONS.api.core := $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-core
EXPORTED_FUNCTIONS.api.in := $(EXPORTED_FUNCTIONS.api.core)
ifeq (1,$(SQLITE_C_IS_SEE))
- EXPORTED_FUNCTIONS.api.in += $(abspath $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-see)
+ EXPORTED_FUNCTIONS.api.in += $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-see
endif
-ifeq (0,$(minimal))
- EXPORTED_FUNCTIONS.api.in += \
- $(abspath $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-auth) \
- $(abspath $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-preupdate) \
- $(abspath $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-session) \
- $(abspath $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-vtab)
+ifeq (0,$(wasm-bare-bones))
+ EXPORTED_FUNCTIONS.api.in += $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-extras
else
-- $(info ========================================)
- $(info This is a minimal-mode build. It is missing many features.)
- $(info This is a minimal-mode build)
-- $(info ========================================)
++ $(info ============================================================)
++ $(info This is a bare-bones build. It is missing many features.)
++ $(info ============================================================)
endif
EXPORTED_FUNCTIONS.api := $(dir.tmp)/EXPORTED_FUNCTIONS.api
$(EXPORTED_FUNCTIONS.api): $(EXPORTED_FUNCTIONS.api.in) $(sqlite3.c) $(MAKEFILE)
# painful.
.PHONY: o0 o1 o2 o3 os oz
--o-xtra :=
--#o-xtra ?= -flto
++emcc-opt-extra :=
++#ifeq (1,$(wasm-bare-bones))
++#emcc-opt-extra += -flto
# ^^^^ -flto can have a considerably performance boost at -O0 but
# doubles the build time and seems to have negligible, if any, effect
# on higher optimization levels.
++#
++# -flto does ont shrink the size of bare-bones builds by any measurable
++# amount.
++#endif
o0: clean
$(MAKE) -e "emcc_opt=-O0"
o1: clean
-- $(MAKE) -e "emcc_opt=-O1 $(o-xtra)"
++ $(MAKE) -e "emcc_opt=-O1 $(emcc-opt-extra)"
o2: clean
-- $(MAKE) -j2 -e "emcc_opt=-O2 $(o-xtra)"
++ $(MAKE) -j2 -e "emcc_opt=-O2 $(emcc-opt-extra)"
o3: clean
-- $(MAKE) -e "emcc_opt=-O3 $(o-xtra)"
++ $(MAKE) -e "emcc_opt=-O3 $(emcc-opt-extra)"
os: clean
@echo "WARNING: -Os can result in a build with mysteriously missing pieces!"
-- $(MAKE) -e "emcc_opt=-Os $(o-xtra)"
++ $(MAKE) -e "emcc_opt=-Os $(emcc-opt-extra)"
oz: clean
-- $(MAKE) -j2 -e "emcc_opt=-Oz $(o-xtra)"
++ $(MAKE) -j2 -e "emcc_opt=-Oz $(emcc-opt-extra)"
########################################################################
# Sub-makes...
- C Merge\scurrent\strunk\sinto\sthis\sbranch.
- D 2024-08-12T13:31:43.385
-C shell.c.in:\suse\seputz/oputz()\sinstead\sof\seputf/oputf()\swhere\sappropriate\sto\savoid\scompilation\serrors\sin\s-std=c99\smode\s(namely\swasm\sbuilds).
-D 2024-08-25T11:59:29.477
++C Merge\strunk\sinto\sthe\swasm-build-rework\sbranch.
++D 2024-08-25T12:04:05.623
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F ext/userauth/user-auth.txt ca7e9ee82ca4e1c1744295f8184dd70edfae1992865d26c64303f539eb6c084c
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
- F ext/wasm/GNUmakefile 1857ad71bfdc780019639f49dc054fee491b4ddba2669898b8acfd4ffba50030
-F ext/wasm/GNUmakefile d4f6586d9a36ee2869a8c7f77227a8b7f42b6c4623f3be594beafb1554ab20d9
++F ext/wasm/GNUmakefile 1bce318cef54073492b461bbad7d3d0ac5e535f48c514725222672925d9e79ff
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
F ext/wasm/README.md a8a2962c3aebdf8d2104a9102e336c5554e78fc6072746e5daf9c61514e7d193
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
- P 3be729493b76a8b51c19d81543dea2dcb1fc718f81d4f2d9c6e1381789217687 9c10664416274df6f8da53ddd86f6356c9704ad798fd4034d2784ae433c1c056
- R fa116f7277db9cf2640434f35cc3643d
-P df65d00f104f31741056686f2ba41ecb192c552012bffb17c2a8b5d4db058328
-R 8d4b348b6bf673b94cab6e107b5bbb73
++P 900a593ddf51eebddb70e2e9ab16abe4911f58f23e574e88ed340a919b8f16b6 9ef8317faebc29d016bdf2e8c678fb21ca2cfa95272f1f18b461fcaf0e220ac5
++R 18dc15cd32835420757efc0bd71059bc
U stephan
- Z b30383c3277b6bf2d3ab4856db5f4a76
-Z 5120e8419efd39e01384da30ed409ec4
++Z 7297c582dbef4ab4eafb733b4bb63970
# Remove this line to create a well-formed Fossil manifest.