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.20 by sashby, Thu Jul 18 13:49:01 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,
56 >        $switch->addtag($parse,"Module",
57 >                                        \&Module_start,$self,
58 >                                        \&OutToScreen, $self,
59                                          "", $self);
60 +
61 +        $switch->addtag($parse,"ProductStore",
62 +                                        \&Store_start,$self,
63 +                                        "", $self,
64 +                                        "", $self);
65          $switch->addtag($parse,"LibType",
66                                          \&LibType_Start,$self,
67                                          \&LibType_text, $self,
# Line 142 | Line 89 | sub _initswitcher {
89          return $switch;
90   }
91  
92 < sub _commontags {
93 <        my $self=shift;
94 <        my $switch=shift;
95 <        my $parse=shift;
96 <
97 <        $switch->grouptag("Export",$parse);
98 <        $switch->addtag($parse,"Use",\&Use_start,$self,
99 <                                               \&OutToMakefile, $self,
100 <                                                "", $self);
101 <        $switch->addtag($parse,"Group",\&Group_start,$self,
102 <                                               \&OutToMakefile, $self,
103 <                                                "", $self);
104 <        $switch->grouptag("Group",$parse);
105 <        $switch->addtag($parse,"External",
106 <                                        \&External_StartTag,$self,
107 <                                        \&OutToMakefile, $self,
108 <                                        "", $self);
109 <        $switch->addtag($parse,"lib",
110 <                                        \&lib_start,$self,
111 <                                        \&OutToMakefile, $self,
112 <                                        "", $self);
113 <        $switch->addtag($parse,"Architecture",
114 <                                        \&Arch_Start,$self,
115 <                                        \&OutToMakefile, $self,
116 <                                        \&Arch_End,$self);
117 <        $switch->addtag($parse,"INCLUDE_PATH",
118 <                                        \&IncludePath_Start,$self,
119 <                                        \&OutToMakefile, $self,
120 <                                        "",$self);
121 <        return $switch;
122 < }
123 <
124 < sub GenerateMakefile {
125 <        my $self=shift;
126 <        my $infile=shift;
127 <        my $outfile=shift;
128 <
129 <        $self->{switch}=$self->_initswitcher();
130 <        $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 < }
92 > sub _commontags
93 >   {
94 >   my $self=shift;
95 >   my $switch=shift;
96 >   my $parse=shift;
97 >  
98 >   $self->verbose(">> _commontags: SW ".$switch." PARSE ".$parse." <<");
99 >  
100 >   $switch->grouptag("Export",$parse);
101 >   $switch->addtag($parse,"Use",
102 >                   \&Use_start,$self,
103 >                   \&OutToMakefile, $self,
104 >                   "", $self);
105 >   $switch->addtag($parse,"Group",
106 >                   \&Group_start,$self,
107 >                   \&OutToMakefile, $self,
108 >                   "", $self);
109 >   $switch->grouptag("Group",$parse);
110 >   $switch->addtag($parse,"External",
111 >                   \&External_StartTag,$self,
112 >                   \&OutToMakefile, $self,
113 >                   "", $self);
114 >   $switch->addtag($parse,"lib",
115 >                   \&lib_start,$self,
116 >                   \&OutToMakefile, $self,"", $self);
117 >   $switch->addtag($parse,"debuglib",
118 >                   \&debuglib_start,$self,
119 >                   \&OutToMakefile, $self,
120 >                   "", $self);
121 >   $switch->addtag($parse,"Architecture",
122 >                   \&Arch_Start,$self,
123 >                   \&OutToMakefile, $self,
124 >                   \&Arch_End,$self);
125 >   $switch->addtag($parse,"INCLUDE_PATH",
126 >                   \&IncludePath_Start,$self,
127 >                   \&OutToMakefile, $self,
128 >                   "",$self);
129 >   return $switch;
130 >   }
131  
132   sub ParseBuildFile {
133          my $self=shift;
# Line 210 | Line 141 | sub ParseBuildFile {
141          else {
142           $fullfilename=$filename;
143          }
144 +
145 +        $self->verbose(">> ParseBuildFile: FN ".$fullfilename." <<");
146 +        
147          $self->{path}=$path;
214        #print "Processing $fullfilename\n";
148          $numbins=0;
149          $self->{envnum}=0;
150          $self->{envlevel}=0;
151 <        $self->{makefile}="$self->{localtop}/$ENV{INTwork}/$self->{path}/".
151 >        $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/".
152                                                                  "BuildFile.mk";
220        $self->{currentenv}=$self->{makefile};
153          $self->{switch}=$self->_initswitcher();
154          $self->{switch}->filetoparse($fullfilename);
155  
156 < #       $self->{switch}->{Strict_no_cr}='no';
225 <        #open a temporary gnumakefile to store output.
156 >        # open a temporary gnumakefile to store output.
157          use Utilities::AddDir;
158 <        AddDir::adddir("$self->{localtop}/$ENV{INTwork}/$self->{path}");
159 <        $ENV{LatestBuildFile}=$self->GenerateMakefile($fullfilename,
160 <         $self->{localtop}."/".$ENV{INTwork}."/".$self->{path}."/BuildFile.mk");
161 < }
158 >        AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}");
159 >        my $fh=FileHandle->new();
160 >        open ( $fh, ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk"
161 >          ) or die "Unable to open /$ENV{INTwork}/".$self->{path}."/BuildFile.mk $!\n";
162 >        @{$self->{filehandlestack}}=($fh);
163 >        # make an alias
164 >        *GNUmakefile=$fh;
165 >        if ( -e $ENV{LatestBuildFile} ) {
166 >          print GNUmakefile "include $ENV{LatestBuildFile}\n";
167 >        }
168  
169 < sub classname {
170 <        my $self=shift;
171 <        if ( @_ ) {
172 <          $self->{classname}=shift;
169 >        $ENV{LatestBuildFile}="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk";
170 >        $self->{switch}->parse("makebuild"); # sort out supported tags
171 >        if ( $numbins > 0 ) {
172 >         print GNUmakefile <<ENDTEXT;
173 > ifndef BINMODE
174 > help::
175 > \t\@echo Generic Binary targets
176 > \t\@echo ----------------------
177 > endif
178 > ENDTEXT
179 >         foreach $target ( keys %$targettypes ) {
180 >         print GNUmakefile <<ENDTEXT;
181 > ifndef BINMODE
182 > help::
183 > \t\@echo $target
184 > endif
185 > ENDTEXT
186 >         }
187          }
188 <        return $self->{classname};
188 >        close GNUmakefile;
189   }
190  
191   sub ParseBuildFile_Export {
192          my $self=shift;
193          my $filename=shift;
194 <        my $bf=BuildSystem::BuildFile->new($self->{area});
194 >
195 >        $self->verbose(">> ParseBuildFile_Export: FN ".$filename." <<");
196 >        
197 >        my $bf=BuildSystem::BuildFile->new($self->{toolbox});
198          if ( defined $self->{remoteproject} ) {
199             $bf->{remoteproject}=$self->{remoteproject};
200          }
# Line 251 | Line 205 | sub ParseBuildFile_Export {
205   sub _location {
206          my $self=shift;
207          use File::Basename;
208 <
208 >        $self->verbose(">> _location: <<");
209          return dirname($self->{switch}->filetoparse());
210   }
211  
212   sub _parseexport {
213          my $self=shift;
214          my $filename=shift;
215 <
215 >        $self->verbose(">> _parseexport: FN ".$filename." <<");
216 >        
217          my $switchex=ActiveDoc::SimpleDoc->new();
218          $switchex->filetoparse($filename);
219          $switchex->newparse("export");
# Line 269 | Line 224 | sub _parseexport {
224                                          \&export_end_export,$self);
225          $self->_commontags($switchex,"export");
226          $switchex->allowgroup("__export","export");
272 #       $switchex->{Strict_no_cr}='no';
227          $self->{switch}=$switchex;
228          $switchex->parse("export"); # sort out supported tags
229   }
# Line 277 | Line 231 | sub _parseexport {
231   sub _pushremoteproject {
232          my $self=shift;
233          my $path=shift;
234 +
235 +        $self->verbose(">> _pushremoteproject: PATH ".$path." <<");
236          
237          if ( defined $self->{remoteproject} ) {
238            push @{$self->{rpstack}}, $self->{remoteproject};
# Line 286 | Line 242 | sub _pushremoteproject {
242  
243   sub _popremoteproject {
244          my $self=shift;
245 +        $self->verbose(">> _popremoteproject:  <<");
246 +        
247          if ( $#{$self->{rpstack}} >=0 ) {
248            $self->{remoteproject}=pop @{$self->{rpstack}};
249          }
# Line 296 | Line 254 | sub _popremoteproject {
254  
255   sub _toolmapper {
256          my $self=shift;
257 +
258          if ( ! defined $self->{mapper} ) {
259             require BuildSystem::ToolMapper;
260             $self->{mapper}=BuildSystem::ToolMapper->new();
261          }
262 +        $self->verbose(">> _toolmapper: TM ".$self->{mapper}."<<");
263          return $self->{mapper};
264   }
265  
# Line 313 | Line 273 | sub Class_StartTag {
273          my $self=shift;
274          my $name=shift;
275          my $hashref=shift;
276 +
277 +        $self->verbose(">> Classs_StartTag: NM ".$name." <<");
278          
279          if ( $self->{Arch} ) {
280           if ( defined $$hashref{'type'} ) {
281 <                $self->classname($$hashref{'type'});
281 >                $ClassName=$$hashref{'type'};
282           }
283          }
284   }
285  
286 < sub IncludePath_Start {
287 <        my $self=shift;
288 <        my $name=shift;
289 <        my $hashref=shift;
290 <
291 <        $self->{switch}->checktag( $name, $hashref, 'path');
292 <        if ( $self->{Arch} ) {
293 <          print GNUmakefile "INCLUDE+=".$self->_location()."/".
294 <                                                $$hashref{'path'}."\n";
295 <        }
296 < }
297 <
298 < #
299 < # --- <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 < }
286 > sub IncludePath_Start
287 >   {
288 >   my $self=shift;
289 >   my $name=shift;
290 >   my $hashref=shift;
291 >  
292 >   $self->verbose(">> IncludePath_Start: NM ".$name." <<");
293 >  
294 >   $self->{switch}->checktag( $name, $hashref, 'path');
295 >   if ( $self->{Arch} )
296 >      {
297 >      print GNUmakefile "INCLUDE+=".$self->_location()."/".$$hashref{'path'}."\n";
298 >      }
299 >   }
300  
301   #
302   # generic build tag
# Line 527 | Line 306 | sub Build_start {
306          my $name=shift;
307          my $hashref=shift;
308  
309 +        $self->verbose(">> Build_start: NM ".$name." <<");
310 +        
311          $self->{switch}->checktag($name,$hashref,'class');
531        $self->{switch}->checktag($name,$hashref,'id');
312          if ( $self->{Arch} ) {
313  
314            # -- determine the build products name
# Line 538 | Line 318 | sub Build_start {
318            }
319            else {
320              $self->{switch}->parseerror("No name specified for build product");
541            #$name="\$(buildname)";
321            }
322  
323            # -- check we have a lookup for the class type
# Line 555 | Line 334 | sub Build_start {
334  
335             # -- generate generic targets
336             print $fh "ifndef _BuildLink_\n";
337 <           $self->_generatedefaulttargets($fh,$$hashref{'class'},@deftypes);
559 <
337 >           print $fh "# -- Generic targets\n";
338             push @targets, $$hashref{'class'};
339 +           foreach $dtype ( @deftypes ) {
340 +            print $fh $$hashref{'class'}."::".$$hashref{'class'}."_".
341 +                                                                $dtype."\n";
342 +           }
343 +           print $fh "\n";
344  
345             # -- generate targets for each type
346             foreach $type ( @types ) {
# Line 572 | Line 355 | sub Build_start {
355              # -- create a new directory for each type
356              push @targets, $pattern;
357              my $dirname=$$hashref{'class'}."_".$type."_".$name;
358 <            my $here="$self->{localtop}/$ENV{INTwork}/".$self->{path}.
576 <                                                                "/".$dirname;
358 >            my $here="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/".$dirname;
359              my $makefile=$here."/BuildFile.mk";
578 #           AddDir::adddir($here);
360  
361              # -- create link targets to the directory
362              push @targets, $dirname;
# Line 596 | Line 377 | sub Build_start {
377              print $fh "\t cd $dirname; \\\n";
378              print $fh "\t echo include ".$self->{currentenv}." > ".
379                                                          "$makefile; \\\n";
380 <            print $fh "\t echo VPATH+=$self->{localtop}/".$self->{path}.
380 >            print $fh "\t echo VPATH+=$ENV{LOCALTOP}/".$self->{path}.
381                                          " >> $makefile; \\\n";
382              print $fh "\t echo buildname=$name >> $makefile;\\\n";
383              print $fh "\t echo ".$dirname.":".$pattern." >> $makefile;\\\n";
# Line 607 | Line 388 | sub Build_start {
388              }
389              print $fh "\tfi\n";
390              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";
391  
392              # -- cleaning targets
393              push @targets, "clean_$dirname";
# Line 652 | Line 428 | sub Bin_start {
428          my $tool;
429          my $filename;
430          my $objectname;
431 +
432 +        $self->verbose(">>          <<");
433          
434          $self->{switch}->checktag($name,$hashref,'file');
435          if ( $self->{Arch} ) {
# Line 662 | Line 440 | sub Bin_start {
440  
441          # Create a new directory for each binary target
442          my $dirname="bin_".$$hashref{name};
443 <        AddDir::adddir("$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname");
443 >        AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname");
444          open (binGNUmakefile,
445 <           ">$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die           "Unable to make $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/".
445 >           ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die           "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/".
446             "BuildFile.mk $!\n";
447  
448          # Create the link targets
# Line 680 | Line 458 | endif
458   ifndef BINMODE
459  
460   define stepdown_$$hashref{'name'}
461 < if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
462 < cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\
463 < \$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\
461 > if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
462 > cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\
463 > \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\
464   fi
465   endef
466  
467   define stepdown2_$$hashref{'name'}
468 < if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
469 < cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\
470 < \$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\
468 > if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
469 > cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\
470 > \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\
471   fi
472  
473   endef
# Line 713 | Line 491 | ENDTEXT
491  
492   # the binary specifics makefile
493          print binGNUmakefile "include ".$self->{currentenv}."\n";
494 <        print binGNUmakefile "VPATH+=".$self->{localtop}."/$self{path}\n";
494 >        print binGNUmakefile "VPATH+=$ENV{LOCALTOP}/$self{path}\n";
495  
496   # alias for bin_Insure
497          print binGNUmakefile <<ENDTEXT;
# Line 810 | Line 588 | ENDTEXT
588          close binGNUmakefile;
589   }
590  
591 + sub Module_start {
592 +        my $self=shift;
593 +        my $name=shift;
594 +        my $hashref=shift;
595 +
596 +        my $fileclass;
597 +        my @tools;
598 +        my $tool;
599 +        my $filename;
600 +        my $objectname;
601 +
602 +        $self->verbose(">> In module_start: ".$name." <<");
603 +        
604 +        $self->{switch}->checktag($name,$hashref,'file');
605 +        if ( $self->{Arch} ) {
606 +        if ( ! defined $$hashref{name} ) {
607 +                ($$hashref{name}=$$hashref{file})=~s/\..*//;
608 +        }
609 +        ($filename=$$hashref{file})=~s/\..*//;
610 +
611 +        # Create a new directory for each module target
612 +        my $dirname="module_".$$hashref{name};
613 +        AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname");
614 +        open (moduleGNUmakefile,
615 +           ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die           "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/".
616 +           "BuildFile.mk $!\n";
617 +
618 +        # Create the link targets
619 +        $numbins++;
620 +        my $fh=$self->{filehandlestack}[0];
621 +        print $fh <<ENDTEXT;
622 +
623 + # Link Targets to module directories
624 + ifdef MODULEMODE
625 + # We dont want to build a library here
626 + override files:=
627 + endif
628 + ifndef MODULEMODE
629 +
630 + BINMODE=true
631 +  
632 + define stepdown_$$hashref{'name'}
633 + if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
634 + cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\
635 + \$(MAKE) MODULEMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\
636 + fi
637 + endef
638 +
639 + define stepdown2_$$hashref{'name'}
640 + if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
641 + cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\
642 + \$(MAKE) MODULEMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\
643 + fi
644 +
645 + endef
646 +
647 + module_$$hashref{'name'}_%:: dummy
648 +        \@\$(stepdown2_$$hashref{'name'})
649 +
650 + $$hashref{'name'}_%:: dummy
651 +        \@\$(stepdown_$$hashref{'name'})
652 +
653 + help module module_debug module_debug_local module_insure module_Insure clean $$hashref{'name'}:: dummy
654 +        \@\$(stepdown_$$hashref{'name'})
655 +
656 + modulefiles+=$$hashref{'file'}
657 + locmodulefiles+=$dirname/$$hashref{'file'}
658 + endif
659 +
660 +
661 + ENDTEXT
662 +
663 +
664 + # the module specifics makefile
665 +        print moduleGNUmakefile "include ".$self->{currentenv}."\n";
666 +        print moduleGNUmakefile "VPATH+=$ENV{LOCALTOP}/$self{path}\n";
667 +
668 + # alias for bin_Insure
669 +        print moduleGNUmakefile <<ENDTEXT;
670 +
671 + module_insure:module_Insure
672 + ifdef MAKETARGET_module_insure
673 + MAKETARGET_$$hashref{name}_Insure=1
674 + endif
675 +
676 + # debuggging target
677 + $$hashref{'name'}_echo_% :: echo_%
678 +
679 + # help targets
680 + help::
681 + \t\@echo  
682 + \t\@echo Targets For $$hashref{'name'}
683 + \t\@echo -------------------------------------
684 + \t\@echo $$hashref{'name'}  - default build
685 + \t\@echo module_$$hashref{'name'}_clean - executable specific cleaning
686 + ENDTEXT
687 +
688 + # Make generic rules for each type
689 +        $targettypes={
690 +                "module" => 'o',
691 +                "module_debug" => 'd',
692 +                "module_debug_local" => 'l_d',
693 +                "module_Insure" => 'Insure'
694 +        };
695 +        #
696 +        foreach $target ( keys %$targettypes ) {
697 +          print moduleGNUmakefile <<ENDTEXT;
698 +
699 + # Type $target specifics
700 + ifdef MAKETARGET_$target
701 + MAKETARGET_$$hashref{name}_$$targettypes{$target}=1
702 + endif
703 + $target ::$$hashref{name}_$$targettypes{$target}
704 +
705 + moduletargets+=$$hashref{name}_$$targettypes{$target}
706 + help::
707 + \t\@echo $$hashref{name}_$$targettypes{$target}
708 + clean::
709 + \t\@if [ -f \$(modulestore)/$$hashref{name}_$$targettypes{$target} ]; then \\
710 + \techo Removing \$(modulestore)/$$hashref{name}; \\
711 + \trm \$(modulestore)/$$hashref{name}_$$targettypes{$target}; \\
712 + \tfi
713 +
714 + ENDTEXT
715 +          ($objectname=$$hashref{file})=~s/\..*/_$$targettypes{$target}\.o/;
716 +          ${"objectname_$$targettypes{$target}"}=$objectname;
717 +          print moduleGNUmakefile "$objectname:$$hashref{name}.dep\n";
718 +        } # end loop
719 +        print moduleGNUmakefile "MDFLAGS= -shared -Wl,-soname,\$\@","\n";
720 +        print moduleGNUmakefile "$$hashref{name}_Insure.so:.psrc\n";
721 +        print moduleGNUmakefile "$$hashref{name}_d.so:$objectname_d\n";
722 +        print moduleGNUmakefile "\t\$(CClinkCmdDebug) \$(MDFLAGS)\n";
723 +        print moduleGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
724 +        print moduleGNUmakefile "$$hashref{name}_l_d.so:$objectname_d\n";
725 +        print moduleGNUmakefile "\t\$(CClinkCmdDebugLocal) \$(MDFLAGS)\n";
726 +        print moduleGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
727 +        print moduleGNUmakefile "$$hashref{name}_Insure.so:$objectname_Insure\n";
728 +        print moduleGNUmakefile "\t\$(CClinkCmdInsure) \$(MDFLAGS)\n";
729 +        print moduleGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
730 +        print moduleGNUmakefile "$$hashref{name}_o.so:$objectname_o\n";
731 +        print moduleGNUmakefile "\t\$(CClinkCmd) \$(MDFLAGS)\n";
732 +        print moduleGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
733 +        print moduleGNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
734 +        print moduleGNUmakefile "-include $$hashref{name}.dep\n";
735 + print moduleGNUmakefile <<ENDTEXT;
736 + clean::
737 + \t\@if [ -f \$(modulestore)/lib$$hashref{name} ]; then \\
738 + \techo Removing \$(modulestore)/lib$$hashref{name}; \\
739 + \trm \$(modulestore)/lib$$hashref{name}; \\
740 + \tfi
741 +
742 +  
743 + $$hashref{name}_d.so:\$(libslocal_d)
744 + $$hashref{name}_o.so:\$(libslocal)
745 + ifdef MCCABE_DATA_DIR
746 + $$hashref{name}_mccabe.so: \$(libslocal_d) \$(MCCABE_DATA_DIR)/mccabeinstr/instplus.cpp
747 + endif
748 + $$hashref{name}_Insure.so:\$(libslocal_I)
749 + $$hashref{name}_d:$$hashref{name}_d.so
750 +        \@cp $$hashref{name}_d.so \$(modulestore)/lib$$hashref{name}
751 + $$hashref{name}_l_d:$$hashref{name}_l_d.so
752 +        \@cp $$hashref{name}_l_d.so \$(modulestore)/lib$$hashref{name}
753 + $$hashref{name}_Insure:$$hashref{name}_Insure.so
754 +        \@cp $$hashref{name}_Insure.so \$(modulestore)/lib$$hashref{name}_Insure
755 + $$hashref{name}:$$hashref{name}_d.so
756 +        \@mv $$hashref{name}_d.so \$(modulestore)/lib$$hashref{name}
757 + $$hashref{name}_o:$$hashref{name}_o.so
758 +        \@mv $$hashref{name}_o.so \$(modulestore)/lib$$hashref{name}.so
759 + modulefiles+=$$hashref{file}
760 + ENDTEXT
761 +        }
762 +        close moduleGNUmakefile;
763 + }
764 +
765 +
766   sub External_StartTag {
767          my $self=shift;
768          my $name=shift;
769          my $hashref=shift;
770 +
771 +        $self->verbose(">> External_StartTag: NM ".$name." <<");
772          
773          my $tool;
774          if ( $self->{Arch} ) {
# Line 867 | Line 822 | sub Group_start {
822          my $name=shift;
823          my $hashref=shift;
824          
825 +        $self->verbose(">> Group_start: NM ".$name." <<");
826 +        
827          $self->{switch}->checktag($name, $hashref, 'name');
828          if ( $self->{Arch} ) {
829          print GNUmakefile "GROUP_".$$hashref{'name'};
# Line 877 | Line 834 | sub Group_start {
834          }
835   }      
836  
837 < sub Use_start {
838 <        my $self=shift;
839 <        my $name=shift;
840 <        my $hashref=shift;
841 <        my $filename;
842 <        use Utilities::SCRAMUtils;
843 <        
844 <        $self->{switch}->checktag($name, $hashref, "name");
845 <        if ( $self->{Arch} ) {
846 <        if ( exists $$hashref{'group'} ) {
847 <          print GNUmakefile "GROUP_".$$hashref{'group'}."=true\n";
848 <        }
849 <        if ( ! defined $self->{remoteproject} ) {
850 <          $filename=SCRAMUtils::checkfile(
851 <                "/$ENV{INTsrc}/$$hashref{name}/BuildFile");
852 <        }
853 <        else {
854 <          $filename=$self->{remoteproject}."/$$hashref{name}/BuildFile";
855 <        print "trying $filename\n";
856 <          if ( ! -f $filename ) { $filename=""; };
857 <        }
858 <        if ( $filename ne "" ) {
859 <          $self->ParseBuildFile_Export( $filename );
860 <        }
861 <        else {
862 <           $self->{switch}->parseerror("Unable to detect Appropriate ".
863 <                "decription file for <$name name=".$$hashref{name}.">");
864 <        }
865 <        }
837 > sub Use_start
838 >   {
839 >   my $self=shift;
840 >   my $name=shift;
841 >   my $hashref=shift;
842 >   my $filename;
843 >   use Utilities::SCRAMUtils;
844 >
845 >   $self->verbose(">> Use_start: NM ".$name." <<");
846 >  
847 >   $self->{switch}->checktag($name, $hashref, "name");
848 >   if ( $self->{Arch} )
849 >      {
850 >      if ( exists $$hashref{'group'} )
851 >         {
852 >         print GNUmakefile "GROUP_".$$hashref{'group'}."=true\n";
853 >         }
854 >      if ( ! defined $self->{remoteproject} )
855 >         {
856 >         $filename=SCRAMUtils::checkfile("/$ENV{INTsrc}/$$hashref{name}/BuildFile");
857 >         }
858 >      else
859 >         {
860 >         $filename=$self->{remoteproject}."/$$hashref{name}/BuildFile";
861 >         print "Trying $filename\n";
862 >         if ( ! -f $filename ) { $filename=""; };
863 >         }
864 >      if ( $filename ne "" )
865 >         {
866 >         $self->ParseBuildFile_Export( $filename );
867 >         }
868 >      else
869 >         {
870 >         $self->{switch}->parseerror("Unable to detect Appropriate ".
871 >                                     "decription file for <$name name=".$$hashref{name}.">");
872 >         }
873 >      }
874 >   }
875 >
876 > sub CheckBuildFile {
877 >         my $self=shift;
878 >         my $classdir=shift;
879 >         my $ClassName="";
880 >         my $thisfile="$classdir/$buildfile";
881 >        
882 >         if ( -e $ENV{LOCALTOP}."/".$thisfile ) {
883 >            $DefaultBuildfile="$ENV{LOCALTOP}/$thisfile";
884 >            $self->ParseBuildFile($ENV{LOCALTOP}, $classdir, $buildfile);
885 >         }
886 >         elsif ( -e $ENV{RELEASETOP}."/".$thisfile ) {
887 >            $DefaultBuildfile="$ENV{RELEASETOP}/$thisfile";
888 >            $self->ParseBuildFile($ENV{RELEASETOP}, $classdir, $buildfile);
889 >         }
890 >         $self->verbose(">> CheckBuildFile: FN ".$thisfile." CN ".$ClassName." <<");
891 >         return $ClassName;
892   }
893  
894   # List association groups between <AssociateGroup> tags
# Line 916 | Line 899 | sub AssociateGroup {
899          my $string=shift;
900          my $word;
901  
902 +        $self->verbose(">> AssociateGroup: NM ".$name." ST ".$string." <<");
903 +        
904          if ( $self->{Arch} ) {
905          foreach $word ( (split /\s/, $string) ){
906                  chomp $word;
# Line 932 | Line 917 | sub Arch_Start {
917          my $name=shift;
918          my $hashref=shift;
919  
920 +        $self->verbose(">> Arch_Start: NM ".$name." <<");
921 +        
922          $self->{switch}->checktag($name, $hashref,'name');
923          ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($self->{Arch}=1)
924                                                  : ($self->{Arch}=0);
# Line 941 | Line 928 | sub Arch_Start {
928   sub Arch_End {
929          my $self=shift;
930          my $name=shift;
931 +        
932 +        $self->verbose(">> Arch_End: NM ".$name." <<");
933  
934 <        pop @{$self->{ARCHBLOCK}};
934 >        pop @{$self->{ARCHBLOCK}};
935          $self->{Arch}=$self->{ARCHBLOCK}[$#{$self->{ARCHBLOCK}}];
936   }
937  
# Line 950 | Line 939 | sub Arch_End {
939   sub _CutBlock {
940      my $self=shift;
941      my $string= shift @_;
942 +
943 +    $self->verbose(">> _CutBlock: ST ".$string." <<");
944 +    
945      @BlockClassA = split /\//, $string;
946   }
947  
# Line 957 | Line 949 | sub OutToMakefile {
949          my $self=shift;
950          my $name=shift;
951          my @vars=@_;
952 +        
953 +        $self->verbose(">> OutToMakefile: <<");
954  
955          if ( $self->{Arch} ) {
956 +          $self->verbose(">> CONT: ".$#vars." lines <<");
957            print GNUmakefile @vars;
958          }
959   }
# Line 966 | Line 961 | sub OutToMakefile {
961   sub OutToScreen {
962          my $name=shift;
963          my @vars=@_;
964 <
964 >        
965          if ( $self->{Arch} ) {
966            print @vars;
967          }
# Line 976 | Line 971 | sub setBlockClassPath {
971          my $name=shift;
972          my $hashref=shift;
973  
974 +        $self->verbose(">> setBlockClassPath: NM ".$name." <<");
975 +        
976          $self->{switch}->checktag($name, $hashref, 'path');
977          $self->{BlockClassPath}=$self->{BlockClassPath}.":".$$hashref{path};
978          $self->_CutBlock($$hashref{path});
# Line 983 | Line 980 | sub setBlockClassPath {
980  
981   sub BlockClassPath {
982          my $self=shift;
983 +
984 +        $self->verbose(">> BlockClassPath: <<");
985 +
986          return $self->{BlockClassPath};
987   }
988  
# Line 991 | Line 991 | sub export_start_export {
991          my $name=shift;
992          my $hashref=shift;
993  
994 +        $self->verbose(">> export_start_export: NM ".$name." <<");
995 +        
996          $self->{switch}->opengroup("__export");
997   }
998  
# Line 999 | Line 1001 | sub export_start {
1001          my $name=shift;
1002          my $hashref=shift;
1003  
1004 +        $self->verbose(">> export_start: NM ".$name." <<");
1005 +        
1006          $self->{switch}->opengroup("__export");
1007          if ( exists $$hashref{autoexport} ) {
1008            print GNUmakefile "scram_autoexport=".$$hashref{autoexport}."\n";
# Line 1015 | Line 1019 | sub export_start {
1019  
1020   sub export_end_export {
1021          my $self=shift;
1022 +        $self->verbose(">> export_end_export: <<");
1023          $self->{switch}->closegroup("__export");
1024   }
1025  
1026   sub export_end {
1027          my $self=shift;
1028 +        $self->verbose(">> export_end: <<");
1029          $self->{switch}->closegroup("__export");
1030          print GNUmakefile "endif\n";
1031   }
# Line 1027 | Line 1033 | sub export_end {
1033   #
1034   # Standard lib tag
1035   #
1036 < sub lib_start {
1037 <        my $self=shift;
1038 <        my $name=shift;
1039 <        my $hashref=shift;
1036 > sub lib_start
1037 >   {
1038 >   my $self=shift;
1039 >   my $name=shift;
1040 >   my $hashref=shift;
1041 >  
1042 >   $self->verbose(">> lib_start: NM ".$name." <<");
1043 >  
1044 >   $self->{switch}->checktag($name, $hashref, 'name');
1045 >
1046 >   if ( $self->{Arch} )
1047 >      {
1048 >      print GNUmakefile "lib+=$$hashref{name}\n";
1049 >      }
1050 >   }
1051  
1052 <        $self->{switch}->checktag($name, $hashref, 'name');
1053 <        if ( $self->{Arch} ) {
1054 <           print GNUmakefile "lib+=$$hashref{name}\n";
1055 <        }
1056 < }
1052 > # Standard debug lib tag
1053 > #
1054 > sub debuglib_start
1055 >   {
1056 >   my $self=shift;
1057 >   my $name=shift;
1058 >   my $hashref=shift;
1059 >  
1060 >   $self->verbose(">> debuglib_start: NM ".$name." <<");
1061 >   $self->{switch}->checktag($name, $hashref, 'name');
1062 >
1063 >   if ( $self->{Arch} )
1064 >      {
1065 >      print GNUmakefile "debuglib+=$$hashref{name}\n";
1066 >      }
1067 >   }
1068  
1069   #
1070   # libtype specification
# Line 1045 | Line 1073 | sub LibType_Start {
1073          my $self=shift;
1074          my $name=shift;
1075          my $hashref=shift;
1076 <
1076 >        
1077 >        $self->verbose(">> LibType_Start: NM ".$name." <<");
1078 >        
1079          if ( $self->{Arch} ) {
1080          if ( defined $self->{libtype_conext} ) {
1081            $self->{switch}->parseerror("<$name> tag cannot be specified".
# Line 1078 | Line 1108 | sub LibType_text {
1108          my $self=shift;
1109          my $name=shift;
1110          my $string=shift;
1111 +        $self->verbose(">> LibType_text: NM ".$name." <<");
1112  
1113 <        if ( $self->{Arch} ) {
1113 >        if ( $self->{Arch} ) {
1114            $string=~s/\n/ /g;
1115            print GNUmakefile "libmsg::\n\t\@echo Library info: ";
1116            print GNUmakefile $string;
# Line 1091 | Line 1122 | sub LibType_end {
1122          my $self=shift;
1123          my $name=shift;
1124  
1125 +        $self->verbose(">> LibType_end: NM ".$name." <<");
1126 +
1127          undef $self->{libtype_conext};
1128   }
1129  
# Line 1099 | Line 1132 | sub Environment_start {
1132          my $name=shift;
1133          my $hashref=shift;
1134  
1135 +        $self->verbose(">> Environment_start: NM ".$name." <<");
1136 +        
1137          if ( $self->{Arch} ) {
1138            $self->{envnum}++;
1139  
1140            # open a new Environment File
1141 <          my $envfile="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_".
1141 >          my $envfile="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_".
1142                  $self->{envnum}.".mk";
1143            use FileHandle;
1144            my $fh=FileHandle->new();
# Line 1113 | Line 1148 | sub Environment_start {
1148  
1149            # include the approprate environment file
1150            if ( $self->{envlevel} == 0 ) {
1151 <             print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/".
1151 >             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/".
1152                  $self->{path}."/BuildFile.mk\n";
1153            }
1154            else {
1155 <             print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/".
1155 >             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/".
1156                  $self->{path}."/Env_".$self->{Envlevels}[$self->{envlevel}].".mk\n";
1157            }
1158            $self->{envlevel}++;
1159            $self->{Envlevels}[$self->{envlevel}]=$self->{envnum};
1160 <          $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk";
1160 >          $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk";
1161          }
1162   }
1163  
# Line 1130 | Line 1165 | sub Environment_end {
1165          my $self=shift;
1166          my $fd;
1167  
1168 +        $self->verbose(">> Environment_end: NM ".$name." <<");
1169 +
1170          if ( $self->{Arch} ) {
1171            $self->{envlevel}--;
1172            if ( $self->{envlevel} < 0 ) {
# Line 1142 | Line 1179 | sub Environment_end {
1179            close $fd;
1180            *GNUmakefile=$self->{filehandlestack}[$#{$self->{filehandlestack}}];
1181            if ( $self->{envlevel} < 1 ) {
1182 <            $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/".
1182 >            $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/".
1183                          "BuildFile.mk";
1184            }
1185            else {
1186              $self->{currentenv}=
1187 <             $self->{localtop}."/$ENV{INTwork}/$self->{path}/Env_".
1187 >             "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_".
1188                  $self->{Envlevels}[$self->{envlevel}];
1189            }
1190          }
1191   }
1192  
1193   sub Store_start {
1194 <        my $self=shift;
1195 <        my $name=shift;
1194 >        my $self=shift;
1195 >        my $name=shift;
1196          my $hashref=shift;
1197  
1198 <        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;
1198 >        $self->verbose(">> Store_start: NM ".$name." <<");
1199  
1200          if ( $self->{Arch} ) {
1201 <          # - default values must always be specified
1202 <          $self->{switch}->checktag( $name, $hashref, 'defaults' );
1203 <          my @blockdirs=split /,/ , $$hashref{'defaults'};
1204 <          $self->{block}->defaultblocks(@blockdirs);
1205 <        }
1201 >          $self->{switch}->checktag( $name, $hashref, 'name' );
1202 >
1203 >          # -- store creation
1204 >          my $dir=$$hashref{'name'};
1205 >          AddDir::adddir($ENV{LOCALTOP}."/".$dir);
1206 >          if ( exists $$hashref{'type'} ) {
1207 >            # -- architecture specific store
1208 >            if ( $$hashref{'type'}=~/^arch/i ) {
1209 >                $dir=$dir."/".$ENV{SCRAM_ARCH};
1210 >                AddDir::adddir($ENV{LOCALTOP}."/".$dir);
1211 >            }
1212 >            else {
1213 >                $self->parseerror("Unknown type in <$name> tag");
1214 >            }
1215 >          }
1216 >
1217 >          # -- set make variables for the store
1218 >          print GNUmakefile "SCRAMSTORENAME_".$$hashref{'name'}.":=".$dir."\n";
1219 >          print GNUmakefile "SCRAMSTORE_".$$hashref{'name'}.":=".
1220 >                                        $ENV{LOCALTOP}."/".$dir."\n";
1221 >          print GNUmakefile "VPATH+=".$ENV{LOCALTOP}
1222 >                        ."/".$dir.":".$ENV{RELEASETOP}."/".$dir."\n";
1223 >        }
1224   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines