153 |
|
"BuildFile.mk"; |
154 |
|
$ENV{SCRAM_CURRENTENV}=$self->{currentenv}; |
155 |
|
|
156 |
< |
#open a temporary gnumakefile to store output. |
156 |
> |
# open a temporary gnumakefile to store output. |
157 |
|
use Utilities::AddDir; |
158 |
|
AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}"); |
159 |
|
$self->GenerateMakefile($fullfilename, |
268 |
|
my $name=shift; |
269 |
|
my $hashref=shift; |
270 |
|
|
271 |
+ |
|
272 |
|
$self->{switch}->checktag($name,$hashref,'class'); |
272 |
– |
$self->{switch}->checktag($name,$hashref,'src'); |
273 |
|
if ( $self->{Arch} ) { |
274 |
< |
|
275 |
< |
# -- determine the build products name |
276 |
< |
my $name; |
277 |
< |
if ( exists $$hashref{'name'} ) { |
278 |
< |
$name=$$hashref{'name'}; |
279 |
< |
} |
280 |
< |
else { |
281 |
< |
$self->{switch}->parseerror("No name specified for build product"); |
282 |
< |
#$name="\$(buildname)"; |
283 |
< |
} |
284 |
< |
|
285 |
< |
# -- check we have a lookup for the class type |
274 |
> |
my $fh=$self->{filehandlestack}[0]; |
275 |
> |
# -- get the mapper object |
276 |
|
my $mapper=$self->_toolmapper($$hashref{'class'}); |
277 |
|
if ( ! defined $mapper ) { |
278 |
|
$self->{switch}->parseerror("Unknown class : ".$$hashref{'class'}); |
279 |
|
} |
280 |
|
else { |
281 |
< |
my @types=$mapper->types(); |
281 |
> |
# -- get default types |
282 |
> |
my @deftypes; |
283 |
> |
if ( ! exists $$hashref{'default'} ) { |
284 |
> |
@deftypes=$mapper->defaulttypes(); |
285 |
> |
} |
286 |
> |
else { |
287 |
> |
@deftypes=split /,/, $$hashref{'default'}; |
288 |
> |
} |
289 |
> |
|
290 |
> |
# -- no src parameter so it must be a default setting tag |
291 |
> |
if ( ! exists $$hashref{src} ) { |
292 |
> |
# -- general default setting |
293 |
> |
$self->{switch}->checktag($name,$hashref,'default'); |
294 |
> |
$mapper->defaulttypes(@deftypes); |
295 |
> |
$self->_makegenerictargets($fh, $$hashref{'class'},@deftypes); |
296 |
> |
} |
297 |
> |
else { |
298 |
> |
$self->{switch}->checktag($name,$hashref,'src'); |
299 |
> |
$self->{switch}->checktag($name,$hashref,'name'); |
300 |
> |
my $name=$$hashref{'name'}; |
301 |
> |
my @types=$mapper->types(); |
302 |
|
|
293 |
– |
# -- get default build rules |
294 |
– |
my @deftypes; |
295 |
– |
if ( ! exists $$hashref{'default'} ) { |
296 |
– |
@deftypes=$mapper->defaulttypes(); |
297 |
– |
} |
298 |
– |
else { |
299 |
– |
@deftypes=split /,/, $$hashref{'default'}; |
300 |
– |
} |
303 |
|
|
302 |
– |
my $fh=$self->{filehandlestack}[0]; |
304 |
|
my @targets=(); |
305 |
|
|
306 |
|
# -- generate generic targets |
307 |
|
print $fh "ifndef _BuildLink_\n"; |
308 |
< |
print $fh "# -- Generic targets\n"; |
309 |
< |
push @targets, $$hashref{'class'}; |
308 |
> |
push @targets, ($self->_makegenerictargets($fh,$$hashref{'class'}, |
309 |
> |
@deftypes)); |
310 |
> |
print $fh "Sdefault_".$$hashref{'class'}."_".$$hashref{'name'}. |
311 |
> |
"=\$(addsuffix _".$$hashref{'name'}.",\$(Sdefault_". |
312 |
> |
$$hashref{'class'}."))\n"; |
313 |
> |
print $fh $$hashref{'class'}."_".$$hashref{'name'}."::\$(". |
314 |
> |
"Sdefault_".$$hashref{'class'}."_".$$hashref{'name'}.")\n"; |
315 |
|
push @targets, $$hashref{'class'}."_".$$hashref{'name'}; |
310 |
– |
foreach $dtype ( @deftypes ) { |
311 |
– |
print $fh $$hashref{'class'}."::".$$hashref{'class'}."_". |
312 |
– |
$dtype."\n"; |
313 |
– |
print $fh $$hashref{'class'}."_".$$hashref{'name'}. |
314 |
– |
"::".$$hashref{'class'}."_".$dtype."_". |
315 |
– |
$$hashref{'name'}."\n"; |
316 |
– |
} |
317 |
– |
print $fh "\n"; |
316 |
|
|
317 |
|
# -- generate targets for each type |
318 |
|
foreach $type ( @types ) { |
409 |
|
print $fh "endif\n"; |
410 |
|
} # end else |
411 |
|
} |
412 |
+ |
} |
413 |
+ |
} |
414 |
+ |
|
415 |
+ |
sub _makegenerictargets { |
416 |
+ |
my $self=shift; |
417 |
+ |
my $fh=shift; |
418 |
+ |
my $class=shift; |
419 |
+ |
my @deftypes=@_; |
420 |
+ |
|
421 |
+ |
my @targets=(); |
422 |
+ |
# -- generate generic targets |
423 |
+ |
print $fh "# -- Generic targets\n"; |
424 |
+ |
push @targets, $class; |
425 |
+ |
print $fh "ifndef Sdefault_".$class."\n"; |
426 |
+ |
foreach $dtype ( @deftypes ) { |
427 |
+ |
print $fh $class."::".$class."_".$dtype."\n"; |
428 |
+ |
print $fh "Sdefault_".$class."+=".$class."_".$dtype."\n"; |
429 |
+ |
} |
430 |
+ |
print $fh "\nendif\n"; |
431 |
+ |
return @targets; |
432 |
|
} |
433 |
|
|
434 |
|
sub Bin_start { |