Subject: bug#30172: dvi, ps, and pdf targets use AM_MAKEINFOFLAGS

From: Mathieu Lirzin <[email-masked]>
Date: Fri, 19 Jan 2018 16:30:32 +0100

The test suite fails for “t/txinfo-many-output-formats.sh” and
“t/txinfo-many-output-formats-vpath.sh”.

  $ make check \
      TESTS="t/txinfo-many-output-formats.sh t/txinfo-many-output-formats-vpath.sh"

The following patch makes the tests pass.

diff --git a/t/txinfo-many-output-formats-vpath.sh b/t/txinfo-many-output-formats-vpath.sh
index 331f57255..114ddc2ef 100644
--- a/t/txinfo-many-output-formats-vpath.sh
+++ b/t/txinfo-many-output-formats-vpath.sh
@@ -155,6 +155,9 @@ test ! -e share/$me/html/main.html
 test ! -e share/$me/html/main2.html
 test ! -e share/$me/html/main3.html
 
+# Restore the makefile without a broken AM_MAKEINFOFLAGS definition.
+cp -f $srcdir/Makefile.sav $srcdir/Makefile.am
+
 $MAKE dvi
 test -f main.dvi
 test -f sub/main2.dvi
@@ -198,8 +201,6 @@ test ! -e share/$me/pdf/main2.pdf
 test ! -e share/$me/pdf/main3.pdf
 test ! -e share/$me/pdf/hello
 
-# Restore the makefile without a broken AM_MAKEINFOFLAGS definition.
-cp -f $srcdir/Makefile.sav $srcdir/Makefile.am
 using_gmake || $MAKE Makefile
 $MAKE distcheck
 
diff --git a/t/txinfo-many-output-formats.sh b/t/txinfo-many-output-formats.sh
index 978417e60..65bbd360d 100644
--- a/t/txinfo-many-output-formats.sh
+++ b/t/txinfo-many-output-formats.sh
@@ -156,6 +156,9 @@ test ! -e share/$me/html/main.html
 test ! -e share/$me/html/main2.html
 test ! -e share/$me/html/main3.html
 
+# Restore the makefile without a broken AM_MAKEINFOFLAGS definition.
+cp -f $srcdir/Makefile.sav $srcdir/Makefile.am
+
 $MAKE dvi
 test -f main.dvi
 test -f sub/main2.dvi
@@ -199,8 +202,6 @@ test ! -e share/$me/pdf/main2.pdf
 test ! -e share/$me/pdf/main3.pdf
 test ! -e share/$me/pdf/hello
 
-# Restore the makefile without a broken AM_MAKEINFOFLAGS definition.
-cp -f $srcdir/Makefile.sav $srcdir/Makefile.am
 using_gmake || $MAKE Makefile
 $MAKE distcheck
 
The reason is that ‘texi2dvi’ is used by the dvi, ps, and pdf targets.
‘texi2dvi’ uses MAKEINFO internally which Automake augments with
AM_MAKEINFOFLAGS.  See the following snippet from the generated
Makefile:

--8<---------------cut here---------------start------------->8---
.texi.dvi:
	$(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
	MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
	$(TEXI2DVI) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@ $(AM_V_texidevnull) \
	$<
--8<---------------cut here---------------end--------------->8---

Whereas the manual claims that AM_MAKEINFOFLAGS should be used only when
building ‘.info’ files:

--8<---------------cut here---------------start------------->8---
‘AM_MAKEINFOFLAGS’
‘AM_MAKEINFOHTMLFLAGS’
     Maintainer flags passed to each ‘makeinfo’ invocation.  Unlike
     ‘MAKEINFOFLAGS’, these variables are meant to be defined by
     maintainers in ‘Makefile.am’.  ‘$(AM_MAKEINFOFLAGS)’ is passed to
     ‘makeinfo’ when building ‘.info’ files; and
     ‘$(AM_MAKEINFOHTMLFLAGS)’ is used when building ‘.html’ files.
--8<---------------cut here---------------end--------------->8---

Here is what could be done:

  1. Fix the manual to state that AM_MAKEINFOFLAGS is used for every
     non-html documentation target.

  2. Remove $(AM_MAKEINFOFLAGS) from the dvi, ps, and pdf targets

I am not sure what should be done.  Enlightened suggestions are welcome.

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37