-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (74 loc) · 3.13 KB
/
Makefile
File metadata and controls
95 lines (74 loc) · 3.13 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
.PHONY: build dev devel check fix test test-unit test-integration setup clean stats arm-devel arm x86-devel x86 setup-arm setup-x86 demo man
DEFAULT_TARGET := build
ARM_TARGET ?= aarch64-unknown-linux-musl
X86_TARGET ?= x86_64-unknown-linux-musl
CORE_WORKSPACE := --workspace --exclude otlp-demo
MANPAGE_MD := $(wildcard doc/manpage/*.1.md)
MANPAGE_OUT := $(MANPAGE_MD:.md=)
build: setup
cargo build $(CORE_WORKSPACE) --release
dev: setup
cargo build --verbose $(CORE_WORKSPACE)
devel: dev
check: setup
cargo clippy $(CORE_WORKSPACE) --all-targets --all-features -- -D warnings
fix: setup
cargo clippy $(CORE_WORKSPACE) --fix --all-targets --all-features --allow-dirty --allow-staged -- -D warnings
test: setup
cargo build -p ljd -p ljx
cargo build -p otlp-demo --bin otlp-bofh-emitter
@if command -v cargo-nextest >/dev/null 2>&1; then \
cargo nextest run $(CORE_WORKSPACE); \
else \
echo "cargo-nextest not available, falling back to cargo test $(CORE_WORKSPACE)"; \
cargo test $(CORE_WORKSPACE); \
fi
test-unit: setup
@if command -v cargo-nextest >/dev/null 2>&1; then \
cargo nextest run -p logjet --lib -p ljd --bins -p ljx --bin ljx; \
else \
echo "cargo-nextest not available, falling back to cargo test unit-only targets"; \
cargo test -p logjet --lib; \
cargo test -p ljd --bin ljd; \
cargo test -p ljx --bin ljx; \
fi
test-integration: setup
cargo build -p ljd -p ljx
cargo build -p otlp-demo --bin otlp-bofh-emitter
@if command -v cargo-nextest >/dev/null 2>&1; then \
cargo nextest run -p ljd --test bridge_flows; \
cargo nextest run -p logjet --test ljx_cli; \
else \
echo "cargo-nextest not available, falling back to cargo test integration targets"; \
cargo test -p ljd --test bridge_flows; \
cargo test -p logjet --test ljx_cli; \
fi
arm-devel: setup setup-arm
cargo build $(CORE_WORKSPACE) --target $(ARM_TARGET)
arm: setup setup-arm
cargo build $(CORE_WORKSPACE) --release --target $(ARM_TARGET)
x86-devel: setup setup-x86
cargo build $(CORE_WORKSPACE) --target $(X86_TARGET)
x86: setup setup-x86
cargo build $(CORE_WORKSPACE) --release --target $(X86_TARGET)
demo: devel
cargo build -p otlp-demo
man: $(MANPAGE_OUT)
$(MANPAGE_OUT): doc/manpage/%.1: doc/manpage/%.1.md
@command -v pandoc >/dev/null 2>&1 || { echo "pandoc not found. Install pandoc to build manpages."; exit 1; }
@mkdir -p doc/manpage
pandoc --standalone --to man $< -o $@
clean:
cargo clean
stats:
tokei . --exclude target --exclude .git
setup:
@command -v rustc >/dev/null 2>&1 || { echo "rustc not found. Install Rust from https://rustup.rs"; exit 1; }
@command -v cargo >/dev/null 2>&1 || { echo "cargo not found. Install Rust from https://rustup.rs"; exit 1; }
@command -v rustup >/dev/null 2>&1 || { echo "rustup not found. Install Rust from https://rustup.rs"; exit 1; }
@cargo clippy --version >/dev/null 2>&1 || { echo "clippy is missing. Run: rustup component add clippy"; exit 1; }
@echo "Rust toolchain looks ready."
setup-arm:
@rustup target list --installed | grep -qx "$(ARM_TARGET)" || rustup target add "$(ARM_TARGET)"
setup-x86:
@rustup target list --installed | grep -qx "$(X86_TARGET)" || rustup target add "$(X86_TARGET)"