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.6 by williamc, Fri Sep 15 11:18:21 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 39 | Line 41 | sub buildfile {
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 51 | 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 60 | 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 87 | 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 138 | Line 174 | sub GenerateMakefile {
174          if ( -e $ENV{LatestBuildFile} ) {
175            print GNUmakefile "include $ENV{LatestBuildFile}\n";
176          }
141        $ENV{LatestBuildFile}=$outfile;
177          $self->{switch}->parse("makebuild"); # sort out supported tags
178          close GNUmakefile;
179 +        return $outfile;
180   }
181  
182   sub ParseBuildFile {
# Line 160 | 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 169 | 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"
174 <          ) or die 'Unable to open /$ENV{INTwork}/".$self->{path}."/BuildFile.mk $!\n';
175 <        @{$self->{filehandlestack}}=($fh);
176 <        # make an alias
177 <        *GNUmakefile=$fh;
178 <        if ( -e $ENV{LatestBuildFile} ) {
179 <          print GNUmakefile "include $ENV{LatestBuildFile}\n";
180 <        }
181 < #       print "writing to :\n".
182 < #               "$self->{localtop}/$ENV{INTwork}/$self->{path}/BuildFile.mk\n";
183 <        $ENV{LatestBuildFile}="$self->{localtop}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk";
184 <        $self->{switch}->parse("makebuild"); # sort out supported tags
185 <        if ( $numbins > 0 ) {
186 <         print GNUmakefile <<ENDTEXT;
187 < ifndef BINMODE
188 < help::
189 < \t\@echo Generic Binary targets
190 < \t\@echo ----------------------
191 < endif
192 < ENDTEXT
193 <         foreach $target ( keys %$targettypes ) {
194 <         print GNUmakefile <<ENDTEXT;
195 < ifndef BINMODE
196 < help::
197 < \t\@echo $target
198 < endif
199 < ENDTEXT
200 <         }
201 <        }
202 <        close GNUmakefile;
209 >        $ENV{LatestBuildFile}=$self->GenerateMakefile($fullfilename,
210 >          $self->{localtop}."/".$ENV{INTwork}."/".$self->{path}."/BuildFile.mk");
211   }
212  
213   sub classname {
# Line 315 | 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 941 | 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