xref: /DragonOS/user/apps/test-for-robustfutex/Makefile (revision 7c28051e8c601312d3d0fd7bcb71bc71450d10c0)
1*7c28051eSlinfengTOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu"
206560afaShmtRUSTFLAGS+=""
306560afaShmt
406560afaShmtifdef DADK_CURRENT_BUILD_DIR
506560afaShmt# 如果是在dadk中编译,那么安装到dadk的安装目录中
606560afaShmt	INSTALL_DIR = $(DADK_CURRENT_BUILD_DIR)
706560afaShmtelse
806560afaShmt# 如果是在本地编译,那么安装到当前目录下的install目录中
906560afaShmt	INSTALL_DIR = ./install
1006560afaShmtendif
1106560afaShmt
1206560afaShmtifeq ($(ARCH), x86_64)
1306560afaShmt	export RUST_TARGET=x86_64-unknown-linux-musl
1406560afaShmtelse ifeq ($(ARCH), riscv64)
1506560afaShmt	export RUST_TARGET=riscv64gc-unknown-linux-gnu
1606560afaShmtelse
1706560afaShmt# 默认为x86_86,用于本地编译
1806560afaShmt	export RUST_TARGET=x86_64-unknown-linux-musl
1906560afaShmtendif
2006560afaShmt
2106560afaShmtrun:
2206560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET)
2306560afaShmt
2406560afaShmtbuild:
2506560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET)
2606560afaShmt
2706560afaShmtclean:
2806560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET)
2906560afaShmt
3006560afaShmttest:
3106560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET)
3206560afaShmt
3306560afaShmtdoc:
3406560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) doc --target $(RUST_TARGET)
3506560afaShmt
3606560afaShmtfmt:
3706560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt
3806560afaShmt
3906560afaShmtfmt-check:
4006560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt --check
4106560afaShmt
4206560afaShmtrun-release:
4306560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET) --release
4406560afaShmt
4506560afaShmtbuild-release:
4606560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET) --release
4706560afaShmt
4806560afaShmtclean-release:
4906560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET) --release
5006560afaShmt
5106560afaShmttest-release:
5206560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET) --release
5306560afaShmt
5406560afaShmt.PHONY: install
5506560afaShmtinstall:
5606560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --target $(RUST_TARGET) --path . --no-track --root $(INSTALL_DIR) --force
57