summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2011-12-28 10:17:30 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2011-12-28 10:29:59 +0100
commite6fa05e7c7df67117138bf131e1599b346213bd0 (patch)
treec5cb9f683a91e86fe4aa656dccef3ce01274c9af
parentf533e9d43dfe84f0e1706855bdd49579df5c4f5b (diff)
downloadautomake-e6fa05e7c7df67117138bf131e1599b346213bd0.tar.gz
maint: autogenerate ChangeLog
Following the practice set by various other GNU projects, we start to automatically generate the ChangeLog file from the git commit messages. This will avoid duplication (as the ChangeLog entries were always inserted both in the git commit message and in the version-controlled ChangeLog file), and potential problems with spurious merge conflicts (which, although greatly mitigated by Bruno Haible's `git-merge-changelog' helper program, have never been completely solved). * ChangeLog: Moved ... * ChangeLog.11:... to this. * Makefile.am (EXTRA_DIST): Add it. (gitlog_to_changelog_command, gitlog_to_changelog_options): New variables. (ChangeLog, am--changelog-regen-hook): New targets. * .gitignore: Add ChangeLog.
-rw-r--r--.gitignore1
-rw-r--r--ChangeLog.11 (renamed from ChangeLog)0
-rw-r--r--Makefile.am38
3 files changed, 39 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 47823214e..33e3827fc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
Makefile.in
Makefile
+/ChangeLog
/aclocal.m4
/configure
/autom4te.cache
diff --git a/ChangeLog b/ChangeLog.11
index 0c37e166f..0c37e166f 100644
--- a/ChangeLog
+++ b/ChangeLog.11
diff --git a/Makefile.am b/Makefile.am
index acb722838..ed01bbb00 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,6 +42,7 @@ EXTRA_DIST = \
ChangeLog.03 \
ChangeLog.04 \
ChangeLog.09 \
+ ChangeLog.11 \
bootstrap \
$(AUTOMAKESOURCES)
@@ -108,6 +109,43 @@ INSTALL: lib/INSTALL
## to anybody else
##
+gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
+gitlog_to_changelog_options = --since='2011-12-28 00:00:00'
+
+# Automatic generation of the ChangeLog from git history.
+#
+# When executed from a git checkout, generate the ChangeLog from the git
+# history. When executed from an extracted distribution tarball, just
+# copy the distributed ChangeLog in the build directory (and if this
+# fails, or if no distributed ChangeLog file is present, complain and
+# give an error).
+#
+# We need the apparently useless dependency from another .PHONY target
+# `am--changelog-regen-hook' to work around a bug of Solaris make, which
+# doesn't execute the recipe of a target named as an existing file, even
+# if such target is declared `.PHONY' (yikes!)
+#
+.PHONY: am--changelog-regen-hook
+am--changelog-regen-hook:
+ChangeLog: am--changelog-regen-hook
+ $(AM_V_GEN)set -e; set -u; \
+## The ChangeLog should be regenerated unconditionally when working from
+## checked-out sources; otherwise, if we're working from a distribution
+## tarball, we expect the ChangeLog to be distributed, so check that it
+## is indeed present in the source directory.
+ if test -d $(srcdir)/.git; then \
+ rm -f $@-t \
+ && $(gitlog_to_changelog_command) \
+ $(gitlog_to_changelog_options) >$@-t \
+ && chmod a-w $@-t \
+ && mv -f $@-t $@ \
+ || exit 1; \
+ elif test ! -f $(srcdir)/$@; then \
+ echo "Source tree is not a git checkout, and no pre-existent" \
+ "$@ file has been found there" >&2; \
+ exit 1; \
+ fi
+
# Ensure tests are world-executable
dist-hook:
cd $(distdir)/tests && chmod a+rx *.test