8 |
|
use ToolBox; |
9 |
|
$buildfile="BuildFile"; |
10 |
|
$toolbox=ToolBox->new(); |
11 |
+ |
$Arch=1; |
12 |
+ |
push @ARCHBLOCK, $Arch; |
13 |
|
} |
14 |
|
|
15 |
|
#Parse the BuildFile |
34 |
|
'Bin' => 'none', |
35 |
|
'Bin_StartTag' => \&Bin_start, |
36 |
|
'ClassPath' => \&OutToMakefile, |
37 |
< |
'ClassPath_StartTag' => \&setBlockClassPath |
37 |
> |
'ClassPath_StartTag' => \&setBlockClassPath, |
38 |
> |
'lib' => 'none', |
39 |
> |
'lib_StartTag' => \&lib_start, |
40 |
> |
'lib_EndTag' => 'none' |
41 |
|
}; |
42 |
|
use Utilities::Switcher; |
43 |
|
$switch=Switcher->new($SupportedTags, $fullfilename); |
56 |
|
close GNUmakefile; |
57 |
|
} |
58 |
|
|
59 |
+ |
sub ParseBuildFile_Export { |
60 |
+ |
my $filename=shift; |
61 |
+ |
use Tool; |
62 |
+ |
# This hash defines which Document Elements we can use |
63 |
+ |
my $SupportedTags={ |
64 |
+ |
'Use' => \&OutToMakefile, |
65 |
+ |
'Use_StartTag' => \&Use_start, |
66 |
+ |
'External' => \&OutToMakefile, |
67 |
+ |
'External_StartTag' => \&External_StartTag, |
68 |
+ |
'none' => 'none', |
69 |
+ |
'export' => \&OutToMakefile, |
70 |
+ |
'export_StartTag' => \&export_start, |
71 |
+ |
'export_EndTag' => \&export_end, |
72 |
+ |
'lib_StartTag' => \&lib_start_export, |
73 |
+ |
'lib' => 'none' |
74 |
+ |
}; |
75 |
+ |
use Utilities::Switcher; |
76 |
+ |
$switchex=Switcher->new($SupportedTags, $filename); |
77 |
+ |
$switchex->{Strict_no_cr}='no'; |
78 |
+ |
push @switchstack, $switchex; |
79 |
+ |
$switchex->parse(); # sort out supported tags |
80 |
+ |
pop @switchstack; |
81 |
+ |
$switchex=$switchstack[$#switchstack]; # Make sure we can Use multiply |
82 |
+ |
} |
83 |
+ |
|
84 |
|
sub initialterms() { |
85 |
|
my $name=shift; |
86 |
|
my @string=@_; |
166 |
|
print GNUmakefile "$$hashref{name}.dep:$$hashref{file}\n"; |
167 |
|
print GNUmakefile "-include $$hashref{name}.dep\n"; |
168 |
|
# print GNUmakefile "$$hashref{name}:$$hashref{file}\n"; |
169 |
< |
print GNUmakefile "$$hashref{name}_d:$$hashref{name}_d.exe\n"; |
170 |
< |
print GNUmakefile "\t\@mv $$hashref{name}_d.exe \$(binarystore)/". |
171 |
< |
"$$hashref{name}\n"; |
172 |
< |
print GNUmakefile "$$hashref{name}_Insure:$$hashref{name}_Insure.exe\n"; |
173 |
< |
print GNUmakefile "\t\@mv $$hashref{name}_Insure.exe \$(binarystore)/". |
174 |
< |
"$$hashref{name}_Insure\n"; |
175 |
< |
print GNUmakefile "$$hashref{name}:$$hashref{name}.exe\n"; |
176 |
< |
print GNUmakefile "\t\@mv $$hashref{name}.exe \$(binarystore)/". |
177 |
< |
"$$hashref{name}\n"; |
178 |
< |
print GNUmakefile "binfiles+=$filename\n"; |
179 |
< |
print GNUmakefile "bintargets+=$$hashref{name} $$hashref{name}_d\n"; |
180 |
< |
print GNUmakefile "#files+=$$hashref{file}\n"; |
181 |
< |
|
169 |
> |
print GNUmakefile <<ENDTEXT; |
170 |
> |
$$hashref{name}_d.exe:\$(libslocal_d) |
171 |
> |
$$hashref{name}.exe:\$(libslocal) |
172 |
> |
$$hashref{name}_Insure.exe:\$(libslocal_I) |
173 |
> |
$$hashref{name}_d:$$hashref{name}_d.exe |
174 |
> |
\@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name} |
175 |
> |
$$hashref{name}_Insure:$$hashref{name}_Insure.exe |
176 |
> |
\@mv $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure |
177 |
> |
$$hashref{name}:$$hashref{name}_d.exe |
178 |
> |
\@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name} |
179 |
> |
$$hashref{name}_o:$$hashref{name}_o.exe |
180 |
> |
\@mv $$hashref{name}.exe \$(binarystore)/$$hashref{name} |
181 |
> |
binfiles+=$filename |
182 |
> |
bintargets+=$$hashref{name} $$hashref{name}_d $$hashref{name}_Insure |
183 |
> |
ENDTEXT |
184 |
|
} |
185 |
|
|
186 |
|
sub External_StartTag { |
189 |
|
my $hashref; |
190 |
|
|
191 |
|
$hashref=$switch->SetupValueHash(\@vars); |
192 |
+ |
if ( $Arch ) { |
193 |
|
$$hashref{'ref'}=~tr[A-Z][a-z]; |
194 |
|
print GNUmakefile $$hashref{'ref'}; |
195 |
|
if ( defined $$hashref{'version'} ) { |
196 |
|
print GNUmakefile "_V_".$$hashref{'version'}; |
197 |
|
} |
198 |
|
print GNUmakefile "=true\n"; |
199 |
+ |
} |
200 |
|
|
201 |
|
} |
202 |
|
|
238 |
|
|
239 |
|
$hashref=$switch->SetupValueHash(\@vars); |
240 |
|
$switch->checkparam($hashref, $name, "name"); |
241 |
< |
if ( $filename=checkfile("$ENV{INTsrc}/$$hashref{name}/BuildFile") |
242 |
< |
ne "" ) { |
243 |
< |
print GNUmakefile "ReqDependencies += $filename\n"; |
241 |
> |
$filename=SCRAMUtils::checkfile( |
242 |
> |
"$ENV{INTsrc}/$$hashref{name}/BuildFile"); |
243 |
> |
if ( $filename ne "" ) { |
244 |
> |
ParseBuildFile_Export( $filename ); |
245 |
|
} |
211 |
– |
print GNUmakefile "local__$$hashref{name}=true\n"; |
246 |
|
} |
247 |
|
|
248 |
|
sub CheckBuildFile { |
297 |
|
$BlockClassPath=$BlockClassPath.":".$$hashref{path}; |
298 |
|
_CutBlock($$hashref{path}); |
299 |
|
} |
300 |
+ |
|
301 |
+ |
sub export_start { |
302 |
+ |
#Set up a toolfile object |
303 |
+ |
$exporttool=Tool->new(); |
304 |
+ |
} |
305 |
+ |
|
306 |
+ |
sub export_end { |
307 |
+ |
#Write toolfile object to disk |
308 |
+ |
$exporttool->envtomake(\*GNUmakefile); |
309 |
+ |
} |
310 |
+ |
|
311 |
+ |
# |
312 |
+ |
# Export Mode Lib Tag |
313 |
+ |
# |
314 |
+ |
sub lib_start_export { |
315 |
+ |
my $name=shift; |
316 |
+ |
my @vars=@_; |
317 |
+ |
my $hashref; |
318 |
+ |
|
319 |
+ |
$hashref=$switchex->SetupValueHash( \@vars ); |
320 |
+ |
$switchex->checkparam($hashref, $name, 'name'); |
321 |
+ |
if ( $Arch ) { |
322 |
+ |
if ( $switchex->context('export') ) { |
323 |
+ |
#If export mode then add this env to the export tool |
324 |
+ |
$exporttool->addenv('lib',$$hashref{name}); |
325 |
+ |
} |
326 |
+ |
} |
327 |
+ |
} |
328 |
+ |
|
329 |
+ |
# |
330 |
+ |
# Standard lib tag |
331 |
+ |
# |
332 |
+ |
sub lib_start { |
333 |
+ |
my $name=shift; |
334 |
+ |
my @vars=@_; |
335 |
+ |
my $hashref; |
336 |
+ |
|
337 |
+ |
$hashref=$switch->SetupValueHash( \@vars ); |
338 |
+ |
$switch->checkparam($hashref, $name, 'name'); |
339 |
+ |
if ( $Arch ) { |
340 |
+ |
print GNUmakefile "lib+=$$hashref{name}\n"; |
341 |
+ |
} |
342 |
+ |
} |