mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Update wasmfs.make to get WASMFS building again, but changes made to OPFS-over-WASMFS since we last tested it have made it incompatible with how we used it. It can now only be used from worker threads, eliminating the one benefit it had over the sqlite3_vfs OPFS implementation. Remove/amend references to WASMFS in the docs and remove all WASMFS-specific test app links from index.html.
FossilOrigin-Name: 32dc98c8001387b1970623192ec6cb89445000fa49bda5f4bd7c525bbe20bb5b
This commit is contained in:
@ -599,20 +599,26 @@ $(sqlite3.mjs): $(pre-post-sqlite3.deps.esm)
|
||||
# Upstream RFE:
|
||||
# https://github.com/emscripten-core/emscripten/issues/18237
|
||||
########################################################################
|
||||
# SQLITE3.xJS.EXPORT-DEFAULT is part of SQLITE3[-WASMFS].xJS.RECIPE,
|
||||
# factored into a separate piece to avoid code duplication. $1 is
|
||||
# the build mode: one of (vanilla, esm).
|
||||
define SQLITE3.xJS.ESM-EXPORT-DEFAULT
|
||||
if [ esm = $(1) ]; then \
|
||||
echo "Fragile workaround for an Emscripten annoyance. See SQLITE3.xJS.RECIPE."; \
|
||||
sed -i -e '0,/^export default/{/^export default/d}' $@ || exit $$?; \
|
||||
if ! grep -q '^export default' $@; then \
|
||||
echo "Cannot find export default." 1>&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi
|
||||
endef
|
||||
define SQLITE3.xJS.RECIPE
|
||||
@echo "Building $@ ..."
|
||||
$(emcc.bin) -o $@ $(emcc_opt_full) $(emcc.flags) \
|
||||
$(emcc.jsflags) \
|
||||
$(pre-post-sqlite3.flags.$(1)) $(emcc.flags.sqlite3.$(1)) \
|
||||
$(cflags.common) $(SQLITE_OPT) $(sqlite3-wasm.c)
|
||||
@if [ esm = $(1) ]; then \
|
||||
echo "Fragile workaround for an Emscripten annoyance. See emcc.flags.sqlite3.esm."; \
|
||||
sed -i -e '0,/^export default/{/^export default/d}' $@ || exit $$?; \
|
||||
if ! grep -q '^export default' $@; then \
|
||||
echo "Cannot find export default." 1>&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi
|
||||
@$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,$(1))
|
||||
chmod -x $(sqlite3.wasm)
|
||||
$(maybe-wasm-strip) $(sqlite3.wasm)
|
||||
@ls -la $@ $(sqlite3.wasm)
|
||||
@ -665,29 +671,29 @@ all: batch
|
||||
########################################################################
|
||||
# Wasmified speedtest1 is our primary benchmarking tool.
|
||||
#
|
||||
# speedtest1.eflags.common = emcc flags used by multiple builds of speedtest1
|
||||
# speedtest1.eflags = emcc flags used by main build of speedtest1
|
||||
speedtest1.eflags.common := $(emcc_opt_full)
|
||||
speedtest1.eflags :=
|
||||
speedtest1.eflags += -sENVIRONMENT=web
|
||||
speedtest1.eflags += -sALLOW_MEMORY_GROWTH
|
||||
speedtest1.eflags += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.$(emcc.INITIAL_MEMORY))
|
||||
speedtest1.eflags.common += -sINVOKE_RUN=0
|
||||
speedtest1.eflags.common += --no-entry
|
||||
#speedtest1.eflags.common += -flto
|
||||
speedtest1.eflags.common += -sABORTING_MALLOC
|
||||
speedtest1.eflags.common += -sSTRICT_JS
|
||||
speedtest1.eflags.common += -sMODULARIZE
|
||||
speedtest1.eflags.common += -Wno-limited-postlink-optimizations
|
||||
# emcc.speedtest1.common = emcc flags used by multiple builds of speedtest1
|
||||
# emcc.speedtest1 = emcc flags used by main build of speedtest1
|
||||
emcc.speedtest1.common := $(emcc_opt_full)
|
||||
emcc.speedtest1 :=
|
||||
emcc.speedtest1 += -sENVIRONMENT=web
|
||||
emcc.speedtest1 += -sALLOW_MEMORY_GROWTH
|
||||
emcc.speedtest1 += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.$(emcc.INITIAL_MEMORY))
|
||||
emcc.speedtest1.common += -sINVOKE_RUN=0
|
||||
emcc.speedtest1.common += --no-entry
|
||||
#emcc.speedtest1.common += -flto
|
||||
emcc.speedtest1.common += -sABORTING_MALLOC
|
||||
emcc.speedtest1.common += -sSTRICT_JS
|
||||
emcc.speedtest1.common += -sMODULARIZE
|
||||
emcc.speedtest1.common += -Wno-limited-postlink-optimizations
|
||||
EXPORTED_FUNCTIONS.speedtest1 := $(abspath $(dir.tmp)/EXPORTED_FUNCTIONS.speedtest1)
|
||||
speedtest1.eflags.common += -sSTACK_SIZE=512KB
|
||||
speedtest1.eflags.common += -sEXPORTED_FUNCTIONS=@$(EXPORTED_FUNCTIONS.speedtest1)
|
||||
speedtest1.eflags.common += $(emcc.exportedRuntimeMethods)
|
||||
speedtest1.eflags.common += -sALLOW_TABLE_GROWTH
|
||||
speedtest1.eflags.common += -sDYNAMIC_EXECUTION=0
|
||||
speedtest1.eflags.common += --minify 0
|
||||
speedtest1.eflags.common += -sEXPORT_NAME=$(sqlite3.js.init-func)
|
||||
speedtest1.eflags.common += -sWASM_BIGINT=$(emcc.WASM_BIGINT)
|
||||
emcc.speedtest1.common += -sSTACK_SIZE=512KB
|
||||
emcc.speedtest1.common += -sEXPORTED_FUNCTIONS=@$(EXPORTED_FUNCTIONS.speedtest1)
|
||||
emcc.speedtest1.common += $(emcc.exportedRuntimeMethods)
|
||||
emcc.speedtest1.common += -sALLOW_TABLE_GROWTH
|
||||
emcc.speedtest1.common += -sDYNAMIC_EXECUTION=0
|
||||
emcc.speedtest1.common += --minify 0
|
||||
emcc.speedtest1.common += -sEXPORT_NAME=$(sqlite3.js.init-func)
|
||||
emcc.speedtest1.common += -sWASM_BIGINT=$(emcc.WASM_BIGINT)
|
||||
speedtest1.exit-runtime0 := -sEXIT_RUNTIME=0
|
||||
speedtest1.exit-runtime1 := -sEXIT_RUNTIME=1
|
||||
# Re -sEXIT_RUNTIME=1 vs 0: if it's 1 and speedtest1 crashes, we get
|
||||
@ -712,7 +718,7 @@ $(EXPORTED_FUNCTIONS.speedtest1): $(EXPORTED_FUNCTIONS.api)
|
||||
@{ echo _wasm_main; cat $(EXPORTED_FUNCTIONS.api); } > $@
|
||||
speedtest1.js := $(dir.dout)/speedtest1.js
|
||||
speedtest1.wasm := $(dir.dout)/speedtest1.wasm
|
||||
speedtest1.cflags := $(cflags.common) -DSQLITE_SPEEDTEST1_WASM
|
||||
cflags.speedtest1 := $(cflags.common) -DSQLITE_SPEEDTEST1_WASM
|
||||
speedtest1.cses := $(speedtest1.c) $(sqlite3-wasm.c)
|
||||
$(eval $(call call-make-pre-js,speedtest1,vanilla))
|
||||
$(speedtest1.js): $(MAKEFILE) $(speedtest1.cses) \
|
||||
@ -720,8 +726,8 @@ $(speedtest1.js): $(MAKEFILE) $(speedtest1.cses) \
|
||||
$(EXPORTED_FUNCTIONS.speedtest1)
|
||||
@echo "Building $@ ..."
|
||||
$(emcc.bin) \
|
||||
$(speedtest1.eflags) $(speedtest1.eflags.common) \
|
||||
$(speedtest1.cflags) $(pre-post-speedtest1.flags.vanilla) \
|
||||
$(emcc.speedtest1) $(emcc.speedtest1.common) \
|
||||
$(cflags.speedtest1) $(pre-post-speedtest1.flags.vanilla) \
|
||||
$(SQLITE_OPT) \
|
||||
$(speedtest1.exit-runtime0) \
|
||||
-o $@ $(speedtest1.cses) -lm
|
||||
|
@ -79,13 +79,9 @@
|
||||
the `realloc(3)`-compatible routine for the WASM
|
||||
environment. Defaults to `"sqlite3_realloc"`.
|
||||
|
||||
- `wasmfsOpfsDir`[^1]: if the environment supports persistent
|
||||
storage using OPFS-over-WASMFS , this directory names the "mount
|
||||
point" for that directory. It must be prefixed by `/` and may
|
||||
contain only a single directory-name part. Using the root
|
||||
directory name is not supported by any current persistent
|
||||
backend. This setting is only used in WASMFS-enabled builds.
|
||||
|
||||
- `wasmfsOpfsDir`[^1]: As of 2022-12-17, this feature does not
|
||||
currently work due to incompatible Emscripten-side changes made
|
||||
in the WASMFS+OPFS combination. This option is currently ignored.
|
||||
|
||||
[^1] = This property may optionally be a function, in which case this
|
||||
function re-assigns it to the value returned from that function,
|
||||
@ -138,6 +134,10 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
config[k] = config[k]();
|
||||
}
|
||||
});
|
||||
config.wasmOpfsDir =
|
||||
/* 2022-12-17: WASMFS+OPFS can no longer be activated from the
|
||||
main thread (aborts via a failed assert() if it's attempted),
|
||||
which eliminates any(?) benefit to supporting it. */ false;
|
||||
|
||||
/**
|
||||
The main sqlite3 binding API gets installed into this object,
|
||||
@ -1050,6 +1050,13 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
/** State for sqlite3_wasmfs_opfs_dir(). */
|
||||
let __wasmfsOpfsDir = undefined;
|
||||
/**
|
||||
2022-12-17: incompatible WASMFS changes have made WASMFS+OPFS
|
||||
unavailable from the main thread, which eliminates the most
|
||||
significant benefit of supporting WASMFS. This function is now a
|
||||
no-op which always returns a falsy value. Before that change,
|
||||
this function behaved as documented below (and how it will again
|
||||
if we can find a compelling reason to support it).
|
||||
|
||||
If the wasm environment has a WASMFS/OPFS-backed persistent
|
||||
storage directory, its path is returned by this function. If it
|
||||
does not then it returns "" (noting that "" is a falsy value).
|
||||
@ -1066,6 +1073,8 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
if(undefined !== __wasmfsOpfsDir) return __wasmfsOpfsDir;
|
||||
// If we have no OPFS, there is no persistent dir
|
||||
const pdir = config.wasmfsOpfsDir;
|
||||
console.error("sqlite3_wasmfs_opfs_dir() can no longer work due "+
|
||||
"to incompatible WASMFS changes. It will be removed.");
|
||||
if(!pdir
|
||||
|| !self.FileSystemHandle
|
||||
|| !self.FileSystemDirectoryHandle
|
||||
|
@ -86,8 +86,6 @@
|
||||
<li>speedtest1 ports (sqlite3's primary benchmarking tool)...
|
||||
<ul>
|
||||
<li><a href='speedtest1.html'>speedtest1</a>: a main-thread WASM build of speedtest1.</li>
|
||||
<!--li><a href='speedtest1-wasmfs.html?flags=--size,25'>speedtest1-wasmfs</a>: a variant of speedtest1 built solely for the wasmfs/opfs feature.
|
||||
</li-->
|
||||
<li><a href='speedtest1.html?vfs=kvvfs'>speedtest1?vfs=kvvfs</a>: speedtest1 with the kvvfs.</li>
|
||||
<li><a href='speedtest1-worker.html?size=25'>speedtest1-worker</a>: an interactive Worker-thread variant of speedtest1.</li>
|
||||
<li><a href='speedtest1-worker.html?vfs=opfs&size=25'>speedtest1-worker?vfs=opfs</a>: speedtest1-worker with the
|
||||
@ -100,10 +98,6 @@
|
||||
a high-level overview of the symbols exposed by the JS
|
||||
module.</li>
|
||||
<li><a href='batch-runner.html'>batch-runner</a>: runs batches of SQL exported from speedtest1.</li>
|
||||
<!--li><a href='scratchpad-wasmfs-main.html'>scratchpad-wasmfs-main</a>:
|
||||
experimenting with WASMFS/OPFS-based persistence. Maintenance
|
||||
reminder: we cannot currently (2022-09-15) load WASMFS in a
|
||||
worker due to an Emscripten limitation.</li-->
|
||||
<li><a href='test-opfs-vfs.html'>test-opfs-vfs</a>
|
||||
(<a href='test-opfs-vfs.html?opfs-sanity-check&opfs-verbose'>same
|
||||
with verbose output and sanity-checking tests</a>) is an
|
||||
@ -117,6 +111,18 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<!--li>WASMFS-specific tests which currently do not work due to incompatible changes
|
||||
made to the WASMFS+OPFS combination.
|
||||
<ul>
|
||||
<li><a href='speedtest1-wasmfs.html?flags=--size,25'>speedtest1-wasmfs</a>:
|
||||
a variant of speedtest1 built solely for the wasmfs/opfs
|
||||
feature.</li>
|
||||
<li><a href='scratchpad-wasmfs-main.html'>scratchpad-wasmfs-main</a>:
|
||||
experimenting with WASMFS/OPFS-based persistence. Maintenance
|
||||
reminder: we cannot currently (2022-09-15) load WASMFS in a
|
||||
worker due to an Emscripten wasm loader limitation.</li>
|
||||
</ul>
|
||||
</li-->
|
||||
<!--li><a href='x.html'></a></li-->
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -92,8 +92,9 @@
|
||||
|
||||
const runTests = function(sqlite3){
|
||||
console.log("Module inited.");
|
||||
const wasm = sqlite3.capi.wasm;
|
||||
const unlink = wasm.xWrap("sqlite3_wasm_vfs_unlink", "int", ["string"]);
|
||||
const wasm = sqlite3.wasm;
|
||||
const __unlink = wasm.xWrap("sqlite3_wasm_vfs_unlink", "int", ["*","string"]);
|
||||
const unlink = (fn)=>__unlink(0,fn);
|
||||
const pDir = wasmfsDir(wasm);
|
||||
if(pDir) log2('',"Persistent storage:",pDir);
|
||||
else{
|
||||
|
@ -15,101 +15,117 @@ MAKEFILE.wasmfs := $(lastword $(MAKEFILE_LIST))
|
||||
# Worker to an Emscripten quirk regarding loading nested Workers.
|
||||
dir.wasmfs := $(dir.wasm)
|
||||
sqlite3-wasmfs.js := $(dir.wasmfs)/sqlite3-wasmfs.js
|
||||
sqlite3-wasmfs.mjs := $(dir.wasmfs)/sqlite3-wasmfs.mjs
|
||||
sqlite3-wasmfs.wasm := $(dir.wasmfs)/sqlite3-wasmfs.wasm
|
||||
|
||||
CLEAN_FILES += $(sqlite3-wasmfs.js) $(sqlite3-wasmfs.wasm) \
|
||||
$(subst .js,.worker.js,$(sqlite3-wasmfs.js))
|
||||
$(subst .js,.worker.js,$(sqlite3-wasmfs.js)) \
|
||||
$(sqlite3-wasmfs.mjs) \
|
||||
$(subst .mjs,.worker.mjs,$(sqlite3-wasmfs.mjs))
|
||||
|
||||
########################################################################
|
||||
# emcc flags for .c/.o.
|
||||
sqlite3-wasmfs.cflags :=
|
||||
sqlite3-wasmfs.cflags += -std=c99 -fPIC
|
||||
sqlite3-wasmfs.cflags += -pthread
|
||||
sqlite3-wasmfs.cflags += $(cflags.common)
|
||||
sqlite3-wasmfs.cflags += $(SQLITE_OPT) -DSQLITE_ENABLE_WASMFS
|
||||
cflags.sqlite3-wasmfs :=
|
||||
cflags.sqlite3-wasmfs += -std=c99 -fPIC
|
||||
cflags.sqlite3-wasmfs += -pthread
|
||||
cflags.sqlite3-wasmfs += $(cflags.speedtest1)
|
||||
cflags.sqlite3-wasmfs += $(SQLITE_OPT) -DSQLITE_ENABLE_WASMFS
|
||||
|
||||
########################################################################
|
||||
# emcc flags specific to building the final .js/.wasm file...
|
||||
sqlite3-wasmfs.jsflags := -fPIC
|
||||
sqlite3-wasmfs.jsflags += --no-entry
|
||||
sqlite3-wasmfs.jsflags += --minify 0
|
||||
sqlite3-wasmfs.jsflags += -sMODULARIZE
|
||||
sqlite3-wasmfs.jsflags += -sSTRICT_JS
|
||||
sqlite3-wasmfs.jsflags += -sDYNAMIC_EXECUTION=0
|
||||
sqlite3-wasmfs.jsflags += -sNO_POLYFILL
|
||||
sqlite3-wasmfs.jsflags += -sEXPORTED_FUNCTIONS=@$(abspath $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-api)
|
||||
sqlite3-wasmfs.jsflags += -sEXPORTED_RUNTIME_METHODS=FS,wasmMemory,allocateUTF8OnStack
|
||||
# wasmMemory ==> for -sIMPORTED_MEMORY
|
||||
# allocateUTF8OnStack ==> wasmfs internals
|
||||
sqlite3-wasmfs.jsflags += -sUSE_CLOSURE_COMPILER=0
|
||||
sqlite3-wasmfs.jsflags += -sIMPORTED_MEMORY
|
||||
#sqlite3-wasmfs.jsflags += -sINITIAL_MEMORY=13107200
|
||||
sqlite3-wasmfs.jsflags += -sSTACK_SIZE=1MB
|
||||
sqlite3-wasmfs.jsflags += -sEXPORT_NAME=$(sqlite3.js.init-func)
|
||||
sqlite3-wasmfs.jsflags += -sGLOBAL_BASE=4096 # HYPOTHETICALLY keep func table indexes from overlapping w/ heap addr.
|
||||
#sqlite3-wasmfs.jsflags += -sFILESYSTEM=0 # only for experimentation. sqlite3 needs the FS API
|
||||
# Perhaps the wasmfs build doesn't?
|
||||
#sqlite3-wasmfs.jsflags += -sABORTING_MALLOC
|
||||
sqlite3-wasmfs.jsflags += -sALLOW_TABLE_GROWTH
|
||||
sqlite3-wasmfs.jsflags += -Wno-limited-postlink-optimizations
|
||||
emcc.flags.sqlite3-wasmfs := -fPIC
|
||||
emcc.flags.sqlite3-wasmfs += --no-entry
|
||||
emcc.flags.sqlite3-wasmfs += --minify 0
|
||||
emcc.flags.sqlite3-wasmfs += -sMODULARIZE
|
||||
emcc.flags.sqlite3-wasmfs += -sEXPORT_NAME=$(sqlite3.js.init-func)
|
||||
emcc.flags.sqlite3-wasmfs += -sSTRICT_JS
|
||||
emcc.flags.sqlite3-wasmfs += -sDYNAMIC_EXECUTION=0
|
||||
emcc.flags.sqlite3-wasmfs += -sNO_POLYFILL
|
||||
emcc.flags.sqlite3-wasmfs += -sWASM_BIGINT=$(emcc.WASM_BIGINT)
|
||||
emcc.flags.sqlite3-wasmfs += -sEXPORTED_FUNCTIONS=@$(abspath $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-api)
|
||||
emcc.flags.sqlite3-wasmfs += -sEXPORTED_RUNTIME_METHODS=FS,wasmMemory,allocateUTF8OnStack
|
||||
# wasmMemory ==> for -sIMPORTED_MEMORY
|
||||
# allocateUTF8OnStack ==> wasmfs internals
|
||||
emcc.flags.sqlite3-wasmfs += -sUSE_CLOSURE_COMPILER=0
|
||||
emcc.flags.sqlite3-wasmfs += -Wno-limited-postlink-optimizations
|
||||
# ^^^^^ it likes to warn when we have "limited optimizations" via the -g3 flag.
|
||||
sqlite3-wasmfs.jsflags += -sERROR_ON_UNDEFINED_SYMBOLS=0
|
||||
sqlite3-wasmfs.jsflags += -sLLD_REPORT_UNDEFINED
|
||||
#sqlite3-wasmfs.jsflags += --import-undefined
|
||||
sqlite3-wasmfs.jsflags += -sMEMORY64=0
|
||||
sqlite3-wasmfs.jsflags += -sINITIAL_MEMORY=128450560
|
||||
emcc.flags.sqlite3-wasmfs += -sALLOW_TABLE_GROWTH
|
||||
emcc.flags.sqlite3-wasmfs += -sSTACK_SIZE=512KB
|
||||
emcc.flags.sqlite3-wasmfs += -sGLOBAL_BASE=4096 # HYPOTHETICALLY keep func table indexes from overlapping w/ heap addr.
|
||||
emcc.flags.sqlite3-wasmfs += -sMEMORY64=0
|
||||
emcc.flags.sqlite3-wasmfs += -sIMPORTED_MEMORY
|
||||
emcc.flags.sqlite3-wasmfs += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.128)
|
||||
# ^^^^ 64MB is not enough for WASMFS/OPFS test runs using batch-runner.js
|
||||
sqlite3-wasmfs.fsflags := -pthread -sWASMFS -sPTHREAD_POOL_SIZE=2 -sENVIRONMENT=web,worker
|
||||
# -sPTHREAD_POOL_SIZE values of 2 or higher trigger that bug.
|
||||
sqlite3-wasmfs.jsflags += $(sqlite3-wasmfs.fsflags)
|
||||
#sqlite3-wasmfs.jsflags += -sALLOW_MEMORY_GROWTH
|
||||
sqlite3-wasmfs.fsflags := -pthread -sWASMFS \
|
||||
-sPTHREAD_POOL_SIZE=2 -sENVIRONMENT=web,worker \
|
||||
-sERROR_ON_UNDEFINED_SYMBOLS=0 -sLLD_REPORT_UNDEFINED
|
||||
# ^^^^^ why undefined symbols are necessary for the wasmfs build is anyone's guess.
|
||||
emcc.flags.sqlite3-wasmfs += $(sqlite3-wasmfs.fsflags)
|
||||
#emcc.flags.sqlite3-wasmfs += -sALLOW_MEMORY_GROWTH
|
||||
#^^^ using ALLOW_MEMORY_GROWTH produces a warning from emcc:
|
||||
# USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code slowly,
|
||||
# see https://github.com/WebAssembly/design/issues/1271 [-Wpthreads-mem-growth]
|
||||
sqlite3-wasmfs.jsflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT)
|
||||
# And, indeed, it runs slowly if memory is permitted to grow.
|
||||
emcc.flags.sqlite3-wasmfs.vanilla :=
|
||||
emcc.flags.sqlite3-wasmfs.esm := -sEXPORT_ES6 -sUSE_ES6_IMPORT_META
|
||||
$(eval $(call call-make-pre-js,sqlite3-wasmfs,vanilla))
|
||||
sqlite3-wasmfs.jsflags += \
|
||||
$(eval $(call call-make-pre-js,sqlite3-wasmfs,esm))
|
||||
Xemcc.flags.sqlite3-wasmfs.vanilla += \
|
||||
$(pre-post-common.flags.vanilla) \
|
||||
$(pre-post-sqlite3-wasmfs.flags.vanilla)
|
||||
$(sqlite3-wasmfs.js): $(sqlite3-wasm.c) \
|
||||
$(EXPORTED_FUNCTIONS.api) $(MAKEFILE) $(MAKEFILE.wasmfs) \
|
||||
$(pre-post-sqlite3-wasmfs.deps.vanilla)
|
||||
Xemcc.flags.sqlite3-wasmfs.esm += \
|
||||
$(pre-post-common.flags.esm) \
|
||||
$(pre-post-sqlite3-wasmfs.flags.esm)
|
||||
$(sqlite3-wasmfs.js) $(sqlite3-wasmfs.mjs): $(sqlite3-wasm.c) \
|
||||
$(EXPORTED_FUNCTIONS.api) $(MAKEFILE) $(MAKEFILE.wasmfs)
|
||||
$(sqlite3-wasmfs.js): $(pre-post-sqlite3-wasmfs.deps.vanilla)
|
||||
$(sqlite3-wasmfs.mjs): $(pre-post-sqlite3-wasmfs.deps.esm)
|
||||
# SQLITE3-WASMFS.xJS.RECIPE is the wasmfs-specific counterpart
|
||||
# of SQLITE3.xJS.RECIPE from the main makefile.
|
||||
define SQLITE3-WASMFS.xJS.RECIPE
|
||||
@echo "Building $@ ..."
|
||||
$(emcc.bin) -o $@ $(emcc_opt_full) $(emcc.flags) \
|
||||
$(sqlite3-wasmfs.cflags) $(sqlite3-wasmfs.jsflags) \
|
||||
$(pre-post-sqlite3-wasm.flags.vanilla) \
|
||||
$(cflags.sqlite3-wasmfs) \
|
||||
$(emcc.flags.sqlite3-wasmfs) $(emcc.flags.sqlite3-wasmfs.$(1)) \
|
||||
$(pre-post-sqlite3-wasmfs.flags.$(1)) \
|
||||
$(sqlite3-wasm.c)
|
||||
@$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,$(1))
|
||||
chmod -x $(sqlite3-wasmfs.wasm)
|
||||
$(maybe-wasm-strip) $(sqlite3-wasmfs.wasm)
|
||||
@ls -la $@ $(sqlite3-wasmfs.wasm)
|
||||
@ls -la $(sqlite3-wasmfs.wasm) sqlite3-wasmfs*js
|
||||
endef
|
||||
$(sqlite3-wasmfs.js):
|
||||
$(call SQLITE3-WASMFS.xJS.RECIPE,vanilla)
|
||||
$(sqlite3-wasmfs.mjs): $(sqlite3-wasmfs.js)
|
||||
$(call SQLITE3-WASMFS.xJS.RECIPE,esm)
|
||||
$(sqlite3-wasmfs.wasm): $(sqlite3-wasmfs.js)
|
||||
wasmfs: $(sqlite3-wasmfs.js)
|
||||
all: wasmfs
|
||||
wasmfs: $(sqlite3-wasmfs.js) $(sqlite3-wasmfs.mjs)
|
||||
#all: wasmfs
|
||||
|
||||
########################################################################
|
||||
# speedtest1 for wasmfs.
|
||||
speedtest1-wasmfs.js := $(dir.wasmfs)/speedtest1-wasmfs.js
|
||||
speedtest1-wasmfs.wasm := $(subst .js,.wasm,$(speedtest1-wasmfs.js))
|
||||
speedtest1-wasmfs.eflags := $(sqlite3-wasmfs.fsflags)
|
||||
speedtest1-wasmfs.eflags += $(SQLITE_OPT) -DSQLITE_ENABLE_WASMFS
|
||||
speedtest1-wasmfs.eflags += -sALLOW_MEMORY_GROWTH=0
|
||||
speedtest1-wasmfs.eflags += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.128)
|
||||
$(eval $(call call-make-pre-js,speedtest1-wasmfs))
|
||||
emcc.flags.speedtest1-wasmfs := $(sqlite3-wasmfs.fsflags)
|
||||
emcc.flags.speedtest1-wasmfs += $(SQLITE_OPT) -DSQLITE_ENABLE_WASMFS
|
||||
emcc.flags.speedtest1-wasmfs += -sALLOW_MEMORY_GROWTH=0
|
||||
emcc.flags.speedtest1-wasmfs += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.128)
|
||||
#$(eval $(call call-make-pre-js,speedtest1-wasmfs,vanilla))
|
||||
$(speedtest1-wasmfs.js): $(speedtest1.cses) $(sqlite3-wasmfs.js) \
|
||||
$(MAKEFILE) $(MAKEFILE.wasmfs) \
|
||||
$(pre-post-speedtest1-wasmfs.deps) \
|
||||
$(pre-post-sqlite3-wasmfs.deps) \
|
||||
$(EXPORTED_FUNCTIONS.speedtest1)
|
||||
@echo "Building $@ ..."
|
||||
$(emcc.bin) \
|
||||
$(speedtest1-wasmfs.eflags) $(speedtest1.eflags.common) \
|
||||
$(pre-post-speedtest1-wasmfs.flags) \
|
||||
$(speedtest1.cflags) \
|
||||
$(sqlite3-wasmfs.cflags) \
|
||||
$(emcc.speedtest1.common) $(emcc.flags.speedtest1-wasmfs) \
|
||||
$(pre-post-sqlite3-wasmfs.flags.vanilla) \
|
||||
$(cflags.sqlite3-wasmfs) \
|
||||
-o $@ $(speedtest1.cses) -lm
|
||||
$(maybe-wasm-strip) $(speedtest1-wasmfs.wasm)
|
||||
ls -la $@ $(speedtest1-wasmfs.wasm)
|
||||
|
||||
speedtest1: $(speedtest1-wasmfs.js)
|
||||
#speedtest1: $(speedtest1-wasmfs.js)
|
||||
wasmfs: $(speedtest1-wasmfs.js)
|
||||
CLEAN_FILES += $(speedtest1-wasmfs.js) $(speedtest1-wasmfs.wasm) \
|
||||
$(subst .js,.worker.js,$(speedtest1-wasmfs.js))
|
||||
# end speedtest1.js
|
||||
|
Reference in New Issue
Block a user