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.14 by williamc, Thu Apr 1 08:27:33 1999 UTC vs.
Revision 1.21.2.14 by williamc, Wed Sep 15 07:46:59 1999 UTC

# Line 8 | Line 8 | BEGIN {
8   use ToolBox;
9   $buildfile="BuildFile";
10   $toolbox=ToolBox->new();
11 + $Arch=1;
12 + push @ARCHBLOCK, $Arch;
13   }
14  
15   #Parse the BuildFile
# Line 32 | Line 34 | sub ParseBuildFile {
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 >                'LibType_StartTag' => \&LibType_Start,
48 >                'LibType_EndTag' => 'none',
49 >                'LibType' => \&OutToScreen
50          };
51          use Utilities::Switcher;
52          $switch=Switcher->new($SupportedTags, $fullfilename);
# Line 51 | Line 65 | sub ParseBuildFile {
65          close GNUmakefile;
66   }
67  
68 + sub ParseBuildFile_Export {
69 +        my $filename=shift;
70 +        use Tool;
71 +        # This hash defines which Document Elements we can use
72 +        my $SupportedTags={
73 +                'none' => 'none',
74 +                'export' => \&OutToMakefile,
75 +                'export_StartTag' => \&export_start,
76 +                'export_EndTag' => \&export_end,
77 +                'lib_StartTag' => \&lib_start_export,
78 +                'External_StartTag' => \&Ext_start_export,
79 +                'lib' => 'none'
80 +        };
81 +        use Utilities::Switcher;
82 +        $switchex=Switcher->new($SupportedTags, $filename);
83 +        $switchex->{Strict_no_cr}='no';
84 +        $switchex->parse(); # sort out supported tags
85 + }
86 +
87   sub initialterms() {
88          my $name=shift;
89          my @string=@_;
# Line 80 | Line 113 | sub Class_StartTag {
113          my @vars=@_;
114          
115          $hashref=$switch->SetupValueHash(\@vars);
116 +        if ( $Arch ) {
117          if ( defined $$hashref{'type'} ) {
118                  $ClassName=$$hashref{'type'};
119          }
120 +        }
121   }
122  
123   sub ClassPath_StartTag {
# Line 91 | Line 126 | sub ClassPath_StartTag {
126          my $hashref;
127  
128          $hashref=$switch->SetupValueHash(\@vars);
129 +        if ( $Arch ) {
130          if ( defined $$hashref{'defaultpath'} ) {
131          }
132 +        }
133   }
134  
135   sub Bin_start {
# Line 107 | Line 144 | sub Bin_start {
144          
145          $hashref=$switch->SetupValueHash(\@vars);
146          $switch->checkparam($hashref, $name, 'file');
147 +        if ( $Arch ) {
148          if ( ! defined $$hashref{name} ) {
149                  ($$hashref{name}=$$hashref{file})=~s/\..*//;
150          }
# Line 117 | Line 155 | sub Bin_start {
155          ($objectname=$$hashref{file})=~s/\..*/\.o/;
156          ($objectname_d=$$hashref{file})=~s/\..*/_d\.o/;
157          ($objectname_Insure=$$hashref{file})=~s/\..*/_Insure\.o/;
158 <        print GNUmakefile "bin:$$hashref{name}\n";
158 >        print GNUmakefile "bin:$$hashref{name}_o\n";
159          print GNUmakefile "bin_debug:$$hashref{name}_d\n";
160          print GNUmakefile "bin_insure:$$hashref{name}_Insure\n";
161 <        print GNUmakefile ".INTERMEDIATE::$$hashref{name}_d.exe\n";
162 <        print GNUmakefile ".INTERMEDIATE::$$hashref{name}_Insure.exe\n";
161 > #       print GNUmakefile ".INTERMEDIATE::$$hashref{name}_d.exe\n";
162 > #       print GNUmakefile ".INTERMEDIATE::$$hashref{name}_Insure.exe\n";
163          print GNUmakefile ".INTERMEDIATE::$$hashref{name}.exe\n";
164          print GNUmakefile "$$hashref{name}_Insure:.psrc\n";
165          print GNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
166 +        print GNUmakefile "\t\$(CClinkCmdDebug)\n";
167          print GNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
168 +        print GNUmakefile "\t\$(CClinkCmdInsure)\n";
169          print GNUmakefile "$$hashref{name}.exe:$objectname\n";
170 +        print GNUmakefile "\t\$(CClinkCmd)\n";
171 +        print GNUmakefile "$objectname:$$hashref{name}.dep\n";
172 +        print GNUmakefile "$objectname_d:$$hashref{name}.dep\n";
173 +        print GNUmakefile "$objectname_Insure:$$hashref{name}.dep\n";
174 +        print GNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
175 +        print GNUmakefile "-include $$hashref{name}.dep\n";
176   #       print GNUmakefile "$$hashref{name}:$$hashref{file}\n";
177 <        print GNUmakefile "$$hashref{name}_d:$$hashref{name}_d.exe\n";
178 <        print GNUmakefile "\t\@mv $$hashref{name}_d.exe \$(binarystore)/".
179 <                        "$$hashref{name}\n";
180 <        print GNUmakefile "$$hashref{name}_Insure:$$hashref{name}_Insure.exe\n";
181 <        print GNUmakefile "\t\@mv $$hashref{name}_Insure.exe \$(binarystore)/".
182 <                        "$$hashref{name}_Insure\n";
183 <        print GNUmakefile "$$hashref{name}:$$hashref{name}.exe\n";
184 <        print GNUmakefile "\t\@mv $$hashref{name}.exe \$(binarystore)/".
185 <                        "$$hashref{name}\n";
186 <        print GNUmakefile "binfiles+=$filename\n";
187 <        print GNUmakefile "bintargets+=$$hashref{name} $$hashref{name}_d\n";
188 <        print GNUmakefile "files+=$$hashref{file}\n";
177 > print GNUmakefile <<ENDTEXT;
178 > $$hashref{name}_d.exe:\$(libslocal_d)
179 > $$hashref{name}.exe:\$(libslocal)
180 > ifdef MCCABE_DATA_DIR
181 > $$hashref{name}_mccabe.exe: \$(libslocal_d) $(MCCABE_DATA_DIR)/mccabeinstr/instplus.cpp
182 > endif
183 > $$hashref{name}_Insure.exe:\$(libslocal_I)
184 > $$hashref{name}_d:$$hashref{name}_d.exe
185 >        \@cp $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
186 > $$hashref{name}_Insure:$$hashref{name}_Insure.exe
187 >        \@cp $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure
188 > $$hashref{name}:$$hashref{name}_d.exe
189 >        \@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
190 > $$hashref{name}_o:$$hashref{name}.exe
191 >        \@mv $$hashref{name}.exe \$(binarystore)/$$hashref{name}
192 > binfiles+=$$hashref{file}
193 > bintargets+=$$hashref{name} $$hashref{name}_d $$hashref{name}_Insure
194 > ENDTEXT
195 >        }
196 > }
197  
198 + sub Ext_start_export {
199 +        my $name=shift;
200 +        my @vars=@_;
201 +        my $hashref;
202 +        
203 +        $hashref=$switch->SetupValueHash(\@vars);
204 +        if ( $Arch ) {
205 +         if ( $switchex->context('export') ) {
206 +          $$hashref{'ref'}=~tr[A-Z][a-z];
207 +          print GNUmakefile $$hashref{'ref'};
208 +          if ( defined $$hashref{'version'} ) {
209 +                print GNUmakefile "_V_".$$hashref{'version'};
210 +          }
211 +          print GNUmakefile "=true\n";
212 +         }
213 +        }
214   }
215  
216   sub External_StartTag {
# Line 149 | Line 219 | sub External_StartTag {
219          my $hashref;
220          
221          $hashref=$switch->SetupValueHash(\@vars);
222 +        if ( $Arch ) {
223          $$hashref{'ref'}=~tr[A-Z][a-z];
224          print GNUmakefile $$hashref{'ref'};
225          if ( defined $$hashref{'version'} ) {
226                  print GNUmakefile "_V_".$$hashref{'version'};
227          }
228          print GNUmakefile "=true\n";
229 +        }
230          
231   }      
232  
# Line 165 | Line 237 | sub Group_start {
237          
238          $hashref=$switch->SetupValueHash(\@vars);
239          $switch->checkparam($hashref, $name, 'name');
240 +        if ( $Arch ) {
241          print GNUmakefile "GROUP_".$$hashref{'name'};
242          if ( defined $$hashref{'version'} ) {
243                  print GNUmakefile "_V_".$$hashref{'version'};
244          }
245          print GNUmakefile "=true\n";
246 +        }
247   }      
248  
249   sub External {
# Line 196 | Line 270 | sub Use_start {
270          
271          $hashref=$switch->SetupValueHash(\@vars);
272          $switch->checkparam($hashref, $name, "name");
273 <        if ( $filename=checkfile("$ENV{INTsrc}/$$hashref{name}/BuildFile")
274 <                                                 ne "" ) {
275 <          print GNUmakefile "ReqDependencies += $filename\n";
273 >        if ( $Arch ) {
274 >        $filename=SCRAMUtils::checkfile(
275 >                "$ENV{INTsrc}/$$hashref{name}/BuildFile");
276 >        if ( $filename ne "" ) {
277 >          ParseBuildFile_Export( $filename );
278 >        }
279          }
203        print GNUmakefile "local__$$hashref{name}=true\n";
280   }
281  
282   sub CheckBuildFile {
# Line 233 | Line 309 | sub AssociateGroup {
309          }
310   }
311  
312 + sub ignoretag {
313 +        my $name=shift;
314 +        my @vars=@_;
315 +        
316 +        $Arch=0;
317 +        push @ARCHBLOCK, $Arch;
318 + }
319 +
320 + sub ignoretag_end {
321 +        my $name=shift;
322 +        my @vars=@_;
323 +        
324 +        pop @ARCHBLOCK;
325 +        $Arch=$ARCHBLOCK[$#ARCHBLOCK];
326 + }
327 +
328 + sub Arch_Start {
329 +        my $name=shift;
330 +        my @vars=@_;
331 +        my $hashref;
332 +
333 +        $hashref=$toolswitch->SetupValueHash( \@vars );
334 +        $toolswitch->checkparam($hashref, $name, 'name');
335 +        #( ($$hashref{name}=~/$ENV{SCRAM_ARCH}/) )?$Arch=1:$Arch=0;
336 +        ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($Arch=1) : ($Arch=0);
337 +        push @ARCHBLOCK, $Arch;
338 + }
339 + sub Arch_End {
340 +        my $name=shift;
341 +        my @vars=@_;
342 +
343 +        pop @ARCHBLOCK;
344 +        $Arch=$ARCHBLOCK[$#ARCHBLOCK];
345 + }
346 +
347   # Split up the Class Block String into a useable array
348   sub _CutBlock {
349      my $string= shift @_;
# Line 245 | Line 356 | sub OutToMakefile {
356  
357          print GNUmakefile @vars;
358   }
359 + sub OutToScreen {
360 +        my $name=shift;
361 +        my @vars=@_;
362 +
363 +        print @vars;
364 + }
365   sub setBlockClassPath {
366          my $name=shift;
367          my @vars=@_;
# Line 255 | Line 372 | sub setBlockClassPath {
372          $BlockClassPath=$BlockClassPath.":".$$hashref{path};
373          _CutBlock($$hashref{path});
374   }
375 +
376 + sub export_start {
377 + #Set up a toolfile object
378 +        $exporttool=Tool->new();
379 + }
380 +
381 + sub export_end {
382 + #Write toolfile object to disk
383 +        $exporttool->envtomake(\*GNUmakefile);
384 + }
385 +
386 + #
387 + # Export Mode Lib Tag
388 + #
389 + sub lib_start_export {
390 +        my $name=shift;
391 +        my @vars=@_;
392 +        my $hashref;
393 +
394 +        $hashref=$switchex->SetupValueHash( \@vars );
395 +        $switchex->checkparam($hashref, $name, 'name');
396 +        if ( $Arch ) {
397 +         if ( $switchex->context('export') ) {
398 +                #If export mode then add this env to the export tool
399 +                $exporttool->addenv('lib',$$hashref{name});
400 +         }
401 +        }
402 + }
403 +
404 + #
405 + # Standard lib tag
406 + #
407 + sub lib_start {
408 +        my $name=shift;
409 +        my @vars=@_;
410 +        my $hashref;
411 +
412 +        $hashref=$switch->SetupValueHash( \@vars );
413 +        $switch->checkparam($hashref, $name, 'name');
414 +        if ( $Arch ) {
415 +           print GNUmakefile "lib+=$$hashref{name}\n";
416 +        }
417 + }
418 +
419 + #
420 + # libtype specification
421 + #
422 + sub LibType_Start {
423 +        my $name=shift;
424 +        my @vars=@_;
425 +        my $hashref;
426 +
427 +        if ( $Arch ) {
428 +        $hashref=$switch->SetupValueHash( \@vars );
429 +        $switch->checkparam($hashref, $name, 'type');
430 +        
431 +        print GNUmakefile "# Specify Library Type\n";
432 +        print GNUmakefile "DefaultLibsOff=yes\n";
433 +        if ( $$hashref{'type'}=~/^archive/i ) {
434 +          print GNUmakefile "LibArchive=true\n";
435 +        }
436 +        elsif ($$hashref{'type'}=~/debug_archive/i ) {
437 +          print GNUmakefile "LibDebugArchive=true\n";
438 +        }
439 +        elsif ($$hashref{'type'}=~/debug_shared/i ) {
440 +          print GNUmakefile "LibDebugShared=true\n";
441 +        }
442 +        elsif ($$hashref{'type'}=~/shared/i ) {
443 +          print GNUmakefile 'LibShared=true'."\n";
444 +        }
445 +        print GNUmakefile "\n";
446 +        }
447 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines