# 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)\"
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