Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (61 loc) · 2.14 KB
/
Copy pathMakefile
File metadata and controls
74 lines (61 loc) · 2.14 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
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2026 Nutanix, Inc. All rights reserved.
#
# Author: Thanos Makatos <thanos.makatos@nutanix.com>
TARGET ?= debug
# Extra cargo feature flags. Defaults come from Cargo.toml
# (`qemu`, `threshold-engine`, `tui`). Examples:
# make # default features, including iothread-tui
# make CARGO_FEATURES='--no-default-features --features qemu-backend,threshold-engine'
# # daemon only (no TUI)
CARGO_FEATURES ?=
.PHONY: all
all: $(TARGET)
.PHONY: debug
debug:
$(CARGO_BUILD)
.PHONY: release
release:
$(CARGO_BUILD) --release
CARGO_FMT_FLAGS = --config wrap_comments=true
CARGO_FMT = cargo fmt --all -- $(CARGO_FMT_FLAGS)
CARGO_CLIPPY = cargo clippy --all-features --all-targets --tests --locked
CARGO_CLIPPY_FLAGS = -- -D warnings -D clippy::use_self -W dead_code
CARGO_BUILD = cargo build --locked $(CARGO_FEATURES)
.PHONY: check
check:
$(CARGO_FMT) --check
$(CARGO_CLIPPY) $(CARGO_CLIPPY_FLAGS)
.PHONY: fix
fix:
$(CARGO_FMT)
$(CARGO_CLIPPY) --fix --allow-dirty --allow-staged \
$(CARGO_CLIPPY_FLAGS)
.PHONY: clean
clean:
cargo clean
.PHONY: unit-test
unit-test:
RUST_BACKTRACE=1 cargo test --all-features
.PHONY: test
test: unit-test
.PHONY: pre-push
pre-push: check test
.PHONY: install
install: $(TARGET)
install -D -m 0755 target/$(TARGET)/io-thread-controller \
${DESTDIR}/usr/libexec/io-thread-controller
install -D -m 0644 io-thread-controller.json \
${DESTDIR}/etc/io-thread-controller.json
install -D -m 0644 io-thread-controller.d/engines/threshold.json \
${DESTDIR}/etc/io-thread-controller.d/engines/threshold.json
install -D -m 0644 io-thread-controller.d/backends/qemu.json \
${DESTDIR}/etc/io-thread-controller.d/backends/qemu.json
install -D -m 0644 io-thread-controller.service \
${DESTDIR}/usr/lib/systemd/system/io-thread-controller.service
install -D -m 0644 com.nutanix.io_thread_controller.conf \
${DESTDIR}/etc/dbus-1/system.d/com.nutanix.io_thread_controller.conf
if [ -f target/$(TARGET)/iothread-tui ]; then \
install -D -m 0755 target/$(TARGET)/iothread-tui \
${DESTDIR}/usr/bin/iothread-tui; \
fi