summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-02-18 14:25:08 +0100
committerTobias Klauser <tklauser@distanz.ch>2015-02-18 14:25:08 +0100
commit2eedbf21ac62b5e15f5ba896b1e8b7125c8052de (patch)
treeaa26080f3b751f22f467e07804375c2133dc5310 /Makefile
parent083023711b5248c5511185e536679020b6696486 (diff)
build: Check if called from git repo when generating GIT_VERSION
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 6 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 84cd2cf..3e4205d 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,6 @@
# Copyright (C) 2014-2015 Tobias Klauser <tklauser@distanz.ch>
VERSION = 0.1-rc1
-GIT_VERSION = `git describe --always`
# llmnrd binary
D_P = llmnrd
@@ -21,6 +20,12 @@ INSTALL = install
CFLAGS ?= -W -Wall -O2
LDFLAGS ?=
+ifeq ($(shell git rev-parse > /dev/null 2>&1; echo $$?), 0)
+ GIT_VERSION = "(git id $(shell git describe --always))"
+else
+ GIT_VERSION =
+endif
+
CFLAGS += -DVERSION_STRING=\"v$(VERSION)\" -DGIT_VERSION=\"$(GIT_VERSION)\"
ifeq ($(DEBUG), 1)