automake-patches
[Top][All Lists]
Advanced

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

generated texinfo files, step 2


From: Alexandre Duret-Lutz
Subject: generated texinfo files, step 2
Date: 07 Jun 2002 18:06:58 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

This is a monstro patch that would be difficult to split.
It apply after
  http://mail.gnu.org/pipermail/automake-patches/2002-June/000858.html
(and it will conflict once Paolo's patch for `make pdf' is applied)

I initially intended to add support for nodist_info_TEXINFOS
only.  But it turned out I needed Texinfos files to be built in
the builddir instead of srcdir (this is PR/168).  So I've done
that too.  

Also since I was shaking all this code a lot, I've added support
for noinst_TEXINFOS (a comment suggested this), and Texinfo
sources in subdiretories.

This adds four test cases, but I'm not really confidant.  
I've not tested this in a real project yet.

Index: ChangeLog
===================================================================
RCS file: /home/adl/CVSROOT/HEAD-20020603-2004/ChangeLog,v
retrieving revision 1.1
diff -u -r1.1 ChangeLog
--- ChangeLog   3 Jun 2002 18:04:34 -0000       1.1
+++ ChangeLog   7 Jun 2002 15:44:52 -0000
@@ -1,3 +1,41 @@
+2002-06-07  Alexandre Duret-Lutz  <address@hidden>
+
+       Shake the Texinfo rules to support nodist_, noinst_, and
+       subdirectories.  Also build info, texi, and dvi files in the
+       current directory instead of srcdir (for PR automake/168).
+
+       * automake.in (stampvti): New variable.
+       (initialize_per_input): Reset it.
+       (texinfo_build_clean_files) <clean_suffixes>: Don't return ps and dvi.
+       (get_texinfo_deps): Do not return \$(${canonical}_FILENAME), but
+       it's value.
+       (output_texinfo_build_rules,
+       variable_pretty_output_if_defined): New functions.
+       (handle_texinfo_helper, handle_texinfo): Reorganize these two
+       functions; move the Texinfo.tex handling code to handle_texinfo;
+       add support for noinst_, nodist_, and subdir Texinfos.
+       Especially, this introduces the following new Make variables:
+       DIST_INFOS, DIST_TEXINFOS, INST_INFOS, am__texinfo_dirstamps.
+       * automake.texi (Texinfo): Document nodist_ and noinst_.
+       * lib/am/distdir.am (DISTFILES): Distribute $(DIST_TEXINFOS) instead
+       of $(TEXINFOS).
+       * lib/am/texi-vers.am: Build version.texi and stamp-vti in the
+       current directory, not $(srcdir).  Use %STAMPVTI% to name the stamp
+       file.
+       * lib/am/texibuild.am: Rewrite to output files in the current
+       directory, not $(srcdir).  Also, support both generic and
+       non-generic output.
+       * lib/am/texinfos.am (dvi-am, info-am): Depend on
+       $(am__texinfo_dirstamps).
+       (install-info-am, uninstall-info-am): Install $(INST_INFOS),
+       not $(INFO_DEPS).
+       (dist-info): Distribute $(DIST_INFOS), not $(INFO_DEPS).
+       * tests/texinfo12.test, tests/texinfo13.test, tests/texinfo14.test,
+       tests/texinfo15.test: New files.
+       * tests/Makefile.am (TESTS): Add them.
+       * tests/texinfo10.test: Use set -e, so the checks are not ignored.
+       * tests/texinfo11.test: Update comment.
+
 2002-05-30  Alexandre Duret-Lutz  <address@hidden>
 
        Honor `_FILENAME' variables for Texinfo files, to help with
Index: automake.in
===================================================================
RCS file: /home/adl/CVSROOT/HEAD-20020603-2004/automake.in,v
retrieving revision 1.1
diff -u -r1.1 automake.in
--- automake.in 3 Jun 2002 18:04:34 -0000       1.1
+++ automake.in 7 Jun 2002 14:54:22 -0000
@@ -613,6 +613,9 @@
 # the named of the helper variable used to append to VAR in CONDITIONS.
 my %appendvar = ();
 
+# Counter for numbering the stamp files used in Texinfo rules.
+my $stampvti = 0;
+
 ## --------------------------------- ##
 ## Forward subroutine declarations.  ##
 ## --------------------------------- ##
@@ -753,6 +756,8 @@
     %subobjvar = ();
 
     %appendvar = ();
+
+    $stampvti = 0;
 }
 
 
@@ -3080,7 +3085,7 @@
     my ($filename, $extra_suffixes, $syncode_indexes) = (@_, [], []);
 
     # These are always created, no matter whether indexes are used or not.
-    my @clean_suffixes = qw(aux dvi log ps toc
+    my @clean_suffixes = qw(aux log toc
                            cp fn ky vr tp pg); # grep new.*index texinfo.tex
     push @clean_suffixes, @$extra_suffixes;
 
@@ -3210,40 +3215,99 @@
        # the most common index files and let the user clean any
        # custom index file itself.
        my @common_indices = qw/cps fns kys vrs tps pgs/;
-       return ("\$(${canonical}_FILENAME)", undef,
+       # It's tempting to return "\$(${canonical}_FILENAME)" here,
+       # but the Texinfo functions need the actual value (so they
+       # see which directory and extension is used).
+       return (variable_value ("${canonical}_FILENAME"), undef,
                texinfo_build_clean_files ($filename, @common_indices));
     }
     return scan_texinfo_file $filename;
 }
 
-# ($DO-SOMETHING, $TEXICLEANS)
-# handle_texinfo_helper ()
-# ------------------------
-# Handle all Texinfo source; helper for handle_texinfo
-sub handle_texinfo_helper
+# $DIRSTAMP
+# output_texinfo_build_rules ($SOURCE, $DEST, @DEPENDENCIES)
+# ----------------------------------------------------------
+sub output_texinfo_build_rules ($$@)
 {
-    macro_error ('TEXINFOS',
-                "`TEXINFOS' is an anachronism; use `info_TEXINFOS'")
-       if variable_defined ('TEXINFOS');
-    return (0, '') if (! variable_defined ('info_TEXINFOS')
-                      && ! variable_defined ('html_TEXINFOS'));
+    my ($source, $dest, @deps) = @_;
 
-    if (variable_defined ('html_TEXINFOS'))
+    # Split `a.texi' into `a' and `.texi'.
+
+    my ($spfx, $ssfx) = ($source =~ /^(.*?)(\.[^.]*)?$/);
+    my ($dpfx, $dsfx) = ($dest =~ /^(.*?)(\.[^.]*)?$/);
+
+    $ssfx ||= "";
+    $dsfx ||= "";
+
+    # We can output two kinds of rules: the "generic" rules
+    # use Make suffix rules and are appropritate when
+    # $source and $dest lie in the current directory; the "specifix"
+    # rules is needed in the other case.
+    #
+    # The former are output only once (this is not really apparent
+    # here, but just remember that some logic deeper in Automake will
+    # not output the same rule twice); while the later need to be output
+    # for each Texinfo source.
+    my $generic;
+    my $makeinfoflags;
+    my $sdir = dirname $source;
+    if ($sdir eq '.' && dirname ($dest) eq '.')
     {
-       macro_error ('html_TEXINFOS',
-                    "HTML generation not yet supported");
-       return (0, '');
+       $generic = 1;
+       $makeinfoflags = '-I $(srcdir)';
+    }
+    else
+    {
+       $generic = 0;
+       $makeinfoflags = "-I $sdir -I \$(srcdir)/$sdir";
     }
 
-    my @texis = &variable_value_as_list_recursive ('info_TEXINFOS', 'all');
+    # If the resulting file lie into a subdirectory,
+    # make sure this directory will exist.
+    my $dirstamp = require_build_directory_maybe ($dest);
+
+    # It is wrong to make $SOURCE dependent on $DIRSTAMP, because
+    # $SOURCE is distributed and $DIRSTAMP is not.  A generated file
+    # should never be dependent upon a non-distributed built file.
+    #
+    # So don't do that:
+    #
+    #   push @deps, $dirstamp;
+    #
+    # Instead we append all dirstamps to the $(am__texinfo_dirstamps)
+    # variable and have this variable in the dependencies of
+    # info-am, dvi-am, etc.
+    macro_define ('am__texinfo_dirstamps', 1, '+', 'TRUE',
+                 $dirstamp, 'internal');
+
+    $output_rules .= &file_contents ('texibuild',
+                                    GENERIC       => $generic,
+                                    SOURCE_SUFFIX => $ssfx,
+                                    SOURCE => ($generic ? '$<' : $source),
+                                    DEST_PREFIX   => $dpfx,
+                                    DEST_SUFFIX   => $dsfx,
+                                    MAKEINFOFLAGS => $makeinfoflags,
+                                    DEPS          => "@deps");
+    return $dirstamp;
+}
+
+
+# ($DO-SOMETHING, @TEXICLEANS)
+# handle_texinfo_helper ($VARNAME)
+# --------------------------------
+# Handle the Texinfo sources defined in ${prefix}_TEXINFOS.
+# Helper for handle_texinfo.
+sub handle_texinfo_helper ($)
+{
+    my ($variable) = @_;
+
+    my @texis = &variable_value_as_list_recursive ($variable, 'all');
 
     my (@info_deps_list, @dvis_list, @texi_deps);
     my %versions;
-    my $done = 0;
     my @texi_cleans;
     my $canonical;
 
-    my %texi_suffixes;
     foreach my $info_cursor (@texis)
     {
         my $infobase = $info_cursor;
@@ -3255,7 +3319,6 @@
            &am_error ("texinfo file `$info_cursor' has unrecognized 
extension");
            next;
        }
-       $texi_suffixes{$1} = 1;
 
        my $canonical = &canonicalize ($infobase);
 
@@ -3263,6 +3326,15 @@
          &scan_texinfo_deps ("$relative_dir/$info_cursor", $canonical)
            or next;
        push (@texi_cleans, @clean_files);
+       push (@texi_cleans, "$infobase.ps", "$infobase.dvi");
+
+       # If the Texinfo source is in a subdirectory, create the
+       # resulting info in this subdirectory.  If it is in the
+       # current directory, try hard to not prefix "./" because
+       # it breaks the generic rules.
+       my $outdir = dirname ($info_cursor) . '/';
+       $outdir = "" if $outdir eq './';
+       $out_file =  $outdir . $out_file;
 
        # If 'version.texi' is referenced by input file, then include
        # automatic versioning capability.
@@ -3275,19 +3347,17 @@
            # 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.
-           my $vti = ($done ? $done : 'vti');
-           ++$done;
+           my $vti = ($stampvti ? $stampvti : 'vti');
+           ++$stampvti;
 
            # This is ugly, but it is our historical practice.
            if ($config_aux_dir_set_in_configure_in)
            {
-               require_conf_file_with_macro ('info_TEXINFOS', FOREIGN,
-                                             'mdate-sh');
+               require_conf_file_with_macro ($variable, FOREIGN, 'mdate-sh');
            }
            else
            {
-               require_file_with_macro ('info_TEXINFOS', FOREIGN,
-                                        'mdate-sh');
+               require_file_with_macro ($variable, FOREIGN, 'mdate-sh');
            }
 
            my $conf_dir;
@@ -3301,19 +3371,17 @@
                $conf_dir = '$(srcdir)/';
            }
            $output_rules .= &file_contents ('texi-vers',
-                                            ('TEXI'  => $info_cursor,
-                                             'VTI'   => $vti,
-                                             'VTEXI' => $vtexi,
-                                             'MDDIR' => $conf_dir));
+                                            TEXI     => $info_cursor,
+                                            VTI      => $vti,
+                                            STAMPVTI => "${outdir}stamp-$vti",
+                                            VTEXI    => "$outdir$vtexi",
+                                            MDDIR    => $conf_dir);
        }
 
        # If user specified file_TEXINFOS, then use that as explicit
        # dependency list.
        @texi_deps = ();
-       push (@texi_deps, $info_cursor);
-       # Prefix with $(srcdir) because some version of make won't
-       # work if the target has it and the dependency doesn't.
-       push (@texi_deps, '$(srcdir)/' . $vtexi) if $vtexi;
+       push (@texi_deps, "$outdir$vtexi") if $vtexi;
 
        if (variable_defined ($canonical . "_TEXINFOS"))
        {
@@ -3321,98 +3389,162 @@
            &push_dist_common ('$(' . $canonical . '_TEXINFOS)');
        }
 
-       $output_rules .= ("\n" . $out_file . ": "
-                         . "@texi_deps"
-                         . "\n" . $infobase . ".dvi: "
-                         . "@texi_deps"
-                         . "\n");
+       my $dirstamp = output_texinfo_build_rules ($info_cursor, $out_file,
+                                                  @texi_deps);
+       push @texi_cleans, $dirstamp if $dirstamp;
 
        push (@info_deps_list, $out_file);
        push (@dvis_list, $infobase . '.dvi');
     }
 
-    # Handle location of texinfo.tex.
-    my $need_texi_file = 0;
-    my $texinfodir;
-    if ($cygnus_mode)
+    push (@dist_targets, 'dist-info');
+
+    # INFO_DEPS: all *.info files
+    # DIST_INFOS: all distributed *.info files
+    # INST_INFOS: all installable *.info files
+    # DVIS: all *.dvi files
+    # TEXINFOS: all *.texi files
+    # DIST_TEXINFOS: all distributed *.texi files
+
+    if ($variable !~ /noinst_/)
     {
-        $texinfodir = '$(top_srcdir)/../texinfo';
-       &define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex");
+       macro_define ('INST_INFOS', 1, '+', 'TRUE',
+                     "@info_deps_list", 'internal');
     }
-    elsif ($config_aux_dir_set_in_configure_in)
+    macro_define ('INFO_DEPS', 1, '+', 'TRUE',
+                 "@info_deps_list", 'internal');
+
+    if ($variable =~ /nodist_/)
     {
-        $texinfodir = $config_aux_dir;
-       &define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex");
-       $need_texi_file = 2; # so that we require_conf_file later
+       push @texi_cleans, @info_deps_list, variable_value ($variable);
     }
-    elsif (variable_defined ('TEXINFO_TEX'))
+    else
     {
-       # The user defined TEXINFO_TEX so assume he knows what he is
-       # doing.
-        $texinfodir = ('$(srcdir)/'
-                      . dirname (&variable_value ('TEXINFO_TEX')));
+       macro_define ('DIST_INFOS', 1, '+', 'TRUE',
+                     "@info_deps_list", 'internal');
+       macro_define ('DIST_TEXINFOS', 1, '+', 'TRUE',
+                     variable_value ($variable), 'internal')
     }
-    else
+
+    macro_define ('DVIS', 1, '+', 'TRUE',
+                 "@dvis_list", 'internal');
+
+    macro_define ('TEXINFOS', 1, '+', 'TRUE',
+                 variable_value ($variable), 'internal');
+
+
+    return (1, @texi_cleans);
+}
+
+# handle_texinfo ()
+# -----------------
+# Handle all Texinfo sources.
+sub handle_texinfo
+{
+    macro_error ('TEXINFOS',
+                "`TEXINFOS' is an anachronism; use `info_TEXINFOS'")
+       if variable_defined ('TEXINFOS');
+
+    if (variable_defined ('html_TEXINFOS'))
     {
-        $texinfodir = '$(srcdir)';
-       $need_texi_file = 1;
+       macro_error ('html_TEXINFOS',
+                    "HTML generation not yet supported");
+       return (0, '');
     }
 
-    foreach my $txsfx (sort keys %texi_suffixes)
+    my $do_something = 0;
+    my @texi_cleans = ();
+
+    # Process all *info_TEXINFOS variables.
+    my $last_varname;
+    foreach my $varname (keys %var_value)
     {
-       $output_rules .= &file_contents ('texibuild',
-                                        ('TEXINFODIR' => $texinfodir,
-                                         'SUFFIX'     => $txsfx));
+       if ($varname =~ /^(?:dist_|nodist_)?(?:info|noinst)_TEXINFOS$/)
+       {
+           $last_varname = $varname;
+           my ($my_do_something, @my_texi_cleans) =
+               handle_texinfo_helper ($varname);
+           $do_something |= $my_do_something;
+           push @texi_cleans, @my_texi_cleans;
+       }
     }
 
-    # The return value.
     my $texiclean = &pretty_print_internal ("", "\t  ", @texi_cleans);
 
-    push (@dist_targets, 'dist-info');
-
-    if (! defined $options{'no-installinfo'})
+    # Handle location of texinfo.tex.
+    my $need_texi_file = 0;
+    my $texinfodir = "";
+    if ($do_something)
     {
-       # Make sure documentation is made and installed first.  Use
-       # $(INFO_DEPS), not 'info', because otherwise recursive makes
-       # get run twice during "make all".
-       unshift (@all, '$(INFO_DEPS)');
-    }
+       if ($cygnus_mode)
+       {
+           $texinfodir = '$(top_srcdir)/../texinfo';
+           &define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex");
+       }
+       elsif ($config_aux_dir_set_in_configure_in)
+       {
+           $texinfodir = $config_aux_dir;
+           &define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex");
+           $need_texi_file = 2; # so that we require_conf_file later
+       }
+       elsif (variable_defined ('TEXINFO_TEX'))
+       {
+           # The user defined TEXINFO_TEX so assume he knows what he is
+           # doing.
+           $texinfodir = ('$(srcdir)/'
+                          . dirname (&variable_value ('TEXINFO_TEX')));
+       }
+       else
+       {
+           $texinfodir = '$(srcdir)';
+           $need_texi_file = 1;
+       }
 
-    &define_variable ("INFO_DEPS", "@info_deps_list");
-    &define_variable ("DVIS", "@dvis_list");
-    # 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 better, in case noinst_TEXINFOS is ever supported.
-    &define_variable ("TEXINFOS", &variable_value ('info_TEXINFOS'));
+       &define_variable ('am__TEXINFO_TEX_DIR', $texinfodir);
+    }
 
     # Do some error checking.  Note that this file is not required
     # when in Cygnus mode; instead we defined TEXINFO_TEX explicitly
     # up above.
     if ($need_texi_file && ! defined $options{'no-texinfo.tex'})
     {
+       # Use the last processed *_TEXINFO macro for the error message.
+       # (It isn't imporant that it is the last, but we have
+       # to show one.)
        if ($need_texi_file > 1)
        {
-           require_conf_file_with_macro ('info_TEXINFOS', FOREIGN,
+           require_conf_file_with_macro ($last_varname, FOREIGN,
                                          'texinfo.tex');
        }
        else
        {
-           require_file_with_macro ('info_TEXINFOS', FOREIGN, 'texinfo.tex');
+           require_file_with_macro ($last_varname, FOREIGN, 'texinfo.tex');
        }
     }
 
-    return (1, $texiclean);
-}
-
-# handle_texinfo ()
-# -----------------
-# Handle all Texinfo source.
-sub handle_texinfo
-{
-    my ($do_something, $texiclean) = handle_texinfo_helper ();
+    # Output this even if there is nothing to do.  This includes
+    # the rule for recursively building the documentation.
     $output_rules .=  &file_contents ('texinfos',
-                                     ('TEXICLEAN' => $texiclean,
-                                      'LOCAL-TEXIS' => $do_something));
+                                     TEXINFODIR => $texinfodir,
+                                     TEXICLEAN => $texiclean,
+                                     'LOCAL-TEXIS' => $do_something);
+
+    if ($do_something)
+    {
+       push (@dist_targets, 'dist-info');
+
+       if (! defined $options{'no-installinfo'})
+       {
+           # Make sure documentation is made and installed first.  Use
+           # $(INFO_DEPS), not 'info', because otherwise recursive makes
+           # get run twice during "make all".
+           unshift (@all, '$(INFO_DEPS)');
+       }
+
+       variable_pretty_output_if_defined ($_, 'TRUE')
+           foreach (qw/INFO_DEPS DIST_INFOS DVIS TEXINFOS
+                    DIST_TEXINFOS INST_INFOS am__texinfo_dirstamps/);
+    }
 }
 
 # Handle any man pages.
@@ -6640,6 +6772,14 @@
     }
 }
 
+# &variable_pretty_output_if_defined ($VAR, address@hidden)
+# ---------------------------------------------------
+sub variable_pretty_output_if_defined ($@)
+{
+    my $var = shift;
+    variable_pretty_output ($var, @_)
+       if exists $var_value{$var};
+}
 
 # &variable_value_as_list_recursive ($VAR, $COND, $PARENT)
 # --------------------------------------------------------
Index: automake.texi
===================================================================
RCS file: /home/adl/CVSROOT/HEAD-20020603-2004/automake.texi,v
retrieving revision 1.1
diff -u -r1.1 automake.texi
--- automake.texi       3 Jun 2002 18:04:34 -0000       1.1
+++ automake.texi       7 Jun 2002 15:21:55 -0000
@@ -3610,11 +3610,51 @@
 MOSTLYCLEANFILES = maude.mf maude.mc
 @end example
 
-Note that Automake always distributes Texinfo files.  There is no
-support for @code{nodist_info_TEXINFOS} (yet).  This is why the above
-example cleans @file{maude.texi} from @code{maintainer-clean}: it
-doesn't make much sense to @code{clean} or @code{distclean} a file which
-is distributed.
+Note that Automake distributes Texinfo files by default.  This is why
+the above example cleans @file{maude.texi} from @code{maintainer-clean}:
+it doesn't make much sense to @code{clean} or @code{distclean} a file
+which is distributed.
+
address@hidden Not distributing Texinfo files
address@hidden Texinfo files, not distributed
address@hidden Not distributing Texinfo files
address@hidden nodist_info_TEXINFOS
+
+The @code{_TEXINFOS} primary supports the @code{nodist_} prefix.  If you
+declare some Texinfo files with @code{nodist_info_TEXINFOS} they will
+not be distributed.  The resulting @file{*.info} files will not be
+distributed either (it would be a bug to distribute a file which depends
+upon non-distributed files).  Therefore using
address@hidden requires your users to install Texinfo.
+
+Let's revise our last example.  Since we can build @file{maude.texi},
+from @file{maude.c}, we don't want to distribute @file{maude.texi}:
+
address@hidden
+nodist_info_TEXINFOS = maude.texi
+maude_FILENAME = maude.info
+
+maude.texi: maude.c
+        @i{command to build maude.texi from maude.c}
+
+# Extra `index files' to clean.
+MOSTLYCLEANFILES = maude.mf maude.mc
address@hidden example
+
+Note that Automake will produces a rule to clean @file{maude.texi} on
address@hidden mostlyclean} automatically, because using
address@hidden makes sense only when the Texinfo files are
+generated.
+
address@hidden Not installing Texinfo files
address@hidden Not installing Texinfo files
address@hidden Texinfo files, not installed
address@hidden noinst_TEXINFOS
+
+Like most of the other primary, @code{TEXINFOS} supports the
address@hidden prefix.  A file listed in @code{noinst_TEXINFOS} will be
+built and distributed, but not installed.
+
 
 @node Man pages,  , Texinfo, Documentation
 @section Man pages
Index: lib/am/distdir.am
===================================================================
RCS file: /home/adl/CVSROOT/HEAD-20020603-2004/lib/am/distdir.am,v
retrieving revision 1.1
diff -u -r1.1 distdir.am
--- lib/am/distdir.am   3 Jun 2002 18:04:35 -0000       1.1
+++ lib/am/distdir.am   3 Jun 2002 19:15:27 -0000
@@ -17,7 +17,7 @@
 ## 02111-1307, USA.
 
 ## DIST_COMMON comes first so that README can be the very first file.
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(DIST_TEXINFOS) $(EXTRA_DIST)
 
 top_distdir = %TOP_DISTDIR%
 if %?TOPDIR_P%
Index: lib/am/texi-vers.am
===================================================================
RCS file: /home/adl/CVSROOT/HEAD-20020603-2004/lib/am/texi-vers.am,v
retrieving revision 1.1
diff -u -r1.1 texi-vers.am
--- lib/am/texi-vers.am 3 Jun 2002 18:04:35 -0000       1.1
+++ lib/am/texi-vers.am 7 Jun 2002 11:49:52 -0000
@@ -17,15 +17,16 @@
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.
 
-DIST_COMMON += %VTEXI% stamp-%VTI%
+DIST_COMMON += %VTEXI% %STAMPVTI%
 
-$(srcdir)/%VTEXI%: %MAINTAINER-MODE% $(srcdir)/stamp-%VTI%
+%VTEXI%: %MAINTAINER-MODE% %STAMPVTI%
        @:
 
 ## Depend on %CONFIGURE-AC% so that version number updates cause a
 ## rebuild.
-$(srcdir)/stamp-%VTI%: %TEXI% $(top_srcdir)/%CONFIGURE-AC%
-       @(set `$(SHELL) %MDDIR%mdate-sh $(srcdir)/%TEXI%`; \
+%STAMPVTI%: %TEXI% $(top_srcdir)/%CONFIGURE-AC%
+       @(dir=.; test -f ./%TEXI% || dir=$(srcdir); \
+       set `$(SHELL) %MDDIR%mdate-sh $$dir/%TEXI%`; \
        echo "@set UPDATED $$1 $$2 $$3"; \
        echo "@set UPDATED-MONTH $$2 $$3"; \
        echo "@set EDITION $(VERSION)"; \
@@ -33,11 +34,11 @@
 ## Use cp and rm here because some older "mv"s can't move across
 ## filesystems.  Furthermore, GNU "mv" in the AmigaDOS environment
 ## can't handle this.
-       @cmp -s %VTI%.tmp $(srcdir)/%VTEXI% \
-         || (echo "Updating $(srcdir)/%VTEXI%"; \
-             cp %VTI%.tmp $(srcdir)/%VTEXI%)
+       @cmp -s %VTI%.tmp %VTEXI% \
+         || (echo "Updating %VTEXI%"; \
+             cp %VTI%.tmp %VTEXI%)
        address@hidden -f %VTI%.tmp
-       @cp $(srcdir)/%VTEXI% $@
+       @cp %VTEXI% $@
 
 mostlyclean-am: mostlyclean-%VTI%
 mostlyclean-%VTI%:
@@ -45,6 +46,6 @@
 
 maintainer-clean-am: maintainer-clean-%VTI%
 maintainer-clean-%VTI%:
-%MAINTAINER-MODE%      -rm -f $(srcdir)/stamp-%VTI% $(srcdir)/%VTEXI%
+%MAINTAINER-MODE%      -rm -f %STAMPVTI% %VTEXI%
 
 .PHONY: mostlyclean-%VTI% maintainer-clean-%VTI%
Index: lib/am/texibuild.am
===================================================================
RCS file: /home/adl/CVSROOT/HEAD-20020603-2004/lib/am/texibuild.am,v
retrieving revision 1.1
diff -u -r1.1 texibuild.am
--- lib/am/texibuild.am 3 Jun 2002 18:04:35 -0000       1.1
+++ lib/am/texibuild.am 7 Jun 2002 15:34:29 -0000
@@ -17,43 +17,26 @@
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.
 
-.%SUFFIX%.info:
-## We want to force the .info file to be built in srcdir.  This is
-## probably the simplest way.  However, at Cygnus .info files are
-## always put into the build directory.  So at runtime we select which
-## rule to use.
+?GENERIC?%SOURCE_SUFFIX%%DEST_SUFFIX%:
+?!GENERIC?%DEST_PREFIX%%DEST_SUFFIX%: %SOURCE% %DEPS%
 ## Note that we also remove the possible output files before running
 ## makeinfo.  Otherwise, if the texinfo file shrinks (or if you start
 ## using --no-split), you'll be left with some dead info files lying
 ## around -- dead files which will end up in the distribution.
-?!CYGNUS?      @cd $(srcdir) && rm -f $@ address@hidden address@hidden
-?!CYGNUS?      cd $(srcdir) \
-?!CYGNUS?        && $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \
-?!CYGNUS?             `echo $< | sed 's,.*/,,'`
-?CYGNUS?       @rm -f $@ address@hidden address@hidden
-?CYGNUS?       $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \
-?CYGNUS?         -I $(srcdir) $<
+       @rm -f $@ address@hidden address@hidden
+       $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \
+         %MAKEINFOFLAGS% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% -o 
$@
 
-.%SUFFIX%.dvi:
-       TEXINPUTS="%TEXINFODIR%$(PATH_SEPARATOR)$$TEXINPUTS" \
+?GENERIC?%SOURCE_SUFFIX%.dvi:
+?!GENERIC?%DEST_PREFIX%.dvi: %SOURCE% %DEPS%
+       TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
 ## Must set MAKEINFO like this so that version.texi will be found even
-## if it is in srcdir.
-       MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I 
$(srcdir)' \
-       $(TEXI2DVI) $<
+## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
+       MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) 
%MAKEINFOFLAGS%' \
+       $(TEXI2DVI) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% -o $@
 
-.%SUFFIX%:
-## We want to force the .info file to be built in srcdir.  This is
-## probably the simplest way.  However, at Cygnus .info files are
-## always put into the build directory.  So at runtime we select which
-## rule to use.
-## Note that we also remove the possible output files before running
-## makeinfo.  Otherwise, if the texinfo file shrinks (or if you start
-## using --no-split), you'll be left with some dead info files lying
-## around -- dead files which will end up in the distribution.
-?!CYGNUS?      @cd $(srcdir) && rm -f $@ address@hidden address@hidden
-?!CYGNUS?      cd $(srcdir) \
-?!CYGNUS?        && $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \
-?!CYGNUS?             `echo $< | sed 's,.*/,,'`
-?CYGNUS?       @rm -f $@ address@hidden address@hidden
-?CYGNUS?       $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \
-?CYGNUS?         -I $(srcdir) $<
+## If we are using the generic rules, we need separate dependencies.
+if %?GENERIC%
+%DEST_PREFIX%%DEST_SUFFIX%: %DEPS%
+%DEST_PREFIX%.dvi: %DEPS%
+endif %?GENERIC%
Index: lib/am/texinfos.am
===================================================================
RCS file: /home/adl/CVSROOT/HEAD-20020603-2004/lib/am/texinfos.am,v
retrieving revision 1.1
diff -u -r1.1 texinfos.am
--- lib/am/texinfos.am  3 Jun 2002 18:04:35 -0000       1.1
+++ lib/am/texinfos.am  7 Jun 2002 14:55:44 -0000
@@ -68,8 +68,8 @@
 endif !%?SUBDIRS%
 
 if %?LOCAL-TEXIS%
-info-am: $(INFO_DEPS)
-dvi-am: $(DVIS)
+info-am: $(am__texinfo_dirstamps) $(INFO_DEPS)
+dvi-am: $(am__texinfo_dirstamps) $(DVIS)
 else ! %?LOCAL-TEXIS%
 info-am:
 dvi-am:
@@ -108,14 +108,13 @@
 install-info-am: $(INFO_DEPS)
        @$(NORMAL_INSTALL)
        $(mkinstalldirs) $(DESTDIR)$(infodir)
-       @list='$(INFO_DEPS)'; \
+       @list='$(INST_INFOS)'; \
        for file in $$list; do \
-?CYGNUS?         if test -f $$file; then d=.; else d=$(srcdir); fi; \
-?!CYGNUS?        d=$(srcdir); \
+         if test -f $$file; then d=.; else d=$(srcdir); fi; \
          for ifile in echo $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9]; 
do \
            if test -f $$ifile; then \
-## Strip leading '$$d/'.
-             relfile=`expr "$$ifile" : "$$d/\(.*\)"`; \
+## Strip leading directory.
+             relfile=`echo "$$ifile" | sed -e 's,^.*/,,'`; \
              echo " $(INSTALL_DATA) $$ifile $(DESTDIR)$(infodir)/$$relfile"; \
              $(INSTALL_DATA) $$ifile $(DESTDIR)$(infodir)/$$relfile; \
            else : ; fi; \
@@ -133,7 +132,7 @@
 ## therefore the code will be triggered although install-info is missing.
        @if (install-info --version && \
             install-info --version | grep -i -v debian) >/dev/null 2>&1; then \
-         list='$(INFO_DEPS)'; \
+         list='$(INST_INFOS)'; \
          for file in $$list; do \
 ## Run `:' after install-info in case install-info fails.  We really
 ## don't care about failures here, because they can be spurious.  For
@@ -169,7 +168,7 @@
 ## version info to stderr.
        @if (install-info --version && \
             install-info --version | grep -i -v debian) >/dev/null 2>&1; then \
-         list='$(INFO_DEPS)'; \
+         list='$(INST_INFOS)'; \
          for file in $$list; do \
 ## install-info needs the actual info file.  We use the installed one,
 ## rather than relying on one still being in srcdir or builddir.
@@ -178,7 +177,7 @@
          done; \
        else :; fi
        @$(NORMAL_UNINSTALL)
-       @list='$(INFO_DEPS)'; \
+       @list='$(INST_INFOS)'; \
        for file in $$list; do \
          (if cd $(DESTDIR)$(infodir); then \
             echo " rm -f $$file $$file-[0-9] $$file-[0-9][0-9])"; \
@@ -191,13 +190,10 @@
 
 if %?LOCAL-TEXIS%
 .PHONY: dist-info
-dist-info: $(INFO_DEPS)
-       list='$(INFO_DEPS)'; \
+dist-info: $(DIST_INFOS)
+       list='$(DIST_INFOS)'; \
        for base in $$list; do \
-## In Cygnus mode, allow info file to be in source or build dir.  In
-## other modes, allow only source dir.
-?!CYGNUS?        d=$(srcdir); \
-?CYGNUS?         if test -f $$base; then d=.; else d=$(srcdir); fi; \
+         if test -f $$base; then d=.; else d=$(srcdir); fi; \
          for file in $$d/$$base*; do \
 ## Strip leading '$$d/'.
            relfile=`expr "$$file" : "$$d/\(.*\)"`; \
@@ -225,7 +221,6 @@
 maintainer-clean-am: maintainer-clean-aminfo
 maintainer-clean-aminfo:
 ## Eww.  But how else can we find all the output files from makeinfo?
-?!CYGNUS?      cd $(srcdir) && \
        for i in $(INFO_DEPS); do \
          rm -f $$i; \
          if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
Index: tests/Makefile.am
===================================================================
RCS file: /home/adl/CVSROOT/HEAD-20020603-2004/tests/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- tests/Makefile.am   3 Jun 2002 18:04:35 -0000       1.1
+++ tests/Makefile.am   7 Jun 2002 14:53:42 -0000
@@ -358,6 +358,10 @@
 texinfo9.test \
 texinfo10.test \
 texinfo11.test \
+texinfo12.test \
+texinfo13.test \
+texinfo14.test \
+texinfo15.test \
 unused.test \
 vars.test \
 vartar.test \
Index: tests/texinfo10.test
===================================================================
RCS file: /home/adl/CVSROOT/HEAD-20020603-2004/tests/texinfo10.test,v
retrieving revision 1.1
diff -u -r1.1 texinfo10.test
--- tests/texinfo10.test        3 Jun 2002 18:04:44 -0000       1.1
+++ tests/texinfo10.test        7 Jun 2002 12:45:26 -0000
@@ -5,6 +5,8 @@
 
 . $srcdir/defs || exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 SUBDIRS = sub
 END
@@ -17,8 +19,8 @@
 echo '@setfilename maude.info' > sub/maude.texi
 : > sub/texinfo.tex
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep dvi-recursive Makefile.in
 grep '[^-]info-recursive' Makefile.in
Index: tests/texinfo11.test
===================================================================
RCS file: /home/adl/CVSROOT/HEAD-20020603-2004/tests/texinfo11.test,v
retrieving revision 1.1
diff -u -r1.1 texinfo11.test
--- tests/texinfo11.test        3 Jun 2002 18:04:44 -0000       1.1
+++ tests/texinfo11.test        7 Jun 2002 14:52:49 -0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# FIXME: Write something here.
+# Check for _FILENAME support.
 
 required=makeinfo
 . $srcdir/defs || exit 1
@@ -14,7 +14,7 @@
 generated_FILENAME = generated.info
 
 generated.texi:
-       cp g $@
+       cp $(srcdir)/g $@
 
 EXTRA_DIST = g
 
Index: tests/texinfo12.test
===================================================================
RCS file: tests/texinfo12.test
diff -N tests/texinfo12.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/texinfo12.test        7 Jun 2002 13:11:51 -0000
@@ -0,0 +1,55 @@
+#! /bin/sh
+
+# Check for nodist_ (and generated) Texinfo.
+
+required=makeinfo
+. $srcdir/defs || exit 1
+
+$has_gnu_make
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am << 'END'
+nodist_info_TEXINFOS = generated.texi
+generated_FILENAME = generated.info
+
+generated.texi:
+       cp $(srcdir)/g $@
+
+check-dist: distdir
+       test ! -f $(distdir)/generated.texi
+       test ! -f $(distdir)/generated.info
+
+EXTRA_DIST = g
+END
+
+cat > g << 'END'
+\input texinfo
address@hidden generated.info
address@hidden generated
address@hidden Top
+Hello walls.
+
address@hidden
+END
+
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+./configure
+$MAKE
+test -f generated.texi
+test -f generated.info
+$MAKE clean
+test ! -f generated.texi
+test ! -f generated.info
+$MAKE check-dist
+test ! -f generated.texi
+test ! -f generated.info
+$MAKE distcheck
+test ! -f generated.texi
+test ! -f generated.info
+:
Index: tests/texinfo13.test
===================================================================
RCS file: tests/texinfo13.test
diff -N tests/texinfo13.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/texinfo13.test        7 Jun 2002 12:59:01 -0000
@@ -0,0 +1,43 @@
+#! /bin/sh
+
+# Check for subdir Texinfo.
+
+required=makeinfo
+. $srcdir/defs || exit 1
+
+$has_gnu_make
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am << 'END'
+info_TEXINFOS = subdir/main.texi
+subdir_main_TEXINFOS = subdir/inc.texi
+
+END
+
+mkdir subdir
+
+cat > subdir/main.texi << 'END'
+\input texinfo
address@hidden main.info
address@hidden main
address@hidden Top
+Hello walls.
address@hidden version.texi
address@hidden inc.texi
address@hidden
+END
+
+cat > subdir/inc.texi << 'END'
+I'm included.
+END
+
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+./configure
+$MAKE distcheck
+test -f subdir/main.info
Index: tests/texinfo14.test
===================================================================
RCS file: tests/texinfo14.test
diff -N tests/texinfo14.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/texinfo14.test        7 Jun 2002 14:40:53 -0000
@@ -0,0 +1,78 @@
+#! /bin/sh
+
+# Check for noinst_ Texinfo.
+
+required=makeinfo
+. $srcdir/defs || exit 1
+
+$has_gnu_make
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am << 'END'
+noinst_TEXINFOS = main.texi subdir/foo.texi
+info_TEXINFOS = bar.texi subdir/baz.texi
+END
+
+mkdir subdir
+
+cat > main.texi << 'END'
+\input texinfo
address@hidden main.info
address@hidden main
address@hidden Top
+Hello walls.
address@hidden version.texi
address@hidden
+END
+
+cat > subdir/foo.texi << 'END'
+\input texinfo
address@hidden foo.info
address@hidden foo
address@hidden Top
+Hello walls.
address@hidden versio.texi
address@hidden
+END
+
+cat > bar.texi << 'END'
+\input texinfo
address@hidden bar.info
address@hidden bar
address@hidden Top
+Hello walls.
address@hidden versi.texi
address@hidden
+END
+
+cat > subdir/baz.texi << 'END'
+\input texinfo
address@hidden baz.info
address@hidden baz
address@hidden Top
+Hello walls.
address@hidden
+END
+
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+./configure --prefix `pwd`/inst
+$MAKE
+test -f main.info
+test -f subdir/foo.info
+test -f bar.info
+test -f subdir/baz.info
+test -f version.texi
+test -f subdir/versio.texi
+test -f versi.texi
+$MAKE install
+test -f inst/info/bar.info
+test ! -f inst/info/foo.info
+test ! -f inst/info/main.info
+test -f inst/info/baz.info
+$MAKE distcheck
Index: tests/texinfo15.test
===================================================================
RCS file: tests/texinfo15.test
diff -N tests/texinfo15.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/texinfo15.test        7 Jun 2002 14:52:17 -0000
@@ -0,0 +1,50 @@
+#! /bin/sh
+
+# Check for nodist_noinst_ Texinfo.
+
+required=makeinfo
+. $srcdir/defs || exit 1
+
+$has_gnu_make
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am << 'END'
+nodist_noinst_TEXINFOS =  subdir/generated.texi
+
+subdir_generated_FILENAME = generated.info
+
+subdir/generated.texi:
+       $(mkinstalldirs) subdir
+       cp $(srcdir)/g $@
+
+EXTRA_DIST = g
+
+MAINTAINERCLEANFILES = subdir/generated.texi
+
+END
+
+mkdir subdir
+
+cat > g << 'END'
+\input texinfo
address@hidden generated.info
address@hidden generated
address@hidden Top
+Hello walls.
address@hidden
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+./configure --prefix `pwd`/inst
+$MAKE
+test -f subdir/generated.texi
+test -f subdir/generated.info
+$MAKE install
+test ! -f inst/info/generated.texi
+test ! -f inst/info/generated.info
+$MAKE distcheck

-- 
Alexandre Duret-Lutz




reply via email to

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