commit:     4a507f5d088260c117fc3836ecc66e468af4849b
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 10 03:18:51 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Mar 10 03:18:51 2019 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=4a507f5d

Generate & add ChangeLog when creating dist target

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 Makefile.am | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 144bee4..b969189 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,2 +1,20 @@
 eselectdir = $(datadir)/eselect/modules
 dist_eselect_DATA = rust.eselect
+
+dist-hook: gen-ChangeLog
+
+.PHONY: gen-ChangeLog
+gen-ChangeLog:
+       @if test -d "$(top_srcdir)/.git"; \
+       then \
+               echo "Creating ChangeLog ..." && \
+               ( cd "$(top_srcdir)" && \
+                 echo '# Generated by Makefile. Do not edit.'; echo; \
+                 git log --no-color --no-decorate ) > ChangeLog.tmp \
+               && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
+               || ( rm -f ChangeLog.tmp ; \
+                    echo "Failed to generate ChangeLog" >&2; \
+                    exit 1; ); \
+       else \
+               echo "A git clone is required to generate a ChangeLog" >&2; \
+       fi

Reply via email to