1*fbd63a30SSMALLCTOOLCHAIN="+nightly-2023-08-15-x86_64-unknown-linux-gnu" 2*fbd63a30SSMALLCRUSTFLAGS+="" 3*fbd63a30SSMALLC 4*fbd63a30SSMALLCifdef DADK_CURRENT_BUILD_DIR 5*fbd63a30SSMALLC# 如果是在dadk中编译,那么安装到dadk的安装目录中 6*fbd63a30SSMALLC INSTALL_DIR = $(DADK_CURRENT_BUILD_DIR) 7*fbd63a30SSMALLCelse 8*fbd63a30SSMALLC# 如果是在本地编译,那么安装到当前目录下的install目录中 9*fbd63a30SSMALLC INSTALL_DIR = ./install 10*fbd63a30SSMALLCendif 11*fbd63a30SSMALLC 12*fbd63a30SSMALLCifeq ($(ARCH), x86_64) 13*fbd63a30SSMALLC export RUST_TARGET=x86_64-unknown-linux-musl 14*fbd63a30SSMALLCelse ifeq ($(ARCH), riscv64) 15*fbd63a30SSMALLC export RUST_TARGET=riscv64gc-unknown-linux-gnu 16*fbd63a30SSMALLCelse 17*fbd63a30SSMALLC# 默认为x86_86,用于本地编译 18*fbd63a30SSMALLC export RUST_TARGET=x86_64-unknown-linux-musl 19*fbd63a30SSMALLCendif 20*fbd63a30SSMALLC 21*fbd63a30SSMALLCrun: 22*fbd63a30SSMALLC RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET) 23*fbd63a30SSMALLC 24*fbd63a30SSMALLCbuild: 25*fbd63a30SSMALLC RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET) 26*fbd63a30SSMALLC 27*fbd63a30SSMALLCclean: 28*fbd63a30SSMALLC RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET) 29*fbd63a30SSMALLC 30*fbd63a30SSMALLCtest: 31*fbd63a30SSMALLC RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET) 32*fbd63a30SSMALLC 33*fbd63a30SSMALLCdoc: 34*fbd63a30SSMALLC RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) doc --target $(RUST_TARGET) 35*fbd63a30SSMALLC 36*fbd63a30SSMALLCfmt: 37*fbd63a30SSMALLC RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt 38*fbd63a30SSMALLC 39*fbd63a30SSMALLCfmt-check: 40*fbd63a30SSMALLC RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt --check 41*fbd63a30SSMALLC 42*fbd63a30SSMALLCrun-release: 43*fbd63a30SSMALLC RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET) --release 44*fbd63a30SSMALLC 45*fbd63a30SSMALLCbuild-release: 46*fbd63a30SSMALLC RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET) --release 47*fbd63a30SSMALLC 48*fbd63a30SSMALLCclean-release: 49*fbd63a30SSMALLC RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET) --release 50*fbd63a30SSMALLC 51*fbd63a30SSMALLCtest-release: 52*fbd63a30SSMALLC RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET) --release 53*fbd63a30SSMALLC 54*fbd63a30SSMALLC.PHONY: install 55*fbd63a30SSMALLCinstall: 56*fbd63a30SSMALLC RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --target $(RUST_TARGET) --path . --no-track --root $(INSTALL_DIR) --force 57