From 0cf0cdd0c354020455b88a99d4bab0a3b74fc660 Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@bento.schottelius.org>
Date: Fri, 7 Jun 2013 21:14:51 +0200
Subject: [PATCH] keep version generating in build-helper, so people cloning
 from git don't need make

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
---
 Makefile     | 13 +++++++++++--
 bin/cdist    |  2 +-
 build-helper |  3 +++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index b97acf12..cf83a591 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,10 @@
 #
 #
 
+A2XM=a2x -f manpage --no-xmllint -a encoding=UTF-8
+A2XH=a2x -f xhtml --no-xmllint -a encoding=UTF-8
+helper=./build-helper
+
 MANDIR=docs/man
 MAN1DSTDIR=$(MANDIR)/man1
 MAN7DSTDIR=$(MANDIR)/man7
@@ -32,7 +36,6 @@ RELEASE=release-web release-man release-pypi release-archlinux-makepkg
 RELEASE+=release-blog release-ml
 RELEASE+=release-freecode release-archlinux-aur-upload
 
-helper=./build-helper
 version=`git describe`
 versionchangelog=`$(helper) changelog-version`
 versionfile=cdist/version.py
@@ -40,7 +43,7 @@ versionfile=cdist/version.py
 archlinuxtar=cdist-${versionchangelog}-1.src.tar.gz
 
 $(versionfile):
-	echo $(version) > $@
+	$(helper) version
 
 
 $(DIST): dist-check
@@ -48,6 +51,12 @@ $(RELEASE): $(DIST) $(CHECKS)
 
 man: $(MANREF) mantype manbuild
 
+$(MAN7DSTDIR)/cdist-type__motd.7: $(MAN7DSTDIR)/cdist-type__motd.text 
+	$(A2XM) $^
+
+$(MAN7DSTDIR)/cdist-type__motd.text: cdist/conf/type/__motd/man.text
+	echo ln -sf $@ $^
+
 $(MANREF): $(MANREFSH)
 	$(MANREFSH)
 
diff --git a/bin/cdist b/bin/cdist
index dfe4fa00..f8fec000 100755
--- a/bin/cdist
+++ b/bin/cdist
@@ -25,7 +25,7 @@ dir=${0%/*}
 
 # Ensure version is present - the bundled/shipped version contains a static version,
 # the git version contains a dynamic version
-"$dir/../build" version
+"$dir/../build-helper" version
 
 libdir=$(cd "${dir}/../" && pwd -P)
 export PYTHONPATH="${libdir}"
diff --git a/build-helper b/build-helper
index c3ffe045..3bbf4dfc 100755
--- a/build-helper
+++ b/build-helper
@@ -299,6 +299,9 @@ eof
             python3 -m unittest "$@"
         fi
     ;;
+    version)
+        git describe > cdist/version.py
+    ;;
 
     *)
         echo "Unknown target $@ - aborting"