diff --git a/miniupnpd/Makefile.bsd b/miniupnpd/Makefile.bsd index ffbd2f9..fc879d2 100644 --- a/miniupnpd/Makefile.bsd +++ b/miniupnpd/Makefile.bsd @@ -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 \ diff --git a/miniupnpd/gitrev.mk b/miniupnpd/gitrev.mk index a1f48b9..fa09314 100644 --- a/miniupnpd/gitrev.mk +++ b/miniupnpd/gitrev.mk @@ -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