[PATCH] Makefile.in: Only set git version if .git directory exists

Toke Høiland-Jørgensen toke at toke.dk
Wed May 2 18:43:14 CEST 2018


If Bird is compiled from a release tarball, but there is a git repository
somewhere in a parent directory, the Makefile git version logic will pick
up that version and use it as the Bird version, which is obviously not
desirable.

For instance, on OpenWrt this results in something like this:

BIRD version reboot-6789-g4e9ce23aa5

Signed-off-by: Toke Høiland-Jørgensen <toke at toke.dk>
---
 Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.in b/Makefile.in
index c8168bbe..1184d583 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -21,7 +21,7 @@ INSTALL=@INSTALL@
 INSTALL_PROGRAM=@INSTALL_PROGRAM@
 INSTALL_DATA=@INSTALL_DATA@
 
-git-label:=$(strip $(shell git describe --always --dirty=-x 2>/dev/null))
+git-label:=$(strip $(shell [ -d .git ] && git describe --always --dirty=-x 2>/dev/null))
 ifneq ($(git-label),)
         CFLAGS += -DGIT_LABEL="$(git-label)"
 endif
-- 
2.17.0



More information about the Bird-users mailing list