From: Alexandre Duret-Lutz Date: Mon, 12 Apr 2004 22:16:20 +0000 (+0000) Subject: * automake.in ($automake_needs_to_reprocess_all_files): Remove. X-Git-Tag: Release-1-8b~39 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=8c35ebd552a8e30f6f0cfe63e269c24f707f4bd2;p=automake.git * 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. --- diff --git a/ChangeLog b/ChangeLog index 8919ff79..e2033f30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2004-04-12 Alexandre Duret-Lutz + * 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 ... diff --git a/automake.in b/automake.in index bb868759..00be104d 100755 --- a/automake.in +++ b/automake.in @@ -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_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; + # 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; diff --git a/tests/Makefile.am b/tests/Makefile.am index 369a2193..4ae37e57 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -186,6 +186,7 @@ distcom3.test \ distcom4.test \ distcom5.test \ distcom6.test \ +distcom7.test \ distdir.test \ distname.test \ dollar.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 3eddd9ec..e6b0f58f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 00000000..58f69e29 --- /dev/null +++ b/tests/distcom7.test @@ -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 diff --git a/tests/reqd2.test b/tests/reqd2.test index 428575bf..12cf1f45 100755 --- a/tests/reqd2.test +++ b/tests/reqd2.test @@ -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