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.4 by williamc, Wed Mar 3 17:04:13 1999 UTC vs.
Revision 1.22 by williamc, Wed Apr 14 13:18:41 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 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          };
42          use Utilities::Switcher;
43          $switch=Switcher->new($SupportedTags, $fullfilename);
# Line 51 | Line 56 | sub ParseBuildFile {
56          close GNUmakefile;
57   }
58  
59 + sub ParseBuildFile_Export {
60 +        my $filename=shift;
61 +        use Tool;
62 +        # This hash defines which Document Elements we can use
63 +        my $SupportedTags={
64 +                'Use' => \&OutToMakefile,
65 +                'Use_StartTag' => \&Use_start,
66 +                'External' => \&OutToMakefile,
67 +                'External_StartTag' => \&External_StartTag,
68 +                'none' => 'none',
69 +                'export' => \&OutToMakefile,
70 +                'export_StartTag' => \&export_start,
71 +                'export_EndTag' => \&export_end,
72 +                'lib_StartTag' => \&lib_start_export,
73 +                'lib' => 'none'
74 +        };
75 +        use Utilities::Switcher;
76 +        $switchex=Switcher->new($SupportedTags, $filename);
77 +        $switchex->{Strict_no_cr}='no';
78 +        push @switchstack, $switchex;
79 +        $switchex->parse(); # sort out supported tags
80 +        pop @switchstack;
81 +        $switchex=$switchstack[$#switchstack]; # Make sure we can Use multiply
82 + }
83 +
84   sub initialterms() {
85          my $name=shift;
86          my @string=@_;
# Line 102 | Line 132 | sub Bin_start {
132          my $fileclass;
133          my @tools;
134          my $tool;
135 +        my $filename;
136 +        my $objectname;
137          
138          $hashref=$switch->SetupValueHash(\@vars);
139          $switch->checkparam($hashref, $name, 'file');
# Line 111 | Line 143 | sub Bin_start {
143          # This stuff for later
144          #$fileclass=$toolbox->getclass($file);
145          #$toolbox->maketargets("exe",$fileclass, $$hashref{name}, $file );
146 <        print GNUmakefile "bin::$$hashref{name}\n";
147 <        print GNUmakefile "$$hashref{name}::$$hashref{file}\n";
146 >        ($filename=$$hashref{file})=~s/\..*//;
147 >        ($objectname=$$hashref{file})=~s/\..*/\.o/;
148 >        ($objectname_d=$$hashref{file})=~s/\..*/_d\.o/;
149 >        ($objectname_Insure=$$hashref{file})=~s/\..*/_Insure\.o/;
150 >        print GNUmakefile "bin:$$hashref{name}\n";
151 >        print GNUmakefile "bin_debug:$$hashref{name}_d\n";
152 >        print GNUmakefile "bin_insure:$$hashref{name}_Insure\n";
153 >        print GNUmakefile ".INTERMEDIATE::$$hashref{name}_d.exe\n";
154 >        print GNUmakefile ".INTERMEDIATE::$$hashref{name}_Insure.exe\n";
155 >        print GNUmakefile ".INTERMEDIATE::$$hashref{name}.exe\n";
156 >        print GNUmakefile "$$hashref{name}_Insure:.psrc\n";
157 >        print GNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
158 >        print GNUmakefile "\t\$(CClinkCmdDebug)\n";
159 >        print GNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
160 >        print GNUmakefile "\t\$(CClinkCmdInsure)\n";
161 >        print GNUmakefile "$$hashref{name}.exe:$objectname\n";
162 >        print GNUmakefile "\t\$(CClinkCmd)\n";
163 >        print GNUmakefile "$objectname:$$hashref{name}.dep\n";
164 >        print GNUmakefile "$objectname_d:$$hashref{name}.dep\n";
165 >        print GNUmakefile "$objectname_Insure:$$hashref{name}.dep\n";
166 >        print GNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
167 >        print GNUmakefile "-include $$hashref{name}.dep\n";
168 > #       print GNUmakefile "$$hashref{name}:$$hashref{file}\n";
169 > print GNUmakefile <<ENDTEXT;
170 > $$hashref{name}_d.exe:\$(libslocal_d)
171 > $$hashref{name}.exe:\$(libslocal)
172 > $$hashref{name}_Insure.exe:\$(libslocal_I)
173 > $$hashref{name}_d:$$hashref{name}_d.exe
174 >        \@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
175 > $$hashref{name}_Insure:$$hashref{name}_Insure.exe
176 >        \@mv $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure
177 > $$hashref{name}:$$hashref{name}_d.exe
178 >        \@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
179 > $$hashref{name}_o:$$hashref{name}_o.exe
180 >        \@mv $$hashref{name}.exe \$(binarystore)/$$hashref{name}
181 > binfiles+=$filename
182 > bintargets+=$$hashref{name} $$hashref{name}_d $$hashref{name}_Insure
183 > ENDTEXT
184   }
185  
186   sub External_StartTag {
# Line 121 | Line 189 | sub External_StartTag {
189          my $hashref;
190          
191          $hashref=$switch->SetupValueHash(\@vars);
192 +        if ( $Arch ) {
193 +        $$hashref{'ref'}=~tr[A-Z][a-z];
194          print GNUmakefile $$hashref{'ref'};
195          if ( defined $$hashref{'version'} ) {
196                  print GNUmakefile "_V_".$$hashref{'version'};
197          }
198          print GNUmakefile "=true\n";
199 +        }
200          
201   }      
202  
# Line 167 | Line 238 | sub Use_start {
238          
239          $hashref=$switch->SetupValueHash(\@vars);
240          $switch->checkparam($hashref, $name, "name");
241 <        if ( $filename=checkfile("$ENV{INTsrc}/$$hashref{name}/BuildFile")
242 <                                                 ne "" ) {
243 <          print GNUmakefile "ReqDependencies += $filename\n";
241 >        $filename=SCRAMUtils::checkfile(
242 >                "$ENV{INTsrc}/$$hashref{name}/BuildFile");
243 >        if ( $filename ne "" ) {
244 >          ParseBuildFile_Export( $filename );
245          }
174        print GNUmakefile "local__$$hashref{name}=true\n";
246   }
247  
248 < sub CheckBuildFile($directory) {
248 > sub CheckBuildFile {
249           my $classdir=shift;
250           $ClassName="";
251           $thisfile="$classdir/$buildfile";
# Line 205 | Line 276 | sub AssociateGroup {
276   }
277  
278   # Split up the Class Block String into a useable array
279 < sub _CutBlock($string) {
279 > sub _CutBlock {
280      my $string= shift @_;
281      @BlockClassA = split /\//, $string;
282   }
# Line 226 | Line 297 | sub setBlockClassPath {
297          $BlockClassPath=$BlockClassPath.":".$$hashref{path};
298          _CutBlock($$hashref{path});
299   }
300 +
301 + sub export_start {
302 + #Set up a toolfile object
303 +        $exporttool=Tool->new();
304 + }
305 +
306 + sub export_end {
307 + #Write toolfile object to disk
308 +        $exporttool->envtomake(\*GNUmakefile);
309 + }
310 +
311 + #
312 + # Export Mode Lib Tag
313 + #
314 + sub lib_start_export {
315 +        my $name=shift;
316 +        my @vars=@_;
317 +        my $hashref;
318 +
319 +        $hashref=$switchex->SetupValueHash( \@vars );
320 +        $switchex->checkparam($hashref, $name, 'name');
321 +        if ( $Arch ) {
322 +         if ( $switchex->context('export') ) {
323 +                #If export mode then add this env to the export tool
324 +                $exporttool->addenv('lib',$$hashref{name});
325 +         }
326 +        }
327 + }
328 +
329 + #
330 + # Standard lib tag
331 + #
332 + sub lib_start {
333 +        my $name=shift;
334 +        my @vars=@_;
335 +        my $hashref;
336 +
337 +        $hashref=$switch->SetupValueHash( \@vars );
338 +        $switch->checkparam($hashref, $name, 'name');
339 +        if ( $Arch ) {
340 +           print GNUmakefile "lib+=$$hashref{name}\n";
341 +        }
342 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines