From 55cd8b050dd78aad23479ec9f4dbb3c2c9748d5c Mon Sep 17 00:00:00 2001
From: midipix <writeonce@midipix.org>
Date: Wed, 20 Apr 2016 18:46:42 -0400
Subject: build system: when present, use the git refdir as a version.tag
 dependency.

---
 Makefile.in | 3 ++-
 configure   | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Makefile.in b/Makefile.in
index 98677d5..7671b87 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,5 +1,6 @@
 PACKAGE 		= @package@
 PROJECT_DIR 		= @project_dir@
+GIT_REFERENCE_DIR	= @git_reference_dir@
 
 BUILD 			= @build@
 HOST 			= @host@
@@ -177,7 +178,7 @@ host.tag:	Makefile
 		$(PROJECT_DIR)/sysinfo/host/host.sh --compiler="$(CC)" --cflags="$(CFLAGS)"
 		touch host.tag
 
-version.tag:
+version.tag:	$(GIT_REFERENCE_DIR)
 		$(PROJECT_DIR)/sysinfo/version.sh	\
 			-s $(PROJECT_DIR)		\
 			-o build/$(PACKAGE)_version.h	\
diff --git a/configure b/configure
index b428d13..4145c3c 100755
--- a/configure
+++ b/configure
@@ -28,6 +28,11 @@ init_vars()
 		. "$mb_config" || exit 2
 	fi
 
+	# git
+	if [ -d "$mb_project_dir/.git" ]; then
+		mb_git_reference_dir="\$(PROJECT_DIR)/.git"
+	fi
+
 	# dirs
 	mb_prefix=$PREFIX
 	mb_exec_prefix=$EXEC_PREFIX
@@ -304,6 +309,7 @@ config_copy()
 {
 	sed 		-e 's^@package@^'"$mb_package"'^g' 				\
 			-e 's^@project_dir@^'"$mb_project_dir"'^g'			\
+			-e 's^@git_reference_dir@^'"$mb_git_reference_dir"'^g'		\
 											\
 			-e 's^@build@^'"$mb_build"'^g'					\
 			-e 's^@host@^'"$mb_host"'^g'					\
-- 
cgit v1.2.3