V
Vittal
Hello All,
I am writing a simple perl script to scan C/C++ Makefiles and list all
the macros used in those Makefiles. For this I am using the below
mentioned regular expression. The problem with this RE is that it does
not show the complete macro definition. It cuts it short at new line
character. As per makefile rules, if a line ends with "/" means it
continues on to next line also. I want to add this portion into my RE
so that I can catch the whole macro definition.
Can someone help in this?
Thanks
-Vittal
open INFILE, $FILE || die "Failed to open $FILE file \n";
while (<INFILE>)
{
# Exclude all the lines starting with # in the
makefile
$temp .=$_ if (!/^#/);
}
$str_macro .= "\n$FILE\n\n";
while ($temp && $temp =~ /(\w+)\s*=(\t| )*([^\n]+)/ )
{
print "\t$&\n";
$temp = $';
}
I am writing a simple perl script to scan C/C++ Makefiles and list all
the macros used in those Makefiles. For this I am using the below
mentioned regular expression. The problem with this RE is that it does
not show the complete macro definition. It cuts it short at new line
character. As per makefile rules, if a line ends with "/" means it
continues on to next line also. I want to add this portion into my RE
so that I can catch the whole macro definition.
Can someone help in this?
Thanks
-Vittal
open INFILE, $FILE || die "Failed to open $FILE file \n";
while (<INFILE>)
{
# Exclude all the lines starting with # in the
makefile
$temp .=$_ if (!/^#/);
}
$str_macro .= "\n$FILE\n\n";
while ($temp && $temp =~ /(\w+)\s*=(\t| )*([^\n]+)/ )
{
print "\t$&\n";
$temp = $';
}