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.4 by williamc, Tue Sep 12 13:01:39 2000 UTC vs.
Revision 1.7 by williamc, Tue Sep 19 10:09:29 2000 UTC

# Line 7 | Line 7
7   # ParseBuildFileExport(filename)
8   # BlockClassPath() : Return the class path
9   # ignore()      : return 1 if directory should be ignored 0 otherwise
10 + # classname()   : get/set the associated class
11 + # buildfile()   : get/set BuildFile location
12 + # makefile()    : get the generated makefile
13  
14   package BuildSystem::BuildFile;
15   use ActiveDoc::SimpleDoc;
# Line 23 | Line 26 | sub new {
26          bless $self, $class;
27          $self->{area}=shift;
28          $self->{toolbox}=$self->{area}->toolbox();
29 +        $self->{localtop}=$self->{area}->location();
30          $self->{Arch}=1;
31          push @{$self->{ARCHBLOCK}}, $self->{Arch};
32          return $self;
33   }
34  
35 + sub buildfile {
36 +        my $self=shift;
37 +        if ( @_ ) {
38 +          $self->{buildfile}=shift;
39 +        }
40 +        return $self->{buildfile};
41 + }
42 +
43 + sub makefile {
44 +        my $self=shift;
45 +        if ( @_ ) {
46 +          $self->{makefile}=shift;
47 +        }
48 +        return $self->{makefile};
49 + }
50 +
51   sub ignore {
52          my $self=shift;
53          return (defined $self->{ignore})?$self->{ignore}:0;
# Line 149 | Line 169 | sub ParseBuildFile {
169          $numbins=0;
170          $self->{envnum}=0;
171          $self->{envlevel}=0;
172 <        $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/".
172 >        $self->{makefile}="$self->{localtop}/$ENV{INTwork}/$self->{path}/".
173                                                                  "BuildFile.mk";
174 +        $self->{currentenv}=$self->{makefile};
175          $self->{switch}=$self->_initswitcher();
176          $self->{switch}->filetoparse($fullfilename);
177  
178   #       $self->{switch}->{Strict_no_cr}='no';
179          #open a temporary gnumakefile to store output.
180          use Utilities::AddDir;
181 <        AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}");
182 <        my $fh=FileHandle->new();
183 <        open ( $fh, ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk"
184 <          ) or die 'Unable to open /$ENV{INTwork}/".$self->{path}."/BuildFile.mk $!\n';
185 <        @{$self->{filehandlestack}}=($fh);
186 <        # make an alias
187 <        *GNUmakefile=$fh;
188 <        if ( -e $ENV{LatestBuildFile} ) {
189 <          print GNUmakefile "include $ENV{LatestBuildFile}\n";
169 <        }
170 < #       print "writing to :\n".
171 < #               "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/BuildFile.mk\n";
172 <        $ENV{LatestBuildFile}="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk";
173 <        $self->{switch}->parse("makebuild"); # sort out supported tags
174 <        if ( $numbins > 0 ) {
175 <         print GNUmakefile <<ENDTEXT;
176 < ifndef BINMODE
177 < help::
178 < \t\@echo Generic Binary targets
179 < \t\@echo ----------------------
180 < endif
181 < ENDTEXT
182 <         foreach $target ( keys %$targettypes ) {
183 <         print GNUmakefile <<ENDTEXT;
184 < ifndef BINMODE
185 < help::
186 < \t\@echo $target
187 < endif
188 < ENDTEXT
189 <         }
181 >        AddDir::adddir("$self->{localtop}/$ENV{INTwork}/$self->{path}");
182 >        $self->GenerateMakefile($fullfilename,
183 >          $self->{localtop}."/".$ENV{INTwork}."/".$self->{path}."/BuildFile.mk");
184 > }
185 >
186 > sub classname {
187 >        my $self=shift;
188 >        if ( @_ ) {
189 >          $self->{classname}=shift;
190          }
191 <        close GNUmakefile;
191 >        return $self->{classname};
192   }
193  
194   sub ParseBuildFile_Export {
# Line 270 | Line 270 | sub Class_StartTag {
270          
271          if ( $self->{Arch} ) {
272           if ( defined $$hashref{'type'} ) {
273 <                $ClassName=$$hashref{'type'};
273 >                $self->classname($$hashref{'type'});
274           }
275          }
276   }
# Line 343 | Line 343 | sub Build_start {
343              # -- create a new directory for each type
344              push @targets, $pattern;
345              my $dirname=$$hashref{'class'}."_".$type."_".$name;
346 <            my $here="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/".$dirname;
346 >            my $here="$self->{localtop}/$ENV{INTwork}/".$self->{path}."/".$dirname;
347              my $makefile=$here."/BuildFile.mk";
348   #           AddDir::adddir($here);
349  
# Line 366 | Line 366 | sub Build_start {
366              print $fh "\t cd $dirname; \\\n";
367              print $fh "\t echo include ".$self->{currentenv}." > ".
368                                                          "$makefile; \\\n";
369 <            print $fh "\t echo VPATH+=$ENV{LOCALTOP}/".$self->{path}.
369 >            print $fh "\t echo VPATH+=$self->{localtop}/".$self->{path}.
370                                          " >> $makefile; \\\n";
371              print $fh "\t echo buildname=$name >> $makefile;\\\n";
372              print $fh "\t echo ".$dirname.":".$pattern." >> $makefile;\\\n";
# Line 381 | Line 381 | sub Build_start {
381   #           print $typefile "\t\$(_quietbuild_)";
382   #           print $typefile $mapper->template($$hashref{'class'},$type)."\n";
383   #           print $typefile "\t\$(_quietstamp_)";
384 < #           print $typefile "$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n";
384 > #           print $typefile "\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n";
385  
386              # -- cleaning targets
387              push @targets, "clean_$dirname";
# Line 432 | Line 432 | sub Bin_start {
432  
433          # Create a new directory for each binary target
434          my $dirname="bin_".$$hashref{name};
435 <        AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname");
435 >        AddDir::adddir("$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname");
436          open (binGNUmakefile,
437 <           ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die           "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/".
437 >           ">$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die           "Unable to make $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/".
438             "BuildFile.mk $!\n";
439  
440          # Create the link targets
# Line 450 | Line 450 | endif
450   ifndef BINMODE
451  
452   define stepdown_$$hashref{'name'}
453 < if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
454 < cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\
455 < \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\
453 > if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
454 > cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\
455 > \$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\
456   fi
457   endef
458  
459   define stepdown2_$$hashref{'name'}
460 < if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
461 < cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\
462 < \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\
460 > if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
461 > cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\
462 > \$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\
463   fi
464  
465   endef
# Line 483 | Line 483 | ENDTEXT
483  
484   # the binary specifics makefile
485          print binGNUmakefile "include ".$self->{currentenv}."\n";
486 <        print binGNUmakefile "VPATH+=$ENV{LOCALTOP}/$self{path}\n";
486 >        print binGNUmakefile "VPATH+=$self->{localtop}/$self{path}\n";
487  
488   # alias for bin_Insure
489          print binGNUmakefile <<ENDTEXT;
# Line 539 | Line 539 | ENDTEXT
539          print binGNUmakefile "$$hashref{name}_Insure.exe:.psrc\n";
540          print binGNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
541          print binGNUmakefile "\t\$(CClinkCmdDebug)\n";
542 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
542 >        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
543          print binGNUmakefile "$$hashref{name}_l_d.exe:$objectname_d\n";
544          print binGNUmakefile "\t\$(CClinkCmdDebugLocal)\n";
545 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
545 >        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
546          print binGNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
547          print binGNUmakefile "\t\$(CClinkCmdInsure)\n";
548 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
548 >        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
549          print binGNUmakefile "$$hashref{name}_o.exe:$objectname_o\n";
550          print binGNUmakefile "\t\$(CClinkCmd)\n";
551 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
551 >        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
552          print binGNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
553          print binGNUmakefile "-include $$hashref{name}.dep\n";
554   print binGNUmakefile <<ENDTEXT;
# Line 678 | Line 678 | sub Use_start {
678          }
679   }
680  
681 sub CheckBuildFile {
682         my $self=shift;
683         my $classdir=shift;
684         my $ClassName="";
685         my $thisfile="$classdir/$buildfile";
686
687         if ( -e $ENV{LOCALTOP}."/".$thisfile ) {
688            $DefaultBuildfile="$ENV{LOCALTOP}/$thisfile";
689            $self->ParseBuildFile($ENV{LOCALTOP}, $classdir, $buildfile);
690         }
691         elsif ( -e $ENV{RELEASETOP}."/".$thisfile ) {
692            $DefaultBuildfile="$ENV{RELEASETOP}/$thisfile";
693            $self->ParseBuildFile($ENV{RELEASETOP}, $classdir, $buildfile);
694         }
695         return $ClassName;
696 }
697
681   # List association groups between <AssociateGroup> tags
682   # seperated by newlines or spaces
683   sub AssociateGroup {
# Line 890 | Line 873 | sub Environment_start {
873            $self->{envnum}++;
874  
875            # open a new Environment File
876 <          my $envfile="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_".
876 >          my $envfile="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_".
877                  $self->{envnum}.".mk";
878            use FileHandle;
879            my $fh=FileHandle->new();
# Line 900 | Line 883 | sub Environment_start {
883  
884            # include the approprate environment file
885            if ( $self->{envlevel} == 0 ) {
886 <             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/".
886 >             print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/".
887                  $self->{path}."/BuildFile.mk\n";
888            }
889            else {
890 <             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/".
890 >             print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/".
891                  $self->{path}."/Env_".$self->{Envlevels}[$self->{envlevel}].".mk\n";
892            }
893            $self->{envlevel}++;
894            $self->{Envlevels}[$self->{envlevel}]=$self->{envnum};
895 <          $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk";
895 >          $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk";
896          }
897   }
898  
# Line 929 | Line 912 | sub Environment_end {
912            close $fd;
913            *GNUmakefile=$self->{filehandlestack}[$#{$self->{filehandlestack}}];
914            if ( $self->{envlevel} < 1 ) {
915 <            $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/".
915 >            $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/".
916                          "BuildFile.mk";
917            }
918            else {
919              $self->{currentenv}=
920 <             "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_".
920 >             $self->{localtop}."/$ENV{INTwork}/$self->{path}/Env_".
921                  $self->{Envlevels}[$self->{envlevel}];
922            }
923          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines