automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [PATCH 2/4] [ng] clean: prefer internal variables over aut


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 2/4] [ng] clean: prefer internal variables over automake-time %TRANSFORMS%
Date: Tue, 31 Jul 2012 00:56:11 +0200

This will be especially useful in the next change.

* automake.in (handle_clean): Define several new private make variables
'am.clean.*.f.auto' and 'am.clean.*.d.auto'.  Drop the %TRANSFORMS% when
processing ...
(lib/am/clean.am): ... this file, which now uses the new internal vars.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in     | 37 +++++++++++++++++--------------------
 lib/am/clean.am | 16 ++++++++--------
 2 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/automake.in b/automake.in
index 9bba923..5a311af 100644
--- a/automake.in
+++ b/automake.in
@@ -3881,30 +3881,27 @@ sub handle_clean ($)
 {
   my ($makefile) = @_;
 
+  my (%f, %d);
+
   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;
+  $f{mostly} = [ grep { $clean_files{$_} == MOSTLY_CLEAN     } @fkeys ];
+  $f{normal} = [ grep { $clean_files{$_} == CLEAN            } @fkeys ];
+  $f{dist}   = [ grep { $clean_files{$_} == DIST_CLEAN       } @fkeys ];
+  $f{maint}  = [ 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;
+  $d{mostly} = [ grep { $clean_dirs{$_} == MOSTLY_CLEAN     } @dkeys ];
+  $d{normal} = [ grep { $clean_dirs{$_} == CLEAN            } @dkeys ];
+  $d{dist}   = [ grep { $clean_dirs{$_} == DIST_CLEAN       } @dkeys ];
+  $d{maint}  = [ grep { $clean_dirs{$_} == MAINTAINER_CLEAN } @dkeys ];
 
-  $output_rules .= &file_contents
-    ('clean',
-     new Automake::Location,
-     'MOSTLYCLEAN-FILES'     => "@fmostly",
-     'CLEAN-FILES'           => "@fplain",
-     'DISTCLEAN-FILES'       => "@fdist",
-     'MAINTAINERCLEAN-FILES' => "@fmaint",
-     'MOSTLYCLEAN-DIRS'      => "@dmostly",
-     'CLEAN-DIRS'            => "@dplain",
-     'DISTCLEAN-DIRS'        => "@ddist",
-     'MAINTAINERCLEAN-DIRS'  => "@dmaint",
-    );
+  foreach my $kind (qw/mostly normal dist maint/)
+    {
+      define_variable ("am.clean.$kind.f.auto", INTERNAL, @{$f{$kind}});
+      define_variable ("am.clean.$kind.d.auto", INTERNAL, @{$d{$kind}});
+    }
+
+  $output_rules .= &file_contents ('clean', new Automake::Location);
 }
 
 
diff --git a/lib/am/clean.am b/lib/am/clean.am
index bc8315d..aa489ff 100644
--- a/lib/am/clean.am
+++ b/lib/am/clean.am
@@ -19,15 +19,15 @@ am.clean.normal.f += $(CLEANFILES)
 am.clean.dist.f   += $(DISTCLEANFILES)
 am.clean.maint.f  += $(MAINTAINERCLEANFILES)
 
-am.clean.mostly.f += %MOSTLYCLEAN-FILES%
-am.clean.normal.f += %CLEAN-FILES%
-am.clean.dist.f   += %DISTCLEAN-FILES%
-am.clean.maint.f  += %MAINTAINERCLEAN-FILES%
+am.clean.mostly.f += $(am.clean.mostly.f.auto)
+am.clean.normal.f += $(am.clean.normal.f.auto)
+am.clean.dist.f   += $(am.clean.dist.f.auto)
+am.clean.maint.f  += $(am.clean.maint.f.auto)
 
-am.clean.mostly.d += %MOSTLYCLEAN-DIRS%
-am.clean.normal.d += %CLEAN-DIRS%
-am.clean.dist.d   += %DISTCLEAN-DIRS%
-am.clean.maint.d  += %MAINTAINERCLEAN-DIRS%
+am.clean.mostly.d += $(am.clean.mostly.d.auto)
+am.clean.normal.d += $(am.clean.normal.d.auto)
+am.clean.dist.d   += $(am.clean.dist.d.auto)
+am.clean.maint.d  += $(am.clean.maint.d.auto)
 
 am.clean.dist.f += $(CONFIG_CLEAN_FILES)
 # Some files must be cleaned only in VPATH builds -- e.g., those linked
-- 
1.7.12.rc0




reply via email to

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