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