autoconf-2.13-autoscan
authorAnas Nashif <anas.nashif@intel.com>
Sun, 18 Nov 2012 15:40:22 +0000 (07:40 -0800)
committerAnas Nashif <anas.nashif@intel.com>
Sun, 18 Nov 2012 15:40:22 +0000 (07:40 -0800)
autoscan.pl

index 32852360f5179ffe4be64c7f191c29ca2c415b1a..15ebf4e8c9b74bec3ba460a1fe9c7fe5c2d966ba 100644 (file)
@@ -123,14 +123,33 @@ sub init_tables
 # Called by &find on each file.
 sub wanted
 {
-    if (/^.*\.[chlymC]$/ || /^.*\.cc$/) {
-       $name =~ s?^\./??; push(@cfiles, $name);
+  # Wanted only if there is no corresponding FILE.in.
+  return
+    if -f "$_.in";
+
+  # Strip a useless leading `./'.
+  $name =~ s,^\./,,;
+
+  if (/^.*\.[chlymC](\.in)?$/)
+    {
+      push (@cfiles, $name);
+      $programs{cc}++;
     }
-    elsif (/^[Mm]akefile$/ || /^[Mm]akefile\.in$/ || /^GNUmakefile$/) {
-       $name =~ s?^\./??; push(@makefiles, $name);
+  elsif (/^.*\.(cc|cpp|cxx|CC|C|hh|hpp|hxx|HH|H|yy|ypp|ll|lpp)(\.in)?$/)
+    {
+      push (@cfiles, $name);
+      $programs{CC}++;
     }
-    elsif (/^.*\.sh$/) {
-       $name =~ s?^\./??; push(@shfiles, $name);
+  elsif (/^[Mm]akefile(\.in)?$/ || /^GNUmakefile$/)
+    {
+      # Wanted only if there is no corresponding Makefile.in.
+      # Using Find, $_ contains the current filename with the current
+      # directory of the walk through.
+      push (@makefiles, $name);
+    }
+  elsif (/^.*\.sh(\.in)?$/)
+    {
+      push (@shfiles, $name);
     }
 }
 
@@ -244,7 +263,7 @@ sub scan_makefile
            $libraries{$1}++;
        }
        # Tokens in the code.
-       while (s/\W([a-zA-Z_]\w*)\W/ /) {
+       while (s/\W([a-zA-Z_][\w\+\.-]*)\W/ /) {
            $programs{$1}++;
        }
     }