delete guileslop and add haskellslop

This commit is contained in:
2026-07-17 14:11:50 -06:00
parent d3cf938eb3
commit 388363397a
27 changed files with 143 additions and 28 deletions
+39
View File
@@ -0,0 +1,39 @@
import Development.Shake
import Development.Shake.Command
import Development.Shake.FilePath
import Development.Shake.Util
import Data.Char (toUpper)
capitalise (x:xs) = toUpper x : xs
ghcflags =
[ "-no-hs-main"
, "-optl-mexec-model=reactor"
, "-optl-Wl,--export=hello,--export=hs_init"
]
main = shakeArgs shakeOptions $ do
want ["call-hello.wasm","hello.wasm"]
"call-hello.wasm" %> \out -> do
need ["call-hello.wat"]
cmd_ "wasm-tools parse call-hello.wat" "-o" [out]
"hello.wasm" %> \out -> do
need ["Hello.hs"]
cmd_
"wasm32-wasi-ghc"
"Hello.hs" ghcflags
"-o" [out]
phony "run" $ do
need ["call-hello.wasm","hello.wasm"]
cmd_ "wasmtime run"
"--preload" "env=hello.wasm"
"--invoke" "call-hello"
"call-hello.wasm"
phony "clean" $ do
removeFilesAfter ".shake" ["//*"]
liftIO $ removeFiles "."
[ "*.wasm"
, "*.o"
, "*_stub.h"
, "*.hi"
]