Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # =============== WASMTIME example make script ===============
- # uncomment for a debug build
- #EXTRA_COMPILE_OPTIONS=-g
- # ======= Configure =======
- # wasmtime sdk location configured here
- WASMTIME_SDK=../wasmtime
- # Clang linking doesn't like relative paths.
- WASMTIME_SDK_RESOLVED=$(cd $WASMTIME_SDK; pwd)
- WASMTIME_LIB=$WASMTIME_SDK_RESOLVED/lib
- WASMTIME_H=$WASMTIME_SDK/include
- COMPILE_OPTIONS="$EXTRA_COMPILE_OPTIONS -c"
- HEADERS="-I$WASMTIME_H"
- mkdir -p obj
- mkdir -p bin
- # ======= Compile =======
- clang $HEADERS $COMPILE_OPTIONS ./main.c -o ./obj/main.o
- # ======= Link =======
- # Install wasmtime shared library so it can resolve.
- cp $WASMTIME_LIB/libwasmtime.so /usr/local/lib
- cp $WASMTIME_LIB/libwasmtime.a /usr/local/lib
- LINK_OPTIONS="-lc"
- LIBS="/usr/local/lib/libwasmtime.so"
- clang $LINK_OPTIONS $LIBS ./obj/main.o -o ./bin/test_app
- # ======= Inspect =======
- # Optionally inspect debug info
- # llvm-dwarfdump ./bin/test_app
Advertisement
Add Comment
Please, Sign In to add comment