mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Remove some now-dead makefile code, rename a var for consistency, and fix a recipe bug introduced in the previous checkin in the bundler-friendly build.
FossilOrigin-Name: 0acd4ef3addb311476f4a670be0c4c4a0f3f88b0420886d4c1c3c3027dd51d73
This commit is contained in:
@ -4,17 +4,12 @@ bin.emcc = @EMCC_WRAPPER@
|
||||
bin.wasm-strip = @BIN_WASM_STRIP@
|
||||
bin.wasm-opt = @BIN_WASM_OPT@
|
||||
|
||||
ifeq (,$(bin.wasm-opt))
|
||||
# wasm-opt is an optional optimization step. We install a dummy
|
||||
# command in its place if it's not available to simplify the make
|
||||
# recipes which use it.
|
||||
#bin.wasm-opt = echo "[not wasm-opt]"
|
||||
endif
|
||||
SHELL := $(bin.bash)
|
||||
|
||||
# The following overrides can be activated to test
|
||||
# various validation in GNUmakefile:
|
||||
# The following overrides can be uncommented to test various
|
||||
# validation and if/else branches the makefile code:
|
||||
#
|
||||
#bin.bash :=
|
||||
#bin.emcc :=
|
||||
#bin.wasm-strip :=
|
||||
#bin.wasm-opt :=
|
||||
|
@ -69,7 +69,7 @@ static void mk_prologue(void){
|
||||
** name) through $(bin.wasm-opt) */
|
||||
ps("ifeq (,$(bin.wasm-opt))");
|
||||
ps("define SQLITE.CALL.WASM-OPT");
|
||||
ps("echo 'wasm-opt not available: $(1)'");
|
||||
ps("echo 'wasm-opt not available for $(1)'");
|
||||
ps("endef");
|
||||
ps("else");
|
||||
ps("define SQLITE.CALL.WASM-OPT");
|
||||
@ -211,7 +211,7 @@ static void mk_lib_mode(const char *zName /* build name */,
|
||||
const char *zJsOut /* name of generated sqlite3.js/.mjs */,
|
||||
const char *zCmppD /* extra -D flags for c-pp */,
|
||||
const char *zEmcc /* extra flags for emcc */){
|
||||
const char * zTgtWasmName = "$(basename $@).wasm"
|
||||
const char * zWasmOut = "$(basename $@).wasm"
|
||||
/* The various targets named X.js or X.mjs (zJsOut) also generate
|
||||
** X.wasm, and we need that part of the name to perform some
|
||||
** post-processing after Emscripten generates X.wasm. */;
|
||||
@ -260,12 +260,12 @@ static void mk_lib_mode(const char *zName /* build name */,
|
||||
0==strcmp("sqlite3-wasmfs", zName) ? 1 : 0);
|
||||
}
|
||||
pf("\t@chmod -x %s; \\\n"
|
||||
"\t$(maybe-wasm-strip) %s;\n",
|
||||
zTgtWasmName, zTgtWasmName);
|
||||
pf("\t@$(call SQLITE.CALL.WASM-OPT,%s)\n", zTgtWasmName);
|
||||
"\t\t$(maybe-wasm-strip) %s;\n",
|
||||
zWasmOut, zWasmOut);
|
||||
pf("\t@$(call SQLITE.CALL.WASM-OPT,%s)\n", zWasmOut);
|
||||
pf("\t@sed -i -e '/^var _sqlite3.*createExportWrapper/d' %s || exit; \\\n"
|
||||
/* ^^^^^^ reminder: Mac/BSD sed has no -i flag */
|
||||
"\techo 'Stripped out createExportWrapper() parts.'\n",
|
||||
"\t\techo 'Stripped out createExportWrapper() parts.'\n",
|
||||
zJsOut) /* Our JS code installs bindings of each WASM export. The
|
||||
generated Emscripten JS file does the same using its
|
||||
own framework, but we don't use those results and can
|
||||
@ -273,20 +273,23 @@ static void mk_lib_mode(const char *zName /* build name */,
|
||||
considerably, by stripping them out. */;
|
||||
/*
|
||||
** The above $(bin.emcc) call will write zJsOut and will create a
|
||||
** like-named .wasm file. That .wasm file name gets hard-coded into
|
||||
** zJsOut so we need to, for some cases, patch zJsOut to use the
|
||||
** name sqlite3.wasm instead. Note that the resulting .wasm file is
|
||||
** identical for all builds for which zEmcc is empty.
|
||||
** like-named .wasm file (zWasmOut). That .wasm file name gets
|
||||
** hard-coded into zJsOut so we need to, for some cases, patch
|
||||
** zJsOut to use the name sqlite3.wasm instead. Note that the
|
||||
** resulting .wasm file is identical for all builds for which zEmcc
|
||||
** is empty.
|
||||
*/
|
||||
if( 0==strcmp("bundler-friendly", zMode)
|
||||
|| 0==strcmp("node", zMode) ){
|
||||
pf("\t@echo 'Patching $@ for %s.wasm...'; \\\n", zName);
|
||||
pf("\trm -f %s; \\\n", zTgtWasmName);
|
||||
pf("\tsed -i -e 's/%s-%s.wasm/%s.wasm/g' $@ || exit;\n",
|
||||
pf("\t\trm -f %s; \\\n", zWasmOut);
|
||||
pf("\t\tsed -i -e 's/%s-%s.wasm/%s.wasm/g' $@ || exit;\n",
|
||||
/* ^^^^^^ reminder: Mac/BSD sed has no -i flag */
|
||||
zNM, zName);
|
||||
pf("\t@ls -la $@\n");
|
||||
}else{
|
||||
pf("\t@ls -la %s $@\n", zWasmOut);
|
||||
}
|
||||
pf("\t@ls -la %s $@\n", zTgtWasmName);
|
||||
if( 0!=strcmp("sqlite3-wasmfs", zName) ){
|
||||
/* The sqlite3-wasmfs build is optional and needs to be invoked
|
||||
** conditionally using info we don't have here. */
|
||||
|
Reference in New Issue
Block a user