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