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.5 by williamc, Wed Sep 13 14:00:33 2000 UTC vs.
Revision 1.8 by williamc, Fri Sep 29 06:45:51 2000 UTC

# Line 5 | Line 5
5   # new(ConfigArea)
6   # ParseBuildFile($base,$path,$file)
7   # ParseBuildFileExport(filename)
8 + # blockparse(Block) : perform a parse to modify the block
9   # BlockClassPath() : Return the class path
10   # 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
14  
15   package BuildSystem::BuildFile;
16   use ActiveDoc::SimpleDoc;
# Line 29 | Line 33 | sub new {
33          return $self;
34   }
35  
36 + sub buildfile {
37 +        my $self=shift;
38 +        if ( @_ ) {
39 +          $self->{buildfile}=shift;
40 +        }
41 +        return $self->{buildfile};
42 + }
43 +
44 + sub makefile {
45 +        my $self=shift;
46 +        if ( @_ ) {
47 +          $self->{makefile}=shift;
48 +        }
49 +        return $self->{makefile};
50 + }
51 +
52 + sub blockparse {
53 +        my $self=shift;
54 +        $self->{block}=shift;
55 +
56 +        $self->{switch}=$self->_initswitcher();
57 +        $self->_initblockparse($self->{switch});
58 + }
59 +
60   sub ignore {
61          my $self=shift;
62          return (defined $self->{ignore})?$self->{ignore}:0;
# Line 41 | Line 69 | sub _initswitcher {
69          $switch->newparse($parse);
70          $switch->addignoretags($parse);
71          $self->_commontags($switch,$parse);
72 <        $switch->addtag($parse,"Build", \&Build_start, $self);
72 >        #$switch->addtag($parse,"Build", \&Build_start, $self);
73          $switch->addtag($parse,"none",
74                                          \&OutToMakefile,$self,
75                                          \&OutToMakefile, $self,
# Line 50 | Line 78 | sub _initswitcher {
78                                          \&Bin_start,$self,
79                                          \&OutToScreen, $self,
80                                          "", $self);
81 +        $switch->addtag($parse,"ProductStore",
82 +                                        \&Store_start,$self,
83 +                                        "", $self,
84 +                                        "", $self);
85          $switch->addtag($parse,"LibType",
86                                          \&LibType_Start,$self,
87                                          \&LibType_text, $self,
# Line 77 | Line 109 | sub _initswitcher {
109          return $switch;
110   }
111  
112 + sub _initblockparse {
113 +        my $self=shift;
114 +        my $switch=shift;
115 +
116 +        my $parse="block";
117 +        $switch->newparse($parse);
118 +        $switch->addignoretags($parse);
119 +        $switch->addtag($parse,"DropDown",
120 +                                        \&DropDown_start,$self,
121 +                                        "", $self,
122 +                                        "", $self);
123 +        $switch->addtag($parse,"Build", \&Build_start, $self);
124 + }
125 +
126   sub _commontags {
127          my $self=shift;
128          my $switch=shift;
# Line 128 | Line 174 | sub GenerateMakefile {
174          if ( -e $ENV{LatestBuildFile} ) {
175            print GNUmakefile "include $ENV{LatestBuildFile}\n";
176          }
131        $ENV{LatestBuildFile}=$outfile;
177          $self->{switch}->parse("makebuild"); # sort out supported tags
178          close GNUmakefile;
179 +        return $outfile;
180   }
181  
182   sub ParseBuildFile {
# Line 150 | Line 196 | sub ParseBuildFile {
196          $numbins=0;
197          $self->{envnum}=0;
198          $self->{envlevel}=0;
199 <        $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/".
199 >        $self->{makefile}="$self->{localtop}/$ENV{INTwork}/$self->{path}/".
200                                                                  "BuildFile.mk";
201 +        $self->{currentenv}=$self->{makefile};
202          $self->{switch}=$self->_initswitcher();
203          $self->{switch}->filetoparse($fullfilename);
204  
# Line 159 | Line 206 | sub ParseBuildFile {
206          #open a temporary gnumakefile to store output.
207          use Utilities::AddDir;
208          AddDir::adddir("$self->{localtop}/$ENV{INTwork}/$self->{path}");
209 <        my $fh=FileHandle->new();
210 <        open ( $fh, ">$self->{localtop}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk"
211 <          ) or die 'Unable to open /$ENV{INTwork}/".$self->{path}."/BuildFile.mk $!\n';
212 <        @{$self->{filehandlestack}}=($fh);
213 <        # make an alias
214 <        *GNUmakefile=$fh;
215 <        if ( -e $ENV{LatestBuildFile} ) {
216 <          print GNUmakefile "include $ENV{LatestBuildFile}\n";
170 <        }
171 < #       print "writing to :\n".
172 < #               "$self->{localtop}/$ENV{INTwork}/$self->{path}/BuildFile.mk\n";
173 <        $ENV{LatestBuildFile}="$self->{localtop}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk";
174 <        $self->{switch}->parse("makebuild"); # sort out supported tags
175 <        if ( $numbins > 0 ) {
176 <         print GNUmakefile <<ENDTEXT;
177 < ifndef BINMODE
178 < help::
179 < \t\@echo Generic Binary targets
180 < \t\@echo ----------------------
181 < endif
182 < ENDTEXT
183 <         foreach $target ( keys %$targettypes ) {
184 <         print GNUmakefile <<ENDTEXT;
185 < ifndef BINMODE
186 < help::
187 < \t\@echo $target
188 < endif
189 < ENDTEXT
190 <         }
209 >        $ENV{LatestBuildFile}=$self->GenerateMakefile($fullfilename,
210 >          $self->{localtop}."/".$ENV{INTwork}."/".$self->{path}."/BuildFile.mk");
211 > }
212 >
213 > sub classname {
214 >        my $self=shift;
215 >        if ( @_ ) {
216 >          $self->{classname}=shift;
217          }
218 <        close GNUmakefile;
218 >        return $self->{classname};
219   }
220  
221   sub ParseBuildFile_Export {
# Line 271 | Line 297 | sub Class_StartTag {
297          
298          if ( $self->{Arch} ) {
299           if ( defined $$hashref{'type'} ) {
300 <                $ClassName=$$hashref{'type'};
300 >                $self->classname($$hashref{'type'});
301           }
302          }
303   }
# Line 297 | Line 323 | sub Build_start {
323          my $hashref=shift;
324  
325          $self->{switch}->checktag($name,$hashref,'class');
326 +        $self->{switch}->checktag($name,$hashref,'id');
327          if ( $self->{Arch} ) {
328  
329            # -- determine the build products name
# Line 382 | Line 409 | sub Build_start {
409   #           print $typefile "\t\$(_quietbuild_)";
410   #           print $typefile $mapper->template($$hashref{'class'},$type)."\n";
411   #           print $typefile "\t\$(_quietstamp_)";
412 < #           print $typefile "$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n";
412 > #           print $typefile "\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n";
413  
414              # -- cleaning targets
415              push @targets, "clean_$dirname";
# Line 540 | Line 567 | ENDTEXT
567          print binGNUmakefile "$$hashref{name}_Insure.exe:.psrc\n";
568          print binGNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
569          print binGNUmakefile "\t\$(CClinkCmdDebug)\n";
570 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
570 >        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
571          print binGNUmakefile "$$hashref{name}_l_d.exe:$objectname_d\n";
572          print binGNUmakefile "\t\$(CClinkCmdDebugLocal)\n";
573 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
573 >        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
574          print binGNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
575          print binGNUmakefile "\t\$(CClinkCmdInsure)\n";
576 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
576 >        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
577          print binGNUmakefile "$$hashref{name}_o.exe:$objectname_o\n";
578          print binGNUmakefile "\t\$(CClinkCmd)\n";
579 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
579 >        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
580          print binGNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
581          print binGNUmakefile "-include $$hashref{name}.dep\n";
582   print binGNUmakefile <<ENDTEXT;
# Line 679 | Line 706 | sub Use_start {
706          }
707   }
708  
682 sub CheckBuildFile {
683         my $self=shift;
684         my $classdir=shift;
685         my $ClassName="";
686         my $thisfile="$classdir/$buildfile";
687
688         if ( -e $self->{localtop}."/".$thisfile ) {
689            $DefaultBuildfile="$self->{localtop}/$thisfile";
690            $self->ParseBuildFile($self->{localtop}, $classdir, $buildfile);
691         }
692         elsif ( -e $ENV{RELEASETOP}."/".$thisfile ) {
693            $DefaultBuildfile="$ENV{RELEASETOP}/$thisfile";
694            $self->ParseBuildFile($ENV{RELEASETOP}, $classdir, $buildfile);
695         }
696         return $ClassName;
697 }
698
709   # List association groups between <AssociateGroup> tags
710   # seperated by newlines or spaces
711   sub AssociateGroup {
# Line 940 | Line 950 | sub Environment_end {
950            }
951          }
952   }
953 +
954 + sub Store_start {
955 +        my $self=shift;
956 +        my $name=shift;
957 +        my $hashref=shift;
958 +
959 +        if ( $self->{Arch} ) {
960 +          $self->{switch}->checktag( $name, $hashref, 'name' );
961 +
962 +          # -- store creation
963 +          my $dir=$$hashref{'name'};
964 +          AddDir::adddir($self->{area}->location()."/".$dir);
965 +          if ( exists $$hashref{'type'} ) {
966 +            # -- architecture specific store
967 +            if ( $$hashref{'type'}=~/^arch/i ) {
968 +                $dir=$dir."/".$ENV{SCRAM_ARCH};
969 +                AddDir::adddir($self->{area}->location()."/".$dir);
970 +            }
971 +            else {
972 +                $self->parseerror("Unknown type in <$name> tag");
973 +            }
974 +          }
975 +        
976 +          # -- set make variables for the store
977 +          print GNUmakefile "SCRAMSTORENAME_".$$hashref{'name'}.":=".$dir."\n";
978 +          print GNUmakefile "SCRAMSTORE_".$$hashref{'name'}.":=".
979 +                                        $self->{localtop}."/".$dir."\n";
980 +          print GNUmakefile "VPATH+=".$self->{localtop}
981 +                        ."/".$dir.":".$self->{releasetop}."/".$dir."\n";
982 +        }
983 + }
984 +
985 + sub DropDown {
986 +        my $self=shift;
987 +        my $name=shift;
988 +        my $hashref=shift;
989 +
990 +        if ( $self->{Arch} ) {
991 +          # - default values must always be specified
992 +          $self->{switch}->checktag( $name, $hashref, 'defaults' );
993 +          my @blockdirs=split /,/ , $$hashref{'defaults'};
994 +          $self->{block}->defaultblocks(@blockdirs);
995 +        }
996 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines