91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
}
close (ESE);
}
#-------------------------------------------------------------------------------
sub get_dependencies {
# create pattern to match any left values
my $pattern = "";
foreach my $lvar (keys %expressions) {
$pattern = "$pattern|$lvar";
}
# strip initial |
$pattern =~ s!\|(.*)!/$1/!; # var1|var2|var3
print "$pattern\n" if $debug;
# compile the pattern to improve speed
my $regexp = qr/($pattern)/;
# compare the pattern to each expression
foreach my $lvar (keys %expressions) {
$dependencies{$lvar} = "";
$_ = $expressions{$lvar};
while (/$regexp/g) {
# a left value has been found in the expression
# add it to the dependencies for this lvar
$dependencies{$lvar} = "$dependencies{$lvar} $1";
}
print "$lvar:\t$dependencies{$lvar}\n" if $debug;
}
}
#-------------------------------------------------------------------------------
sub write_make {
|
<
<
<
<
<
<
<
<
<
<
<
<
>
|
|
|
|
>
|
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
}
close (ESE);
}
#-------------------------------------------------------------------------------
sub get_dependencies {
# compare the pattern to each expression
foreach my $lvar (keys %expressions) {
$dependencies{$lvar} = "";
$_ = $expressions{$lvar};
for my $lvar2 (keys %expressions) {
if ($expressions{$lvar} =~ /$lvar2/) {
# a left value has been found in the expression
# add it to the dependencies for this lvar
$dependencies{$lvar} = "$dependencies{$lvar} $lvar2";
}
}
print "$lvar:\t$dependencies{$lvar}\n" if $debug;
}
}
#-------------------------------------------------------------------------------
sub write_make {
|