From: Tom Tromey Date: Fri, 26 Jan 1996 08:33:01 +0000 (+0000) Subject: Support for multiple .texi files X-Git-Tag: Release-0-29~9 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=103b41e6659f241edaae61abd26942908dab7d47;p=automake.git Support for multiple .texi files --- diff --git a/ChangeLog b/ChangeLog index 18e7858f..bf5c5cc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Fri Jan 26 00:15:25 1996 Tom Tromey + + * automake.in (file_contents_with_transform): Changed error + message. + (handle_configure): Define $contents{'CONFIG_HEADER'}. + + * texi-version.am: Many changes to support multiple .texi files. + Replaced "version.texi" with "@VTEXI@". Replaced "vti" with + "@VTI@". + * automake.in (handle_configure): install.sh is an anachronism. + (handle_texinfo): Generalized for multiple .texi files. Handle + 'clean-info' internally. + * texi-clean.am: Removed. + * Makefile.am: Updated for removal. + +Wed Jan 24 22:55:32 1996 Tom Tromey + + * automake.in (grep_for_vers_texi): New function. + (handle_texinfo): Use grep_for_vers_texi, not system("grep"). + (handle_texinfo): Changes to generalize to multiple .texi files. + Tue Jan 23 14:22:16 1996 Tom Tromey Fixes from Gord Matzigkeit: diff --git a/Makefile.am b/Makefile.am index 9ec1b138..87256c75 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,7 +15,7 @@ libraries.am library.am mans-vars.am \ program.am programs.am remake-hdr.am \ remake-subd.am remake.am scripts.am subdirs.am tags.am tags-subd.am \ tags-clean.am \ -texi-clean.am texi-version.am texinfos-vars.am texinfos.am \ +texi-version.am texinfos-vars.am texinfos.am \ libraries-clean.am scripts-clean.am programs-clean.am data-clean.am \ COPYING INSTALL install-sh mdate-sh mkinstalldirs texinfo.tex \ config.guess config.sub diff --git a/Makefile.in b/Makefile.in index 79c0448b..862e5b83 100644 --- a/Makefile.in +++ b/Makefile.in @@ -51,7 +51,7 @@ libraries.am library.am mans-vars.am \ program.am programs.am remake-hdr.am \ remake-subd.am remake.am scripts.am subdirs.am tags.am tags-subd.am \ tags-clean.am \ -texi-clean.am texi-version.am texinfos-vars.am texinfos.am \ +texi-version.am texinfos-vars.am texinfos.am \ libraries-clean.am scripts-clean.am programs-clean.am data-clean.am \ COPYING INSTALL install-sh mdate-sh mkinstalldirs texinfo.tex \ config.guess config.sub @@ -131,18 +131,18 @@ version.texi: stamp-vti stamp-vti: automake.texi $(top_srcdir)/configure.in echo "@set UPDATED `cd $(srcdir) && $(SHELL) mdate-sh automake.texi`" \ - > version.tmp - echo "@set EDITION $(VERSION)" >> version.tmp - echo "@set VERSION $(VERSION)" >> version.tmp - if cmp -s version.tmp $(srcdir)/version.texi; then \ - rm version.tmp; \ + > vti.tmp + echo "@set EDITION $(VERSION)" >> vti.tmp + echo "@set VERSION $(VERSION)" >> vti.tmp + if cmp -s vti.tmp $(srcdir)/version.texi; then \ + rm vti.tmp; \ else \ - mv version.tmp $(srcdir)/version.texi; \ + mv vti.tmp $(srcdir)/version.texi; \ fi echo timestamp > $(srcdir)/stamp-vti mostlyclean-vti: - rm -f version.tmp + rm -f vti.tmp clean-vti: @@ -150,7 +150,8 @@ distclean-vti: maintainer-clean-vti: rm -f stamp-vti version.texi -automake.info: automake.texi version.texi + +automake.info: automake.texi .texi.info: @@ -173,9 +174,9 @@ uninstall-info: done mostlyclean-info: - rm -f automake.aux automake.cp automake.cps automake.dvi \ - automake.fn automake.fns automake.ky automake.log \ - automake.pg automake.toc automake.tp automake.vr automake.op + automake.aux automake.cp automake.cps automake.dvi automake.fn \ + automake.fns automake.ky automake.log automake.pg automake.toc \ + automake.tp automake.vr automake.op clean-info: diff --git a/NEWS b/NEWS index 60cfaf25..c1b2564f 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ New in 0.29: LIBOBJS directly, handles AC_CONFIG_HEADER more precisely, etc. * TEXINFOS and MANS now obsolete; use info_TEXINFOS and man_MANS instead. * CONFIG_HEADER variable now obsolete +* Can handle multiple Texinfo sources New in 0.28: * Added --gnu and --gnits options diff --git a/TODO b/TODO index f8177988..2ff34c93 100644 --- a/TODO +++ b/TODO @@ -137,29 +137,15 @@ Look at dist's jmake for ideas. dist is the name of the distribution including Metaconfig. Perl uses it. Should handle directory hierarchies deeper than 2. Right now there is -no support for this at all. - -================================================================ - -Known Bugs: - -version.texi handling is broken -- it assumes you only have one .texi -file per directory. - (*) In any case, the UPDATED information would be different for - each .texi file included in a package -- that is my problem. - Now, if no package will ever have more than one .texi file - (in a given directory), I can just stop worrying about it. - -If there is ever more than one, we will need to change the name of -'version.texi' to be based on the name of the primary .texi file. -Will have to be careful here not to violate MS-DOS name limits. Also -will need more than one stamp-vti. - -[ actually, we could just number them. version0.texi, version1.texi, -etc ] [ actually, we can't, because the user could be reasonably -expected to want to make dependencies using the name of the .texi file -] [ actually, the real reason we can't is because it wouldn't be -obvious what name to include in the primary .texi file. Duh ] +no support for this at all. Here are some of the issues: +* Should handle AC_CONFIG_SUBDIRS, ie must handle configure.in in subdirs +* Must handle SUBDIRS in subdir Makefile.am's +* Must handle AC_CONFIG_AUX_DIR + * FIXME must already look in .. and ../.. + * Look for install.sh and give error! +* All this means there should be a "configure_dir" macro which points + to the directory in which config.status resides. This should be used + in eg remake-subd.am. ================================================================ @@ -183,7 +169,6 @@ DIST_SUBDIRS directories which are copied verbatim into the lib_LIBADD code conditionally included in a library This probably needs to be redone anyway. -AM_TEXINFOS override form SUFFIXES additional suffixes Document customary ordering of Makefile.am. From Franc,ois. @@ -193,6 +178,7 @@ Must document BUILT_SOURCES variable. See depend.am. How to deal with @LIBOBJS@. configure scanning putting .h files into blah_SOURCES is ok now +version.texi handling ================================================================ diff --git a/automake.in b/automake.in index 2a81461d..8a9c8f0c 100755 --- a/automake.in +++ b/automake.in @@ -545,10 +545,39 @@ sub handle_scripts 'bin', 'sbin', 'libexec', 'noinst'); } +# Search a file for a "version.texi" Texinfo include. Return the name +# of the include file if found, or the empty string if not. A +# "version.texi" file is actually any file whose name matches +# "vers*.texi". +sub grep_for_vers_texi +{ + local ($filename) = @_; + + if (! open (TEXI, $filename)) + { + &am_error ("couldn't open \`$filename': $!"); + return ''; + } + + while () + { + if (/^\@include\s+(vers[^.]*\.texi)\s*$/) + { + # Found it. + close (TEXI); + return $1; + } + } + + close (TEXI); + return ''; +} + # Handle all Texinfo source. +# Anyplace marked FIXME in this code is for multi-texi changes. sub handle_texinfo { - &am_error ("\`TEXINFOS' is an anachronism") + &am_error ("\`TEXINFOS' is an anachronism; use \`info_TEXINFOS'") if defined $contents{'TEXINFOS'}; return if ! defined $contents{'info_TEXINFOS'}; @@ -559,40 +588,76 @@ sub handle_texinfo return; } - local ($infobase); - ($infobase = $texis[0]) =~ s/\.texi$//; + local (@infos_list, @info_deps_list, @dvis_list, @texi_deps); + local ($infobase, $info_cursor); + local (%versions); + local ($done) = 0; + local ($vti); + local ($tc_cursor, @texi_cleans); - # If 'version.texi' is referenced by input file, then include - # automatic versioning capability. - system ("grep version.texi " . $relative_dir . "/" . $texis[0] - . " > /dev/null 2>&1"); - if (! ($? >> 8)) + foreach $info_cursor (@texis) { - # Got a hit. - push (@texis, 'version.texi'); - &push_dist_common ('version.texi', 'stamp-vti'); - push (@clean, 'vti'); + ($infobase = $info_cursor) =~ s/\.texi$//; - $output_rules .= - &file_contents_with_transform ('s/\@TEXI\@/' . $texis[0] . '/go', - 'texi-version'); - &push_phony_cleaners ('vti'); + # If 'version.texi' is referenced by input file, then include + # automatic versioning capability. + local ($vtexi) + = &grep_for_vers_texi ($relative_dir . "/" . $info_cursor); + if ($vtexi) + { + &am_error ("\`$vtexi', included in \`$info_cursor', also included in \`$versions{$vtexi}'") + if (defined $versions{$vtexi}); + $versions{$vtexi} = $info_cursor; - &require_file ($NORMAL, 'mdate-sh'); - } + # Got a hit. + push (@texis, $vtexi); + # We number the stamp-vti files. This is doable since the + # actual names don't matter much. We only number starting + # with the second one, so that the common case looks nice. + $vti = 'vti' . ($done ? $done : ''); + &push_dist_common ($vtexi, 'stamp-' . $vti); + push (@clean, $vti); - # If user specified file_TEXINFOS, then use that as explicit - # dependency list. - if (defined $contents{$infobase . "_TEXINFOS"}) - { - push (@texis, "\$" . $infobase . '_TEXINFOS'); - &push_dist_common ("\$" . $infobase . '_TEXINFOS'); - } + $output_rules .= + &file_contents_with_transform + ('s/\@TEXI\@/' . $info_cursor . '/g; ' + . 's/\@VTI\@/' . $vti . '/g; ' + . 's/\@VTEXI\@/' . $vtexi . '/g', + 'texi-version'); - if (@texis) - { - $output_rules .= ($infobase . ".info: " - . join (' ', @texis) . "\n\n"); + &push_phony_cleaners ($vti); + + # Only require once. + &require_file ($NORMAL, 'mdate-sh') if ! $done; + ++$done; + } + + # If user specified file_TEXINFOS, then use that as explicit + # dependency list. + @texi_deps = (); + push (@texi_deps, $info_cursor); + if (defined $contents{$infobase . "_TEXINFOS"}) + { + push (@texi_deps, "\$" . $infobase . '_TEXINFOS'); + &push_dist_common ("\$" . $infobase . '_TEXINFOS'); + } + + $output_rules .= ("\n" . $infobase . ".info: " + . join (' ', @texi_deps) . "\n\n"); + + push (@infos_list, $infobase . '.info*'); + push (@info_deps_list, $infobase . '.info'); + push (@dvis_list, $infobase . '.dvi'); + + # Generate list of things to clean for this target. We do + # this explicitly because otherwise too many things could be + # removed. In particular the ".log" extension might + # reasonably be used in other contexts by the user. + foreach $tc_cursor ('aux', 'cp', 'cps', 'dvi', 'fn', 'fns', + 'ky', 'log', 'pg', 'toc', 'tp', 'vr', 'op') + { + push (@texi_cleans, $infobase . '.' . $tc_cursor); + } } # Some boilerplate. @@ -601,9 +666,11 @@ sub handle_texinfo push (@phony, 'install-info', 'uninstall-info'); # How to clean. - $output_rules .= - &file_contents_with_transform ('s/\@TEXI\@/' . $infobase . '/go', - 'texi-clean'); + $output_rules .= "\nmostlyclean-info:\n"; + &pretty_print_rule ("\t", "\t ", @texi_cleans); + $output_rules .= ("\nclean-info:\n\ndistclean-info:\n\n" + . "maintainer-clean-info:\n\t" + . 'rm -f $(INFOS)' . "\n"); &push_phony_cleaners ('info'); push (@suffixes, '.texi', '.info', '.dvi'); @@ -616,9 +683,9 @@ sub handle_texinfo unshift (@install_data, 'install-info'); unshift (@all, 'info'); - $output_vars .= ("INFOS = " . $infobase . ".info*\n" - . "INFO_DEPS = " . $infobase . ".info\n" - . "DVIS = " . $infobase . ".dvi\n" + $output_vars .= ("INFOS = " . join (' ', @infos_list) . "\n" + . "INFO_DEPS = " . join (' ', @info_deps_list) . "\n" + . "DVIS = " . join (' ', @dvis_list) . "\n" # This next isn't strictly needed now -- the # places that look here could easily be changed # to look in info_TEXINFOS. But this is probably @@ -633,7 +700,7 @@ sub handle_texinfo # Handle any man pages. sub handle_man_pages { - &am_error ("\`MANS' is an anachronism") + &am_error ("\`MANS' is an anachronism; use \`man_MANS'") if defined $contents{'MANS'}; return if ! defined $contents{'man_MANS'}; @@ -984,6 +1051,10 @@ sub handle_configure # Look for some files we need. &require_file ($NORMAL, 'install-sh', 'mkinstalldirs'); + &am_error + ("\`install.sh' is an anachronism; use \`install-sh' instead") + if -f $relative_dir . '/install.sh'; + # If we have a configure header, require it. if ($config_header) { @@ -1020,12 +1091,13 @@ sub handle_configure $top_reldir = ''; } - &am_error ("\`CONFIG_HEADER' is an anachronism") + &am_error ("\`CONFIG_HEADER' is an anachronism; now determined from \`configure.in'") if defined $contents{'CONFIG_HEADER'}; - # Generate CONFIG_HEADER define. + # Generate CONFIG_HEADER define, and define interally. $output_vars .= "CONFIG_HEADER = ${top_reldir}${config_name}\n" if $config_name; + $contents{'CONFIG_HEADER'} = "${top_reldir}${config_name}"; } # Handle C headers. @@ -1780,7 +1852,7 @@ sub file_contents_with_transform local ($file) = $am_dir . '/' . $basename . '.am'; open (FC_FILE, $file) - || die "automake: installation error: cannot open \"$file\"\n"; + || die "automake: installation error: cannot open \`$file'\n"; local ($was_rule) = 0; local ($result_vars) = ''; diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index 9ec1b138..87256c75 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -15,7 +15,7 @@ libraries.am library.am mans-vars.am \ program.am programs.am remake-hdr.am \ remake-subd.am remake.am scripts.am subdirs.am tags.am tags-subd.am \ tags-clean.am \ -texi-clean.am texi-version.am texinfos-vars.am texinfos.am \ +texi-version.am texinfos-vars.am texinfos.am \ libraries-clean.am scripts-clean.am programs-clean.am data-clean.am \ COPYING INSTALL install-sh mdate-sh mkinstalldirs texinfo.tex \ config.guess config.sub diff --git a/texi-clean.am b/texi-clean.am deleted file mode 100644 index b53e42b8..00000000 --- a/texi-clean.am +++ /dev/null @@ -1,31 +0,0 @@ -## automake - create Makefile.in from Makefile.am -## Copyright (C) 1994, 1995, 1996 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, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -## 02111-1307, USA. -## We substitute the name of the texinfo file here because otherwise -## too many things could be removed. In particular the ".log" -## extension might be used in other contexts by the user -mostlyclean-info: - rm -f @TEXI@.aux @TEXI@.cp @TEXI@.cps @TEXI@.dvi \ - @TEXI@.fn @TEXI@.fns @TEXI@.ky @TEXI@.log \ - @TEXI@.pg @TEXI@.toc @TEXI@.tp @TEXI@.vr @TEXI@.op - -clean-info: - -distclean-info: - -maintainer-clean-info: - rm -f $(INFOS) diff --git a/texi-version.am b/texi-version.am index 451c9292..fdc2dc70 100644 --- a/texi-version.am +++ b/texi-version.am @@ -15,28 +15,28 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. -version.texi: stamp-vti +@VTEXI@: stamp-@VTI@ ## Depend on configure.in so that version number updates cause a ## rebuild. -stamp-vti: @TEXI@ $(top_srcdir)/configure.in +stamp-@VTI@: @TEXI@ $(top_srcdir)/configure.in echo "@set UPDATED `cd $(srcdir) && $(SHELL) mdate-sh @TEXI@`" \ - > version.tmp - echo "@set EDITION $(VERSION)" >> version.tmp - echo "@set VERSION $(VERSION)" >> version.tmp - if cmp -s version.tmp $(srcdir)/version.texi; then \ - rm version.tmp; \ + > @VTI@.tmp + echo "@set EDITION $(VERSION)" >> @VTI@.tmp + echo "@set VERSION $(VERSION)" >> @VTI@.tmp + if cmp -s @VTI@.tmp $(srcdir)/@VTEXI@; then \ + rm @VTI@.tmp; \ else \ - mv version.tmp $(srcdir)/version.texi; \ + mv @VTI@.tmp $(srcdir)/@VTEXI@; \ fi - echo timestamp > $(srcdir)/stamp-vti + echo timestamp > $(srcdir)/stamp-@VTI@ -mostlyclean-vti: - rm -f version.tmp +mostlyclean-@VTI@: + rm -f @VTI@.tmp -clean-vti: +clean-@VTI@: -distclean-vti: +distclean-@VTI@: -maintainer-clean-vti: - rm -f stamp-vti version.texi +maintainer-clean-@VTI@: + rm -f stamp-@VTI@ @VTEXI@