]> git.draconx.ca Git - gob-dx.git/blobdiff - Makefile.am
Generate ChangeLog from git at packaging time.
[gob-dx.git] / Makefile.am
index 0f6ad3da08ea1b68cabb8542f22422df9465f349..60d79401a603af12ce20afa703420f0acafc715d 100644 (file)
@@ -15,13 +15,12 @@ AM_YFLAGS = -d -t
 
 bin_PROGRAMS = gob2
 
-EXTRA_DIST = COPYING.generated-code examples/GNOME_Foo_SomeInterface.idl \
-             examples/README examples/foo-some-interface.gob \
-             examples/gtk-button-count.gob examples/my-glade-main.c \
-             examples/my-glade.glade examples/my-glade.gob gob2.spec \
-             src/treefuncs.c src/treefuncs.h src/treefuncs.stamp \
-             src/treefuncs.def src/generate_treefuncs.pl \
-             t/test.gob t/str.gob
+EXTRA_DIST = COPYING.GPL3 COPYING.generated-code \
+             examples/GNOME_Foo_SomeInterface.idl examples/README \
+             examples/foo-some-interface.gob examples/gtk-button-count.gob \
+             examples/my-glade-main.c examples/my-glade.glade \
+             examples/my-glade.gob gob2.spec src/generate_treefuncs.pl \
+             src/treefuncs.def src/treefuncs.stamp t/str.gob t/test.gob
 
 CLEANFILES =
 DISTCLEANFILES =
@@ -93,4 +92,39 @@ gob2.m4: $(top_srcdir)/common/m4/gob2.m4
 DISTCLEANFILES += gob2.m4
 EXTRA_DIST += common/m4/gob2.m4
 
+git_changelog_start = 2cd951c678998b2b0230c8eb25717ecf0f1dd2db
+dist-hook: generate-changelog
+generate-changelog:
+       -: "$${GIT_DIR=$(top_srcdir)/.git}"; \
+         test -d "$$GIT_DIR" || exit 0; { \
+           $(PERL) -x $(top_srcdir)/build-aux/gitlog-to-changelog -- \
+             $(git_changelog_start).. && \
+           echo && \
+           git show $(git_changelog_start):ChangeLog; \
+         } >$(distdir)/ChangeLog.gen && \
+         mv -f $(distdir)/ChangeLog.gen $(distdir)/ChangeLog
+       rm -f $(distdir)/ChangeLog.gen
+.PHONY: generate-changelog
+
+GENERIC_V   = $(GENERIC_V_@AM_V@)
+GENERIC_V_  = $(GENERIC_V_@AM_DEFAULT_V@)
+GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n'
+
+TEST_DISTRIBUTION = false
+TEST_DISTRIBUTION_OR_ERROR = if $(TEST_DISTRIBUTION); \
+  then echo 'Proceeding anyway...'; \
+  else echo 'Run $(MAKE) TEST_DISTRIBUTION=true to ignore this failure.'; \
+       false; \
+  fi
+
+distcheck-hook:
+       $(GENERIC_V) : 'CHECK   ' ChangeLog; \
+         $(AWK) '/^Stub/ { print FILENAME ":" NR ":", $$0; exit 1 }' \
+           $(distdir)/ChangeLog || { \
+             echo 'ERROR: *** Packaged ChangeLog was not properly generated from git log.'; \
+             echo '       *** The source version was used instead, but this appears to'; \
+             echo '       *** be the stub from a git checkout.  The "git" and "perl"'; \
+             echo '       *** programs are required for ChangeLog generation to work.'; \
+             $(TEST_DISTRIBUTION_OR_ERROR); } >&2
+
 include $(top_srcdir)/common/snippet/autotest.mk