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.6 by williamc, Fri Sep 15 11:18:21 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  
13   package BuildSystem::BuildFile;
14   use ActiveDoc::SimpleDoc;
# Line 23 | Line 25 | sub new {
25          bless $self, $class;
26          $self->{area}=shift;
27          $self->{toolbox}=$self->{area}->toolbox();
28 +        $self->{localtop}=$self->{area}->location();
29          $self->{Arch}=1;
30          push @{$self->{ARCHBLOCK}}, $self->{Arch};
31          return $self;
32   }
33  
34 + sub buildfile {
35 +        my $self=shift;
36 +        if ( @_ ) {
37 +          $self->{buildfile}=shift;
38 +        }
39 +        return $self->{buildfile};
40 + }
41 +
42   sub ignore {
43          my $self=shift;
44          return (defined $self->{ignore})?$self->{ignore}:0;
# Line 149 | Line 160 | sub ParseBuildFile {
160          $numbins=0;
161          $self->{envnum}=0;
162          $self->{envlevel}=0;
163 <        $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/".
163 >        $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/".
164                                                                  "BuildFile.mk";
165          $self->{switch}=$self->_initswitcher();
166          $self->{switch}->filetoparse($fullfilename);
# Line 157 | Line 168 | sub ParseBuildFile {
168   #       $self->{switch}->{Strict_no_cr}='no';
169          #open a temporary gnumakefile to store output.
170          use Utilities::AddDir;
171 <        AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}");
171 >        AddDir::adddir("$self->{localtop}/$ENV{INTwork}/$self->{path}");
172          my $fh=FileHandle->new();
173 <        open ( $fh, ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk"
173 >        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
# Line 168 | Line 179 | sub ParseBuildFile {
179            print GNUmakefile "include $ENV{LatestBuildFile}\n";
180          }
181   #       print "writing to :\n".
182 < #               "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/BuildFile.mk\n";
183 <        $ENV{LatestBuildFile}="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk";
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;
# Line 191 | Line 202 | ENDTEXT
202          close GNUmakefile;
203   }
204  
205 + sub classname {
206 +        my $self=shift;
207 +        if ( @_ ) {
208 +          $self->{classname}=shift;
209 +        }
210 +        return $self->{classname};
211 + }
212 +
213   sub ParseBuildFile_Export {
214          my $self=shift;
215          my $filename=shift;
# Line 270 | Line 289 | sub Class_StartTag {
289          
290          if ( $self->{Arch} ) {
291           if ( defined $$hashref{'type'} ) {
292 <                $ClassName=$$hashref{'type'};
292 >                $self->classname($$hashref{'type'});
293           }
294          }
295   }
# Line 343 | Line 362 | sub Build_start {
362              # -- create a new directory for each type
363              push @targets, $pattern;
364              my $dirname=$$hashref{'class'}."_".$type."_".$name;
365 <            my $here="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/".$dirname;
365 >            my $here="$self->{localtop}/$ENV{INTwork}/".$self->{path}."/".$dirname;
366              my $makefile=$here."/BuildFile.mk";
367   #           AddDir::adddir($here);
368  
# Line 366 | Line 385 | sub Build_start {
385              print $fh "\t cd $dirname; \\\n";
386              print $fh "\t echo include ".$self->{currentenv}." > ".
387                                                          "$makefile; \\\n";
388 <            print $fh "\t echo VPATH+=$ENV{LOCALTOP}/".$self->{path}.
388 >            print $fh "\t echo VPATH+=$self->{localtop}/".$self->{path}.
389                                          " >> $makefile; \\\n";
390              print $fh "\t echo buildname=$name >> $makefile;\\\n";
391              print $fh "\t echo ".$dirname.":".$pattern." >> $makefile;\\\n";
# Line 381 | Line 400 | sub Build_start {
400   #           print $typefile "\t\$(_quietbuild_)";
401   #           print $typefile $mapper->template($$hashref{'class'},$type)."\n";
402   #           print $typefile "\t\$(_quietstamp_)";
403 < #           print $typefile "$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n";
403 > #           print $typefile "\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n";
404  
405              # -- cleaning targets
406              push @targets, "clean_$dirname";
# Line 432 | Line 451 | sub Bin_start {
451  
452          # Create a new directory for each binary target
453          my $dirname="bin_".$$hashref{name};
454 <        AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname");
454 >        AddDir::adddir("$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname");
455          open (binGNUmakefile,
456 <           ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die           "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/".
456 >           ">$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die           "Unable to make $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/".
457             "BuildFile.mk $!\n";
458  
459          # Create the link targets
# Line 450 | Line 469 | endif
469   ifndef BINMODE
470  
471   define stepdown_$$hashref{'name'}
472 < if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
473 < cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\
474 < \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\
472 > if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
473 > cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\
474 > \$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\
475   fi
476   endef
477  
478   define stepdown2_$$hashref{'name'}
479 < if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
480 < cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\
481 < \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\
479 > if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
480 > cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\
481 > \$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\
482   fi
483  
484   endef
# Line 483 | Line 502 | ENDTEXT
502  
503   # the binary specifics makefile
504          print binGNUmakefile "include ".$self->{currentenv}."\n";
505 <        print binGNUmakefile "VPATH+=$ENV{LOCALTOP}/$self{path}\n";
505 >        print binGNUmakefile "VPATH+=$self->{localtop}/$self{path}\n";
506  
507   # alias for bin_Insure
508          print binGNUmakefile <<ENDTEXT;
# Line 539 | Line 558 | ENDTEXT
558          print binGNUmakefile "$$hashref{name}_Insure.exe:.psrc\n";
559          print binGNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
560          print binGNUmakefile "\t\$(CClinkCmdDebug)\n";
561 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
561 >        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
562          print binGNUmakefile "$$hashref{name}_l_d.exe:$objectname_d\n";
563          print binGNUmakefile "\t\$(CClinkCmdDebugLocal)\n";
564 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
564 >        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
565          print binGNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
566          print binGNUmakefile "\t\$(CClinkCmdInsure)\n";
567 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
567 >        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
568          print binGNUmakefile "$$hashref{name}_o.exe:$objectname_o\n";
569          print binGNUmakefile "\t\$(CClinkCmd)\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}.dep:$$hashref{file}\n";
572          print binGNUmakefile "-include $$hashref{name}.dep\n";
573   print binGNUmakefile <<ENDTEXT;
# Line 678 | Line 697 | sub Use_start {
697          }
698   }
699  
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
700   # List association groups between <AssociateGroup> tags
701   # seperated by newlines or spaces
702   sub AssociateGroup {
# Line 890 | Line 892 | sub Environment_start {
892            $self->{envnum}++;
893  
894            # open a new Environment File
895 <          my $envfile="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_".
895 >          my $envfile="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_".
896                  $self->{envnum}.".mk";
897            use FileHandle;
898            my $fh=FileHandle->new();
# Line 900 | Line 902 | sub Environment_start {
902  
903            # include the approprate environment file
904            if ( $self->{envlevel} == 0 ) {
905 <             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/".
905 >             print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/".
906                  $self->{path}."/BuildFile.mk\n";
907            }
908            else {
909 <             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/".
909 >             print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/".
910                  $self->{path}."/Env_".$self->{Envlevels}[$self->{envlevel}].".mk\n";
911            }
912            $self->{envlevel}++;
913            $self->{Envlevels}[$self->{envlevel}]=$self->{envnum};
914 <          $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk";
914 >          $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk";
915          }
916   }
917  
# Line 929 | Line 931 | sub Environment_end {
931            close $fd;
932            *GNUmakefile=$self->{filehandlestack}[$#{$self->{filehandlestack}}];
933            if ( $self->{envlevel} < 1 ) {
934 <            $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/".
934 >            $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/".
935                          "BuildFile.mk";
936            }
937            else {
938              $self->{currentenv}=
939 <             "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_".
939 >             $self->{localtop}."/$ENV{INTwork}/$self->{path}/Env_".
940                  $self->{Envlevels}[$self->{envlevel}];
941            }
942          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines