wasm: move the makefile-eval-generated fiddle rules into mkwasmbuilds.c. Squelch some warnings from grep when running 'make clean' on a clean tree.

FossilOrigin-Name: 0485d1360b0dbf9987d16ab1df47b6b7a25595881581799f87889f6d4eeb60f4
This commit is contained in:
stephan 2024-09-28 12:01:10 +00:00
parent d4c735d491
commit 6a8336987a
5 changed files with 78 additions and 58 deletions

View File

@ -133,12 +133,14 @@ 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
ifneq (1,$(MAKING_CLEAN))
ifeq (,$(shell grep sqlite3_activate_see $(sqlite3.c)))
SQLITE_C_IS_SEE := 0
else
SQLITE_C_IS_SEE := 1
$(info This is an SEE build)
endif
endif
########################################################################@
# It's important that sqlite3.h be built to completion before any
@ -871,6 +873,7 @@ sqlite3-api-node.mjs := $(dir.dout)/sqlite3-api-node.mjs
sqlite3-node.mjs := $(dir.dout)/sqlite3-node.mjs
sqlite3-api-wasmfs.mjs := $(dir.tmp)/sqlite3-api-wasmfs.mjs
sqlite3-wasmfs.mjs := $(dir.wasmfs)/sqlite3-wasmfs.mjs
EXPORTED_FUNCTIONS.fiddle := $(dir.tmp)/EXPORTED_FUNCTIONS.fiddle
ifneq (1,$(MAKING_CLEAN))
.wasmbuilds.make: $(bin.mkwb)
@rm -f $@

View File

@ -7,21 +7,23 @@ MAKEFILE.fiddle := $(lastword $(MAKEFILE_LIST))
########################################################################
# shell.c and its build flags...
make-np-0 := make -C $(dir.top) -n -p
make-np-1 := sed -e 's/(TOP)/(dir.top)/g'
# Extract SHELL_OPT and SHELL_DEP from the top-most makefile and import
# them as vars here...
$(eval $(shell $(make-np-0) | grep -e '^SHELL_OPT ' | $(make-np-1)))
$(eval $(shell $(make-np-0) | grep -e '^SHELL_DEP ' | $(make-np-1)))
# ^^^ can't do that in 1 invocation b/c newlines get stripped
ifeq (,$(SHELL_OPT))
$(error Could not parse SHELL_OPT from $(dir.top)/Makefile.)
endif
ifeq (,$(SHELL_DEP))
$(error Could not parse SHELL_DEP from $(dir.top)/Makefile.)
endif
ifneq (1,$(MAKING_CLEAN))
make-np-0 := make -C $(dir.top) -n -p
make-np-1 := sed -e 's/(TOP)/(dir.top)/g'
# Extract SHELL_OPT and SHELL_DEP from the top-most makefile and import
# them as vars here...
$(eval $(shell $(make-np-0) | grep -e '^SHELL_OPT ' | $(make-np-1)))
$(eval $(shell $(make-np-0) | grep -e '^SHELL_DEP ' | $(make-np-1)))
# ^^^ can't do that in 1 invocation b/c newlines get stripped
ifeq (,$(SHELL_OPT))
$(error Could not parse SHELL_OPT from $(dir.top)/Makefile.)
endif
ifeq (,$(SHELL_DEP))
$(error Could not parse SHELL_DEP from $(dir.top)/Makefile.)
endif
$(dir.top)/shell.c: $(SHELL_DEP) $(dir.tool)/mkshellc.tcl $(sqlite3.c)
$(MAKE) -C $(dir.top) shell.c
endif
# /shell.c
########################################################################
@ -65,46 +67,13 @@ $(EXPORTED_FUNCTIONS.fiddle): $(MKDIR.bld) $(fiddle.EXPORTED_FUNCTIONS.in) \
fiddle.cses := $(dir.top)/shell.c $(sqlite3-wasm.c)
########################################################################
# emit rules for one of the two fiddle builds. $1 must be
# either $(dir.fiddle) or $(dir.fiddle-debug). $2 must be empty
# in the former case and .debug in the latter.
#
# TODO: move this into mkwasmbuilds.c.
define make-fiddle-rules
fiddle-module.js$(2) := $(1)/fiddle-module.js
fiddle-module.wasm$(2) := $$(subst .js,.wasm,$$(fiddle-module.js$(2)))
$$(fiddle-module.js$(2)): $$(MAKEFILE) $$(MAKEFILE.fiddle) \
$$(EXPORTED_FUNCTIONS.fiddle) \
$$(fiddle.cses) $$(pre-post-fiddle-module-vanilla.deps) $$(SOAP.js)
@test -d "$$(dir $$@)" || mkdir -p "$$(dir $$@)"
$$(emcc.bin) -o $$@ $$(fiddle.emcc-flags$(2)) \
$$(pre-post-fiddle-module-vanilla.flags) \
$$(fiddle.cses)
$$(maybe-wasm-strip) $$(fiddle-module.wasm$(2))
@cp -p $$(SOAP.js) $$(dir $$@)
@if [[ x.debug = x$(2) ]]; then \
cp -p $$(dir.fiddle)/index.html \
$$(dir.fiddle)/fiddle.js \
$$(dir.fiddle)/fiddle-worker.js \
$$(dir $$@)/.; \
fi
@for i in $(1)/*.*js $(1)/*.html $(1)/*.wasm; do \
test -f $$$${i} || continue; \
gzip < $$$${i} > $$$${i}.gz; \
done
fiddle$(2): $$(fiddle-module.js$(2)) $(1)/fiddle.js.gz
endef
$(eval $(call make-fiddle-rules,$(dir.fiddle)))
$(eval $(call make-fiddle-rules,$(dir.fiddle-debug),.debug))
fiddle: $(fiddle-module.js) $(fiddle-module.js.debug)
fiddle.debug: $(fiddle-module.js.debug)
clean: clean-fiddle
clean-fiddle:
rm -f $(fiddle-module.js) \
$(fiddle-module.wasm) \
rm -f $(dir.fiddle)/fiddle-module.js \
$(dir.fiddle)/*.wasm \
$(dir.fiddle)/sqlite3-opfs-*.js \
$(dir.fiddle)/*.gz \
EXPORTED_FUNCTIONS.fiddle

View File

@ -133,6 +133,54 @@ static void mk_pre_post(const char *zName /* build name */,
pf("# End --pre/--post flags for %s-%s%s", zName, zMode, zBanner);
}
/*
** Emits rules for the fiddle builds.
**
*/
static void mk_fiddle(){
int i = 0;
mk_pre_post("fiddle-module","vanilla", 0);
for( ; i < 2; ++i ){
const char *zTail = i ? ".debug" : "";
const char *zDir = i ? "$(dir.fiddle-debug)" : "$(dir.fiddle)";
pf("%s# Begin fiddle%s\n", zBanner, zTail);
pf("fiddle-module.js%s := %s/fiddle-module.js\n", zTail, zDir);
pf("fiddle-module.wasm%s := "
"$(subst .js,.wasm,$(fiddle-module.js%s))\n", zTail, zTail);
pf("$(fiddle-module.js%s):%s $(MAKEFILE) $(MAKEFILE.fiddle) "
"$(EXPORTED_FUNCTIONS.fiddle) "
"$(fiddle.cses) $(pre-post-fiddle-module-vanilla.deps) "
"$(SOAP.js)\n",
zTail, (i ? " $(fiddle-module.js)" : ""));
if( 1==i ){/*fiddle.debug*/
pf(" @test -d \"$(dir $@)\" || mkdir -p \"$(dir $@)\"\n");
}
pf(" $(emcc.bin) -o $@ $(fiddle.emcc-flags%s) "
"$(pre-post-fiddle-module-vanilla.flags) $(fiddle.cses)\n",
zTail);
pf(" $(maybe-wasm-strip) $(fiddle-module.wasm%s)\n", zTail);
pf(" @cp -p $(SOAP.js) $(dir $@)\n");
if( 1==i ){/*fiddle.debug*/
pf(" cp -p $(dir.fiddle)/index.html "
"$(dir.fiddle)/fiddle.js "
"$(dir.fiddle)/fiddle-worker.js "
"$(dir $@)\n");
}
pf(" @for i in %s/*.*js %s/*.html %s/*.wasm; do \\\n"
" test -f $${i} || continue; \\\n"
" gzip < $${i} > $${i}.gz; \\\n"
" done\n", zDir, zDir, zDir);
if( 0==i ){
ps("fiddle: $(fiddle-module.js)");
}else{
ps("fiddle-debug: $(fiddle-module-debug.js)");
}
pf("# End fiddle%s%s", zTail, zBanner);
}
}
/*
** Emits makefile code for one build of the library, primarily defined
** by the combination of zName and zMode, each of which must be values
@ -229,7 +277,7 @@ int main(void){
"$(c-pp.D.sqlite3-bundler-friendly) -Dwasmfs",
"-sEXPORT_ES6 -sUSE_ES6_IMPORT_META");
mk_pre_post("fiddle-module","vanilla", 0);
mk_fiddle();
mk_pre_post("speedtest1","vanilla", 0);
mk_pre_post("speedtest1-wasmfs","esm", "$(c-pp.D.sqlite3-bundler-friendly) -Dwasmfs");
return rc;

View File

@ -1,5 +1,5 @@
C Ensure\sthat\sthe\stemporary\sbuild\sdir\sis\smkdir'd\sby\swasm\sdeps\swhich\sdepend\son\sit.
D 2024-09-28T11:23:09.335
C wasm:\smove\sthe\smakefile-eval-generated\sfiddle\srules\sinto\smkwasmbuilds.c.\sSquelch\ssome\swarnings\sfrom\sgrep\swhen\srunning\s'make\sclean'\son\sa\sclean\stree.
D 2024-09-28T12:01:10.696
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -603,7 +603,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
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 abd9c2a5a05dec3a39eea86bee1c05b95c418ac6d92acdd740c1297419148b0b
F ext/wasm/GNUmakefile e87c055bb0aa12bf4540b5d12e533608cb70cb2da1b8659d10b1fce03e08240c
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
F ext/wasm/README.md a8a2962c3aebdf8d2104a9102e336c5554e78fc6072746e5daf9c61514e7d193
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
@ -655,7 +655,7 @@ F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2
F ext/wasm/demo-worker1.js 836bece8615b17b1b572584f7b15912236a5947fe8c68b98d2737d7e287447ef
F ext/wasm/dist.make 653e212c1e84aa3be168d62a10616ccea45ee9585b0192745d2706707a5248ce
F ext/wasm/example_extra_init.c 2347cd69d19d839ef4e5e77b7855103a7fe3ef2af86f2e8c95839afd8b05862f
F ext/wasm/fiddle.make 4a350d7e79875c03b8326ee0fc198443555e79fa1dbf56ccd75d6cd871b44c42
F ext/wasm/fiddle.make ec2353f0eddade864f67b993376a0949e27b72465c24b1970940e48b70bc2df1
F ext/wasm/fiddle/fiddle-worker.js 850e66fce39b89d59e161d1abac43a181a4caa89ddeea162765d660277cd84ce
F ext/wasm/fiddle/fiddle.js b444a5646a9aac9f3fc06c53d78af5e1912eb235d69a8e6010723e4eb0e9d4a1
F ext/wasm/fiddle/index.html c79b1741cbeba78f88af0a84cf5ec7de87a909a6a8d10a369b1f4824c66c2088
@ -663,7 +663,7 @@ F ext/wasm/index-dist.html 564b5ec5669676482c5a25dea9e721d8eafed426ecb155f93d29a
F ext/wasm/index.html e4bbffdb3d40eff12b3f9c7abedef91787e2935620b7f8d40f2c774b80ad8fa9
F ext/wasm/jaccwabyt/jaccwabyt.js 1264710db3cfbcb6887d95665b7aeba60c1126eaef789ca4cf1a4a17d5bc7f54
F ext/wasm/jaccwabyt/jaccwabyt.md 59a20df389abcc3606eb4eaea7fb7ba14504beb3e345dbea9b99a0618ba3bec8
F ext/wasm/mkwasmbuilds.c e58bad0558f6b8359e6ebb9262a0bf30dfd1db9715ec8a0de9f1e74433944b57
F ext/wasm/mkwasmbuilds.c e3580b26bc393e4e4beb25f6349b999878782f3319b740469f64c2e772632e03
F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337
F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96
F ext/wasm/scratchpad-wasmfs.mjs 66034b9256b218de59248aad796760a1584c1dd842231505895eff00dbd57c63
@ -2213,8 +2213,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 45361ab9744ccac3419d97fe8951838f14bd28220e3f7f747b39e46cfc3b5a1d
R 3ace6beda7c5f348d7740cd089b772f4
P cabdf9797281090ab3f95c9f4c2a79878d1c64d1f2a09e433e2309abe5e19e59
R 0187fe6fd0750839e1c4d66882bc06e3
U stephan
Z 1e4b46fc68a5c48e2ab34715ed6387ce
Z 5f0ec8eab9d280a80b50e2d7a52a98d8
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
cabdf9797281090ab3f95c9f4c2a79878d1c64d1f2a09e433e2309abe5e19e59
0485d1360b0dbf9987d16ab1df47b6b7a25595881581799f87889f6d4eeb60f4