forked from kipz/nono
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
146 lines (114 loc) · 3.46 KB
/
Copy pathMakefile
File metadata and controls
146 lines (114 loc) · 3.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# nono - Makefile for library and CLI
#
# Usage:
# make Build everything
# make test Run all tests
# make check Run clippy and format check
# make release Build release binaries
.PHONY: all build build-lib build-cli build-ffi build-arm64 test test-lib test-cli test-ffi check clippy fmt clean install audit help
# Default target
all: build
# Build targets
build: build-lib build-cli
build-lib:
cargo build -p nono
build-cli:
cargo build -p nono-cli
build-ffi:
cargo build -p nono-ffi
build-release:
cargo build --release
build-release-lib:
cargo build --release -p nono
build-release-cli:
cargo build --release -p nono-cli
# Cross-compilation: Linux ARM64 (aarch64-unknown-linux-gnu)
# Uses `cross` which handles both native (ARM64) and cross-compilation (e.g. x86_64).
# On native Linux ARM64, you may need to install `libdbus-1-dev` and `pkg-config`.
# If `cross` fails with "may not be able to run on this system",
# install from git: cargo install cross --git https://github.com/cross-rs/cross
build-arm64:
@cross build --release --target aarch64-unknown-linux-gnu -p nono-cli
# Test targets
test: test-lib test-cli test-ffi
test-lib:
cargo test -p nono
test-cli:
cargo test -p nono-cli
test-ffi:
cargo test -p nono-ffi
test-doc:
cargo test --doc
# Check targets (lint + format)
check: clippy fmt-check
clippy:
cargo clippy --workspace --all-targets --all-features -- -D warnings -D clippy::unwrap_used
clippy-fix:
cargo clippy --fix --allow-dirty
fmt:
cargo fmt --all
fmt-check:
cargo fmt --all -- --check
# Clean
clean:
cargo clean
# Install CLI to ~/.cargo/bin
install:
cargo install --path crates/nono-cli
# Run the CLI (for quick testing)
run:
cargo run -p nono-cli -- --help
run-setup:
cargo run -p nono-cli -- setup --check-only
run-dry:
cargo run -p nono-cli -- run --allow-cwd --dry-run -- echo "test"
# Development helpers
watch:
cargo watch -x 'build -p nono-cli'
watch-test:
cargo watch -x 'test'
# Documentation
doc:
cargo doc --no-deps --open
doc-lib:
cargo doc -p nono --no-deps --open
# Security audit
audit:
cargo audit
# CI simulation (what CI would run)
ci: check test audit
@echo "CI checks passed"
# Help
help:
@echo "nono Makefile targets:"
@echo ""
@echo "Build:"
@echo " make build Build library and CLI (debug)"
@echo " make build-lib Build library only"
@echo " make build-cli Build CLI only"
@echo " make build-ffi Build C FFI bindings"
@echo " make build-release Build release binaries"
@echo " make build-arm64 Build CLI for Linux ARM64 (cargo on Linux ARM64; cross elsewhere)"
@echo ""
@echo "Test:"
@echo " make test Run all tests"
@echo " make test-lib Run library tests only"
@echo " make test-cli Run CLI tests only"
@echo " make test-ffi Run C FFI tests only"
@echo " make test-doc Run doc tests only"
@echo ""
@echo "Check:"
@echo " make check Run clippy and format check"
@echo " make clippy Run clippy linter"
@echo " make fmt Format code"
@echo " make fmt-check Check formatting"
@echo ""
@echo "Security:"
@echo " make audit Run cargo audit for vulnerabilities"
@echo ""
@echo "Other:"
@echo " make install Install CLI to ~/.cargo/bin"
@echo " make clean Clean build artifacts"
@echo " make doc Generate and open documentation"
@echo " make ci Simulate CI checks"
@echo " make help Show this help"