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

Comparing COMP/SCRAM/src/BuildFile.pm (file contents):
Revision 1.2 by williamc, Mon Mar 1 11:01:41 1999 UTC vs.
Revision 1.21.2.5 by williamc, Thu Aug 19 09:12:32 1999 UTC

# Line 7 | Line 7 | require Exporter;
7   BEGIN {
8   use ToolBox;
9   $buildfile="BuildFile";
10 < #$toolbox=ToolBox->new();
10 > $toolbox=ToolBox->new();
11 > $Arch=1;
12 > push @ARCHBLOCK, $Arch;
13   }
14  
15   #Parse the BuildFile
# Line 29 | Line 31 | sub ParseBuildFile {
31                  'ConfigurationClass' => \&OutToMakefile,
32                  'AssociateGroup' => \&AssociateGroup,
33                  'none' => \&OutToMakefile,
34 <                'Bin' => \&OutToMakefile,
34 >                'Bin' => 'none',
35                  'Bin_StartTag' => \&Bin_start,
36                  'ClassPath' => \&OutToMakefile,
37 <                'ClassPath_StartTag' => \&setBlockClassPath
37 >                'ClassPath_StartTag' => \&setBlockClassPath,
38 >                'lib' => 'none',
39 >                'lib_StartTag' => \&lib_start,
40 >                'lib_EndTag' => 'none',
41 >                'ignore' => 'none',
42 >                'ignore_EndTag' => \&ignoretag_end,
43 >                'ignore_StartTag' => \&ignoretag,
44 >                'Architecture_StartTag' => \&Arch_Start,
45 >                'Architecture_EndTag' => \&Arch_End,
46 >                'Architecture' => \&OutToMakefile
47          };
48          use Utilities::Switcher;
49          $switch=Switcher->new($SupportedTags, $fullfilename);
50          $switch->{Strict_no_cr}='no';
51          #open a temporary gnumakefile to store output.
52          use Utilities::AddDir;
53 <        adddir("$ENV{LOCALTOP}/$ENV{INTwork}/${path}");
53 >        AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/${path}");
54          open ( GNUmakefile, ">$ENV{LOCALTOP}/$ENV{INTwork}/${path}/BuildFile.mk") or die 'Unable to open /$ENV{INTwork}/${path}/BuildFile.mk $!\n';
55          if ( -e $ENV{LatestBuildFile} ) {
56            print GNUmakefile "include $ENV{LatestBuildFile}\n";
# Line 51 | Line 62 | sub ParseBuildFile {
62          close GNUmakefile;
63   }
64  
65 + sub ParseBuildFile_Export {
66 +        my $filename=shift;
67 +        use Tool;
68 +        # This hash defines which Document Elements we can use
69 +        my $SupportedTags={
70 +                'none' => 'none',
71 +                'export' => \&OutToMakefile,
72 +                'export_StartTag' => \&export_start,
73 +                'export_EndTag' => \&export_end,
74 +                'lib_StartTag' => \&lib_start_export,
75 +                'lib' => 'none'
76 +        };
77 +        use Utilities::Switcher;
78 +        $switchex=Switcher->new($SupportedTags, $filename);
79 +        $switchex->{Strict_no_cr}='no';
80 +        $switchex->parse(); # sort out supported tags
81 + }
82 +
83   sub initialterms() {
84          my $name=shift;
85          my @string=@_;
# Line 80 | Line 109 | sub Class_StartTag {
109          my @vars=@_;
110          
111          $hashref=$switch->SetupValueHash(\@vars);
112 +        if ( $Arch ) {
113          if ( defined $$hashref{'type'} ) {
114                  $ClassName=$$hashref{'type'};
115          }
116 +        }
117   }
118  
119   sub ClassPath_StartTag {
# Line 91 | Line 122 | sub ClassPath_StartTag {
122          my $hashref;
123  
124          $hashref=$switch->SetupValueHash(\@vars);
125 +        if ( $Arch ) {
126          if ( defined $$hashref{'defaultpath'} ) {
127          }
128 +        }
129   }
130  
131   sub Bin_start {
# Line 102 | Line 135 | sub Bin_start {
135          my $fileclass;
136          my @tools;
137          my $tool;
138 +        my $filename;
139 +        my $objectname;
140          
141          $hashref=$switch->SetupValueHash(\@vars);
142          $switch->checkparam($hashref, $name, 'file');
143 +        if ( $Arch ) {
144          if ( ! defined $$hashref{name} ) {
145                  ($$hashref{name}=$$hashref{file})=~s/\..*//;
146          }
147 <        $fileclass=getclass($file);
148 <        $toolbox->maketargets("exe",$fileclass, $$hashref{name}, $file );
149 <        print GNUmakefile "bin::$file\n\n";
147 >        # This stuff for later
148 >        #$fileclass=$toolbox->getclass($file);
149 >        #$toolbox->maketargets("exe",$fileclass, $$hashref{name}, $file );
150 >        ($filename=$$hashref{file})=~s/\..*//;
151 >        ($objectname=$$hashref{file})=~s/\..*/\.o/;
152 >        ($objectname_d=$$hashref{file})=~s/\..*/_d\.o/;
153 >        ($objectname_Insure=$$hashref{file})=~s/\..*/_Insure\.o/;
154 >        print GNUmakefile "bin:$$hashref{name}_o\n";
155 >        print GNUmakefile "bin_debug:$$hashref{name}_d\n";
156 >        print GNUmakefile "bin_insure:$$hashref{name}_Insure\n";
157 >        print GNUmakefile ".INTERMEDIATE::$$hashref{name}_d.exe\n";
158 >        print GNUmakefile ".INTERMEDIATE::$$hashref{name}_Insure.exe\n";
159 >        print GNUmakefile ".INTERMEDIATE::$$hashref{name}.exe\n";
160 >        print GNUmakefile "$$hashref{name}_Insure:.psrc\n";
161 >        print GNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
162 >        print GNUmakefile "\t\$(CClinkCmdDebug)\n";
163 >        print GNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
164 >        print GNUmakefile "\t\$(CClinkCmdInsure)\n";
165 >        print GNUmakefile "$$hashref{name}.exe:$objectname\n";
166 >        print GNUmakefile "\t\$(CClinkCmd)\n";
167 >        print GNUmakefile "$objectname:$$hashref{name}.dep\n";
168 >        print GNUmakefile "$objectname_d:$$hashref{name}.dep\n";
169 >        print GNUmakefile "$objectname_Insure:$$hashref{name}.dep\n";
170 >        print GNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
171 >        print GNUmakefile "-include $$hashref{name}.dep\n";
172 > #       print GNUmakefile "$$hashref{name}:$$hashref{file}\n";
173 > print GNUmakefile <<ENDTEXT;
174 > $$hashref{name}_d.exe:\$(libslocal_d)
175 > $$hashref{name}.exe:\$(libslocal)
176 > ifdef MCCABE_DATA_DIR
177 > $$hashref{name}_mccabe.exe: \$(libslocal_d) $(MCCABE_DATA_DIR)/mccabeinstr/instplus.cpp
178 > endif
179 > $$hashref{name}_Insure.exe:\$(libslocal_I)
180 > $$hashref{name}_d:$$hashref{name}_d.exe
181 >        \@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
182 > $$hashref{name}_Insure:$$hashref{name}_Insure.exe
183 >        \@mv $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure
184 > $$hashref{name}:$$hashref{name}_d.exe
185 >        \@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
186 > $$hashref{name}_o:$$hashref{name}.exe
187 >        \@mv $$hashref{name}.exe \$(binarystore)/$$hashref{name}
188 > binfiles+=$$hashref{file}
189 > bintargets+=$$hashref{name} $$hashref{name}_d $$hashref{name}_Insure
190 > ENDTEXT
191 >        }
192   }
193  
194   sub External_StartTag {
# Line 119 | Line 197 | sub External_StartTag {
197          my $hashref;
198          
199          $hashref=$switch->SetupValueHash(\@vars);
200 +        if ( $Arch ) {
201 +        $$hashref{'ref'}=~tr[A-Z][a-z];
202          print GNUmakefile $$hashref{'ref'};
203          if ( defined $$hashref{'version'} ) {
204                  print GNUmakefile "_V_".$$hashref{'version'};
205          }
206          print GNUmakefile "=true\n";
207 +        }
208          
209   }      
210  
# Line 134 | Line 215 | sub Group_start {
215          
216          $hashref=$switch->SetupValueHash(\@vars);
217          $switch->checkparam($hashref, $name, 'name');
218 +        if ( $Arch ) {
219          print GNUmakefile "GROUP_".$$hashref{'name'};
220          if ( defined $$hashref{'version'} ) {
221                  print GNUmakefile "_V_".$$hashref{'version'};
222          }
223          print GNUmakefile "=true\n";
224 +        }
225   }      
226  
227   sub External {
# Line 165 | Line 248 | sub Use_start {
248          
249          $hashref=$switch->SetupValueHash(\@vars);
250          $switch->checkparam($hashref, $name, "name");
251 <        if ( $filename=checkfile("$ENV{INTsrc}/$$hashref{name}/BuildFile")
252 <                                                 ne "" ) {
253 <          print GNUmakefile "ReqDependencies += $filename\n";
251 >        if ( $Arch ) {
252 >        $filename=SCRAMUtils::checkfile(
253 >                "$ENV{INTsrc}/$$hashref{name}/BuildFile");
254 >        if ( $filename ne "" ) {
255 >          ParseBuildFile_Export( $filename );
256 >        }
257          }
172        print GNUmakefile "local__$$hashref{name}=true\n";
258   }
259  
260 < sub CheckBuildFile($directory) {
260 > sub CheckBuildFile {
261           my $classdir=shift;
262           $ClassName="";
263           $thisfile="$classdir/$buildfile";
# Line 202 | Line 287 | sub AssociateGroup {
287          }
288   }
289  
290 + sub ignoretag {
291 +        my $name=shift;
292 +        my @vars=@_;
293 +        
294 +        $Arch=0;
295 +        push @ARCHBLOCK, $Arch;
296 + }
297 +
298 + sub ignoretag_end {
299 +        my $name=shift;
300 +        my @vars=@_;
301 +        
302 +        pop @ARCHBLOCK;
303 +        $Arch=$ARCHBLOCK[$#ARCHBLOCK];
304 + }
305 +
306 + sub Arch_Start {
307 +        my $name=shift;
308 +        my @vars=@_;
309 +        my $hashref;
310 +
311 +        $hashref=$toolswitch->SetupValueHash( \@vars );
312 +        $toolswitch->checkparam($hashref, $name, 'name');
313 +        #( ($$hashref{name}=~/$ENV{SCRAM_ARCH}/) )?$Arch=1:$Arch=0;
314 +        ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($Arch=1) : ($Arch=0);
315 +        push @ARCHBLOCK, $Arch;
316 + }
317 + sub Arch_End {
318 +        my $name=shift;
319 +        my @vars=@_;
320 +
321 +        pop @ARCHBLOCK;
322 +        $Arch=$ARCHBLOCK[$#ARCHBLOCK];
323 + }
324 +
325   # Split up the Class Block String into a useable array
326 < sub _CutBlock($string) {
326 > sub _CutBlock {
327      my $string= shift @_;
328      @BlockClassA = split /\//, $string;
329   }
# Line 224 | Line 344 | sub setBlockClassPath {
344          $BlockClassPath=$BlockClassPath.":".$$hashref{path};
345          _CutBlock($$hashref{path});
346   }
347 +
348 + sub export_start {
349 + #Set up a toolfile object
350 +        $exporttool=Tool->new();
351 + }
352 +
353 + sub export_end {
354 + #Write toolfile object to disk
355 +        $exporttool->envtomake(\*GNUmakefile);
356 + }
357 +
358 + #
359 + # Export Mode Lib Tag
360 + #
361 + sub lib_start_export {
362 +        my $name=shift;
363 +        my @vars=@_;
364 +        my $hashref;
365 +
366 +        $hashref=$switchex->SetupValueHash( \@vars );
367 +        $switchex->checkparam($hashref, $name, 'name');
368 +        if ( $Arch ) {
369 +         if ( $switchex->context('export') ) {
370 +                #If export mode then add this env to the export tool
371 +                $exporttool->addenv('lib',$$hashref{name});
372 +         }
373 +        }
374 + }
375 +
376 + #
377 + # Standard lib tag
378 + #
379 + sub lib_start {
380 +        my $name=shift;
381 +        my @vars=@_;
382 +        my $hashref;
383 +
384 +        $hashref=$switch->SetupValueHash( \@vars );
385 +        $switch->checkparam($hashref, $name, 'name');
386 +        if ( $Arch ) {
387 +           print GNUmakefile "lib+=$$hashref{name}\n";
388 +        }
389 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines