]> sourceware.org Git - automake.git/commitdiff
* automake.in ($automake_needs_to_reprocess_all_files): Remove.
authorAlexandre Duret-Lutz <adl@gnu.org>
Mon, 12 Apr 2004 22:16:20 +0000 (22:16 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Mon, 12 Apr 2004 22:16:20 +0000 (22:16 +0000)
($automake_will_process_aux_dir): New variable.
(scan_autoconf_traces): Reorder @input_files so that the Makefile
that distributes aux files is processed last.  This way we do not
have to process all files twice using
$automake_will_process_aux_dir.
(require_file_internal): Suggest a full run of automake when
appropriate.
(MAIN): Remove the loop on $automake_needs_to_reprocess_all_files.
* tests/distcom7.test: New file.
* tests/reqd2.test: Do not check for the "running more than two"
message.
* tests/Makefile.am (TESTS): Add distcom7.test.

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

index 8919ff79c77264f0555df6bf7dea65157dca4dc4..e2033f3005c4643f0a49179391762d4cd5c02a5a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2004-04-12  Alexandre Duret-Lutz  <adl@gnu.org>
 
+       * automake.in ($automake_needs_to_reprocess_all_files): Remove.
+       ($automake_will_process_aux_dir): New variable.
+       (scan_autoconf_traces): Reorder @input_files so that the Makefile
+       that distributes aux files is processed last.  This way we do not
+       have to process all files twice using
+       $automake_will_process_aux_dir.
+       (require_file_internal): Suggest a full run of automake when
+       appropriate.
+       (MAIN): Remove the loop on $automake_needs_to_reprocess_all_files.
+       * tests/distcom7.test: New file.
+       * tests/reqd2.test: Do not check for the "running more than two"
+       message.
+       * tests/Makefile.am (TESTS): Add distcom7.test.
+
        * automake.in (@config_aux_path, $config_aux_dir): Rename as ...
        ($config_aux_dir, $am_config_aux_dir): ... these.
        ($config_aux_dir_set_in_configure_in): Rename as ...
index bb868759e001d8c43d1270df04108143150663cb..00be104df4f83ce763fb6ab183d3940e91bce4a9 100755 (executable)
@@ -421,11 +421,9 @@ 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;
+# Set to 1 if this run will create the Makefile.in that distribute
+# the files in config_aux_dir.
+my $automake_will_process_aux_dir = 0;
 
 # The name of the Makefile currently being processed.
 my $am_file = 'BUG';
@@ -4834,6 +4832,38 @@ sub scan_autoconf_files ()
     }
 
   locate_aux_dir ();
+
+  # Reorder @input_files so that the Makefile that distributes aux
+  # files is processed last.  This is important because each directory
+  # can require auxiliary scripts and we should wait until they have
+  # been installed before distributing them.
+
+  # The Makefile.in that distribute the aux files is the one in
+  # $config_aux_dir or the top-level Makefile.
+  my $auxdirdist = is_make_dir ($config_aux_dir) ? $config_aux_dir : '.';
+  my @new_input_files = ();
+  while (@input_files)
+    {
+      my $in = pop @input_files;
+      my @ins = split (/:/, $output_files{$in});
+      if (dirname ($ins[0]) eq $auxdirdist)
+       {
+         push @new_input_files, $in;
+         $automake_will_process_aux_dir = 1;
+       }
+      else
+       {
+         unshift @new_input_files, $in;
+       }
+    }
+  @input_files = @new_input_files;
+
+  # If neither the auxdir/Makefile nor the ./Makefile are generated
+  # by Automake, we won't distribute the aux files anyway.  Assume
+  # the user know what (s)he does, and pretend we will distribute
+  # them to disable the error in require_file_internal.
+  $automake_will_process_aux_dir = 1 if ! is_make_dir ($auxdirdist);
+
   # Look for some files we need.  Always check for these.  This
   # check must be done for every run, even those where we are only
   # looking at a subdir Makefile.  We must set relative_dir for
@@ -4845,6 +4875,7 @@ sub scan_autoconf_files ()
 
   # Preserve dist_common for later.
   $configure_dist_common = variable_value ('DIST_COMMON') || '';
+
 }
 
 ################################################################
@@ -6801,19 +6832,16 @@ sub require_file_internal ($$$@)
                  if (! maybe_push_required_file (dirname ($fullfile),
                                                  $file, $fullfile))
                    {
-                     if (! $found_it)
+                     if (! $found_it && ! $automake_will_process_aux_dir)
                        {
                          # We have added the file but could not push it
-                         # into DIST_COMMON (probably because this is
+                         # into DIST_COMMONprobably 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;
+                         # the top level Makefile.  Furthermore Automake
+                         # hasn't been asked to create the Makefile.in
+                         # that distribute the aux dir files.
+                         error ($where, 'Please make a full run of automake'
+                                . " so $fullfile gets distributed.");
                        }
                    }
                }
@@ -7343,40 +7371,25 @@ scan_autoconf_files;
 fatal "no `Makefile.am' found or specified\n"
   if ! @input_files;
 
-my $automake_has_run = 0;
-
-do
-{
-  if ($automake_has_run)
-    {
-      verb 'processing Makefiles another time to fix them up.';
-      prog_error 'running more than two times should never be needed.'
-       if $automake_has_run >= 2;
-    }
-  $automake_needs_to_reprocess_all_files = 0;
-
-  # Now do all the work on each file.
-  foreach my $file (@input_files)
-    {
-      ($am_file = $file) =~ s/\.in$//;
-      if (! -f ($am_file . '.am'))
-       {
-         error "`$am_file.am' does not exist";
-       }
-      else
-       {
-         # Any warning setting now local to this Makefile.am.
-         dup_channel_setup;
+# Now do all the work on each file.
+foreach my $file (@input_files)
+  {
+    ($am_file = $file) =~ s/\.in$//;
+    if (! -f ($am_file . '.am'))
+      {
+       error "`$am_file.am' does not exist";
+      }
+    else
+      {
+       # Any warning setting now local to this Makefile.am.
+       dup_channel_setup;
 
-         generate_makefile ($am_file . '.am', $file);
+       generate_makefile ($am_file . '.am', $file);
 
-         # Back out any warning setting.
-         drop_channel_setup;
-       }
-    }
-  ++$automake_has_run;
-}
-while ($automake_needs_to_reprocess_all_files);
+       # Back out any warning setting.
+       drop_channel_setup;
+      }
+  }
 
 exit $exit_code;
 
index 369a21937732662eef2353c95572e171f9b7de9a..4ae37e57e346daf4ac3038ff939a1aa6c75258c3 100644 (file)
@@ -186,6 +186,7 @@ distcom3.test \
 distcom4.test \
 distcom5.test \
 distcom6.test \
+distcom7.test \
 distdir.test \
 distname.test \
 dollar.test \
index 3eddd9ecb62cf232d9c24e727815601b3f0157e7..e6b0f58f494e89aa86e123c5dd45c4e048e4337b 100644 (file)
@@ -301,6 +301,7 @@ distcom3.test \
 distcom4.test \
 distcom5.test \
 distcom6.test \
+distcom7.test \
 distdir.test \
 distname.test \
 dollar.test \
diff --git a/tests/distcom7.test b/tests/distcom7.test
new file mode 100755 (executable)
index 0000000..58f69e2
--- /dev/null
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Copyright (C) 2004  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test to make sure that Automake complains when an auxfile (here depcomp)
+# is installed, but the Makefile tht distributes it is not processed.
+
+. ./defs || exit 1
+
+cat > configure.in << 'END'
+AC_INIT(subdir/foo.c)
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AC_PROG_CC
+AC_OUTPUT(Makefile subdir/Makefile)
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = subdir
+END
+
+rm -f depcomp
+mkdir subdir
+
+echo bin_PROGRAMS = foo > subdir/Makefile.am
+: > subdir/foo.c
+
+$ACLOCAL
+AUTOMAKE_fails --add-missing subdir/Makefile
+grep 'full run' stderr
index 428575bfaaee1acb89f3b812e7ab780961e9dbc1..12cf1f45c5ba12b5ac4cd5cbdc14dd9dcb1b78a4 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -54,9 +54,3 @@ test -f autoconf/ltmain.sh # Sanity check.
 rm -f autoconf/ltmain.sh
 AUTOMAKE_fails --add-missing --copy
 grep 'autoconf/ltmain.sh' stderr
-grep 'running more than two' stderr && exit 1
-
-# Since we are ensuring that 'running more than two' is not printed,
-# also ensure that it can be printed.  This way if someone changes the
-# wording of this message (s)he will remember to adjust this test.
-grep 'running more than two' ../../automake
This page took 0.058609 seconds and 5 git commands to generate.