]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Makefile: Only set git version if BIRD is build from its repository.
authorJan Maria Matejka <mq@ucw.cz>
Thu, 3 May 2018 09:14:49 +0000 (11:14 +0200)
committerJan Maria Matejka <mq@ucw.cz>
Thu, 3 May 2018 09:14:49 +0000 (11:14 +0200)
Thanks to Toke Høiland-Jørgensen <toke@toke.dk> for reporting this bug.

Makefile.in

index c8168bbe4cb1a0988a3d73bb8b562ac8b16db921..eb6cc5c949546be32e79b6a0b6854bc6b51c1770 100644 (file)
@@ -21,11 +21,6 @@ INSTALL=@INSTALL@
 INSTALL_PROGRAM=@INSTALL_PROGRAM@
 INSTALL_DATA=@INSTALL_DATA@
 
-git-label:=$(strip $(shell git describe --always --dirty=-x 2>/dev/null))
-ifneq ($(git-label),)
-        CFLAGS += -DGIT_LABEL="$(git-label)"
-endif
-
 client=$(addprefix $(exedir)/,@CLIENT@)
 daemon=$(exedir)/bird
 protocols=@protocols@
@@ -42,6 +37,11 @@ srcdir := @srcdir@
 objdir := @objdir@
 exedir := @exedir@
 
+git-label:=$(strip $(shell cd $(srcdir) && [ "$$(git rev-parse --show-toplevel)" = "$$(readlink -f .)" ] && git describe --always --dirty=-x 2>/dev/null))
+ifneq ($(git-label),)
+        CFLAGS += -DGIT_LABEL="$(git-label)"
+endif
+
 ifeq ($(objdir),.)
   objdir := $(realpath .)
 endif