From 0170ed2e7de2e23d11cb08ff8cfb2a5790751e38 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sat, 15 May 2004 21:01:04 +0000 Subject: [PATCH] * automake.in (handle_dist): Always define DIST_SUBDIRS, even when the no-dist or cygnus options are used. * tests/clean2.test: New file. * tests/Makefile.am (TESTS): Add clean2.test. Report from Daniel Jacobowitz. --- ChangeLog | 6 ++++ THANKS | 1 + automake.in | 89 ++++++++++++++++++++++++----------------------- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/clean2.test | 57 ++++++++++++++++++++++++++++++ 6 files changed, 112 insertions(+), 43 deletions(-) create mode 100755 tests/clean2.test diff --git a/ChangeLog b/ChangeLog index db6ac5f32..6bee49ae0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2004-05-15 Alexandre Duret-Lutz + * automake.in (handle_dist): Always define DIST_SUBDIRS, even when + the no-dist or cygnus options are used. + * tests/clean2.test: New file. + * tests/Makefile.am (TESTS): Add clean2.test. + Report from Daniel Jacobowitz. + * aclocal.in (add_macro): Do not error out on undefined required macros. We are not sure they are really used, and Autoconf already diagnoses them. diff --git a/THANKS b/THANKS index bd427043d..f90535755 100644 --- a/THANKS +++ b/THANKS @@ -42,6 +42,7 @@ Chris Provenzano proven@io.proven.org Christian Cornelssen ccorn@cs.tu-berlin.de Dalibor Topic robilad@kaffe.org danbp danpb@nospam.postmaster.co.uk +Daniel Jacobowitz drow@false.org Dave Brolley brolley@redhat.com Dave Morrison dave@bnl.gov David A. Swierczek swiercze@mr.med.ge.com diff --git a/automake.in b/automake.in index 97e0cb705..7fb98326c 100755 --- a/automake.in +++ b/automake.in @@ -3358,6 +3358,49 @@ sub for_dist_common # Handle 'dist' target. sub handle_dist () { + # Substutions for distdit.am + my %transform; + + # Define DIST_SUBDIRS. This must always be done, regardless of the + # no-dist setting: target like `distclean' or `maintainer-clean' use it. + my $subdirs = var ('SUBDIRS'); + if ($subdirs) + { + # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS + # to all possible directories, and use it. If DIST_SUBDIRS is + # defined, just use it. + my $dist_subdir_name; + # Note that we check DIST_SUBDIRS first on purpose, so that + # we don't call has_conditional_contents for now reason. + # (In the past one project used so many conditional subdirectories + # that calling has_conditional_contents on SUBDIRS caused + # automake to grow to 150Mb -- this should not happen with + # the current implementation of has_conditional_contents, + # but it's more efficient to avoid the call anyway.) + if (var ('DIST_SUBDIRS')) + { + $dist_subdir_name = 'DIST_SUBDIRS'; + } + elsif ($subdirs->has_conditional_contents) + { + $dist_subdir_name = 'DIST_SUBDIRS'; + define_pretty_variable + ('DIST_SUBDIRS', TRUE, INTERNAL, + uniq ($subdirs->value_as_list_recursive)); + } + else + { + $dist_subdir_name = 'SUBDIRS'; + # We always define this because that is what `distclean' + # wants. + define_pretty_variable ('DIST_SUBDIRS', TRUE, INTERNAL, + '$(SUBDIRS)'); + } + + $transform{'DIST_SUBDIR_NAME'} = $dist_subdir_name; + } + + # The remaining definitions are only required when a dist target is used. return if option 'no-dist'; # At least one of the archive formats must be enabled. @@ -3460,59 +3503,19 @@ sub handle_dist () unless $_ eq '.'; } - # Rule to check whether a distribution is viable. - my %transform = ('DISTCHECK-HOOK' => !! rule 'distcheck-hook', - 'GETTEXT' => $seen_gettext && !$seen_gettext_external); + $transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook'; + $transform{'GETTEXT'} = $seen_gettext && !$seen_gettext_external; # Prepend $(distdir) to each directory given. my %rewritten = map { '$(distdir)/' . "$_" => 1 } keys %dist_dirs; $transform{'DISTDIRS'} = join (' ', sort keys %rewritten); - # If we have SUBDIRS, create all dist subdirectories and do - # recursive build. - my $subdirs = var ('SUBDIRS'); - if ($subdirs) - { - # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS - # to all possible directories, and use it. If DIST_SUBDIRS is - # defined, just use it. - my $dist_subdir_name; - # Note that we check DIST_SUBDIRS first on purpose, so that - # we don't call has_conditional_contents for now reason. - # (In the past one project used so many conditional subdirectories - # that calling has_conditional_contents on SUBDIRS caused - # automake to grow to 150Mb -- this should not happen with - # the current implementation of has_conditional_contents, - # but it's more efficient to avoid the call anyway.) - if (var ('DIST_SUBDIRS')) - { - $dist_subdir_name = 'DIST_SUBDIRS'; - } - elsif ($subdirs->has_conditional_contents) - { - $dist_subdir_name = 'DIST_SUBDIRS'; - define_pretty_variable - ('DIST_SUBDIRS', TRUE, INTERNAL, - uniq ($subdirs->value_as_list_recursive)); - } - else - { - $dist_subdir_name = 'SUBDIRS'; - # We always define this because that is what `distclean' - # wants. - define_pretty_variable ('DIST_SUBDIRS', TRUE, INTERNAL, - '$(SUBDIRS)'); - } - - $transform{'DIST_SUBDIR_NAME'} = $dist_subdir_name; - } - # If the target `dist-hook' exists, make sure it is run. This # allows users to do random weird things to the distribution # before it is packaged up. push (@dist_targets, 'dist-hook') if rule 'dist-hook'; - $transform{'DIST-TARGETS'} = join(' ', @dist_targets); + $transform{'DIST-TARGETS'} = join (' ', @dist_targets); my $flm = option ('filename-length-max'); my $filename_filter = $flm ? '.' x $flm->[1] : ''; diff --git a/tests/Makefile.am b/tests/Makefile.am index 507aae15a..600f93b01 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -75,6 +75,7 @@ check2.test \ check3.test \ checkall.test \ clean.test \ +clean2.test \ colneq.test \ colneq2.test \ colon.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 561e60243..d898a466b 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -192,6 +192,7 @@ check2.test \ check3.test \ checkall.test \ clean.test \ +clean2.test \ colneq.test \ colneq2.test \ colon.test \ diff --git a/tests/clean2.test b/tests/clean2.test new file mode 100755 index 000000000..23a54f323 --- /dev/null +++ b/tests/clean2.test @@ -0,0 +1,57 @@ +#! /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. + +# Make sure distclean works in cygnus mode. +# Report from Daniel Jacobowitz + +. ./defs || exit 1 + +set -e + +cat >> configure.in << 'END' +AM_MAINTAINER_MODE +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +SUBDIRS = sub +END + +mkdir sub + +cat > sub/Makefile.am << 'END' +data_DATA = foo + +foo: + touch $@ + +CLEANFILES = $(data_DATA) +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --cygnus + +./configure +$MAKE +test -f sub/foo +$MAKE distclean +test ! -f sub/foo -- 2.47.2