]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Always include the up-to-date abbreviated git hash if we are in the git repository.
authorMike Brady <mikebrady@eircom.net>
Tue, 16 Apr 2019 21:45:45 +0000 (22:45 +0100)
committerMike Brady <mikebrady@eircom.net>
Tue, 16 Apr 2019 21:45:45 +0000 (22:45 +0100)
Makefile.am
common.c

index 229930bdc03817fd7a6d7b33e0560a34da44fb5e..4aaf53af4922147422a761f20f6a48d817cf29a4 100644 (file)
@@ -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)\"
index 2376ae4823ebcb19d006539e3830b8d68e5f3e1c..98ebe36c9b738087de42845897f1d0c050adb2dd 100644 (file)
--- 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