xref: /StarryEngine/starry_toolkit/Makefile (revision f33c7b22a5870071cca9eef34949e88cd35c55ba)
11c11e7deSyuyi2439ifdef DADK_CURRENT_BUILD_DIR
245e17157SR0ronoa# 如果是在dadk中编译,那么安装到dadk的安装目录中
31c11e7deSyuyi2439	INSTALL_DIR = $(DADK_CURRENT_BUILD_DIR)
41c11e7deSyuyi2439else
545e17157SR0ronoa# 如果是在本地编译,那么安装到当前目录下的install目录中
61c11e7deSyuyi2439	INSTALL_DIR = ./install
71c11e7deSyuyi2439endif
845e17157SR0ronoa
91c11e7deSyuyi2439ifeq ($(ARCH), x86_64)
101c11e7deSyuyi2439	export RUST_TARGET=x86_64-unknown-linux-musl
111c11e7deSyuyi2439else ifeq ($(ARCH), riscv64)
121c11e7deSyuyi2439	export RUST_TARGET=riscv64gc-unknown-linux-gnu
131c11e7deSyuyi2439else
141c11e7deSyuyi2439# 默认为x86_86,用于本地编译
151c11e7deSyuyi2439	export RUST_TARGET=x86_64-unknown-linux-musl
161c11e7deSyuyi2439endif
1745e17157SR0ronoa
1845e17157SR0ronoarun:
19*f33c7b22Syuyi2439	cargo run --target $(RUST_TARGET)
2045e17157SR0ronoa
2145e17157SR0ronoabuild:
22*f33c7b22Syuyi2439	cargo build --target $(RUST_TARGET)
2345e17157SR0ronoa
2445e17157SR0ronoaclean:
25*f33c7b22Syuyi2439	cargo clean --target $(RUST_TARGET)
2645e17157SR0ronoa
2745e17157SR0ronoatest:
28*f33c7b22Syuyi2439	cargo test --target $(RUST_TARGET)
2945e17157SR0ronoa
3045e17157SR0ronoadoc:
31*f33c7b22Syuyi2439	cargo doc --target $(RUST_TARGET)
321c11e7deSyuyi2439
331c11e7deSyuyi2439fmt:
34*f33c7b22Syuyi2439	cargo fmt
351c11e7deSyuyi2439
361c11e7deSyuyi2439fmt-check:
37*f33c7b22Syuyi2439	cargo fmt --check
3845e17157SR0ronoa
3945e17157SR0ronoarun-release:
40*f33c7b22Syuyi2439	cargo run --target $(RUST_TARGET) --release
4145e17157SR0ronoa
4245e17157SR0ronoabuild-release:
43*f33c7b22Syuyi2439	cargo build --target $(RUST_TARGET) --release
4445e17157SR0ronoa
4545e17157SR0ronoaclean-release:
46*f33c7b22Syuyi2439	cargo clean --target $(RUST_TARGET) --release
4745e17157SR0ronoa
4845e17157SR0ronoatest-release:
49*f33c7b22Syuyi2439	cargo test --target $(RUST_TARGET) --release
5045e17157SR0ronoa
5145e17157SR0ronoa.PHONY: install
5245e17157SR0ronoainstall:
53*f33c7b22Syuyi2439	cargo install --target $(RUST_TARGET) --path . --no-track --root $(INSTALL_DIR) --force
54