-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (43 loc) · 1.39 KB
/
Makefile
File metadata and controls
54 lines (43 loc) · 1.39 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
ifdef DADK_CURRENT_BUILD_DIR
# 如果是在dadk中编译,那么安装到dadk的安装目录中
INSTALL_DIR = $(DADK_CURRENT_BUILD_DIR)
else
# 如果是在本地编译,那么安装到当前目录下的install目录中
INSTALL_DIR = ./install
endif
ifeq ($(ARCH), x86_64)
export RUST_TARGET=x86_64-unknown-linux-musl
else ifeq ($(ARCH), riscv64)
export RUST_TARGET=riscv64gc-unknown-linux-gnu
else
# 默认为x86_86,用于本地编译
export RUST_TARGET=x86_64-unknown-linux-musl
endif
.PHONY: fmt fmt-check test build clean help install
# Default target
help:
@echo "Available targets:"
@echo " fmt - Format all Rust files in the workspace"
@echo " fmt-check - Check if all files are formatted"
@echo " test - Run all tests"
@echo " build - Build all workspace members"
@echo " clean - Clean build artifacts"
# Format all Rust files
fmt:
@find crate -name "*.rs" -type f -exec rustfmt --edition 2024 --config-path rustfmt.toml {} +
@echo "Done!"
# Check if all files are formatted
fmt-check:
@echo "Checking formatting..."
@find crate -name "*.rs" -type f -exec rustfmt --edition 2024 --config-path rustfmt.toml --check {} +
# Run tests
test:
cargo test --all
# Build all workspace members
build:
cargo build --all
# Clean build artifacts
clean:
cargo clean
install:
cargo install --target $(RUST_TARGET) --path crate/cli --no-track --root $(INSTALL_DIR) --force