summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2012-07-20 19:06:15 +0200
committerMichael Brown2012-07-20 19:08:52 +0200
commit348ec33aee6b34edcec8e7273cf2435b4e8910b8 (patch)
tree8fdfc6495ff500e30ad47f45e12616578e57beab /src
parent[image] Automatically free autobooted images (diff)
downloadipxe-348ec33aee6b34edcec8e7273cf2435b4e8910b8.tar.gz
ipxe-348ec33aee6b34edcec8e7273cf2435b4e8910b8.tar.xz
ipxe-348ec33aee6b34edcec8e7273cf2435b4e8910b8.zip
[build] Include git commit within version string when available
Originally-implemented-by: Christian Hesse <list@eworm.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r--src/Makefile8
1 files changed, 6 insertions, 2 deletions
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)"
###############################################################################
#