automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [PATCH 5/5] [ng] rule, lang: get rid of 'suffix_rules_coun


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 5/5] [ng] rule, lang: get rid of 'suffix_rules_count', simplify logic
Date: Thu, 24 May 2012 09:42:03 +0200

Apparently, some of our pre-existing logic used to determine when we need
to bring C-related stuff into the generated Makefile was too strict; we can
simplify it a bit, still keeping the testsuite clean.

* automake.in (handle_languages): Bring in C stuff only if we've seen a
non-pure language (like yacc or vala) or if '$need_link' is true, without
bothering to check whether we've seen more than one suffix rules.  This
change removes the only caller in the automake code base of ...
* lib/Automake/Rule.pm (suffix_rules_count): ... this subroutine, which
has thus been removed.
(@EXPORT): Adjust.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in          |    9 ++-------
 lib/Automake/Rule.pm |   14 +-------------
 2 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/automake.in b/automake.in
index 72c6d36..86e0019 100644
--- a/automake.in
+++ b/automake.in
@@ -1537,13 +1537,8 @@ sub handle_languages
        check_user_variables @dont_override;
     }
 
-    # If the project is entirely C++ or entirely Fortran 77 (i.e., 1
-    # suffix rule was learned), don't bother with the C stuff.  But if
-    # anything else creeps in, then use it.
-    $needs_c = 1
-      if $need_link || suffix_rules_count > 1;
-
-    if ($needs_c)
+    # Non-pure languages, or languages lacking a linker of their own.
+    if ($needs_c || $need_link)
       {
        &define_compiler_variable ($languages{'c'})
          unless defined $done{$languages{'c'}};
diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm
index e3fd69a..2406623 100644
--- a/lib/Automake/Rule.pm
+++ b/lib/Automake/Rule.pm
@@ -29,7 +29,7 @@ use Automake::DisjConditions;
 require Exporter;
 use vars '@ISA', '@EXPORT', '@EXPORT_OK';
 @ISA = qw/Automake::Item Exporter/;
address@hidden = qw (reset register_suffix_rule suffix_rules_count
address@hidden = qw (reset register_suffix_rule
              rules $suffix_rules
              depend %dependencies %actions register_action
              reject_rule msg_rule msg_cond_rule err_rule err_cond_rule
@@ -424,18 +424,6 @@ sub register_suffix_rule ($$$)
     }
 }
 
-=item C<$count = suffix_rules_count>
-
-Return the number of suffix rules added while processing the current
-F<Makefile> (excluding predefined suffix rules).
-
-=cut
-
-sub suffix_rules_count ()
-{
-  return (scalar keys %$suffix_rules) - (scalar keys %$_suffix_rules_default);
-}
-
 =item C<rule ($rulename)>
 
 Return the C<Automake::Rule> object for the rule
-- 
1.7.9.5




reply via email to

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