Now allows include statements.

This commit is contained in:
Janet B. Anderson
2001-04-27 14:05:07 +00:00
parent 636c028b56
commit 057fbc10a0
3 changed files with 131 additions and 11 deletions
+44 -5
View File
@@ -16,18 +16,49 @@ open(OUT,">${outfile}") or die "$! opening ${outfile}";
print OUT "#Do not modify this file.\n";
print OUT "#This file is created during the build.\n";
@files =();
push(@files,"$top/configure/RELEASE");
push(@files,"$top/configure/RELEASE.${hostarch}");
foreach $file (@files) {
sub ProcessFile
{
local *IN;
my ($file) = @_;
my $line;
my $app_post;
my $prefix;
my $base;
my ($macro,$post);
if (-r "$file") {
open(IN, "$file") or die "Cannot open $file\n";
open(IN, "$file") or return;
while ($line = <IN>) {
next if ( $line =~ /\s*#/ );
chomp($line);
$line =~ s/[ ]//g; # remove blanks and tabs
next if ( $line =~ /^$/ ); # skip empty lines
$_ = $line;
#the following looks for
# include $(macro)post
($macro,$post) = /include\s*\$\((.*)\)(.*)/;
if ($macro ne "") { # true if macro is present
$base = $applications{$macro};
if ($base eq "") {
#print "error: $macro was not previously defined\n";
next;
} else {
$post = $base . $post;
ProcessFile(${post});
next;
}
}
# the following looks for
# include post
($post) = /include\s*(.*)/;
if ($post ne "") {
ProcessFile(${post});
next;
}
#the following looks for
# prefix = $(macro)post
($prefix,$macro,$post) = /(.*)\s*=\s*\$\((.*)\)(.*)/;
@@ -69,5 +100,13 @@ foreach $file (@files) {
}
}
close IN;
return;
}
}
@files =();
push(@files,"$top/configure/RELEASE");
push(@files,"$top/configure/RELEASE.${hostarch}");
foreach $filename (@files) {
ProcessFile(${filename});
}
+45 -4
View File
@@ -35,12 +35,51 @@ $topbin = "${top}/bin/${arch}";
#skip check that top/bin/${arch} exists; src may not have been builT
print OUT "topbin = \"$topbin\"\n";
$release = "$top/configure/RELEASE";
if (-r "$release") {
open(IN, "$release") or die "Cannot open $release\n";
ProcessFile($release);
close OUT;
sub ProcessFile
{
local *IN;
my ($file) = @_;
my $line;
my $prefix;
my $base;
my ($macro,$post);
if (-r "$file") {
open(IN, "$file") or return;
while ($line = <IN>) {
next if ( $line =~ /\s*#/ );
chomp($line);
$line =~ s/[ ]//g; # remove blanks and tabs
next if ( $line =~ /^$/ ); # skip empty lines
$_ = $line;
#the following looks for
# include $(macro)post
($macro,$post) = /include\s*\$\((.*)\)(.*)/;
if ($macro ne "") { # true if macro is present
$base = $applications{$macro};
if ($base eq "") {
#print "error: $macro was not previously defined\n";
next;
} else {
$post = $base . $post;
ProcessFile(${post});
next;
}
}
# the following looks for
# include post
($post) = /include\s*(.*)/;
if ($post ne "") {
ProcessFile(${post});
next;
}
#the following looks for
# prefix = $(macro)post
($prefix,$macro,$post) = /(.*)\s*=\s*\$\((.*)\)(.*)/;
@@ -51,7 +90,7 @@ if (-r "$release") {
} else {
$base = $applications{$macro};
if ($base eq "") {
print "error: $macro was not previously defined\n";
#print "error: $macro was not previously defined\n";
} else {
$post = $base . $post;
}
@@ -66,5 +105,7 @@ if (-r "$release") {
}
}
close IN;
return ;
}
}
close OUT;
+42 -2
View File
@@ -19,15 +19,54 @@ print OUT "#This file is created during the build.\n";
@files =();
push(@files,"$top/configure/RELEASE");
push(@files,"$top/configure/RELEASE.${hostarch}");
foreach $file (@files) {
foreach $filename (@files) {
ProcessFile($filename);
}
sub ProcessFile
{
local *IN;
my ($file) = @_;
my $line;
my $app_post;
my $prefix;
my $base;
my ($macro,$post);
if (-r "$file") {
open(IN, "$file") or die "Cannot open $file\n";
open(IN, "$file") or return;
while ($line = <IN>) {
next if ( $line =~ /\s*#/ );
chomp($line);
$line =~ s/[ ]//g; # remove blanks and tabs
next if ( $line =~ /^$/ ); # skip empty lines
$_ = $line;
#the following looks for
# include $(macro)post
($macro,$post) = /include\s*\$\((.*)\)(.*)/;
if ($macro ne "") { # true if macro is present
$base = $applications{$macro};
if ($base eq "") {
#print "error: $macro was not previously defined\n";
next;
} else {
$post = $base . $post;
ProcessFile(${post});
next;
}
}
# the following looks for
# include post
($post) = /include\s*(.*)/;
if ($post ne "") {
ProcessFile(${post});
next;
}
#the following looks for
# prefix = $(macro)post
($prefix,$macro,$post) = /(.*)\s*=\s*\$\((.*)\)(.*)/;
@@ -55,5 +94,6 @@ foreach $file (@files) {
}
}
close IN;
return ;
}
}