-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
116 lines (93 loc) · 3.01 KB
/
Makefile
File metadata and controls
116 lines (93 loc) · 3.01 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
110
111
112
113
114
115
116
# Makefile for misec
# Binary name
BINARY_NAME := misec
# Install directory
INSTALL_DIR := $(HOME)/bin
# Cargo flags
CARGO_FLAGS := --release
.PHONY: all build release install clean test check fmt lint help ci ci-quick ci-full coverage
# Default target
all: build
# Build debug version
build:
cargo build
# Build release version
release:
cargo build $(CARGO_FLAGS)
# Build and install to ~/bin
install: release
@mkdir -p $(INSTALL_DIR)
@cp target/release/$(BINARY_NAME) $(INSTALL_DIR)/$(BINARY_NAME)
@echo "Installed $(BINARY_NAME) to $(INSTALL_DIR)/$(BINARY_NAME)"
# Uninstall from ~/bin
uninstall:
@rm -f $(INSTALL_DIR)/$(BINARY_NAME)
@echo "Removed $(BINARY_NAME) from $(INSTALL_DIR)"
# Clean build artifacts
clean:
cargo clean
# Run tests
test:
cargo test
# Run full test suite
fulltest:
./fulltest.sh
# Check code without building
check:
cargo check
# Format code
fmt:
cargo fmt
# Run clippy linter
lint:
cargo clippy -- -D warnings
# Run tests with coverage (requires cargo-tarpaulin)
coverage:
@command -v cargo-tarpaulin >/dev/null 2>&1 || { echo "Installing cargo-tarpaulin..."; cargo install cargo-tarpaulin; }
cargo tarpaulin --out Html --out Json --output-dir target/tarpaulin --all-features --ignore-tests
@echo "Coverage report: target/tarpaulin/tarpaulin-report.html"
# Run tests with coverage and open report
coverage-open: coverage
@open target/tarpaulin/tarpaulin-report.html 2>/dev/null || xdg-open target/tarpaulin/tarpaulin-report.html 2>/dev/null || echo "Open target/tarpaulin/tarpaulin-report.html manually"
# CI: Standard CI check (fmt + lint + check + test + build)
ci:
./ci.sh
# CI: Quick check (fmt + lint + check)
ci-quick:
./ci.sh quick
# CI: Full check (all + fulltest)
ci-full:
./ci.sh full
# Build with all features
build-all:
cargo build $(CARGO_FLAGS) --all-features
# Install with all features
install-all: build-all
@mkdir -p $(INSTALL_DIR)
@cp target/release/$(BINARY_NAME) $(INSTALL_DIR)/$(BINARY_NAME)
@echo "Installed $(BINARY_NAME) (all features) to $(INSTALL_DIR)/$(BINARY_NAME)"
# Show help
help:
@echo "mise Makefile"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " all Build debug version (default)"
@echo " build Build debug version"
@echo " release Build release version"
@echo " install Build release and install to ~/bin"
@echo " install-all Build with all features and install to ~/bin"
@echo " uninstall Remove binary from ~/bin"
@echo " clean Clean build artifacts"
@echo " test Run tests"
@echo " fulltest Run full test suite"
@echo " check Check code without building"
@echo " fmt Format code"
@echo " lint Run clippy linter"
@echo " coverage Run tests with coverage report"
@echo " coverage-open Run coverage and open HTML report"
@echo " ci Run standard CI checks"
@echo " ci-quick Run quick CI checks (no test/build)"
@echo " ci-full Run full CI checks (including fulltest)"
@echo " help Show this help message"