This repository was archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathMakefile
89 lines (65 loc) · 2.47 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
.PHONY: build check clean clippy compile-cairo compile-starknet coverage deps test heaptrack check-python-version compile-abi
OS := $(shell uname)
ifeq ($(OS), Darwin)
CFLAGS += -I/opt/homebrew/opt/gmp/include
LDFLAGS += -L/opt/homebrew/opt/gmp/lib
endif
CAIRO_SOURCES=$(wildcard cairo_programs/*.cairo)
CAIRO_TARGETS=$(patsubst %.cairo,%.json,$(CAIRO_SOURCES))
STARKNET_SOURCES=$(wildcard starknet_programs/*.cairo)
STARKNET_TARGETS=$(patsubst %.cairo,%.json,$(STARKNET_SOURCES))
BUILTIN_SOURCES=$(wildcard starknet_programs/*.cairo)
BUILTIN_TARGETS=$(patsubst %.cairo,%.json,$(BUILTIN_SOURCES))
#
# VENV rules.
#
deps-venv:
pip install \
fastecdsa \
typeguard==2.13.0 \
openzeppelin-cairo-contracts==0.6.1 \
maturin \
cairo-lang==0.11
compile-cairo: $(CAIRO_TARGETS)
compile-starknet: $(STARKNET_TARGETS)
cairo_programs/%.json: cairo_programs/%.cairo
. starknet-venv/bin/activate && cd cairo_programs/ && cairo-compile $(shell grep "^// @compile-flags += .*$$" $< | cut -c 22-) ../$< --output ../$@ || rm ../$@
starknet_programs/%.json: starknet_programs/%.cairo
. starknet-venv/bin/activate && \
cd starknet_programs/ && \
starknet-compile $(shell grep "^// @compile-flags += .*$$" $< | cut -c 22-) \
../$< \
--output ./$*.json \
--abi ./$*_abi.json \
|| rm ./$*.json ./$*_abi.json
# Compiles .cairo files into .json files. if the command fails, then it removes all of the .json files
#
# Normal rules.
#
build: compile-cairo compile-starknet
cargo build --release --all
check: compile-cairo compile-starknet
cargo check --all
deps: check-python-version
cargo install flamegraph --version 0.6.2
cargo install cargo-llvm-cov --version 0.5.14
python3 -m venv starknet-venv
. starknet-venv/bin/activate && $(MAKE) deps-venv
clean:
-rm -rf starknet-venv/
-rm -f cairo_programs/*.json
-rm -f starknet_programs/*.json
-rm -f tests/*.json
clippy: compile-cairo compile-starknet
cargo clippy --all --all-targets -- -D warnings
test: compile-cairo compile-starknet
cargo test
test-py: compile-cairo compile-starknet
. starknet-venv/bin/activate && cargo test -p starknet-rs-py --no-default-features --features embedded-python
coverage: compile-cairo compile-starknet compile-abi
cargo llvm-cov --ignore-filename-regex 'main.rs'
cargo llvm-cov report --lcov --ignore-filename-regex 'main.rs' --output-path lcov.info
heaptrack:
./scripts/heaptrack.sh
flamegraph: compile-cairo compile-starknet
CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root --bench internals