xref: /DragonOS/user/apps/test_tokio/Makefile (revision 7c28051e8c601312d3d0fd7bcb71bc71450d10c0)
1*7c28051eSlinfengTOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu"
24afc5b7bSlinfengRUSTFLAGS+=""
34afc5b7bSlinfeng
44afc5b7bSlinfengifdef DADK_CURRENT_BUILD_DIR
54afc5b7bSlinfeng# 如果是在dadk中编译,那么安装到dadk的安装目录中
64afc5b7bSlinfeng	INSTALL_DIR = $(DADK_CURRENT_BUILD_DIR)
74afc5b7bSlinfengelse
84afc5b7bSlinfeng# 如果是在本地编译,那么安装到当前目录下的install目录中
94afc5b7bSlinfeng	INSTALL_DIR = ./install
104afc5b7bSlinfengendif
114afc5b7bSlinfeng
124afc5b7bSlinfengifeq ($(ARCH), x86_64)
134afc5b7bSlinfeng	export RUST_TARGET=x86_64-unknown-linux-musl
144afc5b7bSlinfengelse ifeq ($(ARCH), riscv64)
154afc5b7bSlinfeng	export RUST_TARGET=riscv64gc-unknown-linux-gnu
164afc5b7bSlinfengelse
174afc5b7bSlinfeng# 默认为x86_86,用于本地编译
184afc5b7bSlinfeng	export RUST_TARGET=x86_64-unknown-linux-musl
194afc5b7bSlinfengendif
204afc5b7bSlinfeng
214afc5b7bSlinfengrun:
224afc5b7bSlinfeng	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET)
234afc5b7bSlinfeng
244afc5b7bSlinfengbuild:
254afc5b7bSlinfeng	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET)
264afc5b7bSlinfeng
274afc5b7bSlinfengclean:
284afc5b7bSlinfeng	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET)
294afc5b7bSlinfeng
304afc5b7bSlinfengtest:
314afc5b7bSlinfeng	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET)
324afc5b7bSlinfeng
334afc5b7bSlinfengdoc:
344afc5b7bSlinfeng	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) doc --target $(RUST_TARGET)
354afc5b7bSlinfeng
364afc5b7bSlinfengfmt:
374afc5b7bSlinfeng	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt
384afc5b7bSlinfeng
394afc5b7bSlinfengfmt-check:
404afc5b7bSlinfeng	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt --check
414afc5b7bSlinfeng
424afc5b7bSlinfengrun-release:
434afc5b7bSlinfeng	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET) --release
444afc5b7bSlinfeng
454afc5b7bSlinfengbuild-release:
464afc5b7bSlinfeng	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET) --release
474afc5b7bSlinfeng
484afc5b7bSlinfengclean-release:
494afc5b7bSlinfeng	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET) --release
504afc5b7bSlinfeng
514afc5b7bSlinfengtest-release:
524afc5b7bSlinfeng	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET) --release
534afc5b7bSlinfeng
544afc5b7bSlinfeng.PHONY: install
554afc5b7bSlinfenginstall:
564afc5b7bSlinfeng	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --target $(RUST_TARGET) --path . --no-track --root $(INSTALL_DIR) --force
57