mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Add experimental esm target to ext/wasm/GNUmakefile to tell emcc to generate sqlite3.mjs (ES6 module) instead of sqlite3.js. Related to discussion at [forum:ed4596cf8496a39b].
FossilOrigin-Name: e55d8eba83012492d85418dc0faedce5896027ecc70295a5ca1826f61a5edbaf
This commit is contained in:
@ -96,7 +96,7 @@ dir.dout := $(dir.wasm)/jswasm
|
||||
# dir.tmp = output dir for intermediary build files, as opposed to
|
||||
# end-user deliverables.
|
||||
dir.tmp := $(dir.wasm)/bld
|
||||
#CLEAN_FILES += $(wildcard $(dir.dout)/*) $(wildcard $(dir.tmp)/*)
|
||||
CLEAN_FILES += $(dir.tmp)/* $(dir.dout)/*
|
||||
ifeq (,$(wildcard $(dir.dout)))
|
||||
dir._tmp := $(shell mkdir -p $(dir.dout))
|
||||
endif
|
||||
@ -418,7 +418,20 @@ emcc.jsflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT)
|
||||
# debugging info, _huge_.
|
||||
########################################################################
|
||||
|
||||
sqlite3.js := $(dir.dout)/sqlite3.js
|
||||
########################################################################
|
||||
# AN EXPERIMENT: undocumented Emscripten feature: if the target file
|
||||
# extension is "mjs", it defaults to ES6 module builds:
|
||||
# https://github.com/emscripten-core/emscripten/issues/14383
|
||||
ifeq (,$(filter esm,$(MAKECMDGOALS)))
|
||||
sqlite3.js.ext := js
|
||||
else
|
||||
esm.deps := $(filter-out esm,$(MAKECMDGOALS))
|
||||
esm: $(if $(esm.deps),$(esm.deps),all)
|
||||
sqlite3.js.ext := mjs
|
||||
endif
|
||||
# /esm
|
||||
########################################################################
|
||||
sqlite3.js := $(dir.dout)/sqlite3.$(sqlite3.js.ext)
|
||||
sqlite3.wasm := $(dir.dout)/sqlite3.wasm
|
||||
sqlite3-wasm.c := $(dir.api)/sqlite3-wasm.c
|
||||
# sqlite3-wasm.o vs sqlite3-wasm.c: building against the latter
|
||||
|
Reference in New Issue
Block a user