From 348ec33aee6b34edcec8e7273cf2435b4e8910b8 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 20 Jul 2012 18:06:15 +0100 Subject: [build] Include git commit within version string when available Originally-implemented-by: Christian Hesse Signed-off-by: Michael Brown --- src/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 6537ecb4..a061f834 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)" ############################################################################### # -- cgit v1.2.3-55-g7522