xref: /StarryEngine/starry_applications/Makefile (revision 49182ea7bc0263215864dd04cd265e345a4af8f5)
1*49182ea7SR0ronoaifdef DADK_CURRENT_BUILD_DIR
2*49182ea7SR0ronoa# 如果是在dadk中编译,那么安装到dadk的安装目录中
3*49182ea7SR0ronoa	INSTALL_DIR = $(DADK_CURRENT_BUILD_DIR)
4*49182ea7SR0ronoaelse
5*49182ea7SR0ronoa# 如果是在本地编译,那么安装到当前目录下的install目录中
6*49182ea7SR0ronoa	INSTALL_DIR = ./install
7*49182ea7SR0ronoaendif
8*49182ea7SR0ronoa
9*49182ea7SR0ronoaifeq ($(ARCH), x86_64)
10*49182ea7SR0ronoa	export RUST_TARGET=x86_64-unknown-linux-musl
11*49182ea7SR0ronoaelse ifeq ($(ARCH), riscv64)
12*49182ea7SR0ronoa	export RUST_TARGET=riscv64gc-unknown-linux-gnu
13*49182ea7SR0ronoaelse
14*49182ea7SR0ronoa# 默认为x86_86,用于本地编译
15*49182ea7SR0ronoa	export RUST_TARGET=x86_64-unknown-linux-musl
16*49182ea7SR0ronoaendif
17*49182ea7SR0ronoa
18*49182ea7SR0ronoarun:
19*49182ea7SR0ronoa	cargo run --target $(RUST_TARGET)
20*49182ea7SR0ronoa
21*49182ea7SR0ronoabuild:
22*49182ea7SR0ronoa	cargo build --target $(RUST_TARGET)
23*49182ea7SR0ronoa
24*49182ea7SR0ronoaclean:
25*49182ea7SR0ronoa	cargo clean --target $(RUST_TARGET)
26*49182ea7SR0ronoa
27*49182ea7SR0ronoatest:
28*49182ea7SR0ronoa	cargo test --target $(RUST_TARGET)
29*49182ea7SR0ronoa
30*49182ea7SR0ronoadoc:
31*49182ea7SR0ronoa	cargo doc --target $(RUST_TARGET)
32*49182ea7SR0ronoa
33*49182ea7SR0ronoafmt:
34*49182ea7SR0ronoa	cargo fmt
35*49182ea7SR0ronoa
36*49182ea7SR0ronoafmt-check:
37*49182ea7SR0ronoa	cargo fmt --check
38*49182ea7SR0ronoa
39*49182ea7SR0ronoarun-release:
40*49182ea7SR0ronoa	cargo run --target $(RUST_TARGET) --release
41*49182ea7SR0ronoa
42*49182ea7SR0ronoabuild-release:
43*49182ea7SR0ronoa	cargo build --target $(RUST_TARGET) --release
44*49182ea7SR0ronoa
45*49182ea7SR0ronoaclean-release:
46*49182ea7SR0ronoa	cargo clean --target $(RUST_TARGET) --release
47*49182ea7SR0ronoa
48*49182ea7SR0ronoatest-release:
49*49182ea7SR0ronoa	cargo test --target $(RUST_TARGET) --release
50*49182ea7SR0ronoa
51*49182ea7SR0ronoa.PHONY: install
52*49182ea7SR0ronoainstall:
53*49182ea7SR0ronoa	cargo install --target $(RUST_TARGET) --path . --no-track --root $(INSTALL_DIR) --force
54