forked from viperproject/prusti-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
145 lines (116 loc) · 4.38 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
SHELL := /usr/bin/env bash
RUST_LOG ?= prusti=info
RUST_TEST_THREADS ?= 1
JAVA_HOME ?= /usr/lib/jvm/default-java
RUN_FILE ?= prusti/tests/typecheck/pass/lint.rs
RUN_FILE_FOLDER=$(shell dirname ${RUN_FILE})
JAVA_LIBJVM_DIR=$(shell dirname "$(shell find "$(shell readlink -f ${JAVA_HOME})" -name "libjvm.so")")
RUSTUP_TOOLCHAIN=$(shell cat rust-toolchain)
RUST_VERSION = ${RUSTUP_TOOLCHAIN}-x86_64-unknown-linux-gnu
COMPILER_PATH = $$HOME/.rustup/toolchains/${RUST_VERSION}
LIB_PATH = ${COMPILER_PATH}/lib:${JAVA_LIBJVM_DIR}:./target/debug:./target/debug/deps
RELEASE_LIB_PATH = ${COMPILER_PATH}/lib:${JAVA_LIBJVM_DIR}:./target/release:./target/release/deps
PRUSTI_DRIVER=./target/debug/prusti-driver
PRUSTI_DRIVER_RELEASE=./target/release/prusti-driver
SET_ENV_VARS = LD_LIBRARY_PATH=$(LIB_PATH) JAVA_HOME=$(JAVA_HOME) RUST_TEST_THREADS=$(RUST_TEST_THREADS)
SET_RELEASE_ENV_VARS = LD_LIBRARY_PATH=$(RELEASE_LIB_PATH) JAVA_HOME=$(JAVA_HOME) RUST_TEST_THREADS=$(RUST_TEST_THREADS)
default: build
fmt:
rustup run nightly cargo fmt --all || true
fix:
$(SET_ENV_VARS) cargo fix
check:
$(SET_ENV_VARS) cargo check --all
build:
$(SET_ENV_VARS) cargo build --all
release:
$(SET_ENV_VARS) cargo build --release --all
test-deep:
$(SET_ENV_VARS) \
PRUSTI_CHECK_FOLDUNFOLD_STATE=1 \
cargo test --all
test: build
$(SET_ENV_VARS) \
cargo test --all
test-examples: build
$(SET_ENV_VARS) \
cargo test -p prusti
build-profile:
$(SET_ENV_VARS) \
CARGO_INCREMENTAL=0 \
RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads" \
cargo build --all
bench:
$(SET_ENV_VARS) cargo bench --all
run: build
$(SET_ENV_VARS) RUST_LOG=$(RUST_LOG) \
$(PRUSTI_DRIVER) \
-L ${COMPILER_PATH}/lib/rustlib/x86_64-unknown-linux-gnu/lib/ \
--extern prusti_contracts=$(wildcard ./target/debug/deps/libprusti_contracts-*.rlib) \
$(RUN_FILE)
run-flamegraph: build
$(SET_ENV_VARS) RUST_LOG=$(RUST_LOG) \
perf record -F 99 --call-graph=dwarf,32000 \
$(PRUSTI_DRIVER) \
-L ${COMPILER_PATH}/lib/rustlib/x86_64-unknown-linux-gnu/lib/ \
--extern prusti_contracts=$(wildcard ./target/debug/deps/libprusti_contracts-*.rlib) \
$(RUN_FILE)
@echo "Now run 'flamegraph-rust-perf > flame.svg'"
run-release: release
$(SET_RELEASE_ENV_VARS) RUST_LOG=$(RUST_LOG) \
$(PRUSTI_DRIVER_RELEASE) \
-L ${COMPILER_PATH}/lib/rustlib/x86_64-unknown-linux-gnu/lib/ \
--extern prusti_contracts=$(wildcard ./target/release/deps/libprusti_contracts-*.rlib) \
$(RUN_FILE)
run-release-profile: release
$(SET_RELEASE_ENV_VARS) RUST_LOG=$(RUST_LOG) \
valgrind --tool=callgrind --vex-iropt-register-updates=allregs-at-mem-access \
${PRUSTI_DRIVER_RELEASE} \
-L ${COMPILER_PATH}/lib/rustlib/x86_64-unknown-linux-gnu/lib/ \
--extern prusti_contracts=$(wildcard ./target/release/deps/libprusti_contracts-*.rlib) \
${RUN_FILE}
@echo "Now run 'kcachegrind callgrind.out.*'"
run-release-flamegraph: release
$(SET_RELEASE_ENV_VARS) RUST_LOG=$(RUST_LOG) \
perf record -F 99 --call-graph=dwarf,32000 \
${PRUSTI_DRIVER_RELEASE} \
-L ${COMPILER_PATH}/lib/rustlib/x86_64-unknown-linux-gnu/lib/ \
--extern prusti_contracts=$(wildcard ./target/release/deps/libprusti_contracts-*.rlib) \
${RUN_FILE}
@echo "Now run 'flamegraph-rust-perf > flame.svg'"
run-release-prusti-rustc-flamegraph: release
perf record -F 99 --call-graph=dwarf,32000 \
./target/release/prusti-rustc ${RUN_FILE}
@echo "Now run 'flamegraph-rust-perf > flame.svg'"
run-release-prusti-rustc-timechart: release
perf timechart record \
./target/release/prusti-rustc ${RUN_FILE}
@echo "Now run 'perf timechart'"
run-release-prusti-rustc-timechart-io: release
perf timechart record -I \
./target/release/prusti-rustc ${RUN_FILE}
@echo "Now run 'perf timechart'"
update:
cargo update
docs: update
$(SET_ENV_VARS) cargo doc --all
clippy: clean
$(SET_ENV_VARS) cargo clippy --all
publish-docker-images:
docker push fpoli/prusti-base
docker push fpoli/prusti-artefact
build-docker-images:
docker build -t fpoli/prusti-base --build-arg RUST_TOOLCHAIN="${RUSTUP_TOOLCHAIN}" -f docker/base.Dockerfile docker/
docker build -t rust-nightly -f docker/playground.Dockerfile .
docker build -t fpoli/prusti-artefact -f docker/artefact.Dockerfile .
clean:
cargo clean
find . -name '*.bk' -delete
rm -rf log
rm -rf nll-facts
rm -rf prusti/log
rm -rf prusti/nll-facts
todo:
git grep -i "todo\|fixme\|xxx\|hack"
demo:
vagrant up