Explorar el Código

[build] Construct full version number automatically from git revision

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown hace 4 años
padre
commit
8f1514a004
Se han modificado 1 ficheros con 15 adiciones y 2 borrados
  1. 15
    2
      src/Makefile

+ 15
- 2
src/Makefile Ver fichero

@@ -207,14 +207,27 @@ install :
207 207
 #
208 208
 # Version number calculations
209 209
 #
210
+ifneq ($(wildcard ../.git),)
211
+VERSIONS := $(shell git describe --tags --always --long --abbrev=1 --match "v*")
212
+VERSION_TUPLE	:= $(subst ., ,$(subst -, ,$(patsubst v%,%,$(VERSIONS))))
213
+VERSION_MAJOR	:= $(word 1,$(VERSION_TUPLE))
214
+VERSION_MINOR	:= $(word 2,$(VERSION_TUPLE))
215
+VERSION_PATCH	:= $(word 3,$(VERSION_TUPLE))
216
+ifeq ($(word 4,$(VERSION_TUPLE)),0)
217
+EXTRAVERSION	:=
218
+else
219
+EXTRAVERSION	:= +
220
+endif
221
+GITVERSION	= $(word 5,$(VERSION_TUPLE))
222
+else
210 223
 VERSION_MAJOR	= 1
211 224
 VERSION_MINOR	= 0
212 225
 VERSION_PATCH	= 0
213 226
 EXTRAVERSION	= +
227
+endif
214 228
 MM_VERSION	= $(VERSION_MAJOR).$(VERSION_MINOR)
215 229
 VERSION		= $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
216
-ifneq ($(wildcard ../.git),)
217
-GITVERSION := $(shell git describe --always --abbrev=1 --match "" 2>/dev/null)
230
+ifneq ($(GITVERSION),)
218 231
 VERSION		+= ($(GITVERSION))
219 232
 endif
220 233
 version :

Loading…
Cancelar
Guardar