Improve gitrev handling.

This commit is contained in:
Markus F.X.J. Oberhumer
2016-09-26 10:35:29 +02:00
parent bd54499537
commit aee52d3880
4 changed files with 12 additions and 3 deletions
+3 -2
View File
@@ -47,9 +47,10 @@ upx_SOURCES := $(sort $(wildcard $(srcdir)/*.cpp))
upx_OBJECTS := $(notdir $(upx_SOURCES:.cpp=$(objext)))
ifneq ($(wildcard $(top_srcdir)/.git/.),)
UPX_VERSION_GITREV := $(strip $(shell cd '$(top_srcdir)' && git rev-parse --short=6 HEAD || echo "ERROR"))
UPX_VERSION_GITREV := $(strip $(shell cd '$(top_srcdir)' && git rev-parse --short=6 HEAD || echo 'ERROR'))
ifneq ($(UPX_VERSION_GITREV),)
DEFS += '-DUPX_VERSION_GITREV="$(UPX_VERSION_GITREV)"'
x := $(strip $(shell cd '$(top_srcdir)' && git diff --exit-code HEAD >/dev/null && echo '' || echo '+'))
DEFS += '-DUPX_VERSION_GITREV="$(UPX_VERSION_GITREV)$(x)"'
endif
endif