xref: /DragonOS/user/apps/test-mount/Makefile (revision 7c28051e8c601312d3d0fd7bcb71bc71450d10c0)
1*7c28051eSlinfengTOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu"
21d37ca6dSDonkey KaneRUSTFLAGS+=""
31d37ca6dSDonkey Kane
41d37ca6dSDonkey Kaneifdef DADK_CURRENT_BUILD_DIR
51d37ca6dSDonkey Kane# 如果是在dadk中编译,那么安装到dadk的安装目录中
61d37ca6dSDonkey Kane	INSTALL_DIR = $(DADK_CURRENT_BUILD_DIR)
71d37ca6dSDonkey Kaneelse
81d37ca6dSDonkey Kane# 如果是在本地编译,那么安装到当前目录下的install目录中
91d37ca6dSDonkey Kane	INSTALL_DIR = ./install
101d37ca6dSDonkey Kaneendif
111d37ca6dSDonkey Kane
121d37ca6dSDonkey Kaneifeq ($(ARCH), x86_64)
131d37ca6dSDonkey Kane	export RUST_TARGET=x86_64-unknown-linux-musl
141d37ca6dSDonkey Kaneelse ifeq ($(ARCH), riscv64)
151d37ca6dSDonkey Kane	export RUST_TARGET=riscv64gc-unknown-linux-gnu
161d37ca6dSDonkey Kaneelse
171d37ca6dSDonkey Kane# 默认为x86_86,用于本地编译
181d37ca6dSDonkey Kane	export RUST_TARGET=x86_64-unknown-linux-musl
191d37ca6dSDonkey Kaneendif
201d37ca6dSDonkey Kane
211d37ca6dSDonkey Kanerun:
221d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET)
231d37ca6dSDonkey Kane
241d37ca6dSDonkey Kanebuild:
251d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET)
261d37ca6dSDonkey Kane
271d37ca6dSDonkey Kaneclean:
281d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET)
291d37ca6dSDonkey Kane
301d37ca6dSDonkey Kanetest:
311d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET)
321d37ca6dSDonkey Kane
331d37ca6dSDonkey Kanedoc:
341d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) doc --target $(RUST_TARGET)
351d37ca6dSDonkey Kane
361d37ca6dSDonkey Kanefmt:
371d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt
381d37ca6dSDonkey Kane
391d37ca6dSDonkey Kanefmt-check:
401d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt --check
411d37ca6dSDonkey Kane
421d37ca6dSDonkey Kanerun-release:
431d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET) --release
441d37ca6dSDonkey Kane
451d37ca6dSDonkey Kanebuild-release:
461d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET) --release
471d37ca6dSDonkey Kane
481d37ca6dSDonkey Kaneclean-release:
491d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET) --release
501d37ca6dSDonkey Kane
511d37ca6dSDonkey Kanetest-release:
521d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET) --release
531d37ca6dSDonkey Kane
541d37ca6dSDonkey Kane.PHONY: install
551d37ca6dSDonkey Kaneinstall:
561d37ca6dSDonkey Kane	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --target $(RUST_TARGET) --path . --no-track --root $(INSTALL_DIR) --force
57