From: Michael Brown Date: Fri, 20 Jul 2012 17:06:15 +0000 (+0100) Subject: [build] Include git commit within version string when available X-Git-Tag: v1.20.1~1693 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=348ec33aee6b34edcec8e7273cf2435b4e8910b8;p=thirdparty%2Fipxe.git [build] Include git commit within version string when available Originally-implemented-by: Christian Hesse Signed-off-by: Michael Brown --- diff --git a/src/Makefile b/src/Makefile index 6537ecb4a..a061f834b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -165,13 +165,17 @@ VERSION_PATCH = 0 EXTRAVERSION = + MM_VERSION = $(VERSION_MAJOR).$(VERSION_MINOR) VERSION = $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION) +GITVERSION := $(shell git describe --always --abbrev=1 --match "" 2>/dev/null) +ifneq ($(GITVERSION),) +VERSION += ($(GITVERSION)) +endif CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) \ -DVERSION_MINOR=$(VERSION_MINOR) \ -DVERSION_PATCH=$(VERSION_PATCH) \ - -DVERSION=\"$(VERSION)\" + -DVERSION="\"$(VERSION)\"" IDENT = '$(@F) $(VERSION) (GPL) ipxe.org' version : - @$(ECHO) $(VERSION) + @$(ECHO) "$(VERSION)" ############################################################################### #