From fcf9c855e37d5174a8e60b7f10819dc90f44d23a Mon Sep 17 00:00:00 2001 From: Jack Rubacha Date: Fri, 13 Dec 2024 13:11:44 -0500 Subject: [PATCH] add commit hash and author hash --- Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2c9e7a1..bf8eede 100644 --- a/Makefile +++ b/Makefile @@ -23,17 +23,25 @@ GIT_MINOR_VERSION := $(shell git describe --tags --abbrev=0 | cut -c2- | cut -d' GIT_PATCH_VERSION := $(shell git describe --tags --abbrev=0 | cut -c2- | cut -d'.' -f3) GIT_IS_UPSTREAM_CLEAN := $(shell bash -c 'git merge-base --is-ancestor HEAD @{u} && echo 0 || echo 1') GIT_IS_LOCAL_CLEAN := $(shell bash -c 'test -z "$$(git status --porcelain)" && echo 0 || echo 1') - +GIT_SHORTHASH := $(shell git rev-parse --short=8 HEAD) +GIT_AUTHORHASH := $(shell bash -c 'git log -n 1 --format=%h --author=$(git config --get user.name)') all: - @echo "Version: $(GIT_MAJOR_VERSION).$(GIT_MINOR_VERSION).$(GIT_PATCH_VERSION)" + @echo "VERSION: $(GIT_MAJOR_VERSION).$(GIT_MINOR_VERSION).$(GIT_PATCH_VERSION)" + @echo "UNPUSHED CHANGES: $(GIT_IS_UPSTREAM_CLEAN)" + @echo "UNCOMMITTED CHANGES: $(GIT_IS_LOCAL_CLEAN)" + @echo "COMMIT HASH: $(GIT_SHORTHASH)" + @echo "AUTHOR HASH: $(GIT_AUTHORHASH)" CFLAGS += -DGIT_MAJOR_VERSION=$(GIT_MAJOR_VERSION) \ -DGIT_MINOR_VERSION=$(GIT_MINOR_VERSION) \ -DGIT_PATCH_VERSION=$(GIT_PATCH_VERSION) \ -DGIT_IS_UPSTREAM_CLEAN=$(GIT_IS_UPSTREAM_CLEAN) \ - -DGIT_IS_LOCAL_CLEAN=$(GIT_IS_LOCAL_CLEAN) + -DGIT_IS_LOCAL_CLEAN=$(GIT_IS_LOCAL_CLEAN) \ + -DGIT_SHORTHASH=$(GIT_SHORTHASH) \ + -DGIT_AUTHORHASH=$(GIT_AUTHORHASH) + ###################################### # building variables ######################################