# 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.
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] : '';
--- /dev/null
+#! /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