show target version, date, commit hash and branch (#221)

This commit is contained in:
coreglitch
2020-11-06 15:31:06 +06:00
committed by GitHub
parent eb2679b982
commit bce6f867f1
5 changed files with 15 additions and 4 deletions

7
make/git.mk Normal file
View File

@@ -0,0 +1,7 @@
GIT_COMMIT = $(shell git describe --always --exclude '*' || echo 'unknown')
GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD || echo 'unknown')
GIT_BRANCH_NUM = $(shell git rev-list --count $(GIT_BRANCH) || echo 'nan')
BUILD_DATE = $(shell date '+%d-%m-%Y' || echo 'unknown')
CFLAGS += -DGIT_COMMIT="\"$(GIT_COMMIT)\"" -DGIT_BRANCH="\"$(GIT_BRANCH)\"" -DGIT_BRANCH_NUM="\"$(GIT_BRANCH_NUM)\""
CFLAGS += -DBUILD_DATE="\"$(BUILD_DATE)\"" -DTARGET="\"$(TARGET)\""