xref: /DragonOS/user/apps/test-mount/Makefile (revision 1d37ca6d172e01a98fa6785d2b3e07fb8202a4a9)
1*1d37ca6dSDonkey KaneTOOLCHAIN="+nightly-2023-08-15-x86_64-unknown-linux-gnu"
2*1d37ca6dSDonkey KaneRUSTFLAGS+=""
3*1d37ca6dSDonkey Kane
4*1d37ca6dSDonkey Kaneifdef DADK_CURRENT_BUILD_DIR
5*1d37ca6dSDonkey Kane# 如果是在dadk中编译,那么安装到dadk的安装目录中
6*1d37ca6dSDonkey Kane	INSTALL_DIR = $(DADK_CURRENT_BUILD_DIR)
7*1d37ca6dSDonkey Kaneelse
8*1d37ca6dSDonkey Kane# 如果是在本地编译,那么安装到当前目录下的install目录中
9*1d37ca6dSDonkey Kane	INSTALL_DIR = ./install
10*1d37ca6dSDonkey Kaneendif
11*1d37ca6dSDonkey Kane
12*1d37ca6dSDonkey Kaneifeq ($(ARCH), x86_64)
13*1d37ca6dSDonkey Kane	export RUST_TARGET=x86_64-unknown-linux-musl
14*1d37ca6dSDonkey Kaneelse ifeq ($(ARCH), riscv64)
15*1d37ca6dSDonkey Kane	export RUST_TARGET=riscv64gc-unknown-linux-gnu
16*1d37ca6dSDonkey Kaneelse
17*1d37ca6dSDonkey Kane# 默认为x86_86,用于本地编译
18*1d37ca6dSDonkey Kane	export RUST_TARGET=x86_64-unknown-linux-musl
19*1d37ca6dSDonkey Kaneendif
20*1d37ca6dSDonkey Kane
21*1d37ca6dSDonkey Kanerun:
22*1d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET)
23*1d37ca6dSDonkey Kane
24*1d37ca6dSDonkey Kanebuild:
25*1d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET)
26*1d37ca6dSDonkey Kane
27*1d37ca6dSDonkey Kaneclean:
28*1d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET)
29*1d37ca6dSDonkey Kane
30*1d37ca6dSDonkey Kanetest:
31*1d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET)
32*1d37ca6dSDonkey Kane
33*1d37ca6dSDonkey Kanedoc:
34*1d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) doc --target $(RUST_TARGET)
35*1d37ca6dSDonkey Kane
36*1d37ca6dSDonkey Kanefmt:
37*1d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt
38*1d37ca6dSDonkey Kane
39*1d37ca6dSDonkey Kanefmt-check:
40*1d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt --check
41*1d37ca6dSDonkey Kane
42*1d37ca6dSDonkey Kanerun-release:
43*1d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET) --release
44*1d37ca6dSDonkey Kane
45*1d37ca6dSDonkey Kanebuild-release:
46*1d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET) --release
47*1d37ca6dSDonkey Kane
48*1d37ca6dSDonkey Kaneclean-release:
49*1d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET) --release
50*1d37ca6dSDonkey Kane
51*1d37ca6dSDonkey Kanetest-release:
52*1d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET) --release
53*1d37ca6dSDonkey Kane
54*1d37ca6dSDonkey Kane.PHONY: install
55*1d37ca6dSDonkey Kaneinstall:
56*1d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --target $(RUST_TARGET) --path . --no-track --root $(INSTALL_DIR) --force
57