chiark / gitweb /
Makefile cleanups for webstead
authorBen Harris <bjh21@bjh21.me.uk>
Sat, 4 Oct 2025 22:27:17 +0000 (23:27 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 13 Jan 2026 21:42:18 +0000 (21:42 +0000)
Add -sINCOMING_MODULE_JS_API because in newer Emscripten -sSTRICT
empties it.  Remove -sMODULARIZE because -sEXPORT_ES6 implies it.  Add
-O2 since the compiled code will probably be run more than once.  Pass
standard compiler flags to emcc.  Build bedstead.js in all-web, and
remove it in clean.

Makefile

index 6e9d205f94c6bb9b0a86eeded681e27ece8ad549..e26e904ea3d0afa255a90661cc00e64b02cb0770 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,8 @@ DISTFILES = bedstead.c Makefile CONTRIBUTING COPYING HACKING NEWS \
 all: $(DISTFILES)
 
 .PHONY: all-web
-all-web: all sample.png extended.png icon-16.png icon-32.png icon-64.png
+all-web: all sample.png extended.png icon-16.png icon-32.png icon-64.png \
+       bedstead.js
 
 .PHONY: experimental
 experimental: bedstead-chiseltip.otf bedstead-plotter-thin.otf \
@@ -111,12 +112,15 @@ bedstead-complement.ps: bedstead
 bedstead-complement.pdf: bedstead-complement.ps bedstead.otf Fontmap
        ps2pdf -P $< $@
 
+EMCCFLAGS = -O2 -sEXPORT_ES6 -sEXIT_RUNTIME -sSTRICT \
+       -sINCOMING_MODULE_JS_API='["arguments","print"]'
+EMCCFLAGS += $(CWARNFLAGS)
 %.js: %.c
-       emcc -sMODULARIZE -sEXPORT_ES6 -sEXIT_RUNTIME=1 -sSTRICT -o $@ $<
+       emcc $(EMCCFLAGS) -o $@ $<
 
 .PHONY: clean
 clean:
-       rm -f bedstead *.ttx *.otf *.bdf *.bdf.ps *.png *.pdf \
+       rm -f bedstead *.ttx *.otf *.bdf *.bdf.ps *.png *.pdf *.js *.wasm \
                bedstead-complement.ps
 
 .PHONY: install-user