1ifeq ($(ARCH), x86_64) 2 CROSS_COMPILE=x86_64-linux-musl- 3else ifeq ($(ARCH), riscv64) 4 CROSS_COMPILE=riscv64-linux-musl- 5endif 6 7# 获得当前git提交的sha1,并截取前8位 8GIT_COMMIT_SHA1=$(shell git log -n 1 | head -n 1 | cut -d ' ' -f 2 | cut -c1-8) 9CC=$(CROSS_COMPILE)gcc 10 11 12all: version_header about.c 13 $(CC) -static -o about about.c 14 15.PHONY: install clean 16install: all 17 mv about $(DADK_CURRENT_BUILD_DIR)/about.elf 18 19clean: 20 rm about *.o 21 22# 生成版本头文件sys_version.h 23version_header: about.c 24 @echo "#define DRAGONOS_GIT_COMMIT_SHA1 \"$(GIT_COMMIT_SHA1)\"" > sys_version.h 25 26fmt: 27