Browse Source

[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>
tags/v1.20.1
Michael Brown 12 years ago
parent
commit
348ec33aee
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      src/Makefile

+ 6
- 2
src/Makefile View File

165
 EXTRAVERSION	= +
165
 EXTRAVERSION	= +
166
 MM_VERSION	= $(VERSION_MAJOR).$(VERSION_MINOR)
166
 MM_VERSION	= $(VERSION_MAJOR).$(VERSION_MINOR)
167
 VERSION		= $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
167
 VERSION		= $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
168
+GITVERSION := $(shell git describe --always --abbrev=1 --match "" 2>/dev/null)
169
+ifneq ($(GITVERSION),)
170
+VERSION		+= ($(GITVERSION))
171
+endif
168
 CFLAGS		+= -DVERSION_MAJOR=$(VERSION_MAJOR) \
172
 CFLAGS		+= -DVERSION_MAJOR=$(VERSION_MAJOR) \
169
 		   -DVERSION_MINOR=$(VERSION_MINOR) \
173
 		   -DVERSION_MINOR=$(VERSION_MINOR) \
170
 		   -DVERSION_PATCH=$(VERSION_PATCH) \
174
 		   -DVERSION_PATCH=$(VERSION_PATCH) \
171
-		   -DVERSION=\"$(VERSION)\"
175
+		   -DVERSION="\"$(VERSION)\""
172
 IDENT		= '$(@F) $(VERSION) (GPL) ipxe.org'
176
 IDENT		= '$(@F) $(VERSION) (GPL) ipxe.org'
173
 version :
177
 version :
174
-	@$(ECHO) $(VERSION)
178
+	@$(ECHO) "$(VERSION)"
175
 
179
 
176
 ###############################################################################
180
 ###############################################################################
177
 #
181
 #

Loading…
Cancel
Save