1.PHONY: all clean 2 3# 检查是否需要进行fmt --check 4# 解析命令行参数 5FMT_CHECK?=0 6 7ifeq ($(FMT_CHECK), 1) 8 FMT_CHECK=--check 9else 10 FMT_CHECK= 11endif 12 13export ARCH ?= riscv64 14 15all: 16ifeq ($(ARCH), riscv64) 17 $(MAKE) riscv64imac 18else 19 @echo "ARCH=$(ARCH) is not supported" 20 @exit 1 21endif 22 23riscv64imac: 24 @cargo build --release --target riscv64imac-unknown-none-elf 25 26clean: 27 @cargo clean 28 29 30fmt: 31 @cargo fmt --all $(FMT_CHECK) 32