]> sourceware.org Git - automake.git/commitdiff
Fix for distcommon2.test:
authorAlexandre Duret-Lutz <adl@gnu.org>
Fri, 9 Nov 2001 17:17:45 +0000 (17:17 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Fri, 9 Nov 2001 17:17:45 +0000 (17:17 +0000)
* 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.

* test/distcommon2.test: New file.
* test/Makefile.am (TESTS): Add distcommon2.test.
From Pavel Roskin.

ChangeLog
NEWS
automake.in
tests/Makefile.am
tests/Makefile.in
tests/distcommon2.test [new file with mode: 0755]

index 3bb5964cf0f4531cb04fd07283daaf0902fdbccb..eb022a1329a1ab5e466d5534d5bb322432f3429f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2001-11-09  Alexandre Duret-Lutz  <duret_g@epita.fr>
+
+       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.
+
+       * test/distcommon2.test: New file.
+       * test/Makefile.am (TESTS): Add distcommon2.test.
+       From Pavel Roskin.
+
 2001-11-09  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
        * automake.in (exec_dir_p): Remove.  Replace by...
diff --git a/NEWS b/NEWS
index 947bd82e72993c53f01df666fbff6fecbaa3c0aa..8c8dfe643b5c7f3983d4e1ca2cda7e6238c9bc5d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ New in 1.5a:
 * Fixed CDPATH portability problems, in particular for MacOS X.
 * Fixed handling of nobase_ targets.
 * Fixed support of implicit rules leading to .lo objects.
+* Fixed late inclusion of --add-missing files (e.g. depcomp) in DIST_COMMON
 \f
 New in 1.5:
 * Support for `configure.ac'.
index 0bf5349f4301676441961e162f76a69cb1d8a8e0..f9d145685475c74bcd3865cd45fa08f3fc55e33e 100755 (executable)
@@ -443,6 +443,11 @@ my %required_targets =
    '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;
 \f
 
 ################################################################
@@ -966,21 +971,36 @@ register_language ('name' => 'java',
 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;
 
@@ -7574,6 +7594,7 @@ sub maybe_push_required_file
     if ($dir eq $relative_dir)
     {
        push_dist_common ($file);
+       return 1;
     }
     elsif ($relative_dir eq '.' && ! &is_make_dir ($dir))
     {
@@ -7581,7 +7602,9 @@ sub maybe_push_required_file
        # subdir which does not have a Makefile, then we distribute it
        # here.
        push_dist_common ($fullfile);
+       return 1;
     }
+    return 0;
 }
 
 
@@ -7692,8 +7715,24 @@ sub require_file_internal ($$@)
                        }
                    }
 
-                   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);
index f3b81289f703464b632c8056307beffd6464c081..759e5d91a8ea147fb8d0c7f815b376a715b82533 100644 (file)
@@ -117,6 +117,7 @@ depend4.test \
 dirname.test \
 discover.test \
 distcommon.test \
+distcommon2.test \
 distdir.test \
 distname.test \
 double.test \
index c038afed59f4525132ed8a8cc62aaa96d02c9c86..a326071110389b078f800d2f3bf7e80bf78a6806 100644 (file)
@@ -190,6 +190,7 @@ depend4.test \
 dirname.test \
 discover.test \
 distcommon.test \
+distcommon2.test \
 distdir.test \
 distname.test \
 double.test \
diff --git a/tests/distcommon2.test b/tests/distcommon2.test
new file mode 100755 (executable)
index 0000000..de0ce72
--- /dev/null
@@ -0,0 +1,53 @@
+#! /bin/sh
+
+# Test to make sure that depcomp and compile are added to DIST_COMMON
+# From Pavel Roskin.
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+PACKAGE=nonesuch
+VERSION=nonesuch
+AC_PROG_CC
+AC_OUTPUT(Makefile subdir/Makefile)
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = subdir
+END
+
+mkdir subdir
+: > subdir/foo.c
+
+cat > subdir/Makefile.am << 'END'
+noinst_PROGRAMS = foo
+foo_SOURCES = foo.c
+foo_CFLAGS = -DBAR
+END
+
+rm -f compile depcomp
+
+$ACLOCAL || exit 1
+$AUTOMAKE --add-missing || exit 1
+
+test -f compile || exit 1
+test -f depcomp || exit 1
+
+sed -n -e '/^DIST_COMMON =.*\\$/ {
+   :loop
+   p
+   n
+   /\\$/ b loop
+   p
+   n
+   }' -e '/^DIST_COMMON =/ p' Makefile.in | grep compile || exit 1
+
+sed -n -e '/^DIST_COMMON =.*\\$/ {
+   :loop
+   p
+   n
+   /\\$/ b loop
+   p
+   n
+   }' -e '/^DIST_COMMON =/ p' Makefile.in | grep depcomp || exit 1
This page took 0.052106 seconds and 5 git commands to generate.