automake-ng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-NG] [PATCH 10/26] [ng] texi: reduce code duplication in output


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 10/26] [ng] texi: reduce code duplication in output Makefile
Date: Sat, 16 Jun 2012 23:29:57 +0200

No semantic change is intended.

* lib/am/texibuild.am: Use a make-runtime $(foreach) loop to define the
conversion rules for all the accepted Texinfo suffixes ('.txi', '.texi',
'.texinfo'), with the help of ...
(am__texi_rules_for_suffix): ... this new internal make function.
* automake.in (handle_texinfo): Adjust.
* t/txinfo6.sh: Adjust and extend.
* t/txinfo-rules-once.sh: Remove as obsolete.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in            |   22 ++++++++++------------
 lib/am/texibuild.am    |   21 +++++++++++----------
 t/txinfo-rules-once.sh |   36 ------------------------------------
 t/txinfo6.sh           |   20 +++++++++++++++-----
 4 files changed, 36 insertions(+), 63 deletions(-)
 delete mode 100755 t/txinfo-rules-once.sh

diff --git a/automake.in b/automake.in
index 4ce80b1..244c12b 100644
--- a/automake.in
+++ b/automake.in
@@ -3179,18 +3179,16 @@ sub handle_texinfo ()
       define_verbose_texinfo;
       # Keep this list in sync with the $infobase transform done
       # in &handle_texinfo_helper.
-      foreach my $valid_texinfo_suf (qw/texi texinfo txi/)
-        {
-          $output_verbatim .= preprocess_file (
-              "$libdir/am/texibuild.am",
-              AM_V_MAKEINFO    => verbose_flag('MAKEINFO'),
-              AM_V_TEXI2DVI    => verbose_flag('TEXI2DVI'),
-              AM_V_TEXI2PDF    => verbose_flag('TEXI2PDF'),
-              TEXIQUIET        => verbose_flag('texinfo'),
-              TEXIDEVNULL      => verbose_flag('texidevnull'),
-              'TEXI-SUFFIX'    => $valid_texinfo_suf
-            );
-        }
+      my @valid_texinfo_suffixes = qw/texi texinfo txi/;
+      $output_verbatim .= preprocess_file (
+          "$libdir/am/texibuild.am",
+          AM_V_MAKEINFO    => verbose_flag('MAKEINFO'),
+          AM_V_TEXI2DVI    => verbose_flag('TEXI2DVI'),
+          AM_V_TEXI2PDF    => verbose_flag('TEXI2PDF'),
+          TEXIQUIET        => verbose_flag('texinfo'),
+          TEXIDEVNULL      => verbose_flag('texidevnull'),
+          'TEXI-SUFFIXES'  => "@valid_texinfo_suffixes",
+          );
       ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper 
($info_texinfos);
       chomp $mostlyclean;
       chomp $clean;
diff --git a/lib/am/texibuild.am b/lib/am/texibuild.am
index a81bcf2..09905d5 100644
--- a/lib/am/texibuild.am
+++ b/lib/am/texibuild.am
@@ -89,14 +89,15 @@ define am__texibuild_html
        fi
 endef
 
-%.info: %.%TEXI-SUFFIX%
-       $(call am__texibuild_info,$(am__info_insrc))
-
-%.dvi: %.%TEXI-SUFFIX%
-       $(call am__texibuild_dvi_or_pdf,%AM_V_TEXI2DVI%,$(TEXI2DVI))
-
-%.pdf: %.%TEXI-SUFFIX%
-       $(call am__texibuild_dvi_or_pdf,%AM_V_TEXI2PDF%,$(TEXI2PDF))
+define am__texi_rules_for_suffix
+%.info: %.$1
+       $$(call am__texibuild_info,$$(am__info_insrc))
+%.dvi: %.$1
+       $$(call am__texibuild_dvi_or_pdf,$$(AM_V_TEXI2DVI),$$(TEXI2DVI))
+%.pdf: %.$1
+       $$(call am__texibuild_dvi_or_pdf,$$(AM_V_TEXI2PDF),$$(TEXI2PDF))
+%.html: %.$1
+       $$(am__texibuild_html)
+endef
 
-%.html: %.%TEXI-SUFFIX%
-       $(am__texibuild_html)
+$(foreach s,%TEXI-SUFFIXES%,$(eval $(call am__texi_rules_for_suffix,$s)))
diff --git a/t/txinfo-rules-once.sh b/t/txinfo-rules-once.sh
deleted file mode 100755
index d15ecbc..0000000
--- a/t/txinfo-rules-once.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2003-2012 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Some grepping checks on Texinfo support.
-
-. ./defs || Exit 1
-
-echo AC_OUTPUT >> configure.ac
-
-$ACLOCAL
-
-: > texinfo.tex
-
-echo info_TEXINFOS = main.texi other.texi sub/x.texi > Makefile.am
-mkdir sub
-echo @setfilename main.info > main.texi
-echo @setfilename other.info > other.texi
-echo @setfilename sub/x.info > sub/x.texi
-$AUTOMAKE
-$EGREP '\.(info|texi)' Makefile.in # For debugging.
-test $(grep -c '^%\.info: %\.texi$' Makefile.in) -eq 1
-
-:
diff --git a/t/txinfo6.sh b/t/txinfo6.sh
index b13c51f..05997b1 100755
--- a/t/txinfo6.sh
+++ b/t/txinfo6.sh
@@ -14,20 +14,30 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure '.txi' extension works.
+# Make sure '.txi' and '.texinfo' are accepted Texinfo extensions.
 
 . ./defs || Exit 1
 
-cat > Makefile.am << 'END'
-info_TEXINFOS = foo.txi
-END
+echo AC_OUTPUT >> configure.ac
+echo info_TEXINFOS = foo.txi doc/bar.texinfo > Makefile.am
 
+mkdir doc
 echo '@setfilename foo.info' > foo.txi
+echo '@setfilename bar.info' > doc/bar.texinfo
 : > texinfo.tex
 
 $ACLOCAL
+$AUTOCONF
 $AUTOMAKE
 
-grep '^%\.info: %\.txi$' Makefile.in
+./configure
+
+for fmt in info pdf dvi html; do
+  $MAKE -n "$fmt" > stdout || { cat stdout; Exit 1; }
+  cat stdout
+  for basename in foo doc/bar; do
+    grep "[/ $tab]$basename\\.$fmt[; $tab]" stdout
+  done
+done
 
 :
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]