瀏覽代碼

[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 年之前
父節點
當前提交
348ec33aee
共有 1 個檔案被更改,包括 6 行新增2 行删除
  1. 6
    2
      src/Makefile

+ 6
- 2
src/Makefile 查看文件

@@ -165,13 +165,17 @@ VERSION_PATCH	= 0
165 165
 EXTRAVERSION	= +
166 166
 MM_VERSION	= $(VERSION_MAJOR).$(VERSION_MINOR)
167 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 172
 CFLAGS		+= -DVERSION_MAJOR=$(VERSION_MAJOR) \
169 173
 		   -DVERSION_MINOR=$(VERSION_MINOR) \
170 174
 		   -DVERSION_PATCH=$(VERSION_PATCH) \
171
-		   -DVERSION=\"$(VERSION)\"
175
+		   -DVERSION="\"$(VERSION)\""
172 176
 IDENT		= '$(@F) $(VERSION) (GPL) ipxe.org'
173 177
 version :
174
-	@$(ECHO) $(VERSION)
178
+	@$(ECHO) "$(VERSION)"
175 179
 
176 180
 ###############################################################################
177 181
 #

Loading…
取消
儲存