xref: /DragonOS/user/apps/test_lo/Makefile (revision 1ea2daad8121b77ed704e6d7c3a09f478147441d)
1*1ea2daadSSMALLCTOOLCHAIN=
2*1ea2daadSSMALLCRUSTFLAGS=
3*1ea2daadSSMALLC
4*1ea2daadSSMALLCifdef DADK_CURRENT_BUILD_DIR
5*1ea2daadSSMALLC# 如果是在dadk中编译,那么安装到dadk的安装目录中
6*1ea2daadSSMALLC	INSTALL_DIR = $(DADK_CURRENT_BUILD_DIR)
7*1ea2daadSSMALLCelse
8*1ea2daadSSMALLC# 如果是在本地编译,那么安装到当前目录下的install目录中
9*1ea2daadSSMALLC	INSTALL_DIR = ./install
10*1ea2daadSSMALLCendif
11*1ea2daadSSMALLC
12*1ea2daadSSMALLCifeq ($(ARCH), x86_64)
13*1ea2daadSSMALLC	export RUST_TARGET=x86_64-unknown-linux-musl
14*1ea2daadSSMALLCelse ifeq ($(ARCH), riscv64)
15*1ea2daadSSMALLC	export RUST_TARGET=riscv64gc-unknown-linux-gnu
16*1ea2daadSSMALLCelse
17*1ea2daadSSMALLC# 默认为x86_86,用于本地编译
18*1ea2daadSSMALLC	export RUST_TARGET=x86_64-unknown-linux-musl
19*1ea2daadSSMALLCendif
20*1ea2daadSSMALLC
21*1ea2daadSSMALLCrun:
22*1ea2daadSSMALLC	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET)
23*1ea2daadSSMALLC
24*1ea2daadSSMALLCbuild:
25*1ea2daadSSMALLC	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET)
26*1ea2daadSSMALLC
27*1ea2daadSSMALLCclean:
28*1ea2daadSSMALLC	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET)
29*1ea2daadSSMALLC
30*1ea2daadSSMALLCtest:
31*1ea2daadSSMALLC	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET)
32*1ea2daadSSMALLC
33*1ea2daadSSMALLCdoc:
34*1ea2daadSSMALLC	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) doc --target $(RUST_TARGET)
35*1ea2daadSSMALLC
36*1ea2daadSSMALLCfmt:
37*1ea2daadSSMALLC	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt
38*1ea2daadSSMALLC
39*1ea2daadSSMALLCfmt-check:
40*1ea2daadSSMALLC	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt --check
41*1ea2daadSSMALLC
42*1ea2daadSSMALLCrun-release:
43*1ea2daadSSMALLC	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET) --release
44*1ea2daadSSMALLC
45*1ea2daadSSMALLCbuild-release:
46*1ea2daadSSMALLC	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET) --release
47*1ea2daadSSMALLC
48*1ea2daadSSMALLCclean-release:
49*1ea2daadSSMALLC	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET) --release
50*1ea2daadSSMALLC
51*1ea2daadSSMALLCtest-release:
52*1ea2daadSSMALLC	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET) --release
53*1ea2daadSSMALLC
54*1ea2daadSSMALLC.PHONY: install
55*1ea2daadSSMALLCinstall:
56*1ea2daadSSMALLC	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --target $(RUST_TARGET) --path . --no-track --root $(INSTALL_DIR) --force
57