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.17 by sashby, Tue May 14 10:21:19 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   }
274  
275 < sub IncludePath_Start {
276 <        my $self=shift;
277 <        my $name=shift;
278 <        my $hashref=shift;
279 <
280 <        $self->{switch}->checktag( $name, $hashref, 'path');
281 <        if ( $self->{Arch} ) {
282 <          print GNUmakefile "INCLUDE+=".$self->_location()."/".
283 <                                                $$hashref{'path'}."\n";
284 <        }
285 < }
286 <
287 < #
288 < # --- <Build class=> tag
289 < #
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 < }
275 > sub IncludePath_Start
276 >   {
277 >   my $self=shift;
278 >   my $name=shift;
279 >   my $hashref=shift;
280 >  
281 >   $self->verbose(">> IncludePath_Start: NM ".$name." <<");
282 >  
283 >   $self->{switch}->checktag( $name, $hashref, 'path');
284 >   if ( $self->{Arch} )
285 >      {
286 >      print GNUmakefile "INCLUDE:=\$(filter-out ".$self->_location()."/".$$hashref{'path'}.",\$(INCLUDE))","\n";
287 >      print GNUmakefile "INCLUDE+=".$self->_location()."/".$$hashref{'path'}."\n";
288 >      }
289 >   }
290  
291   #
292   # generic build tag
# Line 527 | Line 296 | sub Build_start {
296          my $name=shift;
297          my $hashref=shift;
298  
299 +        $self->verbose(">> Build_start: NM ".$name." <<");
300 +        
301          $self->{switch}->checktag($name,$hashref,'class');
531        $self->{switch}->checktag($name,$hashref,'id');
302          if ( $self->{Arch} ) {
303  
304            # -- determine the build products name
# Line 538 | Line 308 | sub Build_start {
308            }
309            else {
310              $self->{switch}->parseerror("No name specified for build product");
541            #$name="\$(buildname)";
311            }
312  
313            # -- check we have a lookup for the class type
# Line 555 | Line 324 | sub Build_start {
324  
325             # -- generate generic targets
326             print $fh "ifndef _BuildLink_\n";
327 <           $self->_generatedefaulttargets($fh,$$hashref{'class'},@deftypes);
559 <
327 >           print $fh "# -- Generic targets\n";
328             push @targets, $$hashref{'class'};
329 +           foreach $dtype ( @deftypes ) {
330 +            print $fh $$hashref{'class'}."::".$$hashref{'class'}."_".
331 +                                                                $dtype."\n";
332 +           }
333 +           print $fh "\n";
334  
335             # -- generate targets for each type
336             foreach $type ( @types ) {
# Line 572 | Line 345 | sub Build_start {
345              # -- create a new directory for each type
346              push @targets, $pattern;
347              my $dirname=$$hashref{'class'}."_".$type."_".$name;
348 <            my $here="$self->{localtop}/$ENV{INTwork}/".$self->{path}.
576 <                                                                "/".$dirname;
348 >            my $here="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/".$dirname;
349              my $makefile=$here."/BuildFile.mk";
578 #           AddDir::adddir($here);
350  
351              # -- create link targets to the directory
352              push @targets, $dirname;
# Line 596 | Line 367 | sub Build_start {
367              print $fh "\t cd $dirname; \\\n";
368              print $fh "\t echo include ".$self->{currentenv}." > ".
369                                                          "$makefile; \\\n";
370 <            print $fh "\t echo VPATH+=$self->{localtop}/".$self->{path}.
370 >            print $fh "\t echo VPATH+=$ENV{LOCALTOP}/".$self->{path}.
371                                          " >> $makefile; \\\n";
372              print $fh "\t echo buildname=$name >> $makefile;\\\n";
373              print $fh "\t echo ".$dirname.":".$pattern." >> $makefile;\\\n";
# Line 607 | Line 378 | sub Build_start {
378              }
379              print $fh "\tfi\n";
380              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";
381  
382              # -- cleaning targets
383              push @targets, "clean_$dirname";
# Line 652 | Line 418 | sub Bin_start {
418          my $tool;
419          my $filename;
420          my $objectname;
421 +
422 +        $self->verbose(">>          <<");
423          
424          $self->{switch}->checktag($name,$hashref,'file');
425          if ( $self->{Arch} ) {
# Line 662 | Line 430 | sub Bin_start {
430  
431          # Create a new directory for each binary target
432          my $dirname="bin_".$$hashref{name};
433 <        AddDir::adddir("$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname");
433 >        AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname");
434          open (binGNUmakefile,
435 <           ">$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die           "Unable to make $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/".
435 >           ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die           "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/".
436             "BuildFile.mk $!\n";
437  
438          # Create the link targets
# Line 680 | Line 448 | endif
448   ifndef BINMODE
449  
450   define stepdown_$$hashref{'name'}
451 < if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
452 < cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\
453 < \$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\
451 > if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
452 > cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\
453 > \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\
454   fi
455   endef
456  
457   define stepdown2_$$hashref{'name'}
458 < if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
459 < cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\
460 < \$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\
458 > if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
459 > cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\
460 > \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\
461   fi
462  
463   endef
# Line 713 | Line 481 | ENDTEXT
481  
482   # the binary specifics makefile
483          print binGNUmakefile "include ".$self->{currentenv}."\n";
484 <        print binGNUmakefile "VPATH+=".$self->{localtop}."/$self{path}\n";
484 >        print binGNUmakefile "VPATH+=$ENV{LOCALTOP}/$self{path}\n";
485  
486   # alias for bin_Insure
487          print binGNUmakefile <<ENDTEXT;
# Line 814 | Line 582 | sub External_StartTag {
582          my $self=shift;
583          my $name=shift;
584          my $hashref=shift;
585 +
586 +        $self->verbose(">> External_StartTag: NM ".$name." <<");
587          
588          my $tool;
589          if ( $self->{Arch} ) {
# Line 867 | Line 637 | sub Group_start {
637          my $name=shift;
638          my $hashref=shift;
639          
640 +        $self->verbose(">> Group_start: NM ".$name." <<");
641 +        
642          $self->{switch}->checktag($name, $hashref, 'name');
643          if ( $self->{Arch} ) {
644          print GNUmakefile "GROUP_".$$hashref{'name'};
# Line 877 | Line 649 | sub Group_start {
649          }
650   }      
651  
652 < sub Use_start {
653 <        my $self=shift;
654 <        my $name=shift;
655 <        my $hashref=shift;
656 <        my $filename;
657 <        use Utilities::SCRAMUtils;
658 <        
659 <        $self->{switch}->checktag($name, $hashref, "name");
660 <        if ( $self->{Arch} ) {
661 <        if ( exists $$hashref{'group'} ) {
662 <          print GNUmakefile "GROUP_".$$hashref{'group'}."=true\n";
663 <        }
664 <        if ( ! defined $self->{remoteproject} ) {
665 <          $filename=SCRAMUtils::checkfile(
666 <                "/$ENV{INTsrc}/$$hashref{name}/BuildFile");
667 <        }
668 <        else {
669 <          $filename=$self->{remoteproject}."/$$hashref{name}/BuildFile";
670 <        print "trying $filename\n";
671 <          if ( ! -f $filename ) { $filename=""; };
672 <        }
673 <        if ( $filename ne "" ) {
674 <          $self->ParseBuildFile_Export( $filename );
675 <        }
676 <        else {
677 <           $self->{switch}->parseerror("Unable to detect Appropriate ".
678 <                "decription file for <$name name=".$$hashref{name}.">");
679 <        }
680 <        }
652 > sub Use_start
653 >   {
654 >   my $self=shift;
655 >   my $name=shift;
656 >   my $hashref=shift;
657 >   my $filename;
658 >   use Utilities::SCRAMUtils;
659 >
660 >   $self->verbose(">> Use_start: NM ".$name." <<");
661 >  
662 >   $self->{switch}->checktag($name, $hashref, "name");
663 >   if ( $self->{Arch} )
664 >      {
665 >      if ( exists $$hashref{'group'} )
666 >         {
667 >         print GNUmakefile "GROUP_".$$hashref{'group'}."=true\n";
668 >         }
669 >      if ( ! defined $self->{remoteproject} )
670 >         {
671 >         $filename=SCRAMUtils::checkfile("/$ENV{INTsrc}/$$hashref{name}/BuildFile");
672 >         }
673 >      else
674 >         {
675 >         $filename=$self->{remoteproject}."/$$hashref{name}/BuildFile";
676 >         print "Trying $filename\n";
677 >         if ( ! -f $filename ) { $filename=""; };
678 >         }
679 >      if ( $filename ne "" )
680 >         {
681 >         $self->ParseBuildFile_Export( $filename );
682 >         }
683 >      else
684 >         {
685 >         $self->{switch}->parseerror("Unable to detect Appropriate ".
686 >                                     "decription file for <$name name=".$$hashref{name}.">");
687 >         }
688 >      }
689 >   }
690 >
691 > sub CheckBuildFile {
692 >         my $self=shift;
693 >         my $classdir=shift;
694 >         my $ClassName="";
695 >         my $thisfile="$classdir/$buildfile";
696 >        
697 >         if ( -e $ENV{LOCALTOP}."/".$thisfile ) {
698 >            $DefaultBuildfile="$ENV{LOCALTOP}/$thisfile";
699 >            $self->ParseBuildFile($ENV{LOCALTOP}, $classdir, $buildfile);
700 >         }
701 >         elsif ( -e $ENV{RELEASETOP}."/".$thisfile ) {
702 >            $DefaultBuildfile="$ENV{RELEASETOP}/$thisfile";
703 >            $self->ParseBuildFile($ENV{RELEASETOP}, $classdir, $buildfile);
704 >         }
705 >         $self->verbose(">> CheckBuildFile: FN ".$thisfile." CN ".$ClassName." <<");
706 >         return $ClassName;
707   }
708  
709   # List association groups between <AssociateGroup> tags
# Line 916 | Line 714 | sub AssociateGroup {
714          my $string=shift;
715          my $word;
716  
717 +        $self->verbose(">> AssociateGroup: NM ".$name." ST ".$string." <<");
718 +        
719          if ( $self->{Arch} ) {
720          foreach $word ( (split /\s/, $string) ){
721                  chomp $word;
# Line 932 | Line 732 | sub Arch_Start {
732          my $name=shift;
733          my $hashref=shift;
734  
735 +        $self->verbose(">> Arch_Start: NM ".$name." <<");
736 +        
737          $self->{switch}->checktag($name, $hashref,'name');
738          ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($self->{Arch}=1)
739                                                  : ($self->{Arch}=0);
# Line 941 | Line 743 | sub Arch_Start {
743   sub Arch_End {
744          my $self=shift;
745          my $name=shift;
746 +        
747 +        $self->verbose(">> Arch_End: NM ".$name." <<");
748  
749 <        pop @{$self->{ARCHBLOCK}};
749 >        pop @{$self->{ARCHBLOCK}};
750          $self->{Arch}=$self->{ARCHBLOCK}[$#{$self->{ARCHBLOCK}}];
751   }
752  
# Line 950 | Line 754 | sub Arch_End {
754   sub _CutBlock {
755      my $self=shift;
756      my $string= shift @_;
757 +
758 +    $self->verbose(">> _CutBlock: ST ".$string." <<");
759 +    
760      @BlockClassA = split /\//, $string;
761   }
762  
# Line 957 | Line 764 | sub OutToMakefile {
764          my $self=shift;
765          my $name=shift;
766          my @vars=@_;
767 +        
768 +        $self->verbose(">> OutToMakefile: <<");
769  
770          if ( $self->{Arch} ) {
771 +          $self->verbose(">> CONT: ".$#vars." lines <<");
772            print GNUmakefile @vars;
773          }
774   }
# Line 966 | Line 776 | sub OutToMakefile {
776   sub OutToScreen {
777          my $name=shift;
778          my @vars=@_;
779 <
779 >        
780          if ( $self->{Arch} ) {
781            print @vars;
782          }
# Line 976 | Line 786 | sub setBlockClassPath {
786          my $name=shift;
787          my $hashref=shift;
788  
789 +        $self->verbose(">> setBlockClassPath: NM ".$name." <<");
790 +        
791          $self->{switch}->checktag($name, $hashref, 'path');
792          $self->{BlockClassPath}=$self->{BlockClassPath}.":".$$hashref{path};
793          $self->_CutBlock($$hashref{path});
# Line 983 | Line 795 | sub setBlockClassPath {
795  
796   sub BlockClassPath {
797          my $self=shift;
798 +
799 +        $self->verbose(">> BlockClassPath: <<");
800 +
801          return $self->{BlockClassPath};
802   }
803  
# Line 991 | Line 806 | sub export_start_export {
806          my $name=shift;
807          my $hashref=shift;
808  
809 +        $self->verbose(">> export_start_export: NM ".$name." <<");
810 +        
811          $self->{switch}->opengroup("__export");
812   }
813  
# Line 999 | Line 816 | sub export_start {
816          my $name=shift;
817          my $hashref=shift;
818  
819 +        $self->verbose(">> export_start: NM ".$name." <<");
820 +        
821          $self->{switch}->opengroup("__export");
822          if ( exists $$hashref{autoexport} ) {
823            print GNUmakefile "scram_autoexport=".$$hashref{autoexport}."\n";
# Line 1015 | Line 834 | sub export_start {
834  
835   sub export_end_export {
836          my $self=shift;
837 +        $self->verbose(">> export_end_export: <<");
838          $self->{switch}->closegroup("__export");
839   }
840  
841   sub export_end {
842          my $self=shift;
843 +        $self->verbose(">> export_end: <<");
844          $self->{switch}->closegroup("__export");
845          print GNUmakefile "endif\n";
846   }
# Line 1027 | Line 848 | sub export_end {
848   #
849   # Standard lib tag
850   #
851 < sub lib_start {
852 <        my $self=shift;
853 <        my $name=shift;
854 <        my $hashref=shift;
855 <
856 <        $self->{switch}->checktag($name, $hashref, 'name');
857 <        if ( $self->{Arch} ) {
858 <           print GNUmakefile "lib+=$$hashref{name}\n";
859 <        }
860 < }
851 > sub lib_start
852 >   {
853 >   my $self=shift;
854 >   my $name=shift;
855 >   my $hashref=shift;
856 >  
857 >   $self->verbose(">> lib_start: NM ".$name." <<");
858 >  
859 >   $self->{switch}->checktag($name, $hashref, 'name');
860 >
861 >   if ( $self->{Arch} )
862 >      {
863 >      print GNUmakefile "lib+=$$hashref{name}\n";
864 >      }
865 >   }
866  
867   #
868   # libtype specification
# Line 1045 | Line 871 | sub LibType_Start {
871          my $self=shift;
872          my $name=shift;
873          my $hashref=shift;
874 <
874 >        
875 >        $self->verbose(">> LibType_Start: NM ".$name." <<");
876 >        
877          if ( $self->{Arch} ) {
878          if ( defined $self->{libtype_conext} ) {
879            $self->{switch}->parseerror("<$name> tag cannot be specified".
# Line 1078 | Line 906 | sub LibType_text {
906          my $self=shift;
907          my $name=shift;
908          my $string=shift;
909 +        $self->verbose(">> LibType_text: NM ".$name." <<");
910  
911 <        if ( $self->{Arch} ) {
911 >        if ( $self->{Arch} ) {
912            $string=~s/\n/ /g;
913            print GNUmakefile "libmsg::\n\t\@echo Library info: ";
914            print GNUmakefile $string;
# Line 1091 | Line 920 | sub LibType_end {
920          my $self=shift;
921          my $name=shift;
922  
923 +        $self->verbose(">> LibType_end: NM ".$name." <<");
924 +
925          undef $self->{libtype_conext};
926   }
927  
# Line 1099 | Line 930 | sub Environment_start {
930          my $name=shift;
931          my $hashref=shift;
932  
933 +        $self->verbose(">> Environment_start: NM ".$name." <<");
934 +        
935          if ( $self->{Arch} ) {
936            $self->{envnum}++;
937  
938            # open a new Environment File
939 <          my $envfile="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_".
939 >          my $envfile="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_".
940                  $self->{envnum}.".mk";
941            use FileHandle;
942            my $fh=FileHandle->new();
# Line 1113 | Line 946 | sub Environment_start {
946  
947            # include the approprate environment file
948            if ( $self->{envlevel} == 0 ) {
949 <             print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/".
949 >             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/".
950                  $self->{path}."/BuildFile.mk\n";
951            }
952            else {
953 <             print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/".
953 >             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/".
954                  $self->{path}."/Env_".$self->{Envlevels}[$self->{envlevel}].".mk\n";
955            }
956            $self->{envlevel}++;
957            $self->{Envlevels}[$self->{envlevel}]=$self->{envnum};
958 <          $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk";
958 >          $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk";
959          }
960   }
961  
# Line 1130 | Line 963 | sub Environment_end {
963          my $self=shift;
964          my $fd;
965  
966 +        $self->verbose(">> Environment_end: NM ".$name." <<");
967 +
968          if ( $self->{Arch} ) {
969            $self->{envlevel}--;
970            if ( $self->{envlevel} < 0 ) {
# Line 1142 | Line 977 | sub Environment_end {
977            close $fd;
978            *GNUmakefile=$self->{filehandlestack}[$#{$self->{filehandlestack}}];
979            if ( $self->{envlevel} < 1 ) {
980 <            $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/".
980 >            $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/".
981                          "BuildFile.mk";
982            }
983            else {
984              $self->{currentenv}=
985 <             $self->{localtop}."/$ENV{INTwork}/$self->{path}/Env_".
985 >             "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_".
986                  $self->{Envlevels}[$self->{envlevel}];
987            }
988          }
989   }
990  
991   sub Store_start {
992 <        my $self=shift;
993 <        my $name=shift;
992 >        my $self=shift;
993 >        my $name=shift;
994          my $hashref=shift;
995  
996 <        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;
996 >        $self->verbose(">> Store_start: NM ".$name." <<");
997  
998          if ( $self->{Arch} ) {
999 <          # - default values must always be specified
1000 <          $self->{switch}->checktag( $name, $hashref, 'defaults' );
1001 <          my @blockdirs=split /,/ , $$hashref{'defaults'};
1002 <          $self->{block}->defaultblocks(@blockdirs);
1003 <        }
999 >          $self->{switch}->checktag( $name, $hashref, 'name' );
1000 >
1001 >          # -- store creation
1002 >          my $dir=$$hashref{'name'};
1003 >          AddDir::adddir($ENV{LOCALTOP}."/".$dir);
1004 >          if ( exists $$hashref{'type'} ) {
1005 >            # -- architecture specific store
1006 >            if ( $$hashref{'type'}=~/^arch/i ) {
1007 >                $dir=$dir."/".$ENV{SCRAM_ARCH};
1008 >                AddDir::adddir($ENV{LOCALTOP}."/".$dir);
1009 >            }
1010 >            else {
1011 >                $self->parseerror("Unknown type in <$name> tag");
1012 >            }
1013 >          }
1014 >
1015 >          # -- set make variables for the store
1016 >          print GNUmakefile "SCRAMSTORENAME_".$$hashref{'name'}.":=".$dir."\n";
1017 >          print GNUmakefile "SCRAMSTORE_".$$hashref{'name'}.":=".
1018 >                                        $ENV{LOCALTOP}."/".$dir."\n";
1019 >          print GNUmakefile "VPATH+=".$ENV{LOCALTOP}
1020 >                        ."/".$dir.":".$ENV{RELEASETOP}."/".$dir."\n";
1021 >        }
1022   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines