From: Stefano Lattarini Date: Fri, 15 Jun 2012 21:29:28 +0000 (+0200) Subject: [ng] texi: be sure to only emit generic pattern rules once X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed0f01904b332f0c64f26797eaeb82e5847cc963;p=thirdparty%2Fautomake.git [ng] texi: be sure to only emit generic pattern rules once * lib/am/texibuild.am: Only hold generic pattern rules now, the stuff specific to single '.texi' files moved out ... * lib/am/texi-spec.am: ... to this new file. * Makefile.am (dist_am_DATA): Add it. * automake.in (output_texinfo_build_rules): Process 'texi-spec.am' rather than 'texbuild.am', and adjust transforms accordingly. (handle_texinfo): Process 'texibuild.am', once for each valid Texinfo extension (.texi, .txi, .texinfo). * t/txinfo-rules-once.sh: New test. Signed-off-by: Stefano Lattarini --- diff --git a/Makefile.am b/Makefile.am index f6f9cb248..532a5fdfa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -225,6 +225,7 @@ dist_am_DATA = \ lib/am/subdirs.am \ lib/am/tags.am \ lib/am/texi-vers.am \ + lib/am/texi-spec.am \ lib/am/texibuild.am \ lib/am/texinfos.am \ lib/am/vala.am \ diff --git a/automake.in b/automake.in index dbff5a8eb..750737cff 100644 --- a/automake.in +++ b/automake.in @@ -2865,11 +2865,8 @@ sub output_texinfo_build_rules ($$$@) ? '-I $(srcdir)' : "-I $sdir -I \$(srcdir)/$sdir"; - $output_rules .= file_contents ('texibuild', + $output_rules .= file_contents ('texi-spec', new Automake::Location, - AM_V_MAKEINFO => verbose_flag('MAKEINFO'), - AM_V_TEXI2DVI => verbose_flag('TEXI2DVI'), - AM_V_TEXI2PDF => verbose_flag('TEXI2PDF'), DEPS => "@deps", DEST_PREFIX => $dpfx, DEST_INFO_PREFIX => $dipfx, @@ -2877,9 +2874,6 @@ sub output_texinfo_build_rules ($$$@) INSRC => $insrc, MAKEINFOFLAGS => $makeinfoflags, SOURCE_REAL => $source, - SOURCE_SUFFIX => $ssfx, - TEXIQUIET => verbose_flag('texinfo'), - TEXIDEVNULL => verbose_flag('texidevnull'), ); return ("$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html"); } @@ -3183,6 +3177,20 @@ sub handle_texinfo () if ($info_texinfos) { 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_rules .= file_contents ( + 'texibuild', new Automake::Location, + 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 + ); + } ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos); chomp $mostlyclean; chomp $clean; diff --git a/lib/am/texi-spec.am b/lib/am/texi-spec.am new file mode 100644 index 000000000..de7a1ecfe --- /dev/null +++ b/lib/am/texi-spec.am @@ -0,0 +1,30 @@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 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 . + +INFO_DEPS += %DEST_INFO_PREFIX%.info + +%DEST_INFO_PREFIX%%DEST_SUFFIX%: %SOURCE_REAL% %DEPS% +?INSRC?%DEST_INFO_PREFIX%%DEST_SUFFIX%: am__info_insrc=yes + +%DEST_PREFIX%.dvi: %SOURCE_REAL% %DEPS% +%DEST_PREFIX%.pdf: %SOURCE_REAL% %DEPS% +%DEST_PREFIX%.html: %SOURCE_REAL% %DEPS% + +%DEST_INFO_PREFIX%%DEST_SUFFIX% \ +%DEST_PREFIX%.dvi \ +%DEST_PREFIX%.pdf \ +%DEST_PREFIX%.html \ +: am__makeinfoflags = %MAKEINFOFLAGS% diff --git a/lib/am/texibuild.am b/lib/am/texibuild.am index dad84f367..b4b609103 100644 --- a/lib/am/texibuild.am +++ b/lib/am/texibuild.am @@ -14,7 +14,7 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . -%.info: %%SOURCE_SUFFIX% +%.info: %.%TEXI-SUFFIX% $(if $(am__info_insrc),,@$(am__ensure_target_dir_exists)) ## Back up the info files before running makeinfo. This is the cheapest ## way to ensure that @@ -48,9 +48,7 @@ fi; \ rm -rf $$backupdir; exit $$rc -INFO_DEPS += %DEST_INFO_PREFIX%.info - -%.dvi: %%SOURCE_SUFFIX% +%.dvi: %.%TEXI-SUFFIX% %AM_V_TEXI2DVI%$(am__ensure_target_dir_exists) && \ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ ## Must set MAKEINFO like this so that version.texi will be found even @@ -63,7 +61,7 @@ INFO_DEPS += %DEST_INFO_PREFIX%.info ## can assume Texinf 4.9 or later. $(TEXI2DVI) %TEXIQUIET% --clean -o $@ $< %TEXIDEVNULL% -%.pdf: %%SOURCE_SUFFIX% +%.pdf: %.%TEXI-SUFFIX% %AM_V_TEXI2PDF%$(am__ensure_target_dir_exists) && \ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ ## Must set MAKEINFO like this so that version.texi will be found even @@ -76,7 +74,7 @@ INFO_DEPS += %DEST_INFO_PREFIX%.info ## can assume Texinf 4.9 or later. $(TEXI2PDF) %TEXIQUIET% --clean -o $@ $< %TEXIDEVNULL% -%.html: %%SOURCE_SUFFIX% +%.html: %.%TEXI-SUFFIX% %AM_V_MAKEINFO%$(am__ensure_target_dir_exists) \ ## When --split (the default) is used, makeinfo will output a ## directory. However it will not update the time stamp of a @@ -99,16 +97,3 @@ INFO_DEPS += %DEST_INFO_PREFIX%.info rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ exit 1; \ fi - -%DEST_INFO_PREFIX%.info: %SOURCE_REAL% %DEPS% -?INSRC?%DEST_INFO_PREFIX%.info: am__info_insrc=yes - -%DEST_PREFIX%.dvi: %SOURCE_REAL% %DEPS% -%DEST_PREFIX%.pdf: %SOURCE_REAL% %DEPS% -%DEST_PREFIX%.html: %SOURCE_REAL% %DEPS% - -%DEST_INFO_PREFIX%.info \ -%DEST_PREFIX%.dvi \ -%DEST_PREFIX%.pdf \ -%DEST_PREFIX%.html \ -: am__makeinfoflags = %MAKEINFOFLAGS% diff --git a/t/txinfo-rules-once.sh b/t/txinfo-rules-once.sh new file mode 100755 index 000000000..d15ecbcb6 --- /dev/null +++ b/t/txinfo-rules-once.sh @@ -0,0 +1,36 @@ +#! /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 . + +# 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 + +: