summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2006-08-10 23:49:50 -0400
committerBehdad Esfahbod <behdad@behdad.org>2006-08-11 00:11:49 -0400
commitc04ccc95fa3cd4272889b1e66e4de5e1bef53ae0 (patch)
treee183964a09fb6e88c371e1c24303683eb24345bc /Makefile.am
parent9b5c5b75701e8f8d5270d248c0eaac07aa5eb52a (diff)
[ChangeLog] Make ChangeLog creation faster by caching partial results
The ChangeLog.pre-* files once generated, cannot be outdated and don't need update anymore, but the main ChangeLog needs update everytime a git operation is performed (commit, checkout, etc.) Previously, we were forcing a ChangeLog recreation by making it a phony target. Now, we break it into two parts: One up to the latest tag (as returned by git-describe), and another from there. The former is, again, up-to-date when it exists. The latter, we make it depend on .git. And since the latter is pretty short anyway, you get a very first regeneration of it when you change your repo (and that only happens during 'make dist' by the way.)
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am41
1 files changed, 32 insertions, 9 deletions
diff --git a/Makefile.am b/Makefile.am
index e636263d..31f8134d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -76,27 +76,50 @@ dist-hook: changelogs
cp $$changelog $(distdir)/; \
done
+$(srcdir)/ChangeLog:
+ @if test -d "$(srcdir)/.git"; then \
+ version=$(CURR_CHANGELOG_VERSION); \
+ prev=$(PREV_CHANGELOG_VERSION).0; \
+ nearest_tag=`git-describe | sed 's/-[^-]*//'`; \
+ before=$(srcdir)/ChangeLog.cache-$$prev..$$nearest_tag; \
+ after=$(srcdir)/ChangeLog.cache-$$nearest_tag..; \
+ $(MAKE) $$before $$after && \
+ echo Creating $@ && \
+ { cat $$after; echo; cat $$before; } > $@; \
+ else \
+ test -f $@ || \
+ (echo A git checkout is required to generate $@ >&2 && \
+ echo A git checkout is required to generate this file >> $@); \
+ fi
+
+ChangeLog.cache-*..: .git
+
ChangeLog%: $(srcdir)/ChangeLog%
-$(srcdir)/ChangeLog $(srcdir)/ChangeLog.pre-%:
+$(srcdir)/ChangeLog.cache-% $(srcdir)/ChangeLog.pre-%:
@echo Creating $@
@if test -d "$(srcdir)/.git"; then \
(cd "$(srcdir)" && \
version=$$(echo "$@" | sed 's/.*ChangeLog\([.].*-\)\?//'); \
- to=$$version; \
- test "x$$version" = x && version=$(CURR_CHANGELOG_VERSION); \
- from=$(PREV_CHANGELOG_VERSION); \
- test "x$$to" = x || version=$$version.0; \
- test "x$$from" = xinitial || from=$$from.0; \
- ./missing --run git-log --stat $$from..$$to) > $@.tmp \
+ if echo "$@" | grep -q '^ChangeLog[.]cache'; then \
+ spec=$$version; \
+ else \
+ to=$$version; \
+ test "x$$version" = x && version=$(CURR_CHANGELOG_VERSION); \
+ from=$(PREV_CHANGELOG_VERSION); \
+ test "x$$to" = x || version=$$version.0; \
+ test "x$$from" = xinitial || from=$$from.0; \
+ spec=$$from..$$to; \
+ fi; \
+ ./missing --run git-log --stat "$$spec") > $@.tmp \
&& mv -f $@.tmp $@ \
|| ($(RM) $@.tmp; \
echo Failed to generate $@, your $@ may be outdated >&2; \
(test -f $@ || echo git-log is required to generate this file >> $@)); \
else \
test -f $@ || \
- (echo A git checkout and git-log is required to generate $@ >&2 && \
- echo A git checkout and git-log is required to generate this file >> $@); \
+ (echo A git checkout is required to generate $@ >&2 && \
+ echo A git checkout is required to generate this file >> $@); \
fi
.PHONY: changelogs ChangeLog $(srcdir)/ChangeLog