]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Include git commit within version string when available
authorMichael Brown <mcb30@ipxe.org>
Fri, 20 Jul 2012 17:06:15 +0000 (18:06 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 20 Jul 2012 17:08:52 +0000 (18:08 +0100)
Originally-implemented-by: Christian Hesse <list@eworm.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/Makefile

index 6537ecb4a80633e3a135cae2fd9cedcf171f8e98..a061f834bc3754a099ed02da4584fd2fcfd854ac 100644 (file)
@@ -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)"
 
 ###############################################################################
 #