-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
103 lines (72 loc) · 2.46 KB
/
Makefile
File metadata and controls
103 lines (72 loc) · 2.46 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
.PHONY: help build clean test test-contracts test-cli integration install deploy-local check lint format lint-rust-fmt lint-rust-clippy gas-report coverage-contracts version
# Detect platform
UNAME_S := $(shell uname -s)
.DEFAULT_GOAL := help
help: ## Show this help message
@echo "Ledgerator - Makefile Commands"
@echo ""
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
# Build targets
build: build-contracts build-cli ## Build all components
build-contracts: ## Build smart contracts
cd contracts && forge build
build-cli: ## Build CLI tool
cargo build --release
# Test targets
test: test-contracts test-cli ## Run all tests
test-contracts: ## Run smart contract tests
cd contracts && forge test -vv
test-cli: ## Run CLI tests
cargo test
integration: ## Run full integration test
./integration-test.sh
# Check targets
check: check-contracts check-cli ## Check all code compiles
check-contracts:
cd contracts && forge build --force
check-cli:
cargo check
# Lint targets
lint: lint-contracts lint-rust ## Run all linters
lint-contracts:
cd contracts && forge fmt --check
lint-rust: lint-rust-fmt lint-rust-clippy
lint-rust-fmt:
cargo fmt -- --check
lint-rust-clippy:
cargo clippy -- -D warnings
# Format targets
format: format-contracts format-rust ## Format all code
format-contracts:
cd contracts && forge fmt
format-rust:
cargo fmt
# Clean targets
clean: clean-contracts clean-cli ## Clean all build artifacts
clean-contracts:
cd contracts && forge clean
rm -rf contracts/broadcast contracts/cache
clean-cli:
cargo clean
deploy-local: ## Deploy contract to local Anvil
cd contracts && forge script script/Deploy.s.sol \
--rpc-url http://localhost:8545 \
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--broadcast
# Install CLI tool
install: ## Install CLI tool globally
cargo install --path .
@echo ""
@echo "CLI installed! Run 'ledge --help' to get started."
# Gas report for contracts
gas-report: ## Generate gas report for contracts
cd contracts && forge test --gas-report
# Coverage targets
coverage-contracts: ## Generate contract coverage report
cd contracts && forge coverage
# Version info
version: ## Show component versions
@echo "Component versions:"
@echo " Forge: $$(forge --version | head -n 1)"
@echo " Rust: $$(rustc --version)"
@echo " Cargo: $$(cargo --version)"