From bd351002c07a35e3f5f54370024ab7cdc6b6ee67 Mon Sep 17 00:00:00 2001 From: hev Date: Sat, 20 Apr 2024 23:53:48 +0800 Subject: [PATCH] Build: Read rev-id from file. --- build.mk | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/build.mk b/build.mk index 421ca6995..244f484c5 100644 --- a/build.mk +++ b/build.mk @@ -5,4 +5,16 @@ rwildcard=$(foreach d,$(wildcard $1*), \ $(filter $(subst *,%,$2),$d)) SRCFILES=$(call rwildcard,$(SRCDIR)/,*.c *.S) -VERSION_CFLAGS=-DCOMMIT_ID=\"$(shell git -C $(SRCDIR) rev-parse --short HEAD)\" + +ifeq ($(REV_ID),) + ifneq (,$(wildcard .rev-id)) + REV_ID=$(shell cat .rev-id) + endif + ifeq ($(REV_ID),) + REV_ID=$(shell git -C $(SRCDIR) rev-parse --short HEAD) + endif + ifeq ($(REV_ID),) + REV_ID=unknown + endif +endif +VERSION_CFLAGS=-DCOMMIT_ID=\"$(REV_ID)\"