]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] rule, lang: get rid of 'suffix_rules_count', simplify logic
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 23 May 2012 22:10:53 +0000 (00:10 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 24 May 2012 07:37:37 +0000 (09:37 +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 <stefano.lattarini@gmail.com>
automake.in
lib/Automake/Rule.pm

index 72c6d36464b4cad14398165a0d91dd72fca71e91..86e00190f7545d0aef2c9884c43e20633bb56c94 100644 (file)
@@ -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'}};
index e3fd69aee4cf3f28d1b6012608830e4b16374e95..24066235c645cb3b4ccb3955db2123602857b0c2 100644 (file)
@@ -29,7 +29,7 @@ use Automake::DisjConditions;
 require Exporter;
 use vars '@ISA', '@EXPORT', '@EXPORT_OK';
 @ISA = qw/Automake::Item Exporter/;
-@EXPORT = qw (reset register_suffix_rule suffix_rules_count
+@EXPORT = 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