bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "cygnus" option suppresses DIST_SUBDIRS


From: Alexandre Duret-Lutz
Subject: Re: "cygnus" option suppresses DIST_SUBDIRS
Date: Sat, 15 May 2004 23:00:13 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

>>> "Daniel" == Daniel Jacobowitz <address@hidden> writes:

 Daniel> The AUTOMAKE_OPTIONS flag "cygnus" suppresses automatic
 Daniel> generation of DIST_SUBDIRS from SUBDIRS.  But the
 Daniel> distclean target is still emitted, and normally used,
 Daniel> and no subdirs get cleaned in this case.

Thanks for the report.  
I'm installing the following fix on HEAD and branch-1-8.

2004-05-15  Alexandre Duret-Lutz  <address@hidden>

        * 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.

Index: THANKS
===================================================================
RCS file: /cvs/automake/automake/THANKS,v
retrieving revision 1.230.2.19
diff -u -r1.230.2.19 THANKS
--- THANKS      10 May 2004 20:38:50 -0000      1.230.2.19
+++ THANKS      15 May 2004 20:57:22 -0000
@@ -42,6 +42,7 @@
 Christian Cornelssen   address@hidden
 Dalibor Topic          address@hidden
 danbp                  address@hidden
+Daniel Jacobowitz      address@hidden
 Dave Brolley           address@hidden
 Dave Morrison          address@hidden
 David A. Swierczek     address@hidden
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1526.2.14
diff -u -r1.1526.2.14 automake.in
--- automake.in 14 May 2004 22:44:56 -0000      1.1526.2.14
+++ automake.in 15 May 2004 20:57:25 -0000
@@ -3212,6 +3212,49 @@
 # 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.
@@ -3318,59 +3361,19 @@
        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);
 
   $output_rules .= &file_contents ('distdir',
                                   new Automake::Location,
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.539.2.12
diff -u -r1.539.2.12 Makefile.am
--- tests/Makefile.am   14 May 2004 20:14:15 -0000      1.539.2.12
+++ tests/Makefile.am   15 May 2004 20:57:26 -0000
@@ -72,6 +72,7 @@
 check3.test \
 checkall.test \
 clean.test \
+clean2.test \
 colneq.test \
 colneq2.test \
 colon.test \
Index: tests/clean2.test
===================================================================
RCS file: tests/clean2.test
diff -N tests/clean2.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/clean2.test   15 May 2004 20:57:26 -0000
@@ -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

-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]