automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [PATCH 06/14] [ng] automake: new global variable '%clean_d


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 06/14] [ng] automake: new global variable '%clean_dirs'
Date: Thu, 21 Jun 2012 12:32:37 +0200

Similar to the '%clean_files' variable, but it will allow us to declare
directories (rather than regular files) that are to be cleaned by the
four flavours of cleaning targets ('mostlyclean', 'clean', 'distclean',
'maintainer-clean').  This will be especially useful in later changes.

* automake.in (%clean_dirs): New global.
(%clan_dirs): Reset it.
* automake.in (handle_clean), lib/am/clean.am: Extend to clean the
directories registered in '%clean_dirs'.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in     |   36 ++++++++++++++++++++++++------------
 lib/am/clean.am |    5 +++++
 2 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/automake.in b/automake.in
index 46f22d1..49c9806 100644
--- a/automake.in
+++ b/automake.in
@@ -525,9 +525,10 @@ my @all;
 my @check;
 my @check_tests;
 
-# Keys in this hash table are files to delete.  The associated
-# value tells when this should happen (MOSTLY_CLEAN, DIST_CLEAN, etc.)
-my %clean_files;
+# Keys in this hash table are files and directories to delete.  The
+# associated value tells when this should happen (MOSTLY_CLEAN,
+# DIST_CLEAN, etc).
+my (%clean_files, %clean_dirs);
 
 # Keys in this hash table are object files or other files in
 # subdirectories which need to be removed.  This only holds files
@@ -655,6 +656,7 @@ sub initialize_per_input ()
     @check_tests = ();
 
     %clean_files = ();
+    %clean_dirs = ();
     %compile_clean_files = ();
 
     # We always include '.'.  This isn't strictly correct.
@@ -4006,19 +4008,29 @@ sub handle_clean ($)
 {
   my ($makefile) = @_;
 
-  my @keys = keys %clean_files;
-  my @mostly = grep { $clean_files{$_} == MOSTLY_CLEAN     } @keys;
-  my @plain  = grep { $clean_files{$_} == CLEAN            } @keys;
-  my @dist   = grep { $clean_files{$_} == DIST_CLEAN       } @keys;
-  my @maint  = grep { $clean_files{$_} == MAINTAINER_CLEAN } @keys;
+  my @fkeys = keys %clean_files;
+  my @fmostly = grep { $clean_files{$_} == MOSTLY_CLEAN     } @fkeys;
+  my @fplain  = grep { $clean_files{$_} == CLEAN            } @fkeys;
+  my @fdist   = grep { $clean_files{$_} == DIST_CLEAN       } @fkeys;
+  my @fmaint  = grep { $clean_files{$_} == MAINTAINER_CLEAN } @fkeys;
+
+  my @dkeys = keys %clean_dirs;
+  my @dmostly = grep { $clean_dirs{$_} == MOSTLY_CLEAN     } @dkeys;
+  my @dplain  = grep { $clean_dirs{$_} == CLEAN            } @dkeys;
+  my @ddist   = grep { $clean_dirs{$_} == DIST_CLEAN       } @dkeys;
+  my @dmaint  = grep { $clean_dirs{$_} == MAINTAINER_CLEAN } @dkeys;
 
   $output_rules .= &file_contents
     ('clean',
      new Automake::Location,
-     'MOSTLYCLEAN-FILES'     => "@mostly",
-     'CLEAN-FILES'           => "@plain",
-     'DISTCLEAN-FILES'       => "@dist",
-     'MAINTAINERCLEAN-FILES' => "@maint",
+     'MOSTLYCLEAN-FILES'     => "@fmostly",
+     'CLEAN-FILES'           => "@fplain",
+     'DISTCLEAN-FILES'       => "@fdist",
+     'MAINTAINERCLEAN-FILES' => "@fmaint",
+     'MOSTLYCLEAN-DIRS'      => "@dmostly",
+     'CLEAN-DIRS'            => "@dplain",
+     'DISTCLEAN-DIRS'        => "@ddist",
+     'MAINTAINERCLEAN-DIRS'  => "@dmaint",
      'MAKEFILE'              => basename $makefile);
 }
 
diff --git a/lib/am/clean.am b/lib/am/clean.am
index 6ee5218..7807d56 100644
--- a/lib/am/clean.am
+++ b/lib/am/clean.am
@@ -27,6 +27,11 @@ am__clean_files       += %CLEAN-FILES%
 am__distclean_files   += %DISTCLEAN-FILES%
 am__maintclean_files  += %MAINTAINERCLEAN-FILES%
 
+am__mostlyclean_dirs  += %MOSTLYCLEAN-DIRS%
+am__clean_dirs        += %CLEAN-DIRS%
+am__distclean_dirs    += %DISTCLEAN-DIRS%
+am__maintclean_dirs   += %MAINTAINERCLEAN-DIRS%
+
 am__distclean_files += $(CONFIG_CLEAN_FILES)
 ## Some files must be cleaned only in VPATH builds -- e.g., those linked
 ## in usages like "AC_CONFIG_LINKS([GNUmakefile:GNUmakefile])".
-- 
1.7.9.5




reply via email to

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