From e13d451da2d039049416486270033a1335e6ed4a Mon Sep 17 00:00:00 2001
From: Patrick McDermott <pj@pehjota.net>
Date: Wed, 27 Sep 2017 15:56:24 -0400
Subject: Makefile.am: Link against temporary version.c file

Also add better error handling to PACKAGE_VERSION_GIT macro.
---
diff --git a/Makefile.am b/Makefile.am
index 90cb803..257ad9b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,8 @@
 # along with Marquee.  If not, see <http://www.gnu.org/licenses/>.
 
 if IN_GIT
-PACKAGE_VERSION_GIT = $$(git describe --tags --dirty | sed 's|^.*/||')
+PACKAGE_VERSION_GIT = $$({ git describe --tags --dirty 2>/dev/null || \
+	printf '%s' '$(PACKAGE_VERSION)'; } | sed 's|^.*/||')
 else
 PACKAGE_VERSION_GIT = $(PACKAGE_VERSION)
 endif
@@ -43,4 +44,13 @@ marquee_LDADD = \
 	$(GTK_LIBS) \
 	$(WEBKIT2GTK_LIBS)
 
+marquee$(EXEEXT): $(marquee_OBJECTS) $(marquee_DEPENDENCIES) \
+	$(EXTRA_marquee_DEPENDENCIES)
+	@rm -f marquee$(EXEEXT)
+	@printf 'const char *PACKAGE_VERSION_GIT = "%s";\n' \
+		"$(PACKAGE_VERSION_GIT)" >version.c
+	$(AM_V_CCLD)$(LINK) version.c $(marquee_OBJECTS) $(marquee_LDADD) \
+		$(LIBS)
+	@rm -f version.c
+
 include $(top_srcdir)/src/local.mk
--
cgit v0.9.1