Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
109 lines (86 loc) · 3.18 KB
/
Copy pathMakefile
File metadata and controls
109 lines (86 loc) · 3.18 KB
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
RUST_TOOLCHAIN_NIGHTLY = nightly-2026-01-22
SOLANA_CLI_VERSION = 3.1.8
CODAMA_CLI_VERSION = 0.13.1
CODAMA_IDL_PACKAGES = executor-interface nonce-interface signer-interface
nightly = +${RUST_TOOLCHAIN_NIGHTLY}
# This is a bit tricky -- findstring returns the found string, so we're looking
# for "directory-", returning that, and replacing "-" with "/" to change the
# first "-" to a "/". But if it isn't found, we replace "" with "", which works
# in the case where there is no subdirectory.
pattern-dir = $(firstword $(subst -, ,$1))
find-pattern-dir = $(findstring $(call pattern-dir,$1)-,$1)
make-path = $(subst $(call find-pattern-dir,$1),$(subst -,/,$(call find-pattern-dir,$1)),$1)
rust-toolchain-nightly:
@echo ${RUST_TOOLCHAIN_NIGHTLY}
solana-cli-version:
@echo ${SOLANA_CLI_VERSION}
cargo-nightly:
cargo $(nightly) $(ARGS)
audit:
cargo audit \
--ignore RUSTSEC-2022-0093 \
--ignore RUSTSEC-2024-0344 \
--ignore RUSTSEC-2024-0421 \
--ignore RUSTSEC-2026-0387 \
--ignore RUSTSEC-2026-0391 \
--ignore RUSTSEC-2026-0398 \
--ignore RUSTSEC-2026-0403 \
$(ARGS)
spellcheck:
cargo spellcheck --code 1 $(ARGS)
format-check-js-%:
cd $(call make-path,$*) && pnpm install && pnpm format $(ARGS)
clippy-%:
cargo $(nightly) clippy --manifest-path $(call make-path,$*)/Cargo.toml \
--all-targets \
--all-features \
-- \
--deny=warnings \
--deny=clippy::default_trait_access \
--deny=clippy::arithmetic_side_effects \
--deny=clippy::manual_let_else \
--deny=clippy::used_underscore_binding $(ARGS)
format-check-%:
cargo $(nightly) fmt --check --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
powerset-%:
cargo $(nightly) hack check --feature-powerset --all-targets --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
format-rust:
cargo $(nightly) fmt --all $(ARGS)
build-sbf-%:
cargo build-sbf --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
build-doc-%:
RUSTDOCFLAGS="--cfg docsrs -D warnings" cargo $(nightly) doc --all-features --no-deps --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
test-doc-%:
cargo $(nightly) test --doc --all-features --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
lint-js-%:
cd $(call make-path,$*) && pnpm install && pnpm lint $(ARGS)
test-js-%:
cd $(call make-path,$*) && pnpm install && pnpm build && pnpm test $(ARGS)
test-%:
SBF_OUT_DIR=$(PWD)/target/deploy cargo $(nightly) test --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
generate-clients: generate-idl-workspace
pnpm codama run js $(ARGS)
generate-idl-workspace:
@cargo install --locked --version =${CODAMA_CLI_VERSION} codama-cli
@mkdir -p target/codama-idl
@$(MAKE) $(addprefix generate-codama-idl-,$(CODAMA_IDL_PACKAGES))
pnpm codama run idl
generate-codama-idl-%:
codama-rs generate-idl $(call make-path,$*) \
--output target/codama-idl/$*.json \
--pretty \
$(ARGS)
check-no-std-core-%:
cargo $(nightly) hack check \
--target bpfel-unknown-none \
--each-feature \
--manifest-path $(call make-path,$*)/Cargo.toml \
-Zbuild-std=core \
$(ARGS)
check-no-std-alloc-%:
cargo $(nightly) hack check \
--target bpfel-unknown-none \
--each-feature \
--manifest-path $(call make-path,$*)/Cargo.toml \
-Zbuild-std=alloc,core \
$(ARGS)