xref: /DragonOS/user/apps/test-for-robustfutex/Makefile (revision 06560afa2aa4db352526f4be8b6262719b8b3eac)
1*06560afaShmtTOOLCHAIN="+nightly-2023-08-15-x86_64-unknown-linux-gnu"
2*06560afaShmtRUSTFLAGS+=""
3*06560afaShmt
4*06560afaShmtifdef DADK_CURRENT_BUILD_DIR
5*06560afaShmt# 如果是在dadk中编译,那么安装到dadk的安装目录中
6*06560afaShmt	INSTALL_DIR = $(DADK_CURRENT_BUILD_DIR)
7*06560afaShmtelse
8*06560afaShmt# 如果是在本地编译,那么安装到当前目录下的install目录中
9*06560afaShmt	INSTALL_DIR = ./install
10*06560afaShmtendif
11*06560afaShmt
12*06560afaShmtifeq ($(ARCH), x86_64)
13*06560afaShmt	export RUST_TARGET=x86_64-unknown-linux-musl
14*06560afaShmtelse ifeq ($(ARCH), riscv64)
15*06560afaShmt	export RUST_TARGET=riscv64gc-unknown-linux-gnu
16*06560afaShmtelse
17*06560afaShmt# 默认为x86_86,用于本地编译
18*06560afaShmt	export RUST_TARGET=x86_64-unknown-linux-musl
19*06560afaShmtendif
20*06560afaShmt
21*06560afaShmtrun:
22*06560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET)
23*06560afaShmt
24*06560afaShmtbuild:
25*06560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET)
26*06560afaShmt
27*06560afaShmtclean:
28*06560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET)
29*06560afaShmt
30*06560afaShmttest:
31*06560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET)
32*06560afaShmt
33*06560afaShmtdoc:
34*06560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) doc --target $(RUST_TARGET)
35*06560afaShmt
36*06560afaShmtfmt:
37*06560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt
38*06560afaShmt
39*06560afaShmtfmt-check:
40*06560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt --check
41*06560afaShmt
42*06560afaShmtrun-release:
43*06560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET) --release
44*06560afaShmt
45*06560afaShmtbuild-release:
46*06560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET) --release
47*06560afaShmt
48*06560afaShmtclean-release:
49*06560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET) --release
50*06560afaShmt
51*06560afaShmttest-release:
52*06560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET) --release
53*06560afaShmt
54*06560afaShmt.PHONY: install
55*06560afaShmtinstall:
56*06560afaShmt	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --target $(RUST_TARGET) --path . --no-track --root $(INSTALL_DIR) --force
57