After the previous change `
v1.11-1219-g326ecba', every Makefile.am
requiring a file in the "config auxdir" will cause it to be listed
in the DIST_COMMON variable of the corresponding generated
Makefile.in, not only of the top-level Makefile.in. Thus we don't
need to worry anymore about trying to distribute files in the
config auxdir from the top-level Makefile or the Makefile in
config auxdir (if any). This allows us to carry out some useful
simplifications in the automake script.
This will however cause some changes in the generated Makefile;
for example, if the `PROGRAMS' primary is used only in a subdir
Makefile.am, the `depcomp' script will be distributed only by
`subdir/Makefile', not by the top-level Makefile. This change
can be seen as an internal detail though, and definitely warranted
by the nice simplifications the current commit provides.
* automake.in ($automake_will_process_aux_dir): Variable removed.
(scan_autoconf_files): Adjust and simplify.
(handle_makefiles_threaded): Likewise.
(get_number_of_threads): Likewise.
(require_file_internal): Likewise.
(maybe_push_required_file): Its return value is not used anymore,
so return nothing. Add special handling for distributed files from
`$config_libobj_dir'. Also, catch "this can't happen" situations,
and abort accordingly. Fix function description to better fit its
new role.
* tests/libobj19.test: Extend to also check situations where the
Makefile.am using $(LIBOBJS) is not the top-level one.
* tests/distcom6.test: Delete, merged into ...
* tests/distcom2.test: ... this test, which has been update to
account for the changed automake semantics.
* tests/Makefile.am (TESTS): Update.
* NEWS: Update.
+2011-10-08 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ dist: simplify automake code accordingly to the previous changes
+ After the previous change `v1.11-1219-g326ecba', every Makefile.am
+ requiring a file in the "config auxdir" will cause it to be listed
+ in the DIST_COMMON variable of the corresponding generated
+ Makefile.in, not only of the top-level Makefile.in. Thus we don't
+ need to worry anymore about trying to distribute files in the
+ config auxdir from the top-level Makefile or the Makefile in
+ config auxdir (if any). This allows us to carry out some useful
+ simplifications in the automake script.
+ This will however cause some changes in the generated Makefile;
+ for example, if the `PROGRAMS' primary is used only in a subdir
+ Makefile.am, the `depcomp' script will be distributed only by
+ `subdir/Makefile', not by the top-level Makefile. This change
+ can be seen as an internal detail though, and definitely warranted
+ by the nice simplifications the current commit provides.
+ * automake.in ($automake_will_process_aux_dir): Variable removed.
+ (scan_autoconf_files): Adjust and simplify.
+ (handle_makefiles_threaded): Likewise.
+ (get_number_of_threads): Likewise.
+ (require_file_internal): Likewise.
+ (maybe_push_required_file): Its return value is not used anymore,
+ so return nothing. Add special handling for distributed files from
+ `$config_libobj_dir'. Also, catch "this can't happen" situations,
+ and abort accordingly. Fix function description to better fit its
+ new role.
+ * tests/libobj19.test: Extend to also check situations where the
+ Makefile.am using $(LIBOBJS) is not the top-level one.
+ * tests/distcom6.test: Delete, merged into ...
+ * tests/distcom2.test: ... this test, which has been update to
+ account for the changed automake semantics.
+ * tests/Makefile.am (TESTS): Update.
+ * NEWS: Update.
+
2011-10-08 Stefano Lattarini <stefano.lattarini@gmail.com>
dist: auxiliary files can be distributed from subdir Makefiles
- Initial and still experimental support for the TAP test protocol is
now provided.
-* Miscellaneous changes:
+* Changes related to distribution tarballs:
- The `dist' and `dist-all' targets now can run compressors in parallel.
level via the XZ_OPT and BZIP2 envvars respectively. E.g.,
"make dist-xz XZ_OPT=-7" or "make dist-xz BZIP2=-5"
+ - Some auxiliary files that are automatically distributed by Automake
+ (e.g., `install-sh', or the `depcomp' script for packages compiling
+ C sources) might now be listed in the DIST_COMMON variable in many
+ Makefile.in files, rather than in the top-level one.
+
+* Miscellaneous changes:
+
- Messages of types warning or error from `automake' and `aclocal' are now
prefixed with the respective type, and presence of -Werror is noted.
'install-man' => 1,
);
-# Set to 1 if this run will create the Makefile.in that distributes
-# 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';
\f
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
# &maybe_push_required_file ($DIR, $FILE, $FULLFILE)
# --------------------------------------------------
-# See if we want to push this file onto dist_common. This function
-# encodes the rules for deciding when to do so.
+# Push the given file onto DIST_COMMON.
sub maybe_push_required_file
{
my ($dir, $file, $fullfile) = @_;
+ # If the file to be distributed is in the same directory of the
+ # currently processed Makefile.am, then we want to distribute it
+ # from this same Makefile.am.
if ($dir eq $relative_dir)
{
push_dist_common ($file);
- return 1;
}
# This is needed to allow a construct in a non-top-level Makefile.am
# to require a file in the build-aux directory (see at least the test
{
# FIXME: this breaks serialization of threaded automake :-(
push_dist_common ("$am_config_aux_dir/$file");
- return 1;
+ }
+ # FIXME: another spacial case, for AC_LIBOBJ/AC_LIBSOURCE support.
+ # We probably need some refactoring of this function and its callers,
+ # to have a more explicit and systematic handling of all the special
+ # cases; but, since there are only two of them, this is low-priority
+ # ATM.
+ elsif ($config_libobj_dir && $dir eq $config_libobj_dir)
+ {
+ # Avoid unsightly '/.'s.
+ my $am_config_libobj_dir =
+ '$(top_srcdir)' .
+ ($config_libobj_dir eq '.' ? "" : "/$config_libobj_dir");
+ $am_config_libobj_dir =~ s|/*$||;
+ push_dist_common ("$am_config_libobj_dir/$file");
}
elsif ($relative_dir eq '.' && ! &is_make_dir ($dir))
{
if $dir =~ m,^\.\.(?:$|/),;
push_dist_common ($fullfile);
- return 1;
}
- return 0;
+ else
+ {
+ prog_error "a Makefile in relative directory $relative_dir " .
+ "can't add files in directory $dir to DIST_COMMON";
+ }
}
}
set_dir_cache_file ($dir, $file);
}
-
- if (! maybe_push_required_file (dirname ($fullfile),
- $file, $fullfile))
- {
- 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
- # an auxiliary file and we are not processing
- # the top level Makefile. Furthermore Automake
- # hasn't been asked to create the Makefile.in
- # that distributes the aux dir files.
- error ($where, 'please rerun automake without '
- . "Makefile arguments\n"
- . "so $fullfile gets distributed");
- }
- }
+ maybe_push_required_file ($dir, $file, $fullfile);
}
else
{
# It doesn't make sense to use more threads than makefiles,
my $max_threads = @input_files;
- # but a single worker thread is helpful for exposing bugs.
- if ($automake_will_process_aux_dir && $max_threads > 1)
- {
- $max_threads--;
- }
if ($nthreads > $max_threads)
{
$nthreads = $max_threads;
{
my ($nthreads) = @_;
- my @queued_input_files = @input_files;
- my $last_input_file = undef;
- if ($automake_will_process_aux_dir)
- {
- $last_input_file = pop @queued_input_files;
- }
-
# The file queue distributes all makefiles, the message queues
# collect all serializations needed for respective files.
my $file_queue = Thread::Queue->new;
my %msg_queues;
- foreach my $file (@queued_input_files)
+ foreach my $file (@input_files)
{
$msg_queues{$file} = Thread::Queue->new;
}
});
}
- # Queue all normal makefiles.
- verb "queuing " . @queued_input_files . " input files";
- $file_queue->enqueue (@queued_input_files, (undef) x @threads);
+ # Queue all makefiles.
+ verb "queuing " . @input_files . " input files";
+ $file_queue->enqueue (@input_files, (undef) x @threads);
# Collect and process serializations.
- foreach my $file (@queued_input_files)
+ foreach my $file (@input_files)
{
verb "dequeuing messages for " . $file;
reset_local_duplicates ();
$exit_code = $exit_thread[0]
if ($exit_thread[0] > $exit_code);
}
-
- # The master processes the last file.
- if ($automake_will_process_aux_dir)
- {
- verb "processing last input file";
- handle_makefile ($last_input_file);
- }
}
################################################################
distcom3.test \
distcom4.test \
distcom5.test \
-distcom6.test \
distcom-subdir.test \
distdir.test \
distlinks.test \
distcom3.test \
distcom4.test \
distcom5.test \
-distcom6.test \
distcom-subdir.test \
distdir.test \
distlinks.test \
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test to make sure that depcomp and compile are added to DIST_COMMON
-# From Pavel Roskin.
-# Please keep this in sync with sister test 'distcom6.test'.
+# Test to make sure that depcomp and compile are added to DIST_COMMON.
+# Report from Pavel Roskin. Report of problems with `--no-force' from
+# Scott James Remnant (Debian #206299)
. ./defs || Exit 1
foo_CFLAGS = -DBAR
END
-rm -f compile depcomp
-
$ACLOCAL
-$AUTOMAKE --add-missing
-
-test -f compile
-test -f depcomp
-
-sed -n -e '/^DIST_COMMON =.*\\$/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
- }' -e 's/$/ /' -e '/^DIST_COMMON =/p' Makefile.in > dc.txt
-
-cat dc.txt # might be useful for debugging
-
-$FGREP ' compile ' dc.txt
-$FGREP ' depcomp ' dc.txt
+
+rm -f compile depcomp Makefile.in subdir/Makefile.in dc.txt subdir/dc.txt
+
+for opt in '' --no-force; do
+
+ $AUTOMAKE $opt --add-missing
+
+ test -f compile
+ test -f depcomp
+
+ for dir in . subdir; do
+ # FIXME: the logic of this check and other similar ones in other
+ # FIXME: `distcom*.test' files should be factored out in a common
+ # FIXME: subroutine in `defs'...
+ sed -n -e "
+ /^DIST_COMMON =.*\\\\$/ {
+ :loop
+ p
+ n
+ t clear
+ :clear
+ s/\\\\$/\\\\/
+ t loop
+ s/$/ /
+ s/[$tab ][$tab ]*/ /g
+ p
+ n
+ }" $dir/Makefile.in > $dir/dc.txt
+ done
+
+ cat dc.txt # For debugging.
+ cat subdir/dc.txt # Likewise.
+
+ $FGREP ' $(top_srcdir)/depcomp ' subdir/dc.txt
+ # The `compile' script will be listed in the DIST_COMMON of the top-level
+ # Makefile because it's required in configure.in (by AM_PROG_CC_C_O).
+ $FGREP ' $(top_srcdir)/compile ' dc.txt || $FGREP ' compile ' dc.txt
+
+done
:
+++ /dev/null
-#! /bin/sh
-# Copyright (C) 2003, 2004, 2006, 2010, 2011 Free Software Foundation,
-# Inc.
-#
-# This program 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.
-#
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Test to make sure that depcomp and compile required in subdirectories
-# are added to the top-level DIST_COMMON even with --no-force.
-# This is similar to distcom2.test, but with --no-force added.
-# Report from Scott James Remnant (Debian #206299).
-# Please keep this in sync with sister test 'distcom2.test'.
-
-. ./defs || Exit 1
-
-cat >> configure.in << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_CONFIG_FILES([subdir/Makefile])
-AC_OUTPUT
-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
-$AUTOMAKE --add-missing --no-force
-
-test -f compile
-test -f depcomp
-
-sed -n -e '/^DIST_COMMON =.*\\$/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
- }' -e 's/$/ /' -e '/^DIST_COMMON =/p' Makefile.in > dc.txt
-
-cat dc.txt # might be useful for debugging
-
-$FGREP ' compile ' dc.txt
-$FGREP ' depcomp ' dc.txt
-
-:
noinst_LIBRARIES = libtu.a
libtu_a_SOURCES =
libtu_a_LIBADD = $(LIBOBJS)
-check-local: distdir
- ls -l $(srcdir)/* $(builddir)/* $(distdir)/*
+## Hack with this variable ans with extra make recursion in the check-local
+## rule are required for when we move this Makefile in a subdir, later.
+my_distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)
+check-local:
+ (cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) distdir)
+ ls -l $(top_srcdir)/* $(top_builddir)/* $(my_distdir)/*
test -f libtu.a
- test ! -r $(srcdir)/foobar.c
- test -f $(srcdir)/libobj-dir/foobar.c
- test ! -r $(distdir)/foobar.c
- test -f $(distdir)/libobj-dir/foobar.c
+ test ! -r $(top_srcdir)/foobar.c
+ test -f $(top_srcdir)/libobj-dir/foobar.c
+ test ! -r $(my_distdir)/foobar.c
+ test -f $(my_distdir)/libobj-dir/foobar.c
$(AR) t libtu.a
$(AR) t libtu.a | grep foobar
END
$MAKE check
$MAKE distcheck
+# Same check, but with the Makefile.am using $(LIBOBJS) not being
+# the top-level one.
+
+$MAKE distclean
+rm -rf autom4te*.cache aclocal.m4 configure
+
+mkdir sub
+mv -f Makefile.am sub
+echo SUBDIRS = sub > Makefile.am
+
+sed '/^AC_OUTPUT/i\
+AC_CONFIG_FILES([sub/Makefile])
+' configure.in > t
+mv -f t configure.in
+cat configure.in # For debugging.
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE
+$MAKE check
+$MAKE distcheck
+
: