-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (32 loc) · 1.1 KB
/
Makefile
File metadata and controls
43 lines (32 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
.PHONY= update build optim
all: update build optim prerender
js: update-js build-js
update:
wasm32-wasi-cabal update
js: update-js build-js
build:
wasm32-wasi-cabal build app
rm -rf public
cp -r static public
$(eval my_wasm=$(shell wasm32-wasi-cabal list-bin app | tail -n 1))
$(shell wasm32-wasi-ghc --print-libdir)/post-link.mjs --input $(my_wasm) --output public/ghc_wasm_jsffi.js
cp -v $(my_wasm) public/
cp -rv assets public/
prerender:
nix develop --command bash -c "cabal update && cabal run prerender"
optim:
wasm-opt -all -O2 public/app.wasm -o public/app.wasm
wasm-tools strip -o public/app.wasm public/app.wasm
serve:
http-server public
clean:
rm -rf dist-newstyle public
update-js:
cabal update --with-ghc=javascript-unknown-ghcjs-ghc --with-hc-pkg=javascript-unknown-ghcjs-ghc-pkg
build-js:
cabal build --with-ghc=javascript-unknown-ghcjs-ghc --with-hc-pkg=javascript-unknown-ghcjs-ghc-pkg app
cp -v ./dist-newstyle/build/javascript-ghcjs/ghc-9.12.2/*/x/app/build/app/app.jsexe/all.js .
rm -rf public
cp -rv static public
cp -rv assets public/
bunx swc ./all.js -o public/index.js