possible tm.texi confusion (was: Re: Update^5: Fix PR other/44034)

Message ID 20100628160931.hm3aog5og4sswkcc-nzlynne@webmail.spamcop.net
State New
Headers show

Commit Message

Joern Rennecke June 28, 2010, 8:09 p.m.
Quoting Alexandre Oliva <aoliva@redhat.com>:

> I assume you're Cc:ing me as maintainer of the build machinery.

Yes.  Thanks for the review.

> The
> changes to gcc/Makefile.in are fine, although I think it would be better
> for the message that follows to be sent to stderr rather than stdout:

Done - see my other message to gcc-patches.

I don't want to scupper the big patch for a small detail, but it occurred to
me that there is another possible developer error that the Makefile should
try to diagnose.  Namely, when someone puts new documentation into tm.texi,
no check is done.  And when this file gets checked in and someone else then
changes tm.texi.in or target.def, or even if the checkout just happens to
leave a newer timestamp on one of the two latter files, the other developer
will be asked to overwrite the tm.texi in the source directory.
So, dirst, I add a new dependency of the stamp file on tm.texi, and second,
if tm.texi is newer than both of the source files, the error message is

I've tested the attached sur-patchlet with 'make info' with various
combinations of timestamps of the input file while tm.texi was out-of-sync.
2010-06-28  Joern Rennecke  <joern.rennecke@embecosm.com>

	* Makefile.in (s-tm-texi): Also depend on $(srcdir)/doc/tm.texi.
	When comparison fails and $(srcdir)/doc/tm.texi is newer
	than $(srcdir)/doc/tm.texi.in and $(srcdir)/doc/target.def,
	emit error message advising to edit $(srcdir)/doc/tm.texi.in.


--- Makefile.in-20100628-2010	2010-06-28 20:05:07.126139991 +0100
+++ Makefile.in	2010-06-28 20:52:21.110383212 +0100
@@ -3682,12 +3682,21 @@  s-target-hooks-def-h: build/genhooks$(bu
 	$(SHELL) $(srcdir)/../move-if-change tmp-target-hooks-def.h \
 	$(STAMP) s-target-hooks-def-h
+# check if someone mistakenly only changed tm.texi.
+s-tm-texi: $(srcdir)/doc/tm.texi
 s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
 	$(RUN_GEN) build/genhooks$(build_exeext) \
 			$(srcdir)/doc/tm.texi.in > tmp-tm.texi
 	$(SHELL) $(srcdir)/../move-if-change tmp-tm.texi tm.texi
 	@if cmp -s $(srcdir)/doc/tm.texi tm.texi; then \
 	  $(STAMP) $@; \
+	elif test $(srcdir)/doc/tm.texi -nt $(srcdir)/doc/tm.texi.in \
+	  && test $(srcdir)/doc/tm.texi -nt $(srcdir)/doc/target.def; then \
+	  echo >&2 ; \
+	  echo You should edit $(srcdir)/doc/tm.texi.in rather than $(srcdir)/doc/tm.texi . >&2 ; \
+	  false; \
 	else \
 	  echo >&2 ; \
 	  echo Verify that you have permission to grant a GFDL license for all >&2 ; \