4 |
|
@ISA = qw(Exporter); |
5 |
|
@EXPORT = qw(CheckBuildFile ParseBuildFile @BlockClassA $DefaultBuildFile); |
6 |
|
|
7 |
– |
BEGIN { |
8 |
– |
use ToolBox; |
9 |
– |
$buildfile="BuildFile"; |
10 |
– |
$toolbox=ToolBox->new(); |
11 |
– |
} |
7 |
|
|
8 |
|
#Parse the BuildFile |
9 |
|
sub ParseBuildFile { |
24 |
|
'ConfigurationClass' => \&OutToMakefile, |
25 |
|
'AssociateGroup' => \&AssociateGroup, |
26 |
|
'none' => \&OutToMakefile, |
27 |
< |
'Bin' => \&OutToMakefile, |
27 |
> |
'Bin' => 'none', |
28 |
|
'Bin_StartTag' => \&Bin_start, |
29 |
|
'ClassPath' => \&OutToMakefile, |
30 |
< |
'ClassPath_StartTag' => \&setBlockClassPath |
30 |
> |
'ClassPath_StartTag' => \&setBlockClassPath, |
31 |
> |
'lib' => 'none', |
32 |
> |
'lib_StartTag' => \&lib_start, |
33 |
> |
'lib_EndTag' => 'none' |
34 |
|
}; |
35 |
< |
use Utilities::Switcher; |
35 |
> |
use ActiveDoc::Switcher; |
36 |
|
$switch=Switcher->new($SupportedTags, $fullfilename); |
37 |
|
$switch->{Strict_no_cr}='no'; |
38 |
|
#open a temporary gnumakefile to store output. |
49 |
|
close GNUmakefile; |
50 |
|
} |
51 |
|
|
52 |
+ |
sub ParseBuildFile_Export { |
53 |
+ |
my $filename=shift; |
54 |
+ |
#use Tool; |
55 |
+ |
# This hash defines which Document Elements we can use |
56 |
+ |
my $SupportedTags={ |
57 |
+ |
'Use' => \&OutToMakefile, |
58 |
+ |
'Use_StartTag' => \&Use_start, |
59 |
+ |
'External' => \&OutToMakefile, |
60 |
+ |
'External_StartTag' => \&External_StartTag, |
61 |
+ |
'none' => 'none', |
62 |
+ |
'export' => \&OutToMakefile, |
63 |
+ |
'export_StartTag' => \&export_start, |
64 |
+ |
'export_EndTag' => \&export_end, |
65 |
+ |
'lib_StartTag' => \&lib_start_export, |
66 |
+ |
'lib' => 'none' |
67 |
+ |
}; |
68 |
+ |
use ActiveDoc::Switcher; |
69 |
+ |
$switchex=Switcher->new($SupportedTags, $filename); |
70 |
+ |
$switchex->{Strict_no_cr}='no'; |
71 |
+ |
push @switchstack, $switchex; |
72 |
+ |
$switchex->parse(); # sort out supported tags |
73 |
+ |
pop @switchstack; |
74 |
+ |
$switchex=$switchstack[$#switchstack]; # Make sure we can Use multiply |
75 |
+ |
} |
76 |
+ |
|
77 |
|
sub initialterms() { |
78 |
|
my $name=shift; |
79 |
|
my @string=@_; |
125 |
|
my $fileclass; |
126 |
|
my @tools; |
127 |
|
my $tool; |
128 |
+ |
my $filename; |
129 |
+ |
my $objectname; |
130 |
|
|
131 |
|
$hashref=$switch->SetupValueHash(\@vars); |
132 |
|
$switch->checkparam($hashref, $name, 'file'); |
136 |
|
# This stuff for later |
137 |
|
#$fileclass=$toolbox->getclass($file); |
138 |
|
#$toolbox->maketargets("exe",$fileclass, $$hashref{name}, $file ); |
139 |
< |
print GNUmakefile "bin::$$hashref{name}\n"; |
140 |
< |
print GNUmakefile "$$hashref{name}::$$hashref{file}\n"; |
139 |
> |
($filename=$$hashref{file})=~s/\..*//; |
140 |
> |
($objectname=$$hashref{file})=~s/\..*/\.o/; |
141 |
> |
($objectname_d=$$hashref{file})=~s/\..*/_d\.o/; |
142 |
> |
($objectname_Insure=$$hashref{file})=~s/\..*/_Insure\.o/; |
143 |
> |
print GNUmakefile "bin:$$hashref{name}\n"; |
144 |
> |
print GNUmakefile "bin_debug:$$hashref{name}_d\n"; |
145 |
> |
print GNUmakefile "bin_insure:$$hashref{name}_Insure\n"; |
146 |
> |
print GNUmakefile ".INTERMEDIATE::$$hashref{name}_d.exe\n"; |
147 |
> |
print GNUmakefile ".INTERMEDIATE::$$hashref{name}_Insure.exe\n"; |
148 |
> |
print GNUmakefile ".INTERMEDIATE::$$hashref{name}.exe\n"; |
149 |
> |
print GNUmakefile "$$hashref{name}_Insure:.psrc\n"; |
150 |
> |
print GNUmakefile "$$hashref{name}_d.exe:$objectname_d\n"; |
151 |
> |
print GNUmakefile "\t\$(CClinkCmdDebug)\n"; |
152 |
> |
print GNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n"; |
153 |
> |
print GNUmakefile "\t\$(CClinkCmdInsure)\n"; |
154 |
> |
print GNUmakefile "$$hashref{name}.exe:$objectname\n"; |
155 |
> |
print GNUmakefile "\t\$(CClinkCmd)\n"; |
156 |
> |
print GNUmakefile "$objectname:$$hashref{name}.dep\n"; |
157 |
> |
print GNUmakefile "$objectname_d:$$hashref{name}.dep\n"; |
158 |
> |
print GNUmakefile "$objectname_Insure:$$hashref{name}.dep\n"; |
159 |
> |
print GNUmakefile "$$hashref{name}.dep:$$hashref{file}\n"; |
160 |
> |
print GNUmakefile "-include $$hashref{name}.dep\n"; |
161 |
> |
# print GNUmakefile "$$hashref{name}:$$hashref{file}\n"; |
162 |
> |
print GNUmakefile <<ENDTEXT; |
163 |
> |
$$hashref{name}_d.exe:\$(libslocal_d) |
164 |
> |
$$hashref{name}.exe:\$(libslocal) |
165 |
> |
$$hashref{name}_Insure.exe:\$(libslocal_I) |
166 |
> |
$$hashref{name}_d:$$hashref{name}_d.exe |
167 |
> |
\@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name} |
168 |
> |
$$hashref{name}_Insure:$$hashref{name}_Insure.exe |
169 |
> |
\@mv $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure |
170 |
> |
$$hashref{name}:$$hashref{name}_d.exe |
171 |
> |
\@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name} |
172 |
> |
$$hashref{name}_o:$$hashref{name}_o.exe |
173 |
> |
\@mv $$hashref{name}.exe \$(binarystore)/$$hashref{name} |
174 |
> |
binfiles+=$filename |
175 |
> |
bintargets+=$$hashref{name} $$hashref{name}_d $$hashref{name}_Insure |
176 |
> |
ENDTEXT |
177 |
|
} |
178 |
|
|
179 |
|
sub External_StartTag { |
182 |
|
my $hashref; |
183 |
|
|
184 |
|
$hashref=$switch->SetupValueHash(\@vars); |
185 |
+ |
if ( $Arch ) { |
186 |
+ |
$$hashref{'ref'}=~tr[A-Z][a-z]; |
187 |
|
print GNUmakefile $$hashref{'ref'}; |
188 |
|
if ( defined $$hashref{'version'} ) { |
189 |
|
print GNUmakefile "_V_".$$hashref{'version'}; |
190 |
|
} |
191 |
|
print GNUmakefile "=true\n"; |
192 |
+ |
} |
193 |
|
|
194 |
|
} |
195 |
|
|
231 |
|
|
232 |
|
$hashref=$switch->SetupValueHash(\@vars); |
233 |
|
$switch->checkparam($hashref, $name, "name"); |
234 |
< |
if ( $filename=checkfile("$ENV{INTsrc}/$$hashref{name}/BuildFile") |
235 |
< |
ne "" ) { |
236 |
< |
print GNUmakefile "ReqDependencies += $filename\n"; |
234 |
> |
$filename=SCRAMUtils::checkfile( |
235 |
> |
"$ENV{INTsrc}/$$hashref{name}/BuildFile"); |
236 |
> |
if ( $filename ne "" ) { |
237 |
> |
ParseBuildFile_Export( $filename ); |
238 |
|
} |
174 |
– |
print GNUmakefile "local__$$hashref{name}=true\n"; |
239 |
|
} |
240 |
|
|
241 |
|
sub CheckBuildFile { |
290 |
|
$BlockClassPath=$BlockClassPath.":".$$hashref{path}; |
291 |
|
_CutBlock($$hashref{path}); |
292 |
|
} |
293 |
+ |
|
294 |
+ |
sub export_start { |
295 |
+ |
#Set up a toolfile object |
296 |
+ |
# $exporttool=Tool->new(); |
297 |
+ |
} |
298 |
+ |
|
299 |
+ |
sub export_end { |
300 |
+ |
#Write toolfile object to disk |
301 |
+ |
$exporttool->envtomake(\*GNUmakefile); |
302 |
+ |
} |
303 |
+ |
|
304 |
+ |
# |
305 |
+ |
# Export Mode Lib Tag |
306 |
+ |
# |
307 |
+ |
sub lib_start_export { |
308 |
+ |
my $name=shift; |
309 |
+ |
my @vars=@_; |
310 |
+ |
my $hashref; |
311 |
+ |
|
312 |
+ |
$hashref=$switchex->SetupValueHash( \@vars ); |
313 |
+ |
$switchex->checkparam($hashref, $name, 'name'); |
314 |
+ |
if ( $Arch ) { |
315 |
+ |
if ( $switchex->context('export') ) { |
316 |
+ |
#If export mode then add this env to the export tool |
317 |
+ |
$exporttool->addenv('lib',$$hashref{name}); |
318 |
+ |
} |
319 |
+ |
} |
320 |
+ |
} |
321 |
+ |
|
322 |
+ |
# |
323 |
+ |
# Standard lib tag |
324 |
+ |
# |
325 |
+ |
sub lib_start { |
326 |
+ |
my $name=shift; |
327 |
+ |
my @vars=@_; |
328 |
+ |
my $hashref; |
329 |
+ |
|
330 |
+ |
$hashref=$switch->SetupValueHash( \@vars ); |
331 |
+ |
$switch->checkparam($hashref, $name, 'name'); |
332 |
+ |
if ( $Arch ) { |
333 |
+ |
print GNUmakefile "lib+=$$hashref{name}\n"; |
334 |
+ |
} |
335 |
+ |
} |