ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/BuildSetup.pm
(Generate patch)

Comparing COMP/SCRAM/src/BuildSystem/BuildSetup.pm (file contents):
Revision 1.7 by williamc, Wed Sep 20 16:47:45 2000 UTC vs.
Revision 1.8 by williamc, Fri Sep 29 06:45:51 2000 UTC

# Line 39 | Line 39 | sub _generateexternals {
39          my $self=shift;
40          my $outfile=shift;
41  
42 <        # -- specifiy these files for dependency information
42 >        # -- specify these files for dependency information
43          my $depfile=$self->{projconfigdir}."/External_Dependencies";
44  
45          # -- get list of dependent files
# Line 127 | Line 127 | sub classsetup {
127                  my $classbf=BuildSystem::BuildFile->new($self->{area});
128                  undef $ENV{LatestBuildFile}; # gets set by BuildFile
129                  $classbf->GenerateMakefile($classbuildfile, $classmakefile);
130                undef $ENV{LatestBuildFile}; # we dont want this included in the
131                                             # hierarchy
130                }
131          }
132          else {
# Line 175 | Line 173 | sub BuildDir {
173          my @Targets=@_;
174          my $DefaultBuildFile="";
175  
178        # -- Create working directory
179        my $workdir=$self->{workdir}."/".$THISDIR;
180        chdir $self->{localtop};
181        AddDir::adddir($workdir);
182        $ENV{workdir}=$workdir;
183        my $fullworkdir=$self->{localtop}."/".$ENV{workdir};
184        chdir $fullworkdir || die "Unable to enter working directory $!";
176  
177          # -- Setup Class specifics
178          ($Class,$ClassDir,$classmakefile)=$self->classsetup($THISDIR);
# Line 190 | Line 181 | sub BuildDir {
181          $ENV{ClassDir}=$ClassDir;
182          $DefaultBuildFile=$ENV{classmakefile};
183          $ENV{DefaultBuildFile}=$DefaultBuildFile;
193        
184  
185 +        # -- Create working directory
186 +        my $workdir=$self->{workdir}."/".$ClassDir;
187 +        chdir $self->{localtop};
188 +        AddDir::adddir($workdir);
189 +        $ENV{workdir}=$workdir;
190 +        my $fullworkdir=$self->{localtop}."/".$ENV{workdir};
191 +        chdir $fullworkdir || die "Unable to enter working directory $!";
192 +        
193          # -- Set up some other useful variables for the Build
194          # set variables listing directories/files available
195          my $fh=FileHandle->new();
196 <        opendir $fh, "$self->{localtop}/$THISDIR";
196 >        opendir $fh, "$self->{localtop}/$ClassDir";
197          my @allfiles= grep !/^\.\.?$/, readdir $fh;
198          undef $fh;
199          foreach $file ( @allfiles ) {
200 <         if ( -d "$self->{localtop}/$THISDIR/$file" ) {
200 >         if ( -d "$self->{localtop}/$ClassDir/$file" ) {
201             $ENV{SCRAM_AVAILDIRS}=$ENV{SCRAM_AVAILDIRS}." ".$file;
202           }
203           else {
# Line 231 | Line 229 | sub BuildDir {
229  
230      $ENV{DefaultMakefile}="$ENV{TOOL_HOME}/basics.mk";
231  
232 +
233      $SCRAM_GROUPSDIR=$self->{localtop}."/".$self->{projconfigdir}."/groups.mk";
234      if ( -f $SCRAM_GROUPSDIR ) {
235        $ENV{SCRAM_GROUPSDIR}=$SCRAM_GROUPSDIR;
# Line 238 | Line 237 | sub BuildDir {
237  
238      # Do a datestamp check so that make will build files that have changed
239      # rather than just those which are older than their dependencies
240 <    $self->_checkdatestampindir($THISDIR);
240 >    $self->_checkdatestampindir($ClassDir);
241 >
242 >        # -- call the block building method
243 >        #$report=$bs->build(@Targets);
244 >        
245  
246      # The main build here
247      $rv=system("gmake","--no-print-directory","-r","-k","-f","$ENV{DefaultMakefile}","-I$ENV{TOOL_HOME}", @Targets);
248      return $rv/256; # return the exit status of gmake
249 +        
250 + }
251 +
252 + sub BuildIt {
253 +        my $self=shift;
254 +        my $dir=shift;
255 +
256 +        # -- get the building block for the directory
257 +        my $block=$self->_getdirblock($dir);
258 +
259 +        # -- is there a class block associated with the directory?
260 +        my ($class)=getclass($dir);
261 +        my $classblock=$self->_getclassblock($class);
262 +
263 +        # -- Search for Blocks up to tree root
264 +        my @dirblocks=();
265 +        my @dirs=split /\//, $dir;
266 +        my $fulldir="";
267 +        foreach $dire ( "/",@dirs ) {
268 +              $fulldir=$fulldir."/".$dire;  # root is //
269 +              my $block=$self->_getdirblock($fulldir);
270 +              last if $block->ignore(); # we dont need to go futher
271 +              push @dirblocks, $block;
272 +        }
273 +        foreach $block ( $classblock, @dirblocks ) {
274 +              # -- merge class blocks together
275 +              foreach $name ( $block->classes() ) {
276 +                $object->merge();
277 +              }
278 +              foreach $classinst ( $block->classinst() ) {
279 +                $types{$classinst->id()}=$class->newinst();
280 +                foreach $element ( $classinst ) {
281 +                  $types{$classinst->id()}->setelement($element,
282 +                                                $classinst->value($element));
283 +                }
284 +              }
285 +        }
286 +
287 +        # -- call the builder
288 +
289 + }
290 +
291 + sub _getdirblock {
292 +        my $self=shift;
293 +        my $dir=shift;
294 +
295 +        if ( ! defined $self->{blocks}{$dir} ) {
296 +        
297 +          # -- get a buildfile and do a block parse
298 +          my $bf=$self->_startbuildfile($dir);
299 +          $bf->blockparse($self->{blocks}{$dir});
300 +          
301 +        }
302 +        return $self->{blocks}{$dir};
303   }
304  
305   sub getclass {
# Line 271 | Line 328 | sub getclass {
328          else {
329            # -- sort it out from classpath directives
330            foreach $BlockClassA ( @{$self->{LoBCA}} ) {
331 <           foreach $elem ( @$BlockClassA ) {
331 >           next if ( $#{$BlockClassA} < $i );
332 >           $elem=${$BlockClassA}[$i];
333              if ( $elem=~/^$DIRA[$i]\+/ ) {
334                  $elem=~s/^$DIRA[$i]//;
335              }
336 +            #print $elem." ".$DIRA[$i]."\n";
337              if ( $elem=~/^\+/ ) {
338                  ($Class=$elem)=~s/^\+//;
339                  $ClassDir=$thispath;
340              }
341 <          }
341 >          #}
342           }
343          }
344      }
# Line 313 | Line 372 | sub _startbuildfile {
372              $bf->ParseBuildFile($self->{localtop}, $classdir,
373                                  $self->{buildfilename});
374           }
375 <         elsif ( -e $ENV{RELEASETOP}."/".$thisfile ) {
376 <            $bf->buildfile("$ENV{RELEASETOP}/$thisfile");
377 <            $bf->ParseBuildFile($ENV{RELEASETOP}, $classdir,
378 <                                                $slef->{buildfilename});
375 >         elsif ( -e $self->{releasetop}."/".$thisfile ) {
376 >            $bf->buildfile($self->{releasetop}."/".$thisfile);
377 >            $bf->ParseBuildFile($self->{releasetop}, $classdir,
378 >                                                $self->{buildfilename});
379           }
380           return $bf;
381   }
# Line 376 | Line 435 | sub _checkdatestampindir {
435            my (%files,%moddate);
436  
437            # now get dates in our dependency list
438 <          foreach $file ( $ds->contents() ) {
439 <           # -- only check files
440 <           if ( -f $file ) {
441 <            $files{$file}=$ds->filedate($file);
442 <            # -- check to see if we have a new local copy
443 <            if ( ($file=~/\Q$self->{releasetop}\E/) &&
438 >          my @datedfiles=$ds->dated();
439 >          if ( $#datedfiles >= 0 ) {
440 >             $needsupdate=1;
441 >             $date=$datedfiles[0][1]-1;
442 >          }
443 >          else {
444 >           # -- extra checks for local replacement of files
445 >           foreach $file ( $ds->contents() ) {
446 >            # -- only check files
447 >            if ( -f $file ) {
448 >             $files{$file}=$ds->filedate($file);
449 >             # -- check to see if we have a new local copy
450 >             if ( ($file=~/\Q$self->{releasetop}\E/) &&
451                                  ($self->{releasetop} ne $self->{localtop}) ) {
452 <              ($tempfile=$file)=~s/$self->{releasetop}/$self->{localtop}/;
452 >              ($tempfile=$file)=~s/\Q$self->{releasetop}\E/$self->{localtop}/;
453                if ( -f $tempfile ) {
454                  $files{$tempfile}=$files{$file};
455                  $file=$tempfile;
456                }
457 <            }
458 <            $moddate{$file}=(stat($file))[9];
459 <            if ( $moddate{$file} != $files{$file} ) {
457 >             }
458 >             $moddate{$file}=(stat($file))[9];
459 >             if ( $moddate{$file} != $files{$file} ) {
460                $self->verbose($file." changed");
461                $date=$moddate{$file}-1;
462                $needsupdate=1;
463 +             }
464              }
465 <           }
466 <          }
465 >           }
466 >          }
467            # time stamp the product file to be older than the dependencies
468            if ( $needsupdate == 1 ) { # touch file into the past
469            my $newproductfile;
# Line 425 | Line 492 | sub _checkdatestampindir {
492               $newproductfile=$productfile;
493            }
494            if ( -f $newproductfile ) {
495 <            $self->verbose("Blasting $newproductfile to the past");
495 >            $self->verbose("Blasting $newproductfile to the past ($date)");
496              # If the (local) productfile exists - make it older
497              utime($date,$date,$newproductfile);
498            }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines