2 |
|
# |
3 |
|
# Interface |
4 |
|
# --------- |
5 |
< |
# new(ConfigArea) |
5 |
> |
# new(toolbox) |
6 |
|
# ParseBuildFile($base,$path,$file) |
7 |
|
# ParseBuildFileExport(filename) |
8 |
|
# BlockClassPath() : Return the class path |
9 |
|
# ignore() : return 1 if directory should be ignored 0 otherwise |
10 |
– |
# classname() : get/set the associated class |
11 |
– |
# buildfile() : get/set BuildFile location |
12 |
– |
# makefile() : get the generated makefile |
10 |
|
|
11 |
|
package BuildSystem::BuildFile; |
12 |
+ |
use Utilities::Verbose; |
13 |
|
use ActiveDoc::SimpleDoc; |
14 |
|
use BuildSystem::ToolBox; |
15 |
|
require 5.004; |
16 |
+ |
@ISA=qw(Utilities::Verbose); |
17 |
|
|
18 |
|
BEGIN { |
19 |
|
$buildfile="BuildFile"; |
23 |
|
my $class=shift; |
24 |
|
my $self={}; |
25 |
|
bless $self, $class; |
26 |
< |
$self->{area}=shift; |
28 |
< |
$self->{toolbox}=$self->{area}->toolbox(); |
29 |
< |
$self->{localtop}=$self->{area}->location(); |
26 |
> |
$self->{toolbox}=shift; |
27 |
|
$self->{Arch}=1; |
28 |
|
push @{$self->{ARCHBLOCK}}, $self->{Arch}; |
29 |
|
return $self; |
30 |
|
} |
31 |
|
|
35 |
– |
sub buildfile { |
36 |
– |
my $self=shift; |
37 |
– |
if ( @_ ) { |
38 |
– |
$self->{buildfile}=shift; |
39 |
– |
} |
40 |
– |
return $self->{buildfile}; |
41 |
– |
} |
42 |
– |
|
43 |
– |
sub makefile { |
44 |
– |
my $self=shift; |
45 |
– |
if ( @_ ) { |
46 |
– |
$self->{makefile}=shift; |
47 |
– |
} |
48 |
– |
return $self->{makefile}; |
49 |
– |
} |
50 |
– |
|
32 |
|
sub ignore { |
33 |
|
my $self=shift; |
34 |
+ |
$self->verbose(">> ignore......<<"); |
35 |
+ |
|
36 |
|
return (defined $self->{ignore})?$self->{ignore}:0; |
37 |
|
} |
38 |
|
|
40 |
|
my $self=shift; |
41 |
|
my $switch=ActiveDoc::SimpleDoc->new(); |
42 |
|
my $parse="makebuild"; |
43 |
+ |
$self->verbose(">> _initswitcher: <<"); |
44 |
|
$switch->newparse($parse); |
45 |
|
$switch->addignoretags($parse); |
46 |
|
$self->_commontags($switch,$parse); |
53 |
|
\&Bin_start,$self, |
54 |
|
\&OutToScreen, $self, |
55 |
|
"", $self); |
56 |
+ |
$switch->addtag($parse,"ProductStore", |
57 |
+ |
\&Store_start,$self, |
58 |
+ |
"", $self, |
59 |
+ |
"", $self); |
60 |
|
$switch->addtag($parse,"LibType", |
61 |
|
\&LibType_Start,$self, |
62 |
|
\&LibType_text, $self, |
88 |
|
my $self=shift; |
89 |
|
my $switch=shift; |
90 |
|
my $parse=shift; |
91 |
< |
|
91 |
> |
|
92 |
> |
$self->verbose(">> _commontags: SW ".$switch." PARSE ".$parse." <<"); |
93 |
> |
|
94 |
|
$switch->grouptag("Export",$parse); |
95 |
|
$switch->addtag($parse,"Use",\&Use_start,$self, |
96 |
|
\&OutToMakefile, $self, |
118 |
|
return $switch; |
119 |
|
} |
120 |
|
|
131 |
– |
sub GenerateMakefile { |
132 |
– |
my $self=shift; |
133 |
– |
my $infile=shift; |
134 |
– |
my $outfile=shift; |
135 |
– |
|
136 |
– |
$self->{switch}=$self->_initswitcher(); |
137 |
– |
$self->{switch}->filetoparse($infile); |
138 |
– |
|
139 |
– |
# open a temporary gnumakefile to store output. |
140 |
– |
my $fh=FileHandle->new(); |
141 |
– |
open ( $fh, ">$outfile") or die "Unable to open $outfile for output ". |
142 |
– |
"$!\n"; |
143 |
– |
@{$self->{filehandlestack}}=($fh); |
144 |
– |
|
145 |
– |
# -- make an alias |
146 |
– |
*GNUmakefile=$fh; |
147 |
– |
if ( -e $ENV{LatestBuildFile} ) { |
148 |
– |
print GNUmakefile "include $ENV{LatestBuildFile}\n"; |
149 |
– |
} |
150 |
– |
$ENV{LatestBuildFile}=$outfile; |
151 |
– |
$self->{switch}->parse("makebuild"); # sort out supported tags |
152 |
– |
close GNUmakefile; |
153 |
– |
} |
154 |
– |
|
121 |
|
sub ParseBuildFile { |
122 |
|
my $self=shift; |
123 |
|
my $base=shift; |
130 |
|
else { |
131 |
|
$fullfilename=$filename; |
132 |
|
} |
133 |
+ |
|
134 |
+ |
$self->verbose(">> ParseBuildFile: FN ".$fullfilename." <<"); |
135 |
+ |
|
136 |
|
$self->{path}=$path; |
168 |
– |
#print "Processing $fullfilename\n"; |
137 |
|
$numbins=0; |
138 |
|
$self->{envnum}=0; |
139 |
|
$self->{envlevel}=0; |
140 |
< |
$self->{makefile}="$self->{localtop}/$ENV{INTwork}/$self->{path}/". |
140 |
> |
$self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/". |
141 |
|
"BuildFile.mk"; |
174 |
– |
$self->{currentenv}=$self->{makefile}; |
142 |
|
$self->{switch}=$self->_initswitcher(); |
143 |
|
$self->{switch}->filetoparse($fullfilename); |
144 |
|
|
145 |
< |
# $self->{switch}->{Strict_no_cr}='no'; |
179 |
< |
#open a temporary gnumakefile to store output. |
145 |
> |
# open a temporary gnumakefile to store output. |
146 |
|
use Utilities::AddDir; |
147 |
< |
AddDir::adddir("$self->{localtop}/$ENV{INTwork}/$self->{path}"); |
148 |
< |
$self->GenerateMakefile($fullfilename, |
149 |
< |
$self->{localtop}."/".$ENV{INTwork}."/".$self->{path}."/BuildFile.mk"); |
150 |
< |
} |
147 |
> |
AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}"); |
148 |
> |
my $fh=FileHandle->new(); |
149 |
> |
open ( $fh, ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk" |
150 |
> |
) or die "Unable to open /$ENV{INTwork}/".$self->{path}."/BuildFile.mk $!\n"; |
151 |
> |
@{$self->{filehandlestack}}=($fh); |
152 |
> |
# make an alias |
153 |
> |
*GNUmakefile=$fh; |
154 |
> |
if ( -e $ENV{LatestBuildFile} ) { |
155 |
> |
print GNUmakefile "include $ENV{LatestBuildFile}\n"; |
156 |
> |
} |
157 |
|
|
158 |
< |
sub classname { |
159 |
< |
my $self=shift; |
160 |
< |
if ( @_ ) { |
161 |
< |
$self->{classname}=shift; |
158 |
> |
$ENV{LatestBuildFile}="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk"; |
159 |
> |
$self->{switch}->parse("makebuild"); # sort out supported tags |
160 |
> |
if ( $numbins > 0 ) { |
161 |
> |
print GNUmakefile <<ENDTEXT; |
162 |
> |
ifndef BINMODE |
163 |
> |
help:: |
164 |
> |
\t\@echo Generic Binary targets |
165 |
> |
\t\@echo ---------------------- |
166 |
> |
endif |
167 |
> |
ENDTEXT |
168 |
> |
foreach $target ( keys %$targettypes ) { |
169 |
> |
print GNUmakefile <<ENDTEXT; |
170 |
> |
ifndef BINMODE |
171 |
> |
help:: |
172 |
> |
\t\@echo $target |
173 |
> |
endif |
174 |
> |
ENDTEXT |
175 |
> |
} |
176 |
|
} |
177 |
< |
return $self->{classname}; |
177 |
> |
close GNUmakefile; |
178 |
|
} |
179 |
|
|
180 |
|
sub ParseBuildFile_Export { |
181 |
|
my $self=shift; |
182 |
|
my $filename=shift; |
183 |
< |
my $bf=BuildSystem::BuildFile->new($self->{area}); |
183 |
> |
|
184 |
> |
$self->verbose(">> ParseBuildFile_Export: FN ".$filename." <<"); |
185 |
> |
|
186 |
> |
my $bf=BuildSystem::BuildFile->new($self->{toolbox}); |
187 |
|
if ( defined $self->{remoteproject} ) { |
188 |
|
$bf->{remoteproject}=$self->{remoteproject}; |
189 |
|
} |
194 |
|
sub _location { |
195 |
|
my $self=shift; |
196 |
|
use File::Basename; |
197 |
< |
|
197 |
> |
$self->verbose(">> _location: <<"); |
198 |
|
return dirname($self->{switch}->filetoparse()); |
199 |
|
} |
200 |
|
|
201 |
|
sub _parseexport { |
202 |
|
my $self=shift; |
203 |
|
my $filename=shift; |
204 |
< |
|
204 |
> |
$self->verbose(">> _parseexport: FN ".$filename." <<"); |
205 |
> |
|
206 |
|
my $switchex=ActiveDoc::SimpleDoc->new(); |
207 |
|
$switchex->filetoparse($filename); |
208 |
|
$switchex->newparse("export"); |
213 |
|
\&export_end_export,$self); |
214 |
|
$self->_commontags($switchex,"export"); |
215 |
|
$switchex->allowgroup("__export","export"); |
226 |
– |
# $switchex->{Strict_no_cr}='no'; |
216 |
|
$self->{switch}=$switchex; |
217 |
|
$switchex->parse("export"); # sort out supported tags |
218 |
|
} |
220 |
|
sub _pushremoteproject { |
221 |
|
my $self=shift; |
222 |
|
my $path=shift; |
223 |
+ |
|
224 |
+ |
$self->verbose(">> _pushremoteproject: PATH ".$path." <<"); |
225 |
|
|
226 |
|
if ( defined $self->{remoteproject} ) { |
227 |
|
push @{$self->{rpstack}}, $self->{remoteproject}; |
231 |
|
|
232 |
|
sub _popremoteproject { |
233 |
|
my $self=shift; |
234 |
+ |
$self->verbose(">> _popremoteproject: <<"); |
235 |
+ |
|
236 |
|
if ( $#{$self->{rpstack}} >=0 ) { |
237 |
|
$self->{remoteproject}=pop @{$self->{rpstack}}; |
238 |
|
} |
243 |
|
|
244 |
|
sub _toolmapper { |
245 |
|
my $self=shift; |
246 |
+ |
|
247 |
|
if ( ! defined $self->{mapper} ) { |
248 |
|
require BuildSystem::ToolMapper; |
249 |
|
$self->{mapper}=BuildSystem::ToolMapper->new(); |
250 |
|
} |
251 |
+ |
$self->verbose(">> _toolmapper: TM ".$self->{mapper}."<<"); |
252 |
|
return $self->{mapper}; |
253 |
|
} |
254 |
|
|
262 |
|
my $self=shift; |
263 |
|
my $name=shift; |
264 |
|
my $hashref=shift; |
265 |
+ |
|
266 |
+ |
$self->verbose(">> Classs_StartTag: NM ".$name." <<"); |
267 |
|
|
268 |
|
if ( $self->{Arch} ) { |
269 |
|
if ( defined $$hashref{'type'} ) { |
270 |
< |
$self->classname($$hashref{'type'}); |
270 |
> |
$ClassName=$$hashref{'type'}; |
271 |
|
} |
272 |
|
} |
273 |
|
} |
276 |
|
my $self=shift; |
277 |
|
my $name=shift; |
278 |
|
my $hashref=shift; |
279 |
< |
|
279 |
> |
|
280 |
> |
$self->verbose(">> IncludePath_Start: NM ".$name." <<"); |
281 |
> |
|
282 |
|
$self->{switch}->checktag( $name, $hashref, 'path'); |
283 |
|
if ( $self->{Arch} ) { |
284 |
|
print GNUmakefile "INCLUDE+=".$self->_location()."/". |
294 |
|
my $name=shift; |
295 |
|
my $hashref=shift; |
296 |
|
|
297 |
+ |
$self->verbose(">> Build_start: NM ".$name." <<"); |
298 |
+ |
|
299 |
|
$self->{switch}->checktag($name,$hashref,'class'); |
300 |
|
if ( $self->{Arch} ) { |
301 |
|
|
306 |
|
} |
307 |
|
else { |
308 |
|
$self->{switch}->parseerror("No name specified for build product"); |
308 |
– |
#$name="\$(buildname)"; |
309 |
|
} |
310 |
|
|
311 |
|
# -- check we have a lookup for the class type |
343 |
|
# -- create a new directory for each type |
344 |
|
push @targets, $pattern; |
345 |
|
my $dirname=$$hashref{'class'}."_".$type."_".$name; |
346 |
< |
my $here="$self->{localtop}/$ENV{INTwork}/".$self->{path}."/".$dirname; |
346 |
> |
my $here="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/".$dirname; |
347 |
|
my $makefile=$here."/BuildFile.mk"; |
348 |
– |
# AddDir::adddir($here); |
348 |
|
|
349 |
|
# -- create link targets to the directory |
350 |
|
push @targets, $dirname; |
365 |
|
print $fh "\t cd $dirname; \\\n"; |
366 |
|
print $fh "\t echo include ".$self->{currentenv}." > ". |
367 |
|
"$makefile; \\\n"; |
368 |
< |
print $fh "\t echo VPATH+=$self->{localtop}/".$self->{path}. |
368 |
> |
print $fh "\t echo VPATH+=$ENV{LOCALTOP}/".$self->{path}. |
369 |
|
" >> $makefile; \\\n"; |
370 |
|
print $fh "\t echo buildname=$name >> $makefile;\\\n"; |
371 |
|
print $fh "\t echo ".$dirname.":".$pattern." >> $makefile;\\\n"; |
376 |
|
} |
377 |
|
print $fh "\tfi\n"; |
378 |
|
print $fh "\n"; |
380 |
– |
# print $typefile "$name :\n"; |
381 |
– |
# print $typefile "\t\$(_quietbuild_)"; |
382 |
– |
# print $typefile $mapper->template($$hashref{'class'},$type)."\n"; |
383 |
– |
# print $typefile "\t\$(_quietstamp_)"; |
384 |
– |
# print $typefile "\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n"; |
379 |
|
|
380 |
|
# -- cleaning targets |
381 |
|
push @targets, "clean_$dirname"; |
416 |
|
my $tool; |
417 |
|
my $filename; |
418 |
|
my $objectname; |
419 |
+ |
|
420 |
+ |
$self->verbose(">> <<"); |
421 |
|
|
422 |
|
$self->{switch}->checktag($name,$hashref,'file'); |
423 |
|
if ( $self->{Arch} ) { |
428 |
|
|
429 |
|
# Create a new directory for each binary target |
430 |
|
my $dirname="bin_".$$hashref{name}; |
431 |
< |
AddDir::adddir("$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname"); |
431 |
> |
AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname"); |
432 |
|
open (binGNUmakefile, |
433 |
< |
">$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die "Unable to make $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/". |
433 |
> |
">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/". |
434 |
|
"BuildFile.mk $!\n"; |
435 |
|
|
436 |
|
# Create the link targets |
446 |
|
ifndef BINMODE |
447 |
|
|
448 |
|
define stepdown_$$hashref{'name'} |
449 |
< |
if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
450 |
< |
cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
451 |
< |
\$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\ |
449 |
> |
if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
450 |
> |
cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
451 |
> |
\$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\ |
452 |
|
fi |
453 |
|
endef |
454 |
|
|
455 |
|
define stepdown2_$$hashref{'name'} |
456 |
< |
if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
457 |
< |
cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
458 |
< |
\$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\ |
456 |
> |
if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
457 |
> |
cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
458 |
> |
\$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\ |
459 |
|
fi |
460 |
|
|
461 |
|
endef |
479 |
|
|
480 |
|
# the binary specifics makefile |
481 |
|
print binGNUmakefile "include ".$self->{currentenv}."\n"; |
482 |
< |
print binGNUmakefile "VPATH+=$self->{localtop}/$self{path}\n"; |
482 |
> |
print binGNUmakefile "VPATH+=$ENV{LOCALTOP}/$self{path}\n"; |
483 |
|
|
484 |
|
# alias for bin_Insure |
485 |
|
print binGNUmakefile <<ENDTEXT; |
580 |
|
my $self=shift; |
581 |
|
my $name=shift; |
582 |
|
my $hashref=shift; |
583 |
+ |
|
584 |
+ |
$self->verbose(">> External_StartTag: NM ".$name." <<"); |
585 |
|
|
586 |
|
my $tool; |
587 |
|
if ( $self->{Arch} ) { |
635 |
|
my $name=shift; |
636 |
|
my $hashref=shift; |
637 |
|
|
638 |
+ |
$self->verbose(">> Group_start: NM ".$name." <<"); |
639 |
+ |
|
640 |
|
$self->{switch}->checktag($name, $hashref, 'name'); |
641 |
|
if ( $self->{Arch} ) { |
642 |
|
print GNUmakefile "GROUP_".$$hashref{'name'}; |
647 |
|
} |
648 |
|
} |
649 |
|
|
650 |
< |
sub Use_start { |
651 |
< |
my $self=shift; |
652 |
< |
my $name=shift; |
653 |
< |
my $hashref=shift; |
654 |
< |
my $filename; |
655 |
< |
use Utilities::SCRAMUtils; |
656 |
< |
|
657 |
< |
$self->{switch}->checktag($name, $hashref, "name"); |
658 |
< |
if ( $self->{Arch} ) { |
659 |
< |
if ( exists $$hashref{'group'} ) { |
660 |
< |
print GNUmakefile "GROUP_".$$hashref{'group'}."=true\n"; |
661 |
< |
} |
662 |
< |
if ( ! defined $self->{remoteproject} ) { |
663 |
< |
$filename=SCRAMUtils::checkfile( |
664 |
< |
"/$ENV{INTsrc}/$$hashref{name}/BuildFile"); |
665 |
< |
} |
666 |
< |
else { |
667 |
< |
$filename=$self->{remoteproject}."/$$hashref{name}/BuildFile"; |
668 |
< |
print "trying $filename\n"; |
669 |
< |
if ( ! -f $filename ) { $filename=""; }; |
670 |
< |
} |
671 |
< |
if ( $filename ne "" ) { |
672 |
< |
$self->ParseBuildFile_Export( $filename ); |
673 |
< |
} |
674 |
< |
else { |
675 |
< |
$self->{switch}->parseerror("Unable to detect Appropriate ". |
676 |
< |
"decription file for <$name name=".$$hashref{name}.">"); |
677 |
< |
} |
678 |
< |
} |
650 |
> |
sub Use_start |
651 |
> |
{ |
652 |
> |
my $self=shift; |
653 |
> |
my $name=shift; |
654 |
> |
my $hashref=shift; |
655 |
> |
my $filename; |
656 |
> |
use Utilities::SCRAMUtils; |
657 |
> |
|
658 |
> |
$self->verbose(">> Use_start: NM ".$name." <<"); |
659 |
> |
|
660 |
> |
$self->{switch}->checktag($name, $hashref, "name"); |
661 |
> |
if ( $self->{Arch} ) |
662 |
> |
{ |
663 |
> |
if ( exists $$hashref{'group'} ) |
664 |
> |
{ |
665 |
> |
print GNUmakefile "GROUP_".$$hashref{'group'}."=true\n"; |
666 |
> |
} |
667 |
> |
if ( ! defined $self->{remoteproject} ) |
668 |
> |
{ |
669 |
> |
$filename=SCRAMUtils::checkfile("/$ENV{INTsrc}/$$hashref{name}/BuildFile"); |
670 |
> |
} |
671 |
> |
else |
672 |
> |
{ |
673 |
> |
$filename=$self->{remoteproject}."/$$hashref{name}/BuildFile"; |
674 |
> |
print "Trying $filename\n"; |
675 |
> |
if ( ! -f $filename ) { $filename=""; }; |
676 |
> |
} |
677 |
> |
if ( $filename ne "" ) |
678 |
> |
{ |
679 |
> |
$self->ParseBuildFile_Export( $filename ); |
680 |
> |
} |
681 |
> |
else |
682 |
> |
{ |
683 |
> |
$self->{switch}->parseerror("Unable to detect Appropriate ". |
684 |
> |
"decription file for <$name name=".$$hashref{name}.">"); |
685 |
> |
} |
686 |
> |
} |
687 |
> |
} |
688 |
> |
|
689 |
> |
sub CheckBuildFile { |
690 |
> |
my $self=shift; |
691 |
> |
my $classdir=shift; |
692 |
> |
my $ClassName=""; |
693 |
> |
my $thisfile="$classdir/$buildfile"; |
694 |
> |
|
695 |
> |
if ( -e $ENV{LOCALTOP}."/".$thisfile ) { |
696 |
> |
$DefaultBuildfile="$ENV{LOCALTOP}/$thisfile"; |
697 |
> |
$self->ParseBuildFile($ENV{LOCALTOP}, $classdir, $buildfile); |
698 |
> |
} |
699 |
> |
elsif ( -e $ENV{RELEASETOP}."/".$thisfile ) { |
700 |
> |
$DefaultBuildfile="$ENV{RELEASETOP}/$thisfile"; |
701 |
> |
$self->ParseBuildFile($ENV{RELEASETOP}, $classdir, $buildfile); |
702 |
> |
} |
703 |
> |
$self->verbose(">> CheckBuildFile: FN ".$thisfile." CN ".$ClassName." <<"); |
704 |
> |
return $ClassName; |
705 |
|
} |
706 |
|
|
707 |
|
# List association groups between <AssociateGroup> tags |
712 |
|
my $string=shift; |
713 |
|
my $word; |
714 |
|
|
715 |
+ |
$self->verbose(">> AssociateGroup: NM ".$name." ST ".$string." <<"); |
716 |
+ |
|
717 |
|
if ( $self->{Arch} ) { |
718 |
|
foreach $word ( (split /\s/, $string) ){ |
719 |
|
chomp $word; |
730 |
|
my $name=shift; |
731 |
|
my $hashref=shift; |
732 |
|
|
733 |
+ |
$self->verbose(">> Arch_Start: NM ".$name." <<"); |
734 |
+ |
|
735 |
|
$self->{switch}->checktag($name, $hashref,'name'); |
736 |
|
( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($self->{Arch}=1) |
737 |
|
: ($self->{Arch}=0); |
741 |
|
sub Arch_End { |
742 |
|
my $self=shift; |
743 |
|
my $name=shift; |
744 |
+ |
|
745 |
+ |
$self->verbose(">> Arch_End: NM ".$name." <<"); |
746 |
|
|
747 |
< |
pop @{$self->{ARCHBLOCK}}; |
747 |
> |
pop @{$self->{ARCHBLOCK}}; |
748 |
|
$self->{Arch}=$self->{ARCHBLOCK}[$#{$self->{ARCHBLOCK}}]; |
749 |
|
} |
750 |
|
|
752 |
|
sub _CutBlock { |
753 |
|
my $self=shift; |
754 |
|
my $string= shift @_; |
755 |
+ |
|
756 |
+ |
$self->verbose(">> _CutBlock: ST ".$string." <<"); |
757 |
+ |
|
758 |
|
@BlockClassA = split /\//, $string; |
759 |
|
} |
760 |
|
|
762 |
|
my $self=shift; |
763 |
|
my $name=shift; |
764 |
|
my @vars=@_; |
765 |
+ |
|
766 |
+ |
$self->verbose(">> OutToMakefile: <<"); |
767 |
|
|
768 |
|
if ( $self->{Arch} ) { |
769 |
+ |
$self->verbose(">> CONT: ".$vars[0]." <<"); |
770 |
|
print GNUmakefile @vars; |
771 |
|
} |
772 |
|
} |
774 |
|
sub OutToScreen { |
775 |
|
my $name=shift; |
776 |
|
my @vars=@_; |
777 |
< |
|
777 |
> |
|
778 |
|
if ( $self->{Arch} ) { |
779 |
|
print @vars; |
780 |
|
} |
784 |
|
my $name=shift; |
785 |
|
my $hashref=shift; |
786 |
|
|
787 |
+ |
$self->verbose(">> setBlockClassPath: NM ".$name." <<"); |
788 |
+ |
|
789 |
|
$self->{switch}->checktag($name, $hashref, 'path'); |
790 |
|
$self->{BlockClassPath}=$self->{BlockClassPath}.":".$$hashref{path}; |
791 |
|
$self->_CutBlock($$hashref{path}); |
793 |
|
|
794 |
|
sub BlockClassPath { |
795 |
|
my $self=shift; |
796 |
+ |
|
797 |
+ |
$self->verbose(">> BlockClassPath: <<"); |
798 |
+ |
|
799 |
|
return $self->{BlockClassPath}; |
800 |
|
} |
801 |
|
|
804 |
|
my $name=shift; |
805 |
|
my $hashref=shift; |
806 |
|
|
807 |
+ |
$self->verbose(">> export_start_export: NM ".$name." <<"); |
808 |
+ |
|
809 |
|
$self->{switch}->opengroup("__export"); |
810 |
|
} |
811 |
|
|
814 |
|
my $name=shift; |
815 |
|
my $hashref=shift; |
816 |
|
|
817 |
+ |
$self->verbose(">> export_start: NM ".$name." <<"); |
818 |
+ |
|
819 |
|
$self->{switch}->opengroup("__export"); |
820 |
|
if ( exists $$hashref{autoexport} ) { |
821 |
|
print GNUmakefile "scram_autoexport=".$$hashref{autoexport}."\n"; |
832 |
|
|
833 |
|
sub export_end_export { |
834 |
|
my $self=shift; |
835 |
+ |
$self->verbose(">> export_end_export: <<"); |
836 |
|
$self->{switch}->closegroup("__export"); |
837 |
|
} |
838 |
|
|
839 |
|
sub export_end { |
840 |
|
my $self=shift; |
841 |
+ |
$self->verbose(">> export_end: <<"); |
842 |
|
$self->{switch}->closegroup("__export"); |
843 |
|
print GNUmakefile "endif\n"; |
844 |
|
} |
850 |
|
my $self=shift; |
851 |
|
my $name=shift; |
852 |
|
my $hashref=shift; |
853 |
+ |
|
854 |
+ |
$self->verbose(">> lib_start: NM ".$name." <<"); |
855 |
|
|
856 |
< |
$self->{switch}->checktag($name, $hashref, 'name'); |
857 |
< |
if ( $self->{Arch} ) { |
856 |
> |
$self->{switch}->checktag($name, $hashref, 'name'); |
857 |
> |
|
858 |
> |
if ( $self->{Arch} ) { |
859 |
|
print GNUmakefile "lib+=$$hashref{name}\n"; |
860 |
|
} |
861 |
|
} |
867 |
|
my $self=shift; |
868 |
|
my $name=shift; |
869 |
|
my $hashref=shift; |
870 |
< |
|
870 |
> |
|
871 |
> |
$self->verbose(">> LibType_Start: NM ".$name." <<"); |
872 |
> |
|
873 |
|
if ( $self->{Arch} ) { |
874 |
|
if ( defined $self->{libtype_conext} ) { |
875 |
|
$self->{switch}->parseerror("<$name> tag cannot be specified". |
902 |
|
my $self=shift; |
903 |
|
my $name=shift; |
904 |
|
my $string=shift; |
905 |
+ |
$self->verbose(">> LibType_text: NM ".$name." <<"); |
906 |
|
|
907 |
< |
if ( $self->{Arch} ) { |
907 |
> |
if ( $self->{Arch} ) { |
908 |
|
$string=~s/\n/ /g; |
909 |
|
print GNUmakefile "libmsg::\n\t\@echo Library info: "; |
910 |
|
print GNUmakefile $string; |
916 |
|
my $self=shift; |
917 |
|
my $name=shift; |
918 |
|
|
919 |
+ |
$self->verbose(">> LibType_end: NM ".$name." <<"); |
920 |
+ |
|
921 |
|
undef $self->{libtype_conext}; |
922 |
|
} |
923 |
|
|
926 |
|
my $name=shift; |
927 |
|
my $hashref=shift; |
928 |
|
|
929 |
+ |
$self->verbose(">> Environment_start: NM ".$name." <<"); |
930 |
+ |
|
931 |
|
if ( $self->{Arch} ) { |
932 |
|
$self->{envnum}++; |
933 |
|
|
934 |
|
# open a new Environment File |
935 |
< |
my $envfile="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_". |
935 |
> |
my $envfile="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_". |
936 |
|
$self->{envnum}.".mk"; |
937 |
|
use FileHandle; |
938 |
|
my $fh=FileHandle->new(); |
942 |
|
|
943 |
|
# include the approprate environment file |
944 |
|
if ( $self->{envlevel} == 0 ) { |
945 |
< |
print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/". |
945 |
> |
print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/". |
946 |
|
$self->{path}."/BuildFile.mk\n"; |
947 |
|
} |
948 |
|
else { |
949 |
< |
print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/". |
949 |
> |
print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/". |
950 |
|
$self->{path}."/Env_".$self->{Envlevels}[$self->{envlevel}].".mk\n"; |
951 |
|
} |
952 |
|
$self->{envlevel}++; |
953 |
|
$self->{Envlevels}[$self->{envlevel}]=$self->{envnum}; |
954 |
< |
$self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk"; |
954 |
> |
$self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk"; |
955 |
|
} |
956 |
|
} |
957 |
|
|
959 |
|
my $self=shift; |
960 |
|
my $fd; |
961 |
|
|
962 |
+ |
$self->verbose(">> Environment_end: NM ".$name." <<"); |
963 |
+ |
|
964 |
|
if ( $self->{Arch} ) { |
965 |
|
$self->{envlevel}--; |
966 |
|
if ( $self->{envlevel} < 0 ) { |
973 |
|
close $fd; |
974 |
|
*GNUmakefile=$self->{filehandlestack}[$#{$self->{filehandlestack}}]; |
975 |
|
if ( $self->{envlevel} < 1 ) { |
976 |
< |
$self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/". |
976 |
> |
$self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/". |
977 |
|
"BuildFile.mk"; |
978 |
|
} |
979 |
|
else { |
980 |
|
$self->{currentenv}= |
981 |
< |
$self->{localtop}."/$ENV{INTwork}/$self->{path}/Env_". |
981 |
> |
"$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_". |
982 |
|
$self->{Envlevels}[$self->{envlevel}]; |
983 |
|
} |
984 |
|
} |
985 |
|
} |
986 |
+ |
|
987 |
+ |
sub Store_start { |
988 |
+ |
my $self=shift; |
989 |
+ |
my $name=shift; |
990 |
+ |
my $hashref=shift; |
991 |
+ |
|
992 |
+ |
$self->verbose(">> Store_start: NM ".$name." <<"); |
993 |
+ |
|
994 |
+ |
if ( $self->{Arch} ) { |
995 |
+ |
$self->{switch}->checktag( $name, $hashref, 'name' ); |
996 |
+ |
|
997 |
+ |
# -- store creation |
998 |
+ |
my $dir=$$hashref{'name'}; |
999 |
+ |
AddDir::adddir($ENV{LOCALTOP}."/".$dir); |
1000 |
+ |
if ( exists $$hashref{'type'} ) { |
1001 |
+ |
# -- architecture specific store |
1002 |
+ |
if ( $$hashref{'type'}=~/^arch/i ) { |
1003 |
+ |
$dir=$dir."/".$ENV{SCRAM_ARCH}; |
1004 |
+ |
AddDir::adddir($ENV{LOCALTOP}."/".$dir); |
1005 |
+ |
} |
1006 |
+ |
else { |
1007 |
+ |
$self->parseerror("Unknown type in <$name> tag"); |
1008 |
+ |
} |
1009 |
+ |
} |
1010 |
+ |
|
1011 |
+ |
# -- set make variables for the store |
1012 |
+ |
print GNUmakefile "SCRAMSTORENAME_".$$hashref{'name'}.":=".$dir."\n"; |
1013 |
+ |
print GNUmakefile "SCRAMSTORE_".$$hashref{'name'}.":=". |
1014 |
+ |
$ENV{LOCALTOP}."/".$dir."\n"; |
1015 |
+ |
print GNUmakefile "VPATH+=".$ENV{LOCALTOP} |
1016 |
+ |
."/".$dir.":".$ENV{RELEASETOP}."/".$dir."\n"; |
1017 |
+ |
} |
1018 |
+ |
} |