2 |
|
# |
3 |
|
# Interface |
4 |
|
# --------- |
5 |
< |
# new(ConfigArea) |
5 |
> |
# new(toolbox) |
6 |
|
# ParseBuildFile($base,$path,$file) |
7 |
|
# ParseBuildFileExport(filename) |
8 |
– |
# BlockParse(Block) : perform a parse to modify the block |
8 |
|
# BlockClassPath() : Return the class path |
9 |
|
# ignore() : return 1 if directory should be ignored 0 otherwise |
11 |
– |
# classname() : get/set the associated class |
12 |
– |
# buildfile() : get/set BuildFile location |
13 |
– |
# makefile() : get the generated makefile |
10 |
|
|
11 |
|
package BuildSystem::BuildFile; |
12 |
|
use ActiveDoc::SimpleDoc; |
21 |
|
my $class=shift; |
22 |
|
my $self={}; |
23 |
|
bless $self, $class; |
24 |
< |
$self->{area}=shift; |
29 |
< |
$self->{toolbox}=$self->{area}->toolbox(); |
30 |
< |
$self->{localtop}=$self->{area}->location(); |
31 |
< |
# -- set RELEASTOP |
32 |
< |
my $rarea=$self->{area}->linkarea(); |
33 |
< |
if ( ! defined $rarea ) { |
34 |
< |
$self->{releasetop}=$self->{localtop}; |
35 |
< |
} |
36 |
< |
else { |
37 |
< |
$self->{releasetop}=$rarea->location(); |
38 |
< |
} |
39 |
< |
$self->{releasetop}=$self->{area}->location(); |
24 |
> |
$self->{toolbox}=shift; |
25 |
|
$self->{Arch}=1; |
26 |
|
push @{$self->{ARCHBLOCK}}, $self->{Arch}; |
27 |
|
return $self; |
28 |
|
} |
29 |
|
|
45 |
– |
sub buildfile { |
46 |
– |
my $self=shift; |
47 |
– |
if ( @_ ) { |
48 |
– |
$self->{buildfile}=shift; |
49 |
– |
} |
50 |
– |
return $self->{buildfile}; |
51 |
– |
} |
52 |
– |
|
53 |
– |
sub makefile { |
54 |
– |
my $self=shift; |
55 |
– |
if ( @_ ) { |
56 |
– |
$self->{makefile}=shift; |
57 |
– |
} |
58 |
– |
return $self->{makefile}; |
59 |
– |
} |
60 |
– |
|
61 |
– |
sub BlockParse { |
62 |
– |
my $self=shift; |
63 |
– |
$self->{block}=shift; |
64 |
– |
|
65 |
– |
# -- set up the block parse |
66 |
– |
my $switch=$self->_initswitcher(); |
67 |
– |
my $parse="block"; |
68 |
– |
$switch->newparse($parse); |
69 |
– |
$switch->addignoretags($parse); |
70 |
– |
$switch->addtag($parse,"BuildParam", \&BuildBlock_start, $self); |
71 |
– |
|
72 |
– |
# -- parse away |
73 |
– |
$self->{switch}->parse("block"); |
74 |
– |
} |
75 |
– |
|
76 |
– |
sub Parsetofh { |
77 |
– |
my $self=shift; |
78 |
– |
my $fh=shift; |
79 |
– |
$self->{buildblock}=shift; |
80 |
– |
|
81 |
– |
# -- set up for parse |
82 |
– |
@{$self->{filehandlestack}}=($fh); |
83 |
– |
$self->{switch}->filetoparse($self->buildfile()); |
84 |
– |
*GNUmakefile=$fh; |
85 |
– |
|
86 |
– |
# -- generate makefile |
87 |
– |
$self->{switch}->parse("makebuild"); # sort out supported tags |
88 |
– |
|
89 |
– |
# -- Clean up |
90 |
– |
close GNUmakefile; |
91 |
– |
} |
92 |
– |
|
30 |
|
sub ignore { |
31 |
|
my $self=shift; |
32 |
|
return (defined $self->{ignore})?$self->{ignore}:0; |
39 |
|
$switch->newparse($parse); |
40 |
|
$switch->addignoretags($parse); |
41 |
|
$self->_commontags($switch,$parse); |
42 |
< |
#$switch->addtag($parse,"Build", \&Build_start, $self); |
42 |
> |
$switch->addtag($parse,"Build", \&Build_start, $self); |
43 |
|
$switch->addtag($parse,"none", |
44 |
|
\&OutToMakefile,$self, |
45 |
|
\&OutToMakefile, $self, |
48 |
|
\&Bin_start,$self, |
49 |
|
\&OutToScreen, $self, |
50 |
|
"", $self); |
51 |
< |
$switch->addtag($parse,"ProductStore", |
52 |
< |
\&Store_start,$self, |
53 |
< |
"", $self, |
54 |
< |
"", $self); |
51 |
> |
$switch->addtag($parse,"ProductStore", |
52 |
> |
\&Store_start,$self, |
53 |
> |
"", $self, |
54 |
> |
"", $self); |
55 |
|
$switch->addtag($parse,"LibType", |
56 |
|
\&LibType_Start,$self, |
57 |
|
\&LibType_text, $self, |
111 |
|
return $switch; |
112 |
|
} |
113 |
|
|
177 |
– |
sub GenerateMakefile { |
178 |
– |
my $self=shift; |
179 |
– |
my $infile=shift; |
180 |
– |
my $outfile=shift; |
181 |
– |
|
182 |
– |
$self->{switch}=$self->_initswitcher(); |
183 |
– |
$self->{switch}->filetoparse($infile); |
184 |
– |
|
185 |
– |
# open a temporary gnumakefile to store output. |
186 |
– |
my $fh=FileHandle->new(); |
187 |
– |
open ( $fh, ">$outfile") or die "Unable to open $outfile for output ". |
188 |
– |
"$!\n"; |
189 |
– |
@{$self->{filehandlestack}}=($fh); |
190 |
– |
|
191 |
– |
# -- make an alias |
192 |
– |
*GNUmakefile=$fh; |
193 |
– |
if ( -e $ENV{LatestBuildFile} ) { |
194 |
– |
print GNUmakefile "include $ENV{LatestBuildFile}\n"; |
195 |
– |
} |
196 |
– |
$self->{switch}->parse("makebuild"); # sort out supported tags |
197 |
– |
close GNUmakefile; |
198 |
– |
return $outfile; |
199 |
– |
} |
200 |
– |
|
114 |
|
sub ParseBuildFile { |
115 |
|
my $self=shift; |
116 |
|
my $base=shift; |
128 |
|
$numbins=0; |
129 |
|
$self->{envnum}=0; |
130 |
|
$self->{envlevel}=0; |
131 |
< |
$self->{makefile}="$self->{localtop}/$ENV{INTwork}/$self->{path}/". |
131 |
> |
$self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/". |
132 |
|
"BuildFile.mk"; |
220 |
– |
$self->{currentenv}=$self->{makefile}; |
133 |
|
$self->{switch}=$self->_initswitcher(); |
134 |
|
$self->{switch}->filetoparse($fullfilename); |
135 |
|
|
136 |
|
# $self->{switch}->{Strict_no_cr}='no'; |
137 |
|
#open a temporary gnumakefile to store output. |
138 |
|
use Utilities::AddDir; |
139 |
< |
AddDir::adddir("$self->{localtop}/$ENV{INTwork}/$self->{path}"); |
140 |
< |
$ENV{LatestBuildFile}=$self->GenerateMakefile($fullfilename, |
141 |
< |
$self->{localtop}."/".$ENV{INTwork}."/".$self->{path}."/BuildFile.mk"); |
142 |
< |
} |
143 |
< |
|
144 |
< |
sub classname { |
145 |
< |
my $self=shift; |
146 |
< |
if ( @_ ) { |
147 |
< |
$self->{classname}=shift; |
139 |
> |
AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}"); |
140 |
> |
my $fh=FileHandle->new(); |
141 |
> |
open ( $fh, ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk" |
142 |
> |
) or die "Unable to open /$ENV{INTwork}/".$self->{path}."/BuildFile.mk $!\n"; |
143 |
> |
@{$self->{filehandlestack}}=($fh); |
144 |
> |
# make an alias |
145 |
> |
*GNUmakefile=$fh; |
146 |
> |
if ( -e $ENV{LatestBuildFile} ) { |
147 |
> |
print GNUmakefile "include $ENV{LatestBuildFile}\n"; |
148 |
> |
} |
149 |
> |
# print "writing to :\n". |
150 |
> |
# "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/BuildFile.mk\n"; |
151 |
> |
$ENV{LatestBuildFile}="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk"; |
152 |
> |
$self->{switch}->parse("makebuild"); # sort out supported tags |
153 |
> |
if ( $numbins > 0 ) { |
154 |
> |
print GNUmakefile <<ENDTEXT; |
155 |
> |
ifndef BINMODE |
156 |
> |
help:: |
157 |
> |
\t\@echo Generic Binary targets |
158 |
> |
\t\@echo ---------------------- |
159 |
> |
endif |
160 |
> |
ENDTEXT |
161 |
> |
foreach $target ( keys %$targettypes ) { |
162 |
> |
print GNUmakefile <<ENDTEXT; |
163 |
> |
ifndef BINMODE |
164 |
> |
help:: |
165 |
> |
\t\@echo $target |
166 |
> |
endif |
167 |
> |
ENDTEXT |
168 |
> |
} |
169 |
|
} |
170 |
< |
return $self->{classname}; |
170 |
> |
close GNUmakefile; |
171 |
|
} |
172 |
|
|
173 |
|
sub ParseBuildFile_Export { |
174 |
|
my $self=shift; |
175 |
|
my $filename=shift; |
176 |
< |
my $bf=BuildSystem::BuildFile->new($self->{area}); |
176 |
> |
my $bf=BuildSystem::BuildFile->new($self->{toolbox}); |
177 |
|
if ( defined $self->{remoteproject} ) { |
178 |
|
$bf->{remoteproject}=$self->{remoteproject}; |
179 |
|
} |
249 |
|
|
250 |
|
if ( $self->{Arch} ) { |
251 |
|
if ( defined $$hashref{'type'} ) { |
252 |
< |
$self->classname($$hashref{'type'}); |
252 |
> |
$ClassName=$$hashref{'type'}; |
253 |
|
} |
254 |
|
} |
255 |
|
} |
267 |
|
} |
268 |
|
|
269 |
|
# |
337 |
– |
# --- <Build class=> tag |
338 |
– |
# |
339 |
– |
|
340 |
– |
# |
341 |
– |
# Parameter collection |
342 |
– |
# |
343 |
– |
sub BuildBlock_start { |
344 |
– |
my $self=shift; |
345 |
– |
my $name=shift; |
346 |
– |
my $hashref=shift; |
347 |
– |
|
348 |
– |
|
349 |
– |
my $blockobjid=$self->__blockobjid($hashref); |
350 |
– |
|
351 |
– |
if ( $self->{Arch} ) { |
352 |
– |
|
353 |
– |
|
354 |
– |
# -- get any objects that match |
355 |
– |
my $inheritobj=$self->{block}->getobj($blockobjid); |
356 |
– |
|
357 |
– |
# -- create an object with inherited properties |
358 |
– |
my $obj; |
359 |
– |
if ( ! defined $inheritobj ) { |
360 |
– |
# -- check we have a lookup for the class type |
361 |
– |
my $mapper=$self->_toolmapper(); |
362 |
– |
if ( ! $mapper->exists($$hashref{'class'}) ) { |
363 |
– |
$self->{switch}->parseerror("Unknown class : ". |
364 |
– |
$$hashref{'class'}); |
365 |
– |
} |
366 |
– |
$obj=BuildSystem::BuildClass->new(); |
367 |
– |
} |
368 |
– |
else { |
369 |
– |
# -- inherit the properties from class with the same id class |
370 |
– |
$obj=$inheritobj->child(); |
371 |
– |
} |
372 |
– |
|
373 |
– |
# -- add changes from our tag |
374 |
– |
$obj->paramupdate($hashref); |
375 |
– |
|
376 |
– |
# -- store the new object in the block |
377 |
– |
$self->{block}->setobj($obj,$blockobjid); |
378 |
– |
} |
379 |
– |
} |
380 |
– |
|
381 |
– |
sub BuilderClass_buildmakefile { |
382 |
– |
my $self=shift; |
383 |
– |
my $name=shift; |
384 |
– |
my $hashref=shift; |
385 |
– |
|
386 |
– |
my $blockobjid=$self->__blockobjid($hashref); |
387 |
– |
|
388 |
– |
if ( $self->{Arch} ) { |
389 |
– |
# -- get the matching block object |
390 |
– |
my $blockobj=$self->{buildblock}->getobj($blockobjid); |
391 |
– |
|
392 |
– |
# -- top level buildfile |
393 |
– |
my $fh=$self->{filehandlestack}[0]; |
394 |
– |
|
395 |
– |
# -- var initialisation |
396 |
– |
my @deftypes=(); |
397 |
– |
my $buildname=""; |
398 |
– |
my @types=$self->_toolmapper()->types($$hashref{'class'}); |
399 |
– |
|
400 |
– |
# -- error checking |
401 |
– |
if ( ! defined $blockobj->param("default") ) { |
402 |
– |
$self->error("No default build parameter defined for ". |
403 |
– |
$$hashref{'class'}." ".$$hashref{'id'}); |
404 |
– |
} |
405 |
– |
if ( ! defined $blockobj->param("name") ) { |
406 |
– |
$self->error("\"name\" parameter defined for ". |
407 |
– |
$$hashref{'class'}." ".$$hashref{'id'}); |
408 |
– |
} |
409 |
– |
|
410 |
– |
|
411 |
– |
foreach $param ( $blockobj->paramlist() ) { |
412 |
– |
# -- check for params that need special handling |
413 |
– |
if ( $param eq "default" ) { |
414 |
– |
@deftypes=split /,/, $param; |
415 |
– |
} |
416 |
– |
elsif ( $param eq "name" ) { |
417 |
– |
$buildname=$blockobj->param($param); |
418 |
– |
} |
419 |
– |
else { |
420 |
– |
# -- simple transfer of block object parameters to makefile |
421 |
– |
print $fh $param.":=".$blockobj->param($param)."\n"; |
422 |
– |
} |
423 |
– |
} |
424 |
– |
|
425 |
– |
# -- construct the targets in the top makefile |
426 |
– |
$self->_generatedefaulttargets($fh,$$hashref{'class'},@deftypes); |
427 |
– |
$self->_generatetypetargets($fh,$$hashref{'class'},$buildname,@types); |
428 |
– |
|
429 |
– |
} |
430 |
– |
} |
431 |
– |
|
432 |
– |
sub _blockobjid { |
433 |
– |
my $self=shift; |
434 |
– |
my $hashref=shift; |
435 |
– |
|
436 |
– |
$self->{switch}->checktag($name,$hashref,'class'); |
437 |
– |
$self->{switch}->checktag($name,$hashref,'id'); |
438 |
– |
my $blockobjid="bc_".$$hashref{'class'},"_".$$hashref{'id'}; |
439 |
– |
|
440 |
– |
return $blockobjid; |
441 |
– |
} |
442 |
– |
|
443 |
– |
sub _generatedefaulttargets { |
444 |
– |
my $self=shift; |
445 |
– |
my $fh=shift; |
446 |
– |
my $class=shift; |
447 |
– |
|
448 |
– |
my @deftypes=shift; |
449 |
– |
|
450 |
– |
print $fh "# -- Default type targets\n"; |
451 |
– |
foreach $dtype ( @deftypes ) { |
452 |
– |
print $fh $class."::".$class."_".$dtype."\n"; |
453 |
– |
} |
454 |
– |
print $fh "\n"; |
455 |
– |
} |
456 |
– |
|
457 |
– |
sub _generatetypetargets { |
458 |
– |
my $self=shift; |
459 |
– |
my $fh=shift; |
460 |
– |
my $class=shift; |
461 |
– |
my $name=shift; |
462 |
– |
|
463 |
– |
my @types=shift; |
464 |
– |
|
465 |
– |
print $fh "# -- Generic type targets\n"; |
466 |
– |
foreach $type ( @types ) { |
467 |
– |
my $pattern=$class."_".$type; |
468 |
– |
my $dirname=$class."_".$type."_".$name; |
469 |
– |
my $makefile=$here."/BuildFile.mk"; |
470 |
– |
|
471 |
– |
# -- map to generic name for each type |
472 |
– |
print $fh "# ------ $pattern rules ---------------\n"; |
473 |
– |
print $fh $class."_".$type."::".$class. |
474 |
– |
"_".$type."_$name\n\n"; |
475 |
– |
|
476 |
– |
print $fh "# -- Link Targets to $type directories\n"; |
477 |
– |
print $fh "$dirname: make_$dirname\n"; |
478 |
– |
print $fh "\t\@cd $here; \\\n"; |
479 |
– |
print $fh "\t\$(MAKE) LatestBuildFile=$makefile _BuildLink_=1". |
480 |
– |
" workdir=$here ". |
481 |
– |
" -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \n\n"; |
482 |
– |
|
483 |
– |
# -- write target to make makefile for each directory |
484 |
– |
print $fh "# -- Build target directories\n"; |
485 |
– |
print $fh "make_$dirname:\n"; |
486 |
– |
print $fh "\tif [ ! -e \"$makefile\" ]; then \\\n"; |
487 |
– |
print $fh "\t if [ ! -d \"$here\" ]; then \\\n"; |
488 |
– |
print $fh "\t mkdir $here; \\\n"; |
489 |
– |
print $fh "\t fi;\\\n"; |
490 |
– |
print $fh "\t cd $dirname; \\\n"; |
491 |
– |
print $fh "\t echo include ".$self->{currentenv}." > ". |
492 |
– |
"$makefile; \\\n"; |
493 |
– |
print $fh "\t echo VPATH+=$self->{localtop}/".$self->{path}. |
494 |
– |
" >> $makefile; \\\n"; |
495 |
– |
print $fh "\t echo buildname=$name >> $makefile;\\\n"; |
496 |
– |
print $fh "\t echo ".$dirname.":".$pattern." >> $makefile;\\\n"; |
497 |
– |
if ( defined (my @file=$mapper->rulesfile($class)) ) { |
498 |
– |
foreach $f ( @file ) { |
499 |
– |
print $fh "\t echo -include $f >> $makefile; \\\n"; |
500 |
– |
} |
501 |
– |
} |
502 |
– |
print $fh "\tfi\n"; |
503 |
– |
print $fh "\n"; |
504 |
– |
|
505 |
– |
# -- cleaning targets |
506 |
– |
push @targets, "clean_$dirname"; |
507 |
– |
print $fh "# -- cleaning targets\n"; |
508 |
– |
print $fh "clean::clean_$dirname\n"; |
509 |
– |
print $fh "clean_".$dirname."::\n"; |
510 |
– |
print $fh "\t\@echo cleaning $dirname\n"; |
511 |
– |
print $fh "\t\@if [ -d $here ]; then \\\n"; |
512 |
– |
print $fh "\tcd $here; \\\n"; |
513 |
– |
print $fh "\t\$(MAKE) LatestBuildFile=$makefile workdir=". |
514 |
– |
$here." _BuildLink_=1 -f ". |
515 |
– |
"\$(TOOL_HOME)/basics.mk clean; \\\n"; |
516 |
– |
print $fh "\tfi\n\n"; |
517 |
– |
|
518 |
– |
} |
519 |
– |
print $fh "\n"; |
520 |
– |
} |
521 |
– |
|
522 |
– |
# |
270 |
|
# generic build tag |
271 |
|
# |
272 |
|
sub Build_start { |
275 |
|
my $hashref=shift; |
276 |
|
|
277 |
|
$self->{switch}->checktag($name,$hashref,'class'); |
531 |
– |
$self->{switch}->checktag($name,$hashref,'id'); |
278 |
|
if ( $self->{Arch} ) { |
279 |
|
|
280 |
|
# -- determine the build products name |
301 |
|
|
302 |
|
# -- generate generic targets |
303 |
|
print $fh "ifndef _BuildLink_\n"; |
304 |
< |
$self->_generatedefaulttargets($fh,$$hashref{'class'},@deftypes); |
559 |
< |
|
304 |
> |
print $fh "# -- Generic targets\n"; |
305 |
|
push @targets, $$hashref{'class'}; |
306 |
+ |
foreach $dtype ( @deftypes ) { |
307 |
+ |
print $fh $$hashref{'class'}."::".$$hashref{'class'}."_". |
308 |
+ |
$dtype."\n"; |
309 |
+ |
} |
310 |
+ |
print $fh "\n"; |
311 |
|
|
312 |
|
# -- generate targets for each type |
313 |
|
foreach $type ( @types ) { |
322 |
|
# -- create a new directory for each type |
323 |
|
push @targets, $pattern; |
324 |
|
my $dirname=$$hashref{'class'}."_".$type."_".$name; |
325 |
< |
my $here="$self->{localtop}/$ENV{INTwork}/".$self->{path}. |
576 |
< |
"/".$dirname; |
325 |
> |
my $here="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/".$dirname; |
326 |
|
my $makefile=$here."/BuildFile.mk"; |
327 |
|
# AddDir::adddir($here); |
328 |
|
|
345 |
|
print $fh "\t cd $dirname; \\\n"; |
346 |
|
print $fh "\t echo include ".$self->{currentenv}." > ". |
347 |
|
"$makefile; \\\n"; |
348 |
< |
print $fh "\t echo VPATH+=$self->{localtop}/".$self->{path}. |
348 |
> |
print $fh "\t echo VPATH+=$ENV{LOCALTOP}/".$self->{path}. |
349 |
|
" >> $makefile; \\\n"; |
350 |
|
print $fh "\t echo buildname=$name >> $makefile;\\\n"; |
351 |
|
print $fh "\t echo ".$dirname.":".$pattern." >> $makefile;\\\n"; |
411 |
|
|
412 |
|
# Create a new directory for each binary target |
413 |
|
my $dirname="bin_".$$hashref{name}; |
414 |
< |
AddDir::adddir("$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname"); |
414 |
> |
AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname"); |
415 |
|
open (binGNUmakefile, |
416 |
< |
">$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die "Unable to make $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/". |
416 |
> |
">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/". |
417 |
|
"BuildFile.mk $!\n"; |
418 |
|
|
419 |
|
# Create the link targets |
429 |
|
ifndef BINMODE |
430 |
|
|
431 |
|
define stepdown_$$hashref{'name'} |
432 |
< |
if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
433 |
< |
cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
434 |
< |
\$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\ |
432 |
> |
if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
433 |
> |
cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
434 |
> |
\$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\ |
435 |
|
fi |
436 |
|
endef |
437 |
|
|
438 |
|
define stepdown2_$$hashref{'name'} |
439 |
< |
if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
440 |
< |
cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
441 |
< |
\$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\ |
439 |
> |
if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
440 |
> |
cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
441 |
> |
\$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\ |
442 |
|
fi |
443 |
|
|
444 |
|
endef |
462 |
|
|
463 |
|
# the binary specifics makefile |
464 |
|
print binGNUmakefile "include ".$self->{currentenv}."\n"; |
465 |
< |
print binGNUmakefile "VPATH+=".$self->{localtop}."/$self{path}\n"; |
465 |
> |
print binGNUmakefile "VPATH+=$ENV{LOCALTOP}/$self{path}\n"; |
466 |
|
|
467 |
|
# alias for bin_Insure |
468 |
|
print binGNUmakefile <<ENDTEXT; |
657 |
|
} |
658 |
|
} |
659 |
|
|
660 |
+ |
sub CheckBuildFile { |
661 |
+ |
my $self=shift; |
662 |
+ |
my $classdir=shift; |
663 |
+ |
my $ClassName=""; |
664 |
+ |
my $thisfile="$classdir/$buildfile"; |
665 |
+ |
|
666 |
+ |
if ( -e $ENV{LOCALTOP}."/".$thisfile ) { |
667 |
+ |
$DefaultBuildfile="$ENV{LOCALTOP}/$thisfile"; |
668 |
+ |
$self->ParseBuildFile($ENV{LOCALTOP}, $classdir, $buildfile); |
669 |
+ |
} |
670 |
+ |
elsif ( -e $ENV{RELEASETOP}."/".$thisfile ) { |
671 |
+ |
$DefaultBuildfile="$ENV{RELEASETOP}/$thisfile"; |
672 |
+ |
$self->ParseBuildFile($ENV{RELEASETOP}, $classdir, $buildfile); |
673 |
+ |
} |
674 |
+ |
return $ClassName; |
675 |
+ |
} |
676 |
+ |
|
677 |
|
# List association groups between <AssociateGroup> tags |
678 |
|
# seperated by newlines or spaces |
679 |
|
sub AssociateGroup { |
869 |
|
$self->{envnum}++; |
870 |
|
|
871 |
|
# open a new Environment File |
872 |
< |
my $envfile="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_". |
872 |
> |
my $envfile="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_". |
873 |
|
$self->{envnum}.".mk"; |
874 |
|
use FileHandle; |
875 |
|
my $fh=FileHandle->new(); |
879 |
|
|
880 |
|
# include the approprate environment file |
881 |
|
if ( $self->{envlevel} == 0 ) { |
882 |
< |
print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/". |
882 |
> |
print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/". |
883 |
|
$self->{path}."/BuildFile.mk\n"; |
884 |
|
} |
885 |
|
else { |
886 |
< |
print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/". |
886 |
> |
print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/". |
887 |
|
$self->{path}."/Env_".$self->{Envlevels}[$self->{envlevel}].".mk\n"; |
888 |
|
} |
889 |
|
$self->{envlevel}++; |
890 |
|
$self->{Envlevels}[$self->{envlevel}]=$self->{envnum}; |
891 |
< |
$self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk"; |
891 |
> |
$self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk"; |
892 |
|
} |
893 |
|
} |
894 |
|
|
908 |
|
close $fd; |
909 |
|
*GNUmakefile=$self->{filehandlestack}[$#{$self->{filehandlestack}}]; |
910 |
|
if ( $self->{envlevel} < 1 ) { |
911 |
< |
$self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/". |
911 |
> |
$self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/". |
912 |
|
"BuildFile.mk"; |
913 |
|
} |
914 |
|
else { |
915 |
|
$self->{currentenv}= |
916 |
< |
$self->{localtop}."/$ENV{INTwork}/$self->{path}/Env_". |
916 |
> |
"$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_". |
917 |
|
$self->{Envlevels}[$self->{envlevel}]; |
918 |
|
} |
919 |
|
} |
920 |
|
} |
921 |
|
|
922 |
|
sub Store_start { |
923 |
< |
my $self=shift; |
924 |
< |
my $name=shift; |
923 |
> |
my $self=shift; |
924 |
> |
my $name=shift; |
925 |
|
my $hashref=shift; |
926 |
|
|
927 |
< |
if ( $self->{Arch} ) { |
928 |
< |
$self->{switch}->checktag( $name, $hashref, 'name' ); |
927 |
> |
if ( $self->{Arch} ) { |
928 |
> |
$self->{switch}->checktag( $name, $hashref, 'name' ); |
929 |
|
|
930 |
< |
# -- store creation |
931 |
< |
my $dir=$$hashref{'name'}; |
932 |
< |
AddDir::adddir($self->{area}->location()."/".$dir); |
933 |
< |
if ( exists $$hashref{'type'} ) { |
934 |
< |
# -- architecture specific store |
935 |
< |
if ( $$hashref{'type'}=~/^arch/i ) { |
936 |
< |
$dir=$dir."/".$ENV{SCRAM_ARCH}; |
937 |
< |
AddDir::adddir($self->{area}->location()."/".$dir); |
938 |
< |
} |
939 |
< |
else { |
940 |
< |
$self->parseerror("Unknown type in <$name> tag"); |
941 |
< |
} |
942 |
< |
} |
943 |
< |
|
944 |
< |
# -- set make variables for the store |
945 |
< |
print GNUmakefile "SCRAMSTORENAME_".$$hashref{'name'}.":=".$dir."\n"; |
946 |
< |
print GNUmakefile "SCRAMSTORE_".$$hashref{'name'}.":=". |
947 |
< |
$self->{localtop}."/".$dir."\n"; |
948 |
< |
print GNUmakefile "VPATH+=".$self->{localtop} |
949 |
< |
."/".$dir.":".$self->{releasetop}."/".$dir."\n"; |
950 |
< |
} |
930 |
> |
# -- store creation |
931 |
> |
my $dir=$$hashref{'name'}; |
932 |
> |
AddDir::adddir($ENV{LOCALTOP}."/".$dir); |
933 |
> |
if ( exists $$hashref{'type'} ) { |
934 |
> |
# -- architecture specific store |
935 |
> |
if ( $$hashref{'type'}=~/^arch/i ) { |
936 |
> |
$dir=$dir."/".$ENV{SCRAM_ARCH}; |
937 |
> |
AddDir::adddir($ENV{LOCALTOP}."/".$dir); |
938 |
> |
} |
939 |
> |
else { |
940 |
> |
$self->parseerror("Unknown type in <$name> tag"); |
941 |
> |
} |
942 |
> |
} |
943 |
> |
|
944 |
> |
# -- set make variables for the store |
945 |
> |
print GNUmakefile "SCRAMSTORENAME_".$$hashref{'name'}.":=".$dir."\n"; |
946 |
> |
print GNUmakefile "SCRAMSTORE_".$$hashref{'name'}.":=". |
947 |
> |
$ENV{LOCALTOP}."/".$dir."\n"; |
948 |
> |
print GNUmakefile "VPATH+=".$ENV{LOCALTOP} |
949 |
> |
."/".$dir.":".$ENV{RELEASETOP}."/".$dir."\n"; |
950 |
> |
} |
951 |
|
} |
952 |
|
|
1187 |
– |
sub DropDown { |
1188 |
– |
my $self=shift; |
1189 |
– |
my $name=shift; |
1190 |
– |
my $hashref=shift; |
1191 |
– |
|
1192 |
– |
if ( $self->{Arch} ) { |
1193 |
– |
# - default values must always be specified |
1194 |
– |
$self->{switch}->checktag( $name, $hashref, 'defaults' ); |
1195 |
– |
my @blockdirs=split /,/ , $$hashref{'defaults'}; |
1196 |
– |
$self->{block}->defaultblocks(@blockdirs); |
1197 |
– |
} |
1198 |
– |
} |