-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathMakefile
More file actions
102 lines (84 loc) · 2.63 KB
/
Makefile
File metadata and controls
102 lines (84 loc) · 2.63 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
# Makefile for chopper development
.PHONY: all build test clean fmt clippy audit docs install help musl
# Default target
all: fmt clippy test build
# Build the project
build:
cargo build --release
# Build a statically-linked Linux binary using MUSL
.PHONY: build-musl
musl: build-musl
build-musl:
@echo "Building static MUSL binary (x86_64-unknown-linux-musl)"
rustup target add x86_64-unknown-linux-musl >/dev/null 2>&1 || true
@if command -v cross >/dev/null 2>&1; then \
echo "Using cross for reproducible musl build"; \
LIBZ_SYS_STATIC=1 BZIP2_STATIC=1 LZMA_API_STATIC=1 \
cross build --release --target x86_64-unknown-linux-musl; \
else \
echo "Using cargo. Ensure musl-gcc is available (sudo apt-get install musl-tools)"; \
LIBZ_SYS_STATIC=1 BZIP2_STATIC=1 LZMA_API_STATIC=1 \
RUSTFLAGS='-C target-feature=+crt-static -C linker=musl-gcc' \
cargo build --release --target x86_64-unknown-linux-musl; \
fi
@echo "Binary: target/x86_64-unknown-linux-musl/release/chopper"
# Run tests
test:
cargo test
# Clean build artifacts
clean:
cargo clean
# Format code
fmt:
cargo fmt
# Check formatting
fmt-check:
cargo fmt --check
# Run clippy
clippy:
cargo clippy --all-targets --all-features -- -D warnings
# Security audit
audit:
cargo audit
# Check for outdated dependencies
outdated:
cargo outdated --root-deps-only
# Generate documentation
docs:
cargo doc --no-deps --open
# Install locally
install:
cargo install --path .
# Run all checks (CI simulation)
ci: fmt-check clippy test
@echo "All CI checks passed!"
# Development setup
setup:
rustup component add rustfmt clippy
cargo install cargo-audit cargo-outdated
# Benchmark (if benchmarks exist)
bench:
cargo bench
# Check everything is ready for commit
pre-commit: fmt clippy test
@echo "Ready for commit!"
# Show help
help:
@echo "Available targets:"
@echo " all - Format, lint, test, and build"
@echo " build - Build the project in release mode"
@echo " musl - Build static MUSL binary (x86_64-unknown-linux-musl)"
@echo " test - Run tests"
@echo " clean - Clean build artifacts"
@echo " fmt - Format code"
@echo " fmt-check - Check if code is formatted"
@echo " clippy - Run clippy linter"
@echo " audit - Run security audit"
@echo " outdated - Check for outdated dependencies"
@echo " docs - Generate and open documentation"
@echo " install - Install chopper locally"
@echo " ci - Run all CI checks"
@echo " setup - Install required tools"
@echo " bench - Run benchmarks"
@echo " pre-commit - Check everything before committing"
@echo " help - Show this help message"