1# 获得当前git提交的sha1,并截取前8位 2GIT_COMMIT_SHA1=$(shell git log -n 1 | head -n 1 | cut -d ' ' -f 2 | cut -c1-8) 3 4all: about.o 5 6 ld -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/about $(shell find . -name "*.o") $(shell find $(sys_libs_dir) -name "*.o") -T about.lds 7 8 objcopy -I elf64-x86-64 -R ".eh_frame" -R ".comment" -O elf64-x86-64 $(tmp_output_dir)/about $(output_dir)/about.elf 9 10about.o: version_header about.c 11 $(CC) $(CFLAGS) -c about.c -o about.o 12 13# 生成版本头文件sys_version.h 14version_header: about.c 15 @echo "#define DRAGONOS_GIT_COMMIT_SHA1 \"$(GIT_COMMIT_SHA1)\"" > sys_version.h 16