1######################################################################## 2# This GNU makefile drives the build of the sqlite3 WASM 3# components. It is not part of the canonical build process. 4######################################################################## 5SHELL := $(shell which bash 2>/dev/null) 6MAKEFILE := $(lastword $(MAKEFILE_LIST)) 7all: 8release: all 9 10# Emscripten SDK home dir and related binaries... 11EMSDK_HOME ?= $(word 1,$(wildcard $(HOME)/src/emsdk $(HOME)/emsdk)) 12emcc.bin ?= $(word 1,$(wildcard $(shell which emcc) $(EMSDK_HOME)/upstream/emscripten/emcc)) 13ifeq (,$(emcc.bin)) 14 $(error Cannot find emcc.) 15endif 16 17wasm-strip ?= $(shell which wasm-strip 2>/dev/null) 18ifeq (,$(filter clean,$(MAKECMDGOALS))) 19ifeq (,$(wasm-strip)) 20 $(info WARNING: *******************************************************************) 21 $(info WARNING: builds using -O2/-O3/-Os/-Oz will minify WASM-exported names,) 22 $(info WARNING: breaking _All The Things_. The workaround for that is to build) 23 $(info WARNING: with -g3 (which explodes the file size) and then strip the debug) 24 $(info WARNING: info after compilation, using wasm-strip, to shrink the wasm file.) 25 $(info WARNING: wasm-strip was not found in the PATH so we cannot strip those.) 26 $(info WARNING: If this build uses any optimization level higher than -O1 then) 27 $(info WARNING: the ***resulting WASM binary WILL NOT BE USABLE***.) 28 $(info WARNING: wasm-strip is part of the wabt package:) 29 $(info WARNING: https://github.com/WebAssembly/wabt) 30 $(info WARNING: on Ubuntu-like systems it can be installed with:) 31 $(info WARNING: sudo apt install wabt) 32 $(info WARNING: *******************************************************************) 33endif 34endif # 'make clean' check 35 36ifeq (,$(wasm-strip)) 37 maybe-wasm-strip = echo "not wasm-stripping" 38else 39 maybe-wasm-strip = $(wasm-strip) 40endif 41 42dir.top := ../.. 43# Reminder: some Emscripten flags require absolute paths 44dir.wasm := $(patsubst %/,%,$(dir $(abspath $(MAKEFILE)))) 45dir.api := api 46dir.jacc := jaccwabyt 47dir.common := common 48dir.fiddle := fiddle 49CLEAN_FILES := *~ $(dir.jacc)/*~ $(dir.api)/*~ $(dir.common)/*~ 50emcc_enable_bigint ?= 1 51sqlite3.c := $(dir.top)/sqlite3.c 52SQLITE_OPT = \ 53 -DSQLITE_ENABLE_FTS4 \ 54 -DSQLITE_ENABLE_RTREE \ 55 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ 56 -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION \ 57 -DSQLITE_ENABLE_STMTVTAB \ 58 -DSQLITE_ENABLE_DBPAGE_VTAB \ 59 -DSQLITE_ENABLE_DBSTAT_VTAB \ 60 -DSQLITE_ENABLE_BYTECODE_VTAB \ 61 -DSQLITE_ENABLE_OFFSET_SQL_FUNC \ 62 -DSQLITE_OMIT_LOAD_EXTENSION \ 63 -DSQLITE_OMIT_DEPRECATED \ 64 -DSQLITE_OMIT_UTF16 \ 65 -DSQLITE_OMIT_SHARED_CACHE \ 66 -DSQLITE_OMIT_WAL \ 67 -DSQLITE_THREADSAFE=0 \ 68 -DSQLITE_TEMP_STORE=3 \ 69 -DSQLITE_OS_KV_OPTIONAL=1 \ 70 '-DSQLITE_DEFAULT_UNIX_VFS="unix-none"' \ 71 -DSQLITE_USE_URI=1 72#SQLITE_OPT += -DSQLITE_ENABLE_MEMSYS5 73# ^^^ MEMSYS5 is hypothetically useful for non-Emscripten builds but 74# requires adding more infrastructure and fixing one spot in the 75# sqlite3 internals which calls malloc() early on. 76 77# SQLITE_OMIT_LOAD_EXTENSION: if this is true, sqlite3_vfs::xDlOpen 78# and friends may be NULL. 79 80ifneq (,$(filter release,$(MAKECMDGOALS))) 81emcc_opt ?= -Oz -flto 82else 83emcc_opt ?= -O0 84# ^^^^ build times for -O levels higher than 0 are painful at 85# dev-time. 86endif 87# When passing emcc_opt from the CLI, += and re-assignment have no 88# effect, so emcc_opt+=-g3 doesn't work. So... 89emcc_opt_full := $(emcc_opt) -g3 90# ^^^ ALWAYS use -g3. See below for why. 91# 92# ^^^ -flto improves runtime speed at -O0 considerably but doubles 93# build time. 94# 95# ^^^^ -O3, -Oz, -Os minify symbol names and there appears to be no 96# way around that except to use -g3, but -g3 causes the binary file 97# size to absolutely explode (approx. 5x larger). This minification 98# utterly breaks the resulting module, making it unsable except as 99# self-contained/self-referential-only code, as ALL of the exported 100# symbols get minified names. 101# 102# However, we have an option for using -Oz or -Os: 103# 104# Build with (-Os -g3) or (-Oz -g3) then use wasm-strip, from the wabt 105# tools package (https://github.com/WebAssembly/wabt), to strip the 106# debugging symbols. That results in a small build with unmangled 107# symbol names. -Oz gives ever-so-slightly better compression than 108# -Os: not quite 1% in some completely unscientific tests. Runtime 109# speed for the unit tests is all over the place either way so it's 110# difficult to say whether -Os gives any speed benefit over -Oz. 111# 112# (Much later: -O2 consistently gives the best speeds.) 113######################################################################## 114 115 116$(sqlite3.c): 117 $(MAKE) -C $(dir.top) sqlite3.c 118 119clean: 120 -rm -f $(CLEAN_FILES) 121 122ifeq (release,$(filter release,$(MAKECMDGOALS))) 123 ifeq (,$(wasm-strip)) 124 $(error Cannot make release-quality binary because wasm-strip is not available. \ 125 See notes in the warning above) 126 endif 127else 128 $(info Development build. Use '$(MAKE) release' for a smaller release build.) 129endif 130 131EXPORTED_FUNCTIONS.api.in := $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-api \ 132 $(dir.jacc)/jaccwabyt_test.exports 133 134EXPORTED_FUNCTIONS.api: $(EXPORTED_FUNCTIONS.api.in) $(MAKEFILE) 135 cat $(EXPORTED_FUNCTIONS.api.in) > $@ 136CLEAN_FILES += EXPORTED_FUNCTIONS.api 137 138sqlite3-api.jses := $(dir.api)/sqlite3-api-prologue.js 139sqlite3-api.jses += $(dir.common)/whwasmutil.js 140sqlite3-api.jses += $(dir.jacc)/jaccwabyt.js 141sqlite3-api.jses += $(dir.api)/sqlite3-api-glue.js 142sqlite3-api.jses += $(dir.api)/sqlite3-api-oo1.js 143sqlite3-api.jses += $(dir.api)/sqlite3-api-worker1.js 144sqlite3-api.jses += $(dir.api)/sqlite3-api-opfs.js 145sqlite3-api.jses += $(dir.api)/sqlite3-api-cleanup.js 146 147sqlite3-api.js := sqlite3-api.js 148CLEAN_FILES += $(sqlite3-api.js) 149$(sqlite3-api.js): $(sqlite3-api.jses) $(MAKEFILE) 150 @echo "Making $@..." 151 @for i in $(sqlite3-api.jses); do \ 152 echo "/* BEGIN FILE: $$i */"; \ 153 cat $$i; \ 154 echo "/* END FILE: $$i */"; \ 155 done > $@ 156 157######################################################################## 158# --post-js and --pre-js are emcc flags we use to append/prepend JS to 159# the generated emscripten module file. 160pre-js.js := $(dir.api)/pre-js.js 161post-js.js := post-js.js 162CLEAN_FILES += $(post-js.js) 163post-jses := \ 164 $(dir.api)/post-js-header.js \ 165 $(sqlite3-api.js) \ 166 $(dir.api)/post-js-footer.js 167$(post-js.js): $(post-jses) $(MAKEFILE) 168 @echo "Making $@..." 169 @for i in $(post-jses); do \ 170 echo "/* BEGIN FILE: $$i */"; \ 171 cat $$i; \ 172 echo "/* END FILE: $$i */"; \ 173 done > $@ 174extern-post-js.js := $(dir.api)/extern-post-js.js 175extern-pre-js.js := $(dir.api)/extern-pre-js.js 176pre-post-common.flags := \ 177 --post-js=$(post-js.js) \ 178 --extern-post-js=$(extern-post-js.js) \ 179 --extern-pre-js=$(extern-pre-js.js) 180pre-post-jses.deps := $(post-js.js) \ 181 $(extern-post-js.js) $(extern-pre-js.js) 182######################################################################## 183# call-make-pre-js creates rules for pre-js-$(1).js. $1 = the base 184# name of the JS file on whose behalf this pre-js is for. 185define call-make-pre-js 186pre-post-$(1).flags ?= 187pre-js-$(1).js: $$(pre-js.js) $$(MAKEFILE) 188 cp $$(pre-js.js) $$@ 189 echo "Module[xInstantiateWasm].uri = '$(1).wasm';" >> $$@ 190CLEAN_FILES += pre-js-$(1).js 191pre-post-$(1).deps := $$(pre-post-jses.deps) pre-js-$(1).js 192pre-post-$(1).flags += --pre-js=pre-js-$(1).js 193endef 194#$(error $(call call-make-pre-js,sqlite3-wasmfs)) 195# /post-js and pre-js 196######################################################################## 197 198######################################################################## 199# emcc flags for .c/.o/.wasm/.js. 200emcc.flags = 201#emcc.flags += -v # _very_ loud but also informative about what it's doing 202# -g is needed to keep -O2 and higher from creating broken JS via 203# minification. 204 205######################################################################## 206# emcc flags for .c/.o. 207emcc.cflags := 208emcc.cflags += -std=c99 -fPIC 209# -------------^^^^^^^^ we currently need c99 for WASM-specific sqlite3 APIs. 210emcc.cflags += -I. -I$(dir.top) 211 212######################################################################## 213# emcc flags specific to building the final .js/.wasm file... 214emcc.jsflags := -fPIC 215emcc.jsflags += --minify 0 216emcc.jsflags += --no-entry 217emcc.jsflags += -sMODULARIZE 218emcc.jsflags += -sSTRICT_JS 219emcc.jsflags += -sDYNAMIC_EXECUTION=0 220emcc.jsflags += -sNO_POLYFILL 221emcc.jsflags += -sEXPORTED_FUNCTIONS=@$(dir.wasm)/EXPORTED_FUNCTIONS.api 222emcc.exportedRuntimeMethods := \ 223 -sEXPORTED_RUNTIME_METHODS=FS,wasmMemory,allocateUTF8OnStack 224 # FS ==> stdio/POSIX I/O proxies 225 # wasmMemory ==> required by our code for use with -sIMPORTED_MEMORY 226 # allocateUTF8OnStack => for kvvfs internals 227emcc.jsflags += $(emcc.exportedRuntimeMethods) 228emcc.jsflags += -sUSE_CLOSURE_COMPILER=0 229emcc.jsflags += -sIMPORTED_MEMORY 230emcc.environment := -sENVIRONMENT=web,worker 231emcc.jsflags += -sALLOW_MEMORY_GROWTH 232# emcc: warning: USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code 233# slowly, see https://github.com/WebAssembly/design/issues/1271 234# [-Wpthreads-mem-growth] 235emcc.jsflags += -sINITIAL_MEMORY=13107200 236#emcc.jsflags += -sINITIAL_MEMORY=64225280 237# ^^^^ 64MB is not enough for WASMFS/OPFS test runs using batch-runner.js 238emcc.jsflags += $(emcc.environment) 239#emcc.jsflags += -sTOTAL_STACK=4194304 240 241sqlite3.js.init-func := sqlite3InitModule 242# ^^^^ $(sqlite3.js.init-func) symbol name is hard-coded in $(extern-post-js.js) 243 244emcc.jsflags += -sEXPORT_NAME=$(sqlite3.js.init-func) 245emcc.jsflags += -sGLOBAL_BASE=4096 # HYPOTHETICALLY keep func table indexes from overlapping w/ heap addr. 246#emcc.jsflags += -sSTRICT # fails due to missing __syscall_...() 247#emcc.jsflags += -sALLOW_UNIMPLEMENTED_SYSCALLS 248#emcc.jsflags += -sFILESYSTEM=0 # only for experimentation. sqlite3 needs the FS API 249#emcc.jsflags += -sABORTING_MALLOC 250emcc.jsflags += -sALLOW_TABLE_GROWTH 251emcc.jsflags += -Wno-limited-postlink-optimizations 252# ^^^^^ it likes to warn when we have "limited optimizations" via the -g3 flag. 253#emcc.jsflags += -sSTANDALONE_WASM # causes OOM errors, not sure why 254# https://lld.llvm.org/WebAssembly.html 255emcc.jsflags += -sERROR_ON_UNDEFINED_SYMBOLS=0 256emcc.jsflags += -sLLD_REPORT_UNDEFINED 257#emcc.jsflags += --allow-undefined 258emcc.jsflags += --import-undefined 259#emcc.jsflags += --unresolved-symbols=import-dynamic --experimental-pic 260#emcc.jsflags += --experimental-pic --unresolved-symbols=ingore-all --import-undefined 261#emcc.jsflags += --unresolved-symbols=ignore-all 262emcc.jsflags += -sWASM_BIGINT=$(emcc_enable_bigint) 263# ^^^^ MEMORY64=1 fails to load, erroring with: 264# invalid memory limits flags 0x5 265# (enable via --experimental-wasm-memory64) 266# 267# ^^^^ MEMORY64=2 builds and loads but dies when we do things like: 268# 269# new Uint8Array(heapWrappers().HEAP8U.buffer, ptr, n) 270# 271# because ptr is now a BigInt, so is invalid for passing to arguments 272# which have strict must-be-a-Number requirements. 273######################################################################## 274 275 276######################################################################## 277# -sSINGLE_FILE: 278# https://github.com/emscripten-core/emscripten/blob/main/src/settings.js#L1704 279# -sSINGLE_FILE=1 would be really nice but we have to build with -g 280# for -O2 and higher to work (else minification breaks the code) and 281# cannot wasm-strip the binary before it gets encoded into the JS 282# file. The result is that the generated JS file is, because of the -g 283# debugging info, _huge_. 284######################################################################## 285 286######################################################################## 287# Maintenance reminder: the output .js and .wasm files of emcc must be 288# in _this_ dir, rather than a subdir, or else parts of the generated 289# code get confused and cannot load property (namely, the 290# sqlite3.worker.js generated in conjunction with -sWASMFS). 291sqlite3.js := sqlite3.js 292sqlite3.wasm := sqlite3.wasm 293sqlite3-wasm.o := $(dir.api)/sqlite3-wasm.o 294$(sqlite3-wasm.o): emcc.cflags += $(SQLITE_OPT) 295$(sqlite3-wasm.o): $(dir.top)/sqlite3.c 296sqlite3-wasm.c := $(dir.api)/sqlite3-wasm.c 297jaccwabyt_test.c := $(dir.jacc)/jaccwabyt_test.c 298# ^^^ FIXME (how?): jaccwabyt_test.c is only needed for the test apps, 299# so we don't really want to include it in release builds. However, we 300# want to test the release builds with those apps, so we cannot simply 301# elide that file in release builds. That component is critical to the 302# VFS bindings so needs to be tested along with the core APIs. 303######################################################################## 304# call-wasm-c-compile sets up build rules 305# for $1.o. $1 must be the name of a C file (with extension). 306define call-wasm-c-compile 307$(1).o := $$(subst .c,.o,$(1)) 308sqlite3.wasm.obj += $$($(1).o) 309$$($(1).o): $$(MAKEFILE) $(1) 310 $$(emcc.bin) $$(emcc_opt_full) $$(emcc.flags) $$(emcc.cflags) -c $(1) -o $$@ 311CLEAN_FILES += $$($(1).o) 312endef 313$(foreach c,$(sqlite3-wasm.c) $(jaccwabyt_test.c),$(eval $(call call-wasm-c-compile,$(c)))) 314$(eval $(call call-make-pre-js,sqlite3)) 315$(sqlite3.js): $(MAKEFILE) $(sqlite3.wasm.obj) \ 316 EXPORTED_FUNCTIONS.api \ 317 $(pre-post-sqlite3.deps) 318 @echo "Building $@ ..." 319 $(emcc.bin) -o $@ $(emcc_opt_full) $(emcc.flags) \ 320 $(emcc.jsflags) $(pre-post-common.flags) $(pre-post-sqlite3.flags) \ 321 $(sqlite3.wasm.obj) 322 chmod -x $(sqlite3.wasm) 323 $(maybe-wasm-strip) $(sqlite3.wasm) 324 @ls -la $@ $(sqlite3.wasm) 325 326CLEAN_FILES += $(sqlite3.js) $(sqlite3.wasm) 327all: $(sqlite3.js) 328wasm: $(sqlite3.js) 329# End main Emscripten-based module build 330######################################################################## 331 332######################################################################## 333# batch-runner.js... 334dir.sql := sql 335speedtest1 := ../../speedtest1 336speedtest1.c := ../../test/speedtest1.c 337speedtest1.sql := $(dir.sql)/speedtest1.sql 338speedtest1.cliflags := --size 25 --big-transactions 339$(speedtest1): 340 $(MAKE) -C ../.. speedtest1 341$(speedtest1.sql): $(speedtest1) $(MAKEFILE) 342 $(speedtest1) $(speedtest1.cliflags) --script $@ 343batch-runner.list: $(MAKEFILE) $(speedtest1.sql) $(dir.sql)/000-mandelbrot.sql 344 bash split-speedtest1-script.sh $(dir.sql)/speedtest1.sql 345 ls -1 $(dir.sql)/*.sql | grep -v speedtest1.sql | sort > $@ 346clean-batch: 347 rm -f batch-runner.list $(dir.sql)/speedtest1*.sql 348# ^^^ we don't do this along with 'clean' because we clean/rebuild on 349# a regular basis with different -Ox flags and rebuilding the batch 350# pieces each time is an unnecessary time sink. 351batch: batch-runner.list 352all: batch 353# end batch-runner.js 354######################################################################## 355# speedtest1.js... 356# speedtest1-common.eflags = emcc flags used by multiple builds of speedtest1 357# speedtest1.eflags = emcc flags used by main build of speedtest1 358speedtest1-common.eflags := $(emcc_opt_full) 359speedtest1.eflags := 360speedtest1.eflags += -sENVIRONMENT=web 361speedtest1-common.eflags += -sINVOKE_RUN=0 362speedtest1-common.eflags += --no-entry 363#speedtest1-common.eflags += -flto 364speedtest1-common.eflags += -sABORTING_MALLOC 365speedtest1-common.eflags += -sINITIAL_MEMORY=128450560 366speedtest1-common.eflags += -sSTRICT_JS 367speedtest1-common.eflags += -sMODULARIZE 368speedtest1-common.eflags += -Wno-limited-postlink-optimizations 369speedtest1-common.eflags += -sEXPORTED_FUNCTIONS=@$(dir.wasm)/EXPORTED_FUNCTIONS.speedtest1 370speedtest1-common.eflags += $(emcc.exportedRuntimeMethods) 371speedtest1-common.eflags += -sALLOW_TABLE_GROWTH 372speedtest1-common.eflags += -sDYNAMIC_EXECUTION=0 373speedtest1-common.eflags += --minify 0 374speedtest1-common.eflags += -sEXPORT_NAME=$(sqlite3.js.init-func) 375speedtest1-common.eflags += -sWASM_BIGINT=$(emcc_enable_bigint) 376speedtest1-common.eflags += $(pre-post-common.flags) 377speedtest1.exit-runtime0 := -sEXIT_RUNTIME=0 378speedtest1.exit-runtime1 := -sEXIT_RUNTIME=1 379# Re -sEXIT_RUNTIME=1 vs 0: if it's 1 and speedtest1 crashes, we get 380# this error from emscripten: 381# 382# > native function `free` called after runtime exit (use 383# NO_EXIT_RUNTIME to keep it alive after main() exits)) 384# 385# If it's 0 and it crashes, we get: 386# 387# > stdio streams had content in them that was not flushed. you should 388# set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline 389# when you printf etc. 390# 391# and pending output is not flushed because it didn't end with a 392# newline (by design). The lesser of the two evils seems to be 393# -sEXIT_RUNTIME=1 but we need EXIT_RUNTIME=0 for the worker-based app 394# which runs speedtest1 multiple times. 395 396EXPORTED_FUNCTIONS.speedtest1: EXPORTED_FUNCTIONS.api 397 { echo _wasm_main; cat EXPORTED_FUNCTIONS.api; } > $@ 398CLEAN_FILES += EXPORTED_FUNCTIONS.speedtest1 399speedtest1.js := speedtest1.js 400speedtest1.wasm := $(subst .js,.wasm,$(speedtest1.js)) 401speedtest1.cflags := \ 402 -I. -I.. -I$(dir.top) \ 403 -DSQLITE_SPEEDTEST1_WASM 404speedtest1.cs := $(speedtest1.c) $(sqlite3-wasm.c) $(jaccwabyt_test.c) 405$(speedtest1.js): emcc.cflags+= 406# speedtest1 notes re. sqlite3-wasm.o vs sqlite3-wasm.c: building against 407# the latter (predictably) results in a slightly faster binary, but we're 408# close enough to the target speed requirements that the 500ms makes a 409# difference. 410$(eval $(call call-make-pre-js,speedtest1)) 411$(speedtest1.js): $(MAKEFILE) $(speedtest1.cs) \ 412 $(pre-post-speedtest1.deps) \ 413 EXPORTED_FUNCTIONS.speedtest1 414 @echo "Building $@ ..." 415 $(emcc.bin) \ 416 $(speedtest1.eflags) $(speedtest1-common.eflags) $(speedtest1.cflags) \ 417 $(pre-post-speedtest1.flags) \ 418 $(SQLITE_OPT) \ 419 $(speedtest1.exit-runtime0) \ 420 -o $@ $(speedtest1.cs) -lm 421 $(maybe-wasm-strip) $(speedtest1.wasm) 422 ls -la $@ $(speedtest1.wasm) 423 424speedtest1: $(speedtest1.js) 425all: speedtest1 426CLEAN_FILES += $(speedtest1.js) $(speedtest1.wasm) 427# end speedtest1.js 428######################################################################## 429 430######################################################################## 431# fiddle_remote is the remote destination for the fiddle app. It 432# must be a [user@]HOST:/path for rsync. 433# Note that the target "should probably" contain a symlink of 434# index.html -> fiddle.html. 435fiddle_remote ?= 436ifeq (,$(fiddle_remote)) 437ifneq (,$(wildcard /home/stephan)) 438 fiddle_remote = wh:www/wh/sqlite3/. 439else ifneq (,$(wildcard /home/drh)) 440 #fiddle_remote = if appropriate, add that user@host:/path here 441endif 442endif 443$(fiddle_files): default 444push-fiddle: $(fiddle_files) 445 @if [ x = "x$(fiddle_remote)" ]; then \ 446 echo "fiddle_remote must be a [user@]HOST:/path for rsync"; \ 447 exit 1; \ 448 fi 449 rsync -va fiddle/ $(fiddle_remote) 450# end fiddle remote push 451######################################################################## 452 453######################################################################## 454# Convenience rules to rebuild with various -Ox levels. Much 455# experimentation shows -O2 to be the clear winner in terms of speed. 456# Note that build times with anything higher than -O0 are somewhat 457# painful. 458 459.PHONY: o0 o1 o2 o3 os oz 460o-xtra := -g3 461# ^^^ -g3 is important to keep higher -O levels from mangling (via 462# minification), or outright removing, otherwise working code. 463 464o-xtra += -flto 465# ^^^^ -flto can have a considerably performance boost at -O0 but 466# doubles the build time and seems to have negligible effect on 467# higher optimization levels. 468o0: clean 469 $(MAKE) -e "emcc_opt=-O0 $(o-xtra)" 470o1: clean 471 $(MAKE) -e "emcc_opt=-O1 $(o-xtra)" 472o2: clean 473 $(MAKE) -e "emcc_opt=-O2 $(o-xtra)" 474o3: clean 475 $(MAKE) -e "emcc_opt=-O3 $(o-xtra)" 476os: clean 477 @echo "WARNING: -Os can result in a build with mysteriously missing pieces!" 478 $(MAKE) -e "emcc_opt=-Os $(o-xtra)" 479oz: clean 480 $(MAKE) -e "emcc_opt=-Oz $(o-xtra)" 481 482######################################################################## 483# Sub-makes... 484 485include fiddle.make 486 487######################################################################## 488# Some platforms do not support the WASMFS build. Raspberry Pi OS is one 489# of them. As such platforms are discovered, add their (uname -m) name 490# to PLATFORMS_WITH_NO_WASMFS to exclude the wasmfs build parts. 491PLATFORMS_WITH_NO_WASMFS := aarch64 # add any others here 492THIS_ARCH := $(shell /usr/bin/uname -m) 493ifneq (,$(filter $(THIS_ARCH),$(PLATFORMS_WITH_NO_WASMFS))) 494$(info This platform does not support the WASMFS build.) 495else 496include wasmfs.make 497endif 498 499######################################################################## 500# Push files to public wasm-testing.sqlite.org server 501wasm-testing.include = *.wasm *.js *.html \ 502 batch-runner.list sql common fiddle jaccwabyt 503wasm-testing.exclude = sql/speedtest1.sql 504wasm-testing.dir = /jail/sites/wasm-testing 505wasm-testing.dest ?= wasm-testing:$(wasm-testing.dir) 506# ---------------------^^^^^^^^^^^^ ssh alias 507push: 508 rsync -z -e ssh --ignore-times --chown=stephan:www-data --group -r \ 509 $(patsubst %,--exclude=%,$(wasm-testing.exclude)) \ 510 $(wasm-testing.include) $(wasm-testing.dest) 511 ssh wasm-testing 'cd $(wasm-testing.dir) && bash .gzip' || \ 512 echo "SSH failed: it's likely that stale content will be served via old gzip files." 513 514