automake
[Top][All Lists]
Advanced

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

Re: Automake 1.5 - depcomp not added to DIST_COMMON


From: Alexandre Duret-Lutz
Subject: Re: Automake 1.5 - depcomp not added to DIST_COMMON
Date: 22 Sep 2001 20:49:40 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi Pavel,

>>> "Pavel" == Pavel Roskin <address@hidden> writes:

 Pavel> Hello!
 Pavel> It looks like I just found a serious bug in Automake 1.5.  Perhaps the
 Pavel> Automake team should follow the example of Autoconf and concentrate on
 Pavel> making bugfix releases until (almost) everybody is happy.

 Pavel> The problem is that Automake doesn't add depcomp to DIST_COMMON if

 Pavel> 1) the sources are in the subdirectory and
 Pavel> 2) depcomp doesn't already exist in the top-level directory.

depcomp should appear in the DIST_COMMON variable from the
toplevel, unfortunately its existence starts only when
subdir/Makefile.am is processed, after the toplevel Makefile.in
has been output.

On the next automake run, depcomp is already there so it is
added to DIST_COMMON automatically.

So what about rerunning automake automatically (well, actually just
reprocessing the Makefiles) when such case is detected?  The
patch below does that.  Yeah, this sounds as ugly as processing
a LaTeX file in loop until all references are resolved :(

[...]

2001-09-22  Alexandre Duret-Lutz  <address@hidden>

        Fix for distcommon2.test:
        * automake.in (automake_needs_to_reprocess_all_files): New
        variable.
        ("main"): Process all Makefiles a second time if
        $automake_needs_to_reprocess_all_files is set.
        (maybe_push_required_file): Return 1 or 0 whether the file is
        pushed or not.
        (require_file_internal): Set $automake_needs_to_reprocess_all_files
        if an added file can't be pushed.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1173
diff -u -r1.1173 automake.in
--- automake.in 2001/08/28 03:53:10     1.1173
+++ automake.in 2001/09/22 18:31:50
@@ -486,6 +486,11 @@
    'install-man' => 1,
   );
 
+# This is set to 1 when Automake needs to be run again.
+# (For instance, this happens when an auxiliary file such as
+# depcomp is added after the toplevel Makefile.in -- which
+# should distribute depcomp -- has been generated.)
+my $automake_needs_to_reprocess_all_files = 0;
 
 
 ################################################################
@@ -1010,21 +1015,36 @@
 die "$me: no `Makefile.am' found or specified\n"
     if ! @input_files;
 
-# Now do all the work on each file.
-# This guy must be local otherwise it's private to the loop.
-use vars '$am_file';
-local $am_file;
-foreach $am_file (@input_files)
+my $automake_has_run = 0;
+
+do
 {
-    if (! -f ($am_file . '.am'))
+    if ($automake_has_run)
     {
-       &am_error ("`" . $am_file . ".am' does not exist");
+       print "$me: processing Makefiles another time to fix them up.\n";
+       &prog_error ("running more than two times should never be needed.")
+           if $automake_has_run >= 2;
     }
-    else
+    $automake_needs_to_reprocess_all_files = 0;
+
+    # Now do all the work on each file.
+    # This guy must be local otherwise it's private to the loop.
+    use vars '$am_file';
+    local $am_file;
+    foreach $am_file (@input_files)
     {
-       &generate_makefile ($output_files{$am_file}, $am_file);
+       if (! -f ($am_file . '.am'))
+       {
+           &am_error ("`" . $am_file . ".am' does not exist");
+       }
+       else
+       {
+           &generate_makefile ($output_files{$am_file}, $am_file);
+       }
     }
+    ++$automake_has_run;
 }
+while ($automake_needs_to_reprocess_all_files);
 
 exit $exit_status;
 
@@ -7657,6 +7677,7 @@
     if ($dir eq $relative_dir)
     {
        &push_dist_common ($file);
+       return 1;
     }
     elsif ($relative_dir eq '.' && ! &is_make_dir ($dir))
     {
@@ -7664,7 +7685,9 @@
        # subdir which does not have a Makefile, then we distribute it
        # here.
        &push_dist_common ($fullfile);
+       return 1;
     }
+    return 0;
 }
 
 
@@ -7787,8 +7810,24 @@
                        }
                    }
 
-                   &maybe_push_required_file (dirname ($errfile),
-                                              $file, $errfile);
+                   if (! &maybe_push_required_file (dirname ($errfile),
+                                                    $file, $errfile))
+                   {
+                       if (! $found_it)
+                       {
+                           # We have added the file but could not push it
+                           # into DIST_COMMON (probably because this is
+                           # an auxiliary file and we are not processing
+                           # the top level Makefile). This is unfortunate,
+                           # since it means we are using a file which is not
+                           # distributed!
+
+                           # Get Automake to be run again: on the second
+                           # run the file will be found, and pushed into
+                           # the toplevel DIST_COMMON automatically.
+                           $automake_needs_to_reprocess_all_files = 1;
+                       }
+                   }
 
                    # Prune the path list.
                    @require_file_paths = &dirname ($errfile);
-- 
Alexandre Duret-Lutz



reply via email to

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