use tag as GITREF if available

This commit is contained in:
Thomas Bernard 2020-10-31 10:50:11 +01:00
parent 56c66b5472
commit 01d686078e
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
2 changed files with 4 additions and 6 deletions

View File

@ -54,9 +54,8 @@ CFLAGS += -m64 -mcmodel=medlow
ISGITREPO != git rev-parse --is-inside-work-tree 2> /dev/null || echo "false"
.if $(ISGITREPO) == "true"
GITREF != git rev-parse --short HEAD
GITBRANCH != git rev-parse --abbrev-ref HEAD
CPPFLAGS += -DMINIUPNPD_GIT_REF=\"$(GITBRANCH)-$(GITREF)\"
GITREF != git describe --exact-match --tags 2> /dev/null || echo "`git rev-parse --abbrev-ref HEAD`-`git rev-parse --short HEAD`"
CPPFLAGS += -DMINIUPNPD_GIT_REF=\"$(GITREF)\"
.endif
STDOBJS = miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o \

View File

@ -3,7 +3,6 @@
ISGITREPO := $(shell git rev-parse --is-inside-work-tree)
ifeq ($(ISGITREPO),true)
GITREF := $(shell git rev-parse --short HEAD)
GITBRANCH := $(shell git rev-parse --abbrev-ref HEAD)
CPPFLAGS += -DMINIUPNPD_GIT_REF=\"$(GITBRANCH)-$(GITREF)\"
GITREF := $(shell git describe --exact-match --tags 2> /dev/null || echo "`git rev-parse --abbrev-ref HEAD`-`git rev-parse --short HEAD`" )
CPPFLAGS += -DMINIUPNPD_GIT_REF=\"$(GITREF)\"
endif