From 057fbc10a0ed30c64af9f1b7f3ad26df68d5320f Mon Sep 17 00:00:00 2001 From: "Janet B. Anderson" Date: Fri, 27 Apr 2001 14:05:07 +0000 Subject: [PATCH] Now allows include statements. --- configure/tools/makeConfigAppInclude.pl | 49 ++++++++++++++++++++++--- configure/tools/makeIocCdCommands.pl | 49 +++++++++++++++++++++++-- configure/tools/makeRulesInclude.pl | 44 +++++++++++++++++++++- 3 files changed, 131 insertions(+), 11 deletions(-) diff --git a/configure/tools/makeConfigAppInclude.pl b/configure/tools/makeConfigAppInclude.pl index 4c33b1fdb..31cec79a1 100644 --- a/configure/tools/makeConfigAppInclude.pl +++ b/configure/tools/makeConfigAppInclude.pl @@ -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 = ) { 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}); +} diff --git a/configure/tools/makeIocCdCommands.pl b/configure/tools/makeIocCdCommands.pl index 3d5b3f523..3c1486b74 100644 --- a/configure/tools/makeIocCdCommands.pl +++ b/configure/tools/makeIocCdCommands.pl @@ -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 = ) { 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; + diff --git a/configure/tools/makeRulesInclude.pl b/configure/tools/makeRulesInclude.pl index 1f8fa2744..8d400aaec 100644 --- a/configure/tools/makeRulesInclude.pl +++ b/configure/tools/makeRulesInclude.pl @@ -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 = ) { 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 ; } }