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 by williamc, Tue Apr 13 17:30:19 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          };
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 +                'none' => 'none',
65 +                'export' => \&OutToMakefile,
66 +                'export_StartTag' => \&export_start,
67 +                'export_EndTag' => \&export_end,
68 +                'lib_StartTag' => \&lib_start_export,
69 +                'lib' => 'none'
70 +        };
71 +        use Utilities::Switcher;
72 +        $switchex=Switcher->new($SupportedTags, $filename);
73 +        $switchex->{Strict_no_cr}='no';
74 +        $switchex->parse(); # sort out supported tags
75 + }
76 +
77   sub initialterms() {
78          my $name=shift;
79          my @string=@_;
# Line 102 | Line 125 | sub Bin_start {
125          my $fileclass;
126          my @tools;
127          my $tool;
128 +        my $filename;
129 +        my $objectname;
130          
131          $hashref=$switch->SetupValueHash(\@vars);
132          $switch->checkparam($hashref, $name, 'file');
133          if ( ! defined $$hashref{name} ) {
134                  ($$hashref{name}=$$hashref{file})=~s/\..*//;
135          }
136 <        $fileclass=getclass($file);
137 <        $toolbox->maketargets("exe",$fileclass, $$hashref{name}, $file );
138 <        print GNUmakefile "bin::$file\n\n";
136 >        # This stuff for later
137 >        #$fileclass=$toolbox->getclass($file);
138 >        #$toolbox->maketargets("exe",$fileclass, $$hashref{name}, $file );
139 >        ($filename=$$hashref{file})=~s/\..*//;
140 >        ($objectname=$$hashref{file})=~s/\..*/\.o/;
141 >        ($objectname_d=$$hashref{file})=~s/\..*/_d\.o/;
142 >        ($objectname_Insure=$$hashref{file})=~s/\..*/_Insure\.o/;
143 >        print GNUmakefile "bin:$$hashref{name}\n";
144 >        print GNUmakefile "bin_debug:$$hashref{name}_d\n";
145 >        print GNUmakefile "bin_insure:$$hashref{name}_Insure\n";
146 >        print GNUmakefile ".INTERMEDIATE::$$hashref{name}_d.exe\n";
147 >        print GNUmakefile ".INTERMEDIATE::$$hashref{name}_Insure.exe\n";
148 >        print GNUmakefile ".INTERMEDIATE::$$hashref{name}.exe\n";
149 >        print GNUmakefile "$$hashref{name}_Insure:.psrc\n";
150 >        print GNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
151 >        print GNUmakefile "\t\$(CClinkCmdDebug)\n";
152 >        print GNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
153 >        print GNUmakefile "\t\$(CClinkCmdInsure)\n";
154 >        print GNUmakefile "$$hashref{name}.exe:$objectname\n";
155 >        print GNUmakefile "\t\$(CClinkCmd)\n";
156 >        print GNUmakefile "$objectname:$$hashref{name}.dep\n";
157 >        print GNUmakefile "$objectname_d:$$hashref{name}.dep\n";
158 >        print GNUmakefile "$objectname_Insure:$$hashref{name}.dep\n";
159 >        print GNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
160 >        print GNUmakefile "-include $$hashref{name}.dep\n";
161 > #       print GNUmakefile "$$hashref{name}:$$hashref{file}\n";
162 > print GNUmakefile <<ENDTEXT;
163 > $$hashref{name}_d.exe:\$(libslocal_d)
164 > $$hashref{name}.exe:\$(libslocal)
165 > $$hashref{name}_Insure.exe:\$(libslocal_I)
166 > $$hashref{name}_d:$$hashref{name}_d.exe
167 >        \@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
168 > $$hashref{name}_Insure:$$hashref{name}_Insure.exe
169 >        \@mv $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure
170 > $$hashref{name}:$$hashref{name}_d.exe
171 >        \@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
172 > $$hashref{name}_o:$$hashref{name}_o.exe
173 >        \@mv $$hashref{name}.exe \$(binarystore)/$$hashref{name}
174 > binfiles+=$filename
175 > bintargets+=$$hashref{name} $$hashref{name}_d $$hashref{name}_Insure
176 > ENDTEXT
177   }
178  
179   sub External_StartTag {
# Line 119 | Line 182 | sub External_StartTag {
182          my $hashref;
183          
184          $hashref=$switch->SetupValueHash(\@vars);
185 +        if ( $Arch ) {
186 +        $$hashref{'ref'}=~tr[A-Z][a-z];
187          print GNUmakefile $$hashref{'ref'};
188          if ( defined $$hashref{'version'} ) {
189                  print GNUmakefile "_V_".$$hashref{'version'};
190          }
191          print GNUmakefile "=true\n";
192 +        }
193          
194   }      
195  
# Line 165 | Line 231 | sub Use_start {
231          
232          $hashref=$switch->SetupValueHash(\@vars);
233          $switch->checkparam($hashref, $name, "name");
234 <        if ( $filename=checkfile("$ENV{INTsrc}/$$hashref{name}/BuildFile")
235 <                                                 ne "" ) {
236 <          print GNUmakefile "ReqDependencies += $filename\n";
234 >        $filename=SCRAMUtils::checkfile(
235 >                "$ENV{INTsrc}/$$hashref{name}/BuildFile");
236 >        if ( $filename ne "" ) {
237 >          ParseBuildFile_Export( $filename );
238          }
172        print GNUmakefile "local__$$hashref{name}=true\n";
239   }
240  
241 < sub CheckBuildFile($directory) {
241 > sub CheckBuildFile {
242           my $classdir=shift;
243           $ClassName="";
244           $thisfile="$classdir/$buildfile";
# Line 203 | Line 269 | sub AssociateGroup {
269   }
270  
271   # Split up the Class Block String into a useable array
272 < sub _CutBlock($string) {
272 > sub _CutBlock {
273      my $string= shift @_;
274      @BlockClassA = split /\//, $string;
275   }
# Line 224 | Line 290 | sub setBlockClassPath {
290          $BlockClassPath=$BlockClassPath.":".$$hashref{path};
291          _CutBlock($$hashref{path});
292   }
293 +
294 + sub export_start {
295 + #Set up a toolfile object
296 +        $exporttool=Tool->new();
297 + }
298 +
299 + sub export_end {
300 + #Write toolfile object to disk
301 +        $exporttool->envtomake(\*GNUmakefile);
302 + }
303 +
304 + #
305 + # Export Mode Lib Tag
306 + #
307 + sub lib_start_export {
308 +        my $name=shift;
309 +        my @vars=@_;
310 +        my $hashref;
311 +
312 +        $hashref=$switchex->SetupValueHash( \@vars );
313 +        $switchex->checkparam($hashref, $name, 'name');
314 +        if ( $Arch ) {
315 +         if ( $switchex->context('export') ) {
316 +                #If export mode then add this env to the export tool
317 +                $exporttool->addenv('lib',$$hashref{name});
318 +         }
319 +        }
320 + }
321 +
322 + #
323 + # Standard lib tag
324 + #
325 + sub lib_start {
326 +        my $name=shift;
327 +        my @vars=@_;
328 +        my $hashref;
329 +
330 +        $hashref=$switch->SetupValueHash( \@vars );
331 +        $switch->checkparam($hashref, $name, 'name');
332 +        if ( $Arch ) {
333 +           print GNUmakefile "lib+=$$hashref{name}\n";
334 +        }
335 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines