Makefile 594 B

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