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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines