ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/BuildFile.pm
(Generate patch)

Comparing COMP/SCRAM/src/BuildSystem/BuildFile.pm (file contents):
Revision 1.10 by williamc, Sat Oct 14 17:29:05 2000 UTC vs.
Revision 1.16 by sashby, Fri Apr 12 16:42:08 2002 UTC

# Line 2 | Line 2
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 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";
# Line 25 | Line 23 | sub new {
23          my $class=shift;
24          my $self={};
25          bless $self, $class;
26 <        $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();
26 >        $self->{toolbox}=shift;
27          $self->{Arch}=1;
28          push @{$self->{ARCHBLOCK}}, $self->{Arch};
29          return $self;
30   }
31  
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
32   sub ignore {
33          my $self=shift;
34 +        $self->verbose(">> ignore......<<");
35 +        
36          return (defined $self->{ignore})?$self->{ignore}:0;
37   }
38  
# Line 99 | Line 40 | sub _initswitcher {
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);
47 <        #$switch->addtag($parse,"Build", \&Build_start, $self);
47 >        $switch->addtag($parse,"Build", \&Build_start, $self);
48          $switch->addtag($parse,"none",
49                                          \&OutToMakefile,$self,
50                                          \&OutToMakefile, $self,
# Line 111 | Line 53 | sub _initswitcher {
53                                          \&Bin_start,$self,
54                                          \&OutToScreen, $self,
55                                          "", $self);
56 <        $switch->addtag($parse,"ProductStore",
57 <                                        \&Store_start,$self,
58 <                                        "", $self,
59 <                                        "", $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,
# Line 146 | Line 88 | sub _commontags {
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,
# Line 174 | Line 118 | sub _commontags {
118          return $switch;
119   }
120  
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
121   sub ParseBuildFile {
122          my $self=shift;
123          my $base=shift;
# Line 210 | Line 130 | sub ParseBuildFile {
130          else {
131           $fullfilename=$filename;
132          }
133 +
134 +        $self->verbose(">> ParseBuildFile: FN ".$fullfilename." <<");
135 +        
136          $self->{path}=$path;
214        #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";
220        $self->{currentenv}=$self->{makefile};
142          $self->{switch}=$self->_initswitcher();
143          $self->{switch}->filetoparse($fullfilename);
144  
145 < #       $self->{switch}->{Strict_no_cr}='no';
225 <        #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 <        $ENV{LatestBuildFile}=$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          }
# Line 251 | Line 194 | sub ParseBuildFile_Export {
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");
# Line 269 | Line 213 | sub _parseexport {
213                                          \&export_end_export,$self);
214          $self->_commontags($switchex,"export");
215          $switchex->allowgroup("__export","export");
272 #       $switchex->{Strict_no_cr}='no';
216          $self->{switch}=$switchex;
217          $switchex->parse("export"); # sort out supported tags
218   }
# Line 277 | Line 220 | sub _parseexport {
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};
# Line 286 | Line 231 | sub _pushremoteproject {
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          }
# Line 296 | Line 243 | sub _popremoteproject {
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  
# Line 313 | Line 262 | sub Class_StartTag {
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   }
# Line 325 | Line 276 | sub IncludePath_Start {
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()."/".
# Line 334 | Line 287 | sub IncludePath_Start {
287   }
288  
289   #
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 #
290   # generic build tag
291   #
292   sub Build_start {
# Line 527 | Line 294 | sub Build_start {
294          my $name=shift;
295          my $hashref=shift;
296  
297 +        $self->verbose(">> Build_start: NM ".$name." <<");
298 +        
299          $self->{switch}->checktag($name,$hashref,'class');
531        $self->{switch}->checktag($name,$hashref,'id');
300          if ( $self->{Arch} ) {
301  
302            # -- determine the build products name
# Line 538 | Line 306 | sub Build_start {
306            }
307            else {
308              $self->{switch}->parseerror("No name specified for build product");
541            #$name="\$(buildname)";
309            }
310  
311            # -- check we have a lookup for the class type
# Line 555 | Line 322 | sub Build_start {
322  
323             # -- generate generic targets
324             print $fh "ifndef _BuildLink_\n";
325 <           $self->_generatedefaulttargets($fh,$$hashref{'class'},@deftypes);
559 <
325 >           print $fh "# -- Generic targets\n";
326             push @targets, $$hashref{'class'};
327 +           foreach $dtype ( @deftypes ) {
328 +            print $fh $$hashref{'class'}."::".$$hashref{'class'}."_".
329 +                                                                $dtype."\n";
330 +           }
331 +           print $fh "\n";
332  
333             # -- generate targets for each type
334             foreach $type ( @types ) {
# Line 572 | Line 343 | sub Build_start {
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}.
576 <                                                                "/".$dirname;
346 >            my $here="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/".$dirname;
347              my $makefile=$here."/BuildFile.mk";
578 #           AddDir::adddir($here);
348  
349              # -- create link targets to the directory
350              push @targets, $dirname;
# Line 596 | Line 365 | sub Build_start {
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";
# Line 607 | Line 376 | sub Build_start {
376              }
377              print $fh "\tfi\n";
378              print $fh "\n";
610 #           print $typefile "$name :\n";
611 #           print $typefile "\t\$(_quietbuild_)";
612 #           print $typefile $mapper->template($$hashref{'class'},$type)."\n";
613 #           print $typefile "\t\$(_quietstamp_)";
614 #           print $typefile "\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n";
379  
380              # -- cleaning targets
381              push @targets, "clean_$dirname";
# Line 652 | Line 416 | sub Bin_start {
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} ) {
# Line 662 | Line 428 | sub Bin_start {
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
# Line 680 | Line 446 | endif
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
# Line 713 | Line 479 | ENDTEXT
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;
# Line 814 | Line 580 | sub External_StartTag {
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} ) {
# Line 867 | Line 635 | sub Group_start {
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'};
# Line 877 | Line 647 | sub Group_start {
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
# Line 916 | Line 712 | sub AssociateGroup {
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;
# Line 932 | Line 730 | sub Arch_Start {
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);
# Line 941 | Line 741 | sub Arch_Start {
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  
# Line 950 | Line 752 | sub Arch_End {
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  
# Line 957 | Line 762 | sub OutToMakefile {
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." lines <<");
770            print GNUmakefile @vars;
771          }
772   }
# Line 966 | Line 774 | sub OutToMakefile {
774   sub OutToScreen {
775          my $name=shift;
776          my @vars=@_;
777 <
777 >        
778          if ( $self->{Arch} ) {
779            print @vars;
780          }
# Line 976 | Line 784 | sub setBlockClassPath {
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});
# Line 983 | Line 793 | sub setBlockClassPath {
793  
794   sub BlockClassPath {
795          my $self=shift;
796 +
797 +        $self->verbose(">> BlockClassPath: <<");
798 +
799          return $self->{BlockClassPath};
800   }
801  
# Line 991 | Line 804 | sub export_start_export {
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  
# Line 999 | Line 814 | sub export_start {
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";
# Line 1015 | Line 832 | sub export_start {
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   }
# Line 1031 | Line 850 | sub lib_start {
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   }
# Line 1045 | Line 867 | sub LibType_Start {
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".
# Line 1078 | Line 902 | sub LibType_text {
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;
# Line 1091 | Line 916 | sub LibType_end {
916          my $self=shift;
917          my $name=shift;
918  
919 +        $self->verbose(">> LibType_end: NM ".$name." <<");
920 +
921          undef $self->{libtype_conext};
922   }
923  
# Line 1099 | Line 926 | sub Environment_start {
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();
# Line 1113 | Line 942 | sub Environment_start {
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  
# Line 1130 | Line 959 | sub Environment_end {
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 ) {
# Line 1142 | Line 973 | sub Environment_end {
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;
988 >        my $self=shift;
989 >        my $name=shift;
990          my $hashref=shift;
991  
992 <        if ( $self->{Arch} ) {
1162 <          $self->{switch}->checktag( $name, $hashref, 'name' );
1163 <
1164 <          # -- store creation
1165 <          my $dir=$$hashref{'name'};
1166 <          AddDir::adddir($self->{area}->location()."/".$dir);
1167 <          if ( exists $$hashref{'type'} ) {
1168 <            # -- architecture specific store
1169 <            if ( $$hashref{'type'}=~/^arch/i ) {
1170 <                $dir=$dir."/".$ENV{SCRAM_ARCH};
1171 <                AddDir::adddir($self->{area}->location()."/".$dir);
1172 <            }
1173 <            else {
1174 <                $self->parseerror("Unknown type in <$name> tag");
1175 <            }
1176 <          }
1177 <        
1178 <          # -- set make variables for the store
1179 <          print GNUmakefile "SCRAMSTORENAME_".$$hashref{'name'}.":=".$dir."\n";
1180 <          print GNUmakefile "SCRAMSTORE_".$$hashref{'name'}.":=".
1181 <                                        $self->{localtop}."/".$dir."\n";
1182 <          print GNUmakefile "VPATH+=".$self->{localtop}
1183 <                        ."/".$dir.":".$self->{releasetop}."/".$dir."\n";
1184 <        }
1185 < }
1186 <
1187 < sub DropDown {
1188 <        my $self=shift;
1189 <        my $name=shift;
1190 <        my $hashref=shift;
992 >        $self->verbose(">> Store_start: NM ".$name." <<");
993  
994          if ( $self->{Arch} ) {
995 <          # - default values must always be specified
996 <          $self->{switch}->checktag( $name, $hashref, 'defaults' );
997 <          my @blockdirs=split /,/ , $$hashref{'defaults'};
998 <          $self->{block}->defaultblocks(@blockdirs);
999 <        }
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines