From: Mike Brady Date: Tue, 16 Apr 2019 21:45:45 +0000 (+0100) Subject: Always include the up-to-date abbreviated git hash if we are in the git repository. X-Git-Tag: 3.3rc4~2^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db8fc8057fe19a660133fedabc7b27e2f6a26251;p=thirdparty%2Fshairport-sync.git Always include the up-to-date abbreviated git hash if we are in the git repository. --- diff --git a/Makefile.am b/Makefile.am index 229930bd..4aaf53af 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,8 +12,10 @@ shairport_sync_SOURCES = build_details.h shairport.c rtsp.c mdns.c common.c rtp. # from Stack Overflow, with thanks: https://stackoverflow.com/questions/54303270/how-to-execute-shell-commands-in-automake-makefile-am -build_details.h: - echo "#define GITDESCRIPTION \"`git describe --dirty --always 2>/dev/null`\"" >$@ +build_details.h: FORCE + ( [ -e $(CURDIR)/.git ] && echo "#define GITDESCRIPTION \"`git describe --dirty --always 2>/dev/null`\"" >$@ ) || echo "" >$@ +FORCE: + if BUILD_FOR_FREEBSD AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\" AM_CFLAGS = -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\" diff --git a/common.c b/common.c index 2376ae48..98ebe36c 100644 --- a/common.c +++ b/common.c @@ -1284,10 +1284,12 @@ char *get_version_string() { char *version_string = malloc(1024); if (version_string) { strcpy(version_string, PACKAGE_VERSION); +#ifdef GITDESCRIPTION if (strlen(GITDESCRIPTION)) { strcat(version_string, "-"); strcat(version_string, GITDESCRIPTION); } +#endif #ifdef CONFIG_LIBDAEMON strcat(version_string, "-libdaemon"); #endif