-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
62 lines (47 loc) · 1.88 KB
/
Makefile
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.PHONY: bootstrap build verify prusti bindings wasm2c
# Prusti setup and build instructions:
# (this makefile should handle anything, but you can look at these if you run into problems)
# https://viperproject.github.io/prusti-dev/dev-guide/development/setup.html
# https://viperproject.github.io/prusti-dev/dev-guide/development/build.html
# Used by Prusti
JAVA_HOME ?= /usr/lib/jvm/
bootstrap:
git submodule update --init --recursive
cd prusti-dev && ./x.py setup
cd prusti-dev && JAVA_HOME=$(JAVA_HOME) ./x.py build --release
cargo build --release
make bindings # this is dirty, fix this
cd tools/wasm2c_sandbox_compiler && make
cd tools/wasi-sdk && make
prusti:
cd prusti-dev && JAVA_HOME=$(JAVA_HOME) ./x.py build --release
build:
cargo build --release
build_hello_example:
cd examples/hello && make clean
cd examples/hello && make build
run_hello_example:
cd examples/hello && make run
# If this command is giving you trouble, try deleting the ./target directory and retrying
# TODO: reenable overflow checks
verify:
prusti-dev/target/release/cargo-prusti --features verify
verify-debug:
PRUSTI_LOG=trace prusti-dev/target/debug/cargo-prusti --features verify
# Generate C/Cpp bindings for wave
# wasm2c expects to pass a void pointer instead of a VmCtx pointer
# (which cbindgen generates), so I just use a sed command to replace it :)
bindings:
mkdir -p bindings
# Generates a temporary file with sed because Mac doesn't support -i flag
cbindgen --config cbindgen.toml --crate wave --lang c --output bindings/wave_tmp.h
sed 's/struct[[:space:]]VmCtx[[:space:]][*]const/void/g' bindings/wave_tmp.h > bindings/wave.h
rm bindings/wave_tmp.h
wasm2c:
cd rlbox_wasm2c_sandbox && cmake -S . -B ./build
cd rlbox_wasm2c_sandbox && cmake --build ./build --target all
fuzz_trusted:
mkdir -p fuzz-dir
bash scan_for_trusted.sh
RUST_LOG=quickcheck cargo test -- --nocapture
rm -r fuzz-dir