diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2015-02-18 14:25:08 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-02-18 14:25:08 +0100 |
commit | 2eedbf21ac62b5e15f5ba896b1e8b7125c8052de (patch) | |
tree | aa26080f3b751f22f467e07804375c2133dc5310 | |
parent | 083023711b5248c5511185e536679020b6696486 (diff) |
build: Check if called from git repo when generating GIT_VERSION
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | llmnr-query.c | 4 | ||||
-rw-r--r-- | llmnrd.c | 4 |
3 files changed, 10 insertions, 5 deletions
@@ -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) diff --git a/llmnr-query.c b/llmnr-query.c index 3635a53..a1fac67 100644 --- a/llmnr-query.c +++ b/llmnr-query.c @@ -61,9 +61,9 @@ static void __noreturn usage_and_exit(int status) static void __noreturn version_and_exit(void) { - fprintf(stdout, "llmnr-query %s (git id %s)\n" + fprintf(stdout, "llmnr-query %s %s\n" "Copyright (C) 2015 Tobias Klauser <tklauser@distanz.ch>\n" - "Licensed unter the GNU General Public License, version 2\n", + "Licensed under the GNU General Public License, version 2\n", VERSION_STRING, GIT_VERSION); exit(EXIT_SUCCESS); } @@ -62,9 +62,9 @@ static void __noreturn usage_and_exit(int status) static void __noreturn version_and_exit(void) { - fprintf(stdout, "llmnrd %s (git id %s)\n" + fprintf(stdout, "llmnrd %s %s\n" "Copyright (C) 2014-2015 Tobias Klauser <tklauser@distanz.ch>\n" - "Licensed unter the GNU General Public License, version 2\n", + "Licensed under the GNU General Public License, version 2\n", VERSION_STRING, GIT_VERSION); exit(EXIT_SUCCESS); } |