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.16 by williamc, Thu Apr 1 12:38:49 1999 UTC vs.
Revision 1.21.2.24 by williamc, Wed Oct 13 15:31:18 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
16   sub ParseBuildFile {
17          my $base=shift;
18 <        my $path=shift;
18 >        $path=shift;
19          my $filename=shift @_;
20          my $fullfilename="$base/$path/$filename";
21          #print "Processing $fullfilename\n";
22          # This hash defines which Document Elements we can use
23 +        $numbins=0;
24 +        $envnum=0;
25 +        $envlevel=0;
26 +        $currentenv="$ENV{LOCALTOP}/$ENV{INTwork}/${path}/BuildFile.mk";
27          my $SupportedTags={
28                  'Use' => \&OutToMakefile,
29                  'Use_StartTag' => \&Use_start,
# Line 32 | Line 38 | sub ParseBuildFile {
38                  'Bin' => 'none',
39                  'Bin_StartTag' => \&Bin_start,
40                  'ClassPath' => \&OutToMakefile,
41 <                'ClassPath_StartTag' => \&setBlockClassPath
41 >                'ClassPath_StartTag' => \&setBlockClassPath,
42 >                'Environment' => \&OutToMakefile,
43 >                'Environment_StartTag' => \&Environment_start,
44 >                'Environment_EndTag' => \&Environment_end,
45 >                'lib' => 'none',
46 >                'lib_StartTag' => \&lib_start,
47 >                'lib_EndTag' => 'none',
48 >                'ignore' => 'none',
49 >                'ignore_EndTag' => \&ignoretag_end,
50 >                'ignore_StartTag' => \&ignoretag,
51 >                'Architecture_StartTag' => \&Arch_Start,
52 >                'Architecture_EndTag' => \&Arch_End,
53 >                'Architecture' => \&OutToMakefile,
54 >                'LibType_StartTag' => \&LibType_Start,
55 >                'LibType_EndTag' => 'none',
56 >                #'LibType' => \&OutToScreen
57 >                'LibType' => \&LibType_text
58          };
59          use Utilities::Switcher;
60          $switch=Switcher->new($SupportedTags, $fullfilename);
# Line 40 | Line 62 | sub ParseBuildFile {
62          #open a temporary gnumakefile to store output.
63          use Utilities::AddDir;
64          AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/${path}");
65 <        open ( GNUmakefile, ">$ENV{LOCALTOP}/$ENV{INTwork}/${path}/BuildFile.mk") or die 'Unable to open /$ENV{INTwork}/${path}/BuildFile.mk $!\n';
65 >        my $fh=FileHandle->new();
66 >        open ( $fh, ">$ENV{LOCALTOP}/$ENV{INTwork}/${path}/BuildFile.mk"
67 >          ) or die 'Unable to open /$ENV{INTwork}/${path}/BuildFile.mk $!\n';
68 >        @filehandlestack=($fh);
69 >        # make an alias
70 > #       open ( GNUmakefile, ">&=$fh") or die 'Unable to create alias for '.
71 > #                       "Filehandle $!\n";
72 >        *GNUmakefile=$fh;
73          if ( -e $ENV{LatestBuildFile} ) {
74            print GNUmakefile "include $ENV{LatestBuildFile}\n";
75          }
# Line 48 | Line 77 | sub ParseBuildFile {
77   #               "$ENV{LOCALTOP}/$ENV{INTwork}/${path}/BuildFile.mk\n";
78          $ENV{LatestBuildFile}="$ENV{LOCALTOP}/$ENV{INTwork}/${path}/BuildFile.mk";
79          $switch->parse(); # sort out supported tags
80 +        if ( $numbins > 0 ) {
81 +         print GNUmakefile <<ENDTEXT;
82 + ifndef BINMODE
83 + help::
84 + \t\@echo Generic Binary targets
85 + \t\@echo ----------------------
86 + endif
87 + ENDTEXT
88 +         foreach $target ( keys %$targettypes ) {
89 +         print GNUmakefile <<ENDTEXT;
90 + ifndef BINMODE
91 + help::
92 + \t\@echo $target
93 + endif
94 + ENDTEXT
95 +         }
96 +        }
97          close GNUmakefile;
98   }
99  
100 + sub ParseBuildFile_Export {
101 +        my $filename=shift;
102 +        use Tool;
103 +        # This hash defines which Document Elements we can use
104 +        my $SupportedTags={
105 +                'none' => 'none',
106 +                'export' => \&OutToMakefile,
107 +                'export_StartTag' => \&export_start,
108 +                'export_EndTag' => \&export_end,
109 +                'lib_StartTag' => \&lib_start_export,
110 +                'External_StartTag' => \&Ext_start_export,
111 +                'lib' => 'none'
112 +        };
113 +        use Utilities::Switcher;
114 +        $switchex=Switcher->new($SupportedTags, $filename);
115 +        $switchex->{Strict_no_cr}='no';
116 +        $switchex->parse(); # sort out supported tags
117 + }
118 +
119   sub initialterms() {
120          my $name=shift;
121          my @string=@_;
# Line 80 | Line 145 | sub Class_StartTag {
145          my @vars=@_;
146          
147          $hashref=$switch->SetupValueHash(\@vars);
148 +        if ( $Arch ) {
149          if ( defined $$hashref{'type'} ) {
150                  $ClassName=$$hashref{'type'};
151          }
152 +        }
153   }
154  
155   sub ClassPath_StartTag {
# Line 91 | Line 158 | sub ClassPath_StartTag {
158          my $hashref;
159  
160          $hashref=$switch->SetupValueHash(\@vars);
161 +        if ( $Arch ) {
162          if ( defined $$hashref{'defaultpath'} ) {
163          }
164 +        }
165   }
166  
167   sub Bin_start {
# Line 107 | Line 176 | sub Bin_start {
176          
177          $hashref=$switch->SetupValueHash(\@vars);
178          $switch->checkparam($hashref, $name, 'file');
179 +        if ( $Arch ) {
180          if ( ! defined $$hashref{name} ) {
181                  ($$hashref{name}=$$hashref{file})=~s/\..*//;
182          }
183          # This stuff for later
184          #$fileclass=$toolbox->getclass($file);
185          #$toolbox->maketargets("exe",$fileclass, $$hashref{name}, $file );
186 +
187          ($filename=$$hashref{file})=~s/\..*//;
117        ($objectname=$$hashref{file})=~s/\..*/\.o/;
118        ($objectname_d=$$hashref{file})=~s/\..*/_d\.o/;
119        ($objectname_Insure=$$hashref{file})=~s/\..*/_Insure\.o/;
120        print GNUmakefile "bin:$$hashref{name}\n";
121        print GNUmakefile "bin_debug:$$hashref{name}_d\n";
122        print GNUmakefile "bin_insure:$$hashref{name}_Insure\n";
123        print GNUmakefile ".INTERMEDIATE::$$hashref{name}_d.exe\n";
124        print GNUmakefile ".INTERMEDIATE::$$hashref{name}_Insure.exe\n";
125        print GNUmakefile ".INTERMEDIATE::$$hashref{name}.exe\n";
126        print GNUmakefile "$$hashref{name}_Insure:.psrc\n";
127        print GNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
128        print GNUmakefile "\t\$(CClinkCmdDebug)\n";
129        print GNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
130        print GNUmakefile "\t\$(CClinkCmdInsure)\n";
131        print GNUmakefile "$$hashref{name}.exe:$objectname\n";
132        print GNUmakefile "\t\$(CClinkCmd)\n";
133        print GNUmakefile "$objectname:$$hashref{name}.dep\n";
134        print GNUmakefile "$objectname_d:$$hashref{name}.dep\n";
135        print GNUmakefile "$objectname_Insure:$$hashref{name}.dep\n";
136        print GNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
137        print GNUmakefile "-include $$hashref{name}.dep\n";
138 #       print GNUmakefile "$$hashref{name}:$$hashref{file}\n";
139        print GNUmakefile "$$hashref{name}_d:$$hashref{name}_d.exe\n";
140        print GNUmakefile "\t\@mv $$hashref{name}_d.exe \$(binarystore)/".
141                        "$$hashref{name}\n";
142        print GNUmakefile "$$hashref{name}_Insure:$$hashref{name}_Insure.exe\n";
143        print GNUmakefile "\t\@mv $$hashref{name}_Insure.exe \$(binarystore)/".
144                        "$$hashref{name}_Insure\n";
145        print GNUmakefile "$$hashref{name}:$$hashref{name}.exe\n";
146        print GNUmakefile "\t\@mv $$hashref{name}.exe \$(binarystore)/".
147                        "$$hashref{name}\n";
148        print GNUmakefile "binfiles+=$filename\n";
149        print GNUmakefile "bintargets+=$$hashref{name} $$hashref{name}_d\n";
150        print GNUmakefile "#files+=$$hashref{file}\n";
188  
189 +        # Create a new directory for each binary target
190 +        my $dirname="bin_".$$hashref{name};
191 +        AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname");
192 +        open (binGNUmakefile,
193 +           ">$ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname/BuildFile.mk") or die           "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname/".
194 +           "BuildFile.mk $!\n";
195 +
196 +        # Create the link targets
197 +        $numbins++;
198 +        my $fh=$filehandlestack[0];
199 +        print $fh <<ENDTEXT;
200 +
201 + # Link Targets to binary directories
202 + ifndef BINMODE
203 +
204 + define stepdown_$$hashref{'name'}
205 + if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname" ]; then \\
206 + echo - Invoking binary makefile \$\@ for $dirname; \\
207 + cd $ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname; \\
208 + \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk \$\@; \\
209 + fi
210 + echo - Finished binary makefile \$\@
211 + endef
212 +
213 + define stepdown2_$$hashref{'name'}
214 + if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname" ]; then \\
215 + echo - Invoking binary makefile \$\@ for $dirname; \\
216 + cd $ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname; \\
217 + \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk \$\*; \\
218 + fi
219 + echo - Finished binary makefile \$\@
220 +
221 + endef
222 +
223 + bin_$$hashref{'name'}_%:: dummy
224 +        \@\$(stepdown2_$$hashref{'name'})
225 +
226 + echo_%:: dummy
227 +        \@\$(stepdown_$$hashref{'name'})
228 +
229 + help bin bin_debug bin_debug_local bin_insure bin_Insure clean $$hashref{'name'}:: dummy
230 +        \@\$(stepdown_$$hashref{'name'})
231 + endif
232 +
233 + ENDTEXT
234 +
235 +
236 + # the binary specifics makefile
237 +        print binGNUmakefile "include $currentenv\n";
238 +        print binGNUmakefile "VPATH+=$ENV{LOCALTOP}/${path}\n";
239 +
240 + # alias for bin_Insure
241 +        print binGNUmakefile <<ENDTEXT;
242 +
243 + bin_insure:bin_Insure
244 + ifdef MAKETARGET_bin_insure
245 + MAKETARGET_$$hashref{name}_Insure=1
246 + endif
247 +
248 + # debuggging target
249 + $$hashref{'name'}_echo_% :: echo_%
250 +
251 + ENDTEXT
252 +
253 + # Make generic rules for each type
254 +        $targettypes={
255 +                "bin" => 'o',
256 +                "bin_debug" => 'd',
257 +                "bin_debug_local" => 'l_d',
258 +                "bin_Insure" => 'Insure'
259 +        };
260 +        #
261 +        foreach $target ( keys %$targettypes ) {
262 +          print binGNUmakefile <<ENDTEXT;
263 +
264 + # Type $target specifics
265 + ifdef MAKETARGET_$target
266 + MAKETARGET_$$hashref{name}_$$targettypes{$target}=1
267 + endif
268 + $target ::$$hashref{name}_$$targettypes{$target}
269 +
270 + bintargets+=$$hashref{name}_$$targettypes{$target}
271 + help::
272 + \t\@echo $$hashref{name}_$$targettypes{$target}
273 + clean::
274 + \t\@if [ -f \$(binarystore)/$$hashref{name}_$$targettypes{$target} ]; then \\
275 + \techo Removing \$(binarystore)/$$hashref{name}; \\
276 + \trm \$(binarystore)/$$hashref{name}_$$targettypes{$target}; \\
277 + \tfi
278 +
279 + ENDTEXT
280 +          ($objectname=$$hashref{file})=~s/\..*/_$$targettypes{$target}\.o/;
281 +          ${"objectname_$$targettypes{$target}"}=$objectname;
282 +          print binGNUmakefile "$objectname:$$hashref{name}.dep\n";
283 +        } # end loop
284 +
285 +        print binGNUmakefile "$$hashref{name}_Insure:.psrc\n";
286 +        print binGNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
287 +        print binGNUmakefile "\t\$(CClinkCmdDebug)\n";
288 +        print binGNUmakefile "$$hashref{name}_l_d.exe:$objectname_d\n";
289 +        print binGNUmakefile "\t\$(CClinkCmdDebugLocal)\n";
290 +        print binGNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
291 +        print binGNUmakefile "\t\$(CClinkCmdInsure)\n";
292 +        print binGNUmakefile "$$hashref{name}_o.exe:$objectname_o\n";
293 +        print binGNUmakefile "\t\$(CClinkCmd)\n";
294 +        print binGNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
295 +        print binGNUmakefile "-include $$hashref{name}.dep\n";
296 + print binGNUmakefile <<ENDTEXT;
297 + clean::
298 + \t\@if [ -f \$(binarystore)/$$hashref{name} ]; then \\
299 + \techo Removing \$(binarystore)/$$hashref{name}; \\
300 + \trm \$(binarystore)/$$hashref{name}; \\
301 + \tfi
302 +
303 + $$hashref{name}_d.exe:\$(libslocal_d)
304 + $$hashref{name}_o.exe:\$(libslocal)
305 + ifdef MCCABE_DATA_DIR
306 + $$hashref{name}_mccabe.exe: \$(libslocal_d) \$(MCCABE_DATA_DIR)/mccabeinstr/instplus.cpp
307 + endif
308 + $$hashref{name}_Insure.exe:\$(libslocal_I)
309 + $$hashref{name}_d:$$hashref{name}_d.exe
310 +        \@cp $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
311 + $$hashref{name}_l_d:$$hashref{name}_l_d.exe
312 +        \@cp $$hashref{name}_l_d.exe \$(binarystore)/$$hashref{name}
313 + $$hashref{name}_Insure:$$hashref{name}_Insure.exe
314 +        \@cp $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure
315 + $$hashref{name}:$$hashref{name}_d.exe
316 +        \@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
317 + $$hashref{name}_o:$$hashref{name}_o.exe
318 +        \@mv $$hashref{name}_o.exe \$(binarystore)/$$hashref{name}
319 + binfiles+=$$hashref{file}
320 + ENDTEXT
321 +        }
322 +        close binGNUmakefile;
323 + }
324 +
325 + sub Ext_start_export {
326 +        my $name=shift;
327 +        my @vars=@_;
328 +        my $hashref;
329 +        
330 +        $hashref=$switch->SetupValueHash(\@vars);
331 +        if ( $Arch ) {
332 +         if ( $switchex->context('export') ) {
333 +          $$hashref{'ref'}=~tr[A-Z][a-z];
334 +          print GNUmakefile $$hashref{'ref'};
335 +          if ( defined $$hashref{'version'} ) {
336 +                print GNUmakefile "_V_".$$hashref{'version'};
337 +          }
338 +          print GNUmakefile "=true\n";
339 +         }
340 +        }
341   }
342  
343   sub External_StartTag {
# Line 157 | Line 346 | sub External_StartTag {
346          my $hashref;
347          
348          $hashref=$switch->SetupValueHash(\@vars);
349 +        if ( $Arch ) {
350          $$hashref{'ref'}=~tr[A-Z][a-z];
351          print GNUmakefile $$hashref{'ref'};
352          if ( defined $$hashref{'version'} ) {
353                  print GNUmakefile "_V_".$$hashref{'version'};
354          }
355          print GNUmakefile "=true\n";
356 +        }
357          
358   }      
359  
# Line 173 | Line 364 | sub Group_start {
364          
365          $hashref=$switch->SetupValueHash(\@vars);
366          $switch->checkparam($hashref, $name, 'name');
367 +        if ( $Arch ) {
368          print GNUmakefile "GROUP_".$$hashref{'name'};
369          if ( defined $$hashref{'version'} ) {
370                  print GNUmakefile "_V_".$$hashref{'version'};
371          }
372          print GNUmakefile "=true\n";
373 +        }
374   }      
375  
376   sub External {
# Line 204 | Line 397 | sub Use_start {
397          
398          $hashref=$switch->SetupValueHash(\@vars);
399          $switch->checkparam($hashref, $name, "name");
400 <        if ( $filename=checkfile("$ENV{INTsrc}/$$hashref{name}/BuildFile")
401 <                                                 ne "" ) {
402 <          print GNUmakefile "ReqDependencies += $filename\n";
400 >        if ( $Arch ) {
401 >        $filename=SCRAMUtils::checkfile(
402 >                "$ENV{INTsrc}/$$hashref{name}/BuildFile");
403 >        if ( $filename ne "" ) {
404 >          ParseBuildFile_Export( $filename );
405 >        }
406          }
211        print GNUmakefile "local__$$hashref{name}=true\n";
407   }
408  
409   sub CheckBuildFile {
# Line 241 | Line 436 | sub AssociateGroup {
436          }
437   }
438  
439 + sub ignoretag {
440 +        my $name=shift;
441 +        my @vars=@_;
442 +        
443 +        $Arch=0;
444 +        push @ARCHBLOCK, $Arch;
445 + }
446 +
447 + sub ignoretag_end {
448 +        my $name=shift;
449 +        my @vars=@_;
450 +        
451 +        pop @ARCHBLOCK;
452 +        $Arch=$ARCHBLOCK[$#ARCHBLOCK];
453 + }
454 +
455 + sub Arch_Start {
456 +        my $name=shift;
457 +        my @vars=@_;
458 +        my $hashref;
459 +
460 +        $hashref=$toolswitch->SetupValueHash( \@vars );
461 +        $toolswitch->checkparam($hashref, $name, 'name');
462 +        #( ($$hashref{name}=~/$ENV{SCRAM_ARCH}/) )?$Arch=1:$Arch=0;
463 +        ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($Arch=1) : ($Arch=0);
464 +        push @ARCHBLOCK, $Arch;
465 + }
466 + sub Arch_End {
467 +        my $name=shift;
468 +        my @vars=@_;
469 +
470 +        pop @ARCHBLOCK;
471 +        $Arch=$ARCHBLOCK[$#ARCHBLOCK];
472 + }
473 +
474   # Split up the Class Block String into a useable array
475   sub _CutBlock {
476      my $string= shift @_;
# Line 251 | Line 481 | sub OutToMakefile {
481          my $name=shift;
482          my @vars=@_;
483  
484 <        print GNUmakefile @vars;
484 >        if ( $Arch ) {
485 >          print GNUmakefile @vars;
486 >        }
487 > }
488 > sub OutToScreen {
489 >        my $name=shift;
490 >        my @vars=@_;
491 >
492 >        if ( $Arch ) {
493 >          print @vars;
494 >        }
495   }
496   sub setBlockClassPath {
497          my $name=shift;
# Line 263 | Line 503 | sub setBlockClassPath {
503          $BlockClassPath=$BlockClassPath.":".$$hashref{path};
504          _CutBlock($$hashref{path});
505   }
506 +
507 + sub export_start {
508 + #Set up a toolfile object
509 +        $exporttool=Tool->new();
510 + }
511 +
512 + sub export_end {
513 + #Write toolfile object to disk
514 +        $exporttool->envtomake(\*GNUmakefile);
515 + }
516 +
517 + #
518 + # Export Mode Lib Tag
519 + #
520 + sub lib_start_export {
521 +        my $name=shift;
522 +        my @vars=@_;
523 +        my $hashref;
524 +
525 +        $hashref=$switchex->SetupValueHash( \@vars );
526 +        $switchex->checkparam($hashref, $name, 'name');
527 +        if ( $Arch ) {
528 +         if ( $switchex->context('export') ) {
529 +                #If export mode then add this env to the export tool
530 +                $exporttool->addenv('lib',$$hashref{name});
531 +         }
532 +        }
533 + }
534 +
535 + #
536 + # Standard lib tag
537 + #
538 + sub lib_start {
539 +        my $name=shift;
540 +        my @vars=@_;
541 +        my $hashref;
542 +
543 +        $hashref=$switch->SetupValueHash( \@vars );
544 +        $switch->checkparam($hashref, $name, 'name');
545 +        if ( $Arch ) {
546 +           print GNUmakefile "lib+=$$hashref{name}\n";
547 +        }
548 + }
549 +
550 + #
551 + # libtype specification
552 + #
553 + sub LibType_Start {
554 +        my $name=shift;
555 +        my @vars=@_;
556 +        my $hashref;
557 +
558 +        if ( $Arch ) {
559 +        $hashref=$switch->SetupValueHash( \@vars );
560 +        $switch->checkparam($hashref, $name, 'type');
561 +        
562 +        print GNUmakefile "# Specify Library Type\n";
563 +        print GNUmakefile "DefaultLibsOff=yes\n";
564 +        if ( $$hashref{'type'}=~/^archive/i ) {
565 +          print GNUmakefile "LibArchive=true\n";
566 +        }
567 +        elsif ($$hashref{'type'}=~/debug_archive/i ) {
568 +          print GNUmakefile "LibDebugArchive=true\n";
569 +        }
570 +        elsif ($$hashref{'type'}=~/debug_shared/i ) {
571 +          print GNUmakefile "LibDebugShared=true\n";
572 +        }
573 +        elsif ($$hashref{'type'}=~/shared/i ) {
574 +          print GNUmakefile 'LibShared=true'."\n";
575 +        }
576 +        print GNUmakefile "\n";
577 +        }
578 + }
579 + sub LibType_text {
580 +        my $name=shift;
581 +        my @vars=@_;
582 +
583 +        if ( $Arch ) {
584 +          print GNUmakefile "libmsg::\n\t\@echo Library info: ";
585 +          print GNUmakefile @vars;
586 +          print GNUmakefile "\n";
587 +        }
588 + }
589 +
590 + sub Environment_start {
591 +        my $name=shift;
592 +        my @vars=@_;
593 +        my $hashref;
594 +
595 +        if ( $Arch ) {
596 +          $envnum++;
597 +
598 +          # open a new Environment File
599 +          my $envfile="$ENV{LOCALTOP}/$ENV{INTwork}/${path}/Env_$envnum.mk";
600 +          use FileHandle;
601 +          my $fh=FileHandle->new();
602 +          open ($fh,">$envfile") or die "Unable to open file $envfile \n$!\n";
603 +          push @filehandlestack, $fh;
604 +          *GNUmakefile=$fh;
605 +
606 +          # include the approprate environment file
607 +          if ( $envlevel == 0 ) {
608 +             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/${path}/".
609 +                                "BuildFile.mk\n";
610 +          }
611 +          else {
612 +             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/${path}/".
613 +                                "Env_$Envlevels[$envlevel]\.mk\n";
614 +          }
615 +          $envlevel++;
616 +          $Envlevels[$envlevel]=$envnum;
617 +          $currentenv="$ENV{LOCALTOP}/$ENV{INTwork}/${path}/Env_$envnum.mk";
618 +        }
619 + }
620 +
621 + sub Environment_end {
622 +        my $fd;
623 +
624 +        if ( $Arch ) {
625 +          $envlevel--;
626 +          if ( $envlevel < 0 ) {
627 +            print "Too many </Environent> Tags on $switch->line()\n";
628 +            exit;
629 +          }
630 +          close GNUmakefile;
631 +          # restore the last filehandle
632 +          $fd=pop @filehandlestack;
633 +          close $fd;
634 +          *GNUmakefile=$filehandlestack[$#filehandlestack];
635 +          if ( $envlevel < 1 ) {
636 +            $currentenv="$ENV{LOCALTOP}/$ENV{INTwork}/${path}/BuildFile.mk";
637 +          }
638 +          else {
639 +            $currentenv=
640 +             "$ENV{LOCALTOP}/$ENV{INTwork}/${path}/Env_$Envlevels[$envlevel]";
641 +          }
642 +        }
643 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines