forked from epics_driver_modules/motorBase
- Add TOP to macro list.
- Add support for "include" directive.
This commit is contained in:
+59
-31
@@ -24,37 +24,65 @@ print OUT "top = \"$top\"\n";
|
||||
$topbin = "${top}/bin/${arch}";
|
||||
#skip check that top/bin/${arch} exists; src may not have been builT
|
||||
print OUT "topbin = \"$topbin\"\n";
|
||||
$release = "$top/config/RELEASE";
|
||||
if (-r "$release") {
|
||||
open(IN, "$release") or die "Cannot open $release\n";
|
||||
while ($line = <IN>) {
|
||||
next if ( $line =~ /\s*#/ );
|
||||
chomp($line);
|
||||
$_ = $line;
|
||||
#the following looks for
|
||||
# prefix = $(macro)post
|
||||
($prefix,$macro,$post) = /(.*)\s*=\s*\$\((.*)\)(.*)/;
|
||||
if ($macro eq "") { # true if no macro is present
|
||||
# the following looks for
|
||||
# prefix = post
|
||||
($prefix,$post) = /(.*)\s*=\s*(.*)/;
|
||||
} else {
|
||||
$base = $applications{$macro};
|
||||
if ($base eq "") {
|
||||
print "error: $macro was not previously defined\n";
|
||||
} else {
|
||||
$post = $base . $post;
|
||||
}
|
||||
}
|
||||
$applications{$prefix} = $post;
|
||||
$app = lc($prefix);
|
||||
if ( -d "$post") { #check that directory exists
|
||||
print OUT "$app = \"$post\"\n";
|
||||
}
|
||||
if ( -d "$post/bin/$arch") { #check that directory exists
|
||||
print OUT "${app}bin = \"$post/bin/$arch\"\n";
|
||||
}
|
||||
# Add TOP to macro list.
|
||||
$applications{TOP} = $top;
|
||||
|
||||
@files =();
|
||||
push(@files,"$top/config/RELEASE");
|
||||
foreach $file (@files) {
|
||||
if (-r "$file") {
|
||||
open(IN, "$file") or die "Cannot open $file\n";
|
||||
while ($line = <IN>) {
|
||||
next if ( $line =~ /\s*#/ );
|
||||
chomp($line);
|
||||
$_ = $line;
|
||||
($prefix,$macro,$post) = /(.*)\s* \s*\$\((.*)\)(.*)/;
|
||||
#test for "include" command
|
||||
if ($prefix eq "include") {
|
||||
if ($macro eq "") {
|
||||
# true if no macro is present
|
||||
#the following looks for
|
||||
#prefix = post
|
||||
($prefix,$post) = /(.*)\s* \s*(.*)/;
|
||||
}
|
||||
else {
|
||||
$base = $applications{$macro};
|
||||
if ($base eq "") {
|
||||
#print "error: $macro was not previously defined\n";
|
||||
}
|
||||
else {
|
||||
$post = $base . $post;
|
||||
}
|
||||
}
|
||||
push(@files,"$post")
|
||||
}
|
||||
else {
|
||||
#the following looks for
|
||||
# prefix = $(macro)post
|
||||
($prefix,$macro,$post) = /(.*)\s*=\s*\$\((.*)\)(.*)/;
|
||||
if ($macro eq "") { # true if no macro is present
|
||||
# the following looks for
|
||||
# prefix = post
|
||||
($prefix,$post) = /(.*)\s*=\s*(.*)/;
|
||||
} else {
|
||||
$base = $applications{$macro};
|
||||
if ($base eq "") {
|
||||
#print "error: $macro was not previously defined\n";
|
||||
} else {
|
||||
$post = $base . $post;
|
||||
}
|
||||
}
|
||||
$applications{$prefix} = $post;
|
||||
$app = lc($prefix);
|
||||
if ( -d "$post") { #check that directory exists
|
||||
print OUT "$app = \"$post\"\n";
|
||||
}
|
||||
if ( -d "$post/bin/$arch") { #check that directory exists
|
||||
print OUT "${app}bin = \"$post/bin/$arch\"\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
close IN;
|
||||
}
|
||||
close IN;
|
||||
}
|
||||
close OUT;
|
||||
|
||||
Reference in New Issue
Block a user