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.14 by sashby, Wed Nov 7 19:49:37 2001 UTC vs.
Revision 1.15 by sashby, Wed Apr 10 15:24:29 2002 UTC

# Line 9 | Line 9
9   # ignore()      : return 1 if directory should be ignored 0 otherwise
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 29 | Line 31 | sub new {
31  
32   sub ignore {
33          my $self=shift;
34 +        $self->verbose(">> ignore......<<");
35 +        
36          return (defined $self->{ignore})?$self->{ignore}:0;
37   }
38  
# Line 36 | 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);
# Line 83 | 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 123 | Line 130 | sub ParseBuildFile {
130          else {
131           $fullfilename=$filename;
132          }
133 +
134 +        $self->verbose(">> ParseBuildFile: FN ".$fullfilename." <<");
135 +        
136          $self->{path}=$path;
137          $numbins=0;
138          $self->{envnum}=0;
# Line 170 | Line 180 | ENDTEXT
180   sub ParseBuildFile_Export {
181          my $self=shift;
182          my $filename=shift;
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};
# Line 181 | 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 206 | 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 215 | 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 225 | 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 242 | 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'} ) {
# Line 254 | Line 276 | sub IncludePath_Start {
276          my $self=shift;
277          my $name=shift;
278          my $hashref=shift;
279 <
279 >        
280 >        $self->verbose(">> IncludePath_Start: NM ".$name." <<");
281 >        
282          $self->{switch}->checktag( $name, $hashref, 'path');
283          if ( $self->{Arch} ) {
284            print GNUmakefile "INCLUDE+=".$self->_location()."/".
# Line 270 | Line 294 | sub Build_start {
294          my $name=shift;
295          my $hashref=shift;
296  
297 +        $self->verbose(">> Build_start: NM ".$name." <<");
298 +        
299          $self->{switch}->checktag($name,$hashref,'class');
300          if ( $self->{Arch} ) {
301  
# Line 390 | Line 416 | sub Bin_start {
416          my $tool;
417          my $filename;
418          my $objectname;
419 +
420 +        $self->verbose(">>          <<");
421          
422          $self->{switch}->checktag($name,$hashref,'file');
423          if ( $self->{Arch} ) {
# Line 552 | Line 580 | sub External_StartTag {
580          my $self=shift;
581          my $name=shift;
582          my $hashref=shift;
583 +
584 +        $self->verbose(">> External_StartTag: NM ".$name." <<");
585          
586          my $tool;
587          if ( $self->{Arch} ) {
# Line 605 | Line 635 | sub Group_start {
635          my $name=shift;
636          my $hashref=shift;
637          
638 +        $self->verbose(">> Group_start: NM ".$name." <<");
639 +        
640          $self->{switch}->checktag($name, $hashref, 'name');
641          if ( $self->{Arch} ) {
642          print GNUmakefile "GROUP_".$$hashref{'name'};
# Line 615 | Line 647 | sub Group_start {
647          }
648   }      
649  
650 < sub Use_start {
651 <        my $self=shift;
652 <        my $name=shift;
653 <        my $hashref=shift;
654 <        my $filename;
655 <        use Utilities::SCRAMUtils;
656 <        
657 <        $self->{switch}->checktag($name, $hashref, "name");
658 <        if ( $self->{Arch} ) {
659 <        if ( exists $$hashref{'group'} ) {
660 <          print GNUmakefile "GROUP_".$$hashref{'group'}."=true\n";
661 <        }
662 <        if ( ! defined $self->{remoteproject} ) {
663 <          $filename=SCRAMUtils::checkfile(
664 <                "/$ENV{INTsrc}/$$hashref{name}/BuildFile");
665 <        }
666 <        else {
667 <          $filename=$self->{remoteproject}."/$$hashref{name}/BuildFile";
668 <        print "trying $filename\n";
669 <          if ( ! -f $filename ) { $filename=""; };
670 <        }
671 <        if ( $filename ne "" ) {
672 <          $self->ParseBuildFile_Export( $filename );
673 <        }
674 <        else {
675 <           $self->{switch}->parseerror("Unable to detect Appropriate ".
676 <                "decription file for <$name name=".$$hashref{name}.">");
677 <        }
678 <        }
679 < }
650 > sub Use_start
651 >   {
652 >   my $self=shift;
653 >   my $name=shift;
654 >   my $hashref=shift;
655 >   my $filename;
656 >   use Utilities::SCRAMUtils;
657 >
658 >   $self->verbose(">> Use_start: NM ".$name." <<");
659 >  
660 >   $self->{switch}->checktag($name, $hashref, "name");
661 >   if ( $self->{Arch} )
662 >      {
663 >      if ( exists $$hashref{'group'} )
664 >         {
665 >         print GNUmakefile "GROUP_".$$hashref{'group'}."=true\n";
666 >         }
667 >      if ( ! defined $self->{remoteproject} )
668 >         {
669 >         $filename=SCRAMUtils::checkfile("/$ENV{INTsrc}/$$hashref{name}/BuildFile");
670 >         }
671 >      else
672 >         {
673 >         $filename=$self->{remoteproject}."/$$hashref{name}/BuildFile";
674 >         print "Trying $filename\n";
675 >         if ( ! -f $filename ) { $filename=""; };
676 >         }
677 >      if ( $filename ne "" )
678 >         {
679 >         $self->ParseBuildFile_Export( $filename );
680 >         }
681 >      else
682 >         {
683 >         $self->{switch}->parseerror("Unable to detect Appropriate ".
684 >                                     "decription file for <$name name=".$$hashref{name}.">");
685 >         }
686 >      }
687 >   }
688  
689   sub CheckBuildFile {
690           my $self=shift;
691           my $classdir=shift;
692           my $ClassName="";
693           my $thisfile="$classdir/$buildfile";
694 <
694 >        
695           if ( -e $ENV{LOCALTOP}."/".$thisfile ) {
696              $DefaultBuildfile="$ENV{LOCALTOP}/$thisfile";
697              $self->ParseBuildFile($ENV{LOCALTOP}, $classdir, $buildfile);
# Line 660 | Line 700 | sub CheckBuildFile {
700              $DefaultBuildfile="$ENV{RELEASETOP}/$thisfile";
701              $self->ParseBuildFile($ENV{RELEASETOP}, $classdir, $buildfile);
702           }
703 +         $self->verbose(">> CheckBuildFile: FN ".$thisfile." CN ".$ClassName." <<");
704           return $ClassName;
705   }
706  
# Line 671 | Line 712 | sub AssociateGroup {
712          my $string=shift;
713          my $word;
714  
715 +        $self->verbose(">> AssociateGroup: NM ".$name." ST ".$string." <<");
716 +        
717          if ( $self->{Arch} ) {
718          foreach $word ( (split /\s/, $string) ){
719                  chomp $word;
# Line 687 | Line 730 | sub Arch_Start {
730          my $name=shift;
731          my $hashref=shift;
732  
733 +        $self->verbose(">> Arch_Start: NM ".$name." <<");
734 +        
735          $self->{switch}->checktag($name, $hashref,'name');
736          ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($self->{Arch}=1)
737                                                  : ($self->{Arch}=0);
# Line 696 | Line 741 | sub Arch_Start {
741   sub Arch_End {
742          my $self=shift;
743          my $name=shift;
744 +        
745 +        $self->verbose(">> Arch_End: NM ".$name." <<");
746  
747 <        pop @{$self->{ARCHBLOCK}};
747 >        pop @{$self->{ARCHBLOCK}};
748          $self->{Arch}=$self->{ARCHBLOCK}[$#{$self->{ARCHBLOCK}}];
749   }
750  
# Line 705 | Line 752 | sub Arch_End {
752   sub _CutBlock {
753      my $self=shift;
754      my $string= shift @_;
755 +
756 +    $self->verbose(">> _CutBlock: ST ".$string." <<");
757 +    
758      @BlockClassA = split /\//, $string;
759   }
760  
# Line 712 | Line 762 | sub OutToMakefile {
762          my $self=shift;
763          my $name=shift;
764          my @vars=@_;
765 +        
766 +        $self->verbose(">> OutToMakefile: <<");
767  
768          if ( $self->{Arch} ) {
769 +          $self->verbose(">> CONT: ".$vars[0]." <<");
770            print GNUmakefile @vars;
771          }
772   }
# Line 721 | Line 774 | sub OutToMakefile {
774   sub OutToScreen {
775          my $name=shift;
776          my @vars=@_;
777 <
777 >        
778          if ( $self->{Arch} ) {
779            print @vars;
780          }
# Line 731 | Line 784 | sub setBlockClassPath {
784          my $name=shift;
785          my $hashref=shift;
786  
787 +        $self->verbose(">> setBlockClassPath: NM ".$name." <<");
788 +        
789          $self->{switch}->checktag($name, $hashref, 'path');
790          $self->{BlockClassPath}=$self->{BlockClassPath}.":".$$hashref{path};
791          $self->_CutBlock($$hashref{path});
# Line 738 | Line 793 | sub setBlockClassPath {
793  
794   sub BlockClassPath {
795          my $self=shift;
796 +
797 +        $self->verbose(">> BlockClassPath: <<");
798 +
799          return $self->{BlockClassPath};
800   }
801  
# Line 746 | Line 804 | sub export_start_export {
804          my $name=shift;
805          my $hashref=shift;
806  
807 +        $self->verbose(">> export_start_export: NM ".$name." <<");
808 +        
809          $self->{switch}->opengroup("__export");
810   }
811  
# Line 754 | Line 814 | sub export_start {
814          my $name=shift;
815          my $hashref=shift;
816  
817 +        $self->verbose(">> export_start: NM ".$name." <<");
818 +        
819          $self->{switch}->opengroup("__export");
820          if ( exists $$hashref{autoexport} ) {
821            print GNUmakefile "scram_autoexport=".$$hashref{autoexport}."\n";
# Line 770 | Line 832 | sub export_start {
832  
833   sub export_end_export {
834          my $self=shift;
835 +        $self->verbose(">> export_end_export: <<");
836          $self->{switch}->closegroup("__export");
837   }
838  
839   sub export_end {
840          my $self=shift;
841 +        $self->verbose(">> export_end: <<");
842          $self->{switch}->closegroup("__export");
843          print GNUmakefile "endif\n";
844   }
# Line 786 | Line 850 | sub lib_start {
850          my $self=shift;
851          my $name=shift;
852          my $hashref=shift;
853 +        
854 +        $self->verbose(">> lib_start: NM ".$name." <<");
855  
856 <        $self->{switch}->checktag($name, $hashref, 'name');
857 <        if ( $self->{Arch} ) {
856 >        $self->{switch}->checktag($name, $hashref, 'name');
857 >
858 >        if ( $self->{Arch} ) {
859             print GNUmakefile "lib+=$$hashref{name}\n";
860          }
861   }
# Line 800 | Line 867 | sub LibType_Start {
867          my $self=shift;
868          my $name=shift;
869          my $hashref=shift;
870 <
870 >        
871 >        $self->verbose(">> LibType_Start: NM ".$name." <<");
872 >        
873          if ( $self->{Arch} ) {
874          if ( defined $self->{libtype_conext} ) {
875            $self->{switch}->parseerror("<$name> tag cannot be specified".
# Line 833 | Line 902 | sub LibType_text {
902          my $self=shift;
903          my $name=shift;
904          my $string=shift;
905 +        $self->verbose(">> LibType_text: NM ".$name." <<");
906  
907 <        if ( $self->{Arch} ) {
907 >        if ( $self->{Arch} ) {
908            $string=~s/\n/ /g;
909            print GNUmakefile "libmsg::\n\t\@echo Library info: ";
910            print GNUmakefile $string;
# Line 846 | Line 916 | sub LibType_end {
916          my $self=shift;
917          my $name=shift;
918  
919 +        $self->verbose(">> LibType_end: NM ".$name." <<");
920 +
921          undef $self->{libtype_conext};
922   }
923  
# Line 854 | Line 926 | sub Environment_start {
926          my $name=shift;
927          my $hashref=shift;
928  
929 +        $self->verbose(">> Environment_start: NM ".$name." <<");
930 +        
931          if ( $self->{Arch} ) {
932            $self->{envnum}++;
933  
# Line 885 | Line 959 | sub Environment_end {
959          my $self=shift;
960          my $fd;
961  
962 +        $self->verbose(">> Environment_end: NM ".$name." <<");
963 +
964          if ( $self->{Arch} ) {
965            $self->{envlevel}--;
966            if ( $self->{envlevel} < 0 ) {
# Line 913 | Line 989 | sub Store_start {
989          my $name=shift;
990          my $hashref=shift;
991  
992 +        $self->verbose(">> Store_start: NM ".$name." <<");
993 +
994          if ( $self->{Arch} ) {
995            $self->{switch}->checktag( $name, $hashref, 'name' );
996  
# Line 938 | Line 1016 | sub Store_start {
1016                          ."/".$dir.":".$ENV{RELEASETOP}."/".$dir."\n";
1017          }
1018   }
941

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines