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.25 by williamc, Wed Oct 13 16:01: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 "$$hashref{name}_Insure.exe:$objectname_Insure\n";
129        print GNUmakefile "$$hashref{name}.exe:$objectname\n";
130 #       print GNUmakefile "$$hashref{name}:$$hashref{file}\n";
131        print GNUmakefile "$$hashref{name}_d:$$hashref{name}_d.exe\n";
132        print GNUmakefile "\t\@mv $$hashref{name}_d.exe \$(binarystore)/".
133                        "$$hashref{name}\n";
134        print GNUmakefile "$$hashref{name}_Insure:$$hashref{name}_Insure.exe\n";
135        print GNUmakefile "\t\@mv $$hashref{name}_Insure.exe \$(binarystore)/".
136                        "$$hashref{name}_Insure\n";
137        print GNUmakefile "$$hashref{name}:$$hashref{name}.exe\n";
138        print GNUmakefile "\t\@mv $$hashref{name}.exe \$(binarystore)/".
139                        "$$hashref{name}\n";
140        print GNUmakefile "binfiles+=$filename\n";
141        print GNUmakefile "bintargets+=$$hashref{name} $$hashref{name}_d\n";
142        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 + cd $ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname; \\
207 + \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk \$\@; \\
208 + fi
209 + endef
210 +
211 + define stepdown2_$$hashref{'name'}
212 + if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname" ]; then \\
213 + cd $ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname; \\
214 + \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk \$\*; \\
215 + fi
216 +
217 + endef
218 +
219 + bin_$$hashref{'name'}_%:: dummy
220 +        \@\$(stepdown2_$$hashref{'name'})
221 +
222 + echo_%:: dummy
223 +        \@\$(stepdown_$$hashref{'name'})
224 +
225 + help bin bin_debug bin_debug_local bin_insure bin_Insure clean $$hashref{'name'}:: dummy
226 +        \@\$(stepdown_$$hashref{'name'})
227 + endif
228 +
229 + ENDTEXT
230 +
231 +
232 + # the binary specifics makefile
233 +        print binGNUmakefile "include $currentenv\n";
234 +        print binGNUmakefile "VPATH+=$ENV{LOCALTOP}/${path}\n";
235 +
236 + # alias for bin_Insure
237 +        print binGNUmakefile <<ENDTEXT;
238 +
239 + bin_insure:bin_Insure
240 + ifdef MAKETARGET_bin_insure
241 + MAKETARGET_$$hashref{name}_Insure=1
242 + endif
243 +
244 + # debuggging target
245 + $$hashref{'name'}_echo_% :: echo_%
246 +
247 + # help targets
248 + help::
249 + \t\@echo Targets For $$hashref{'name'}
250 + \t\@echo -------------------------------------
251 + \t\@echo $$hashref{'name'}  - default build
252 + \t\@echo bin_$$hashref{'name'}_clean - executable specific cleaning
253 + ENDTEXT
254 +
255 + # Make generic rules for each type
256 +        $targettypes={
257 +                "bin" => 'o',
258 +                "bin_debug" => 'd',
259 +                "bin_debug_local" => 'l_d',
260 +                "bin_Insure" => 'Insure'
261 +        };
262 +        #
263 +        foreach $target ( keys %$targettypes ) {
264 +          print binGNUmakefile <<ENDTEXT;
265 +
266 + # Type $target specifics
267 + ifdef MAKETARGET_$target
268 + MAKETARGET_$$hashref{name}_$$targettypes{$target}=1
269 + endif
270 + $target ::$$hashref{name}_$$targettypes{$target}
271 +
272 + bintargets+=$$hashref{name}_$$targettypes{$target}
273 + help::
274 + \t\@echo $$hashref{name}_$$targettypes{$target}
275 + clean::
276 + \t\@if [ -f \$(binarystore)/$$hashref{name}_$$targettypes{$target} ]; then \\
277 + \techo Removing \$(binarystore)/$$hashref{name}; \\
278 + \trm \$(binarystore)/$$hashref{name}_$$targettypes{$target}; \\
279 + \tfi
280 +
281 + ENDTEXT
282 +          ($objectname=$$hashref{file})=~s/\..*/_$$targettypes{$target}\.o/;
283 +          ${"objectname_$$targettypes{$target}"}=$objectname;
284 +          print binGNUmakefile "$objectname:$$hashref{name}.dep\n";
285 +        } # end loop
286 +
287 +        print binGNUmakefile "$$hashref{name}_Insure:.psrc\n";
288 +        print binGNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
289 +        print binGNUmakefile "\t\$(CClinkCmdDebug)\n";
290 +        print binGNUmakefile "$$hashref{name}_l_d.exe:$objectname_d\n";
291 +        print binGNUmakefile "\t\$(CClinkCmdDebugLocal)\n";
292 +        print binGNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
293 +        print binGNUmakefile "\t\$(CClinkCmdInsure)\n";
294 +        print binGNUmakefile "$$hashref{name}_o.exe:$objectname_o\n";
295 +        print binGNUmakefile "\t\$(CClinkCmd)\n";
296 +        print binGNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
297 +        print binGNUmakefile "-include $$hashref{name}.dep\n";
298 + print binGNUmakefile <<ENDTEXT;
299 + clean::
300 + \t\@if [ -f \$(binarystore)/$$hashref{name} ]; then \\
301 + \techo Removing \$(binarystore)/$$hashref{name}; \\
302 + \trm \$(binarystore)/$$hashref{name}; \\
303 + \tfi
304 +
305 + $$hashref{name}_d.exe:\$(libslocal_d)
306 + $$hashref{name}_o.exe:\$(libslocal)
307 + ifdef MCCABE_DATA_DIR
308 + $$hashref{name}_mccabe.exe: \$(libslocal_d) \$(MCCABE_DATA_DIR)/mccabeinstr/instplus.cpp
309 + endif
310 + $$hashref{name}_Insure.exe:\$(libslocal_I)
311 + $$hashref{name}_d:$$hashref{name}_d.exe
312 +        \@cp $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
313 + $$hashref{name}_l_d:$$hashref{name}_l_d.exe
314 +        \@cp $$hashref{name}_l_d.exe \$(binarystore)/$$hashref{name}
315 + $$hashref{name}_Insure:$$hashref{name}_Insure.exe
316 +        \@cp $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure
317 + $$hashref{name}:$$hashref{name}_d.exe
318 +        \@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
319 + $$hashref{name}_o:$$hashref{name}_o.exe
320 +        \@mv $$hashref{name}_o.exe \$(binarystore)/$$hashref{name}
321 + binfiles+=$$hashref{file}
322 + ENDTEXT
323 +        }
324 +        close binGNUmakefile;
325 + }
326 +
327 + sub Ext_start_export {
328 +        my $name=shift;
329 +        my @vars=@_;
330 +        my $hashref;
331 +        
332 +        $hashref=$switch->SetupValueHash(\@vars);
333 +        if ( $Arch ) {
334 +         if ( $switchex->context('export') ) {
335 +          $$hashref{'ref'}=~tr[A-Z][a-z];
336 +          print GNUmakefile $$hashref{'ref'};
337 +          if ( defined $$hashref{'version'} ) {
338 +                print GNUmakefile "_V_".$$hashref{'version'};
339 +          }
340 +          print GNUmakefile "=true\n";
341 +         }
342 +        }
343   }
344  
345   sub External_StartTag {
# Line 149 | Line 348 | sub External_StartTag {
348          my $hashref;
349          
350          $hashref=$switch->SetupValueHash(\@vars);
351 +        if ( $Arch ) {
352          $$hashref{'ref'}=~tr[A-Z][a-z];
353          print GNUmakefile $$hashref{'ref'};
354          if ( defined $$hashref{'version'} ) {
355                  print GNUmakefile "_V_".$$hashref{'version'};
356          }
357          print GNUmakefile "=true\n";
358 +        }
359          
360   }      
361  
# Line 165 | Line 366 | sub Group_start {
366          
367          $hashref=$switch->SetupValueHash(\@vars);
368          $switch->checkparam($hashref, $name, 'name');
369 +        if ( $Arch ) {
370          print GNUmakefile "GROUP_".$$hashref{'name'};
371          if ( defined $$hashref{'version'} ) {
372                  print GNUmakefile "_V_".$$hashref{'version'};
373          }
374          print GNUmakefile "=true\n";
375 +        }
376   }      
377  
378   sub External {
# Line 196 | Line 399 | sub Use_start {
399          
400          $hashref=$switch->SetupValueHash(\@vars);
401          $switch->checkparam($hashref, $name, "name");
402 <        if ( $filename=checkfile("$ENV{INTsrc}/$$hashref{name}/BuildFile")
403 <                                                 ne "" ) {
404 <          print GNUmakefile "ReqDependencies += $filename\n";
402 >        if ( $Arch ) {
403 >        $filename=SCRAMUtils::checkfile(
404 >                "$ENV{INTsrc}/$$hashref{name}/BuildFile");
405 >        if ( $filename ne "" ) {
406 >          ParseBuildFile_Export( $filename );
407 >        }
408          }
203        print GNUmakefile "local__$$hashref{name}=true\n";
409   }
410  
411   sub CheckBuildFile {
# Line 233 | Line 438 | sub AssociateGroup {
438          }
439   }
440  
441 + sub ignoretag {
442 +        my $name=shift;
443 +        my @vars=@_;
444 +        
445 +        $Arch=0;
446 +        push @ARCHBLOCK, $Arch;
447 + }
448 +
449 + sub ignoretag_end {
450 +        my $name=shift;
451 +        my @vars=@_;
452 +        
453 +        pop @ARCHBLOCK;
454 +        $Arch=$ARCHBLOCK[$#ARCHBLOCK];
455 + }
456 +
457 + sub Arch_Start {
458 +        my $name=shift;
459 +        my @vars=@_;
460 +        my $hashref;
461 +
462 +        $hashref=$toolswitch->SetupValueHash( \@vars );
463 +        $toolswitch->checkparam($hashref, $name, 'name');
464 +        #( ($$hashref{name}=~/$ENV{SCRAM_ARCH}/) )?$Arch=1:$Arch=0;
465 +        ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($Arch=1) : ($Arch=0);
466 +        push @ARCHBLOCK, $Arch;
467 + }
468 + sub Arch_End {
469 +        my $name=shift;
470 +        my @vars=@_;
471 +
472 +        pop @ARCHBLOCK;
473 +        $Arch=$ARCHBLOCK[$#ARCHBLOCK];
474 + }
475 +
476   # Split up the Class Block String into a useable array
477   sub _CutBlock {
478      my $string= shift @_;
# Line 243 | Line 483 | sub OutToMakefile {
483          my $name=shift;
484          my @vars=@_;
485  
486 <        print GNUmakefile @vars;
486 >        if ( $Arch ) {
487 >          print GNUmakefile @vars;
488 >        }
489 > }
490 > sub OutToScreen {
491 >        my $name=shift;
492 >        my @vars=@_;
493 >
494 >        if ( $Arch ) {
495 >          print @vars;
496 >        }
497   }
498   sub setBlockClassPath {
499          my $name=shift;
# Line 255 | Line 505 | sub setBlockClassPath {
505          $BlockClassPath=$BlockClassPath.":".$$hashref{path};
506          _CutBlock($$hashref{path});
507   }
508 +
509 + sub export_start {
510 + #Set up a toolfile object
511 +        $exporttool=Tool->new();
512 + }
513 +
514 + sub export_end {
515 + #Write toolfile object to disk
516 +        $exporttool->envtomake(\*GNUmakefile);
517 + }
518 +
519 + #
520 + # Export Mode Lib Tag
521 + #
522 + sub lib_start_export {
523 +        my $name=shift;
524 +        my @vars=@_;
525 +        my $hashref;
526 +
527 +        $hashref=$switchex->SetupValueHash( \@vars );
528 +        $switchex->checkparam($hashref, $name, 'name');
529 +        if ( $Arch ) {
530 +         if ( $switchex->context('export') ) {
531 +                #If export mode then add this env to the export tool
532 +                $exporttool->addenv('lib',$$hashref{name});
533 +         }
534 +        }
535 + }
536 +
537 + #
538 + # Standard lib tag
539 + #
540 + sub lib_start {
541 +        my $name=shift;
542 +        my @vars=@_;
543 +        my $hashref;
544 +
545 +        $hashref=$switch->SetupValueHash( \@vars );
546 +        $switch->checkparam($hashref, $name, 'name');
547 +        if ( $Arch ) {
548 +           print GNUmakefile "lib+=$$hashref{name}\n";
549 +        }
550 + }
551 +
552 + #
553 + # libtype specification
554 + #
555 + sub LibType_Start {
556 +        my $name=shift;
557 +        my @vars=@_;
558 +        my $hashref;
559 +
560 +        if ( $Arch ) {
561 +        $hashref=$switch->SetupValueHash( \@vars );
562 +        $switch->checkparam($hashref, $name, 'type');
563 +        
564 +        print GNUmakefile "# Specify Library Type\n";
565 +        print GNUmakefile "DefaultLibsOff=yes\n";
566 +        if ( $$hashref{'type'}=~/^archive/i ) {
567 +          print GNUmakefile "LibArchive=true\n";
568 +        }
569 +        elsif ($$hashref{'type'}=~/debug_archive/i ) {
570 +          print GNUmakefile "LibDebugArchive=true\n";
571 +        }
572 +        elsif ($$hashref{'type'}=~/debug_shared/i ) {
573 +          print GNUmakefile "LibDebugShared=true\n";
574 +        }
575 +        elsif ($$hashref{'type'}=~/shared/i ) {
576 +          print GNUmakefile 'LibShared=true'."\n";
577 +        }
578 +        print GNUmakefile "\n";
579 +        }
580 + }
581 + sub LibType_text {
582 +        my $name=shift;
583 +        my @vars=@_;
584 +
585 +        if ( $Arch ) {
586 +          print GNUmakefile "libmsg::\n\t\@echo Library info: ";
587 +          print GNUmakefile @vars;
588 +          print GNUmakefile "\n";
589 +        }
590 + }
591 +
592 + sub Environment_start {
593 +        my $name=shift;
594 +        my @vars=@_;
595 +        my $hashref;
596 +
597 +        if ( $Arch ) {
598 +          $envnum++;
599 +
600 +          # open a new Environment File
601 +          my $envfile="$ENV{LOCALTOP}/$ENV{INTwork}/${path}/Env_$envnum.mk";
602 +          use FileHandle;
603 +          my $fh=FileHandle->new();
604 +          open ($fh,">$envfile") or die "Unable to open file $envfile \n$!\n";
605 +          push @filehandlestack, $fh;
606 +          *GNUmakefile=$fh;
607 +
608 +          # include the approprate environment file
609 +          if ( $envlevel == 0 ) {
610 +             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/${path}/".
611 +                                "BuildFile.mk\n";
612 +          }
613 +          else {
614 +             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/${path}/".
615 +                                "Env_$Envlevels[$envlevel]\.mk\n";
616 +          }
617 +          $envlevel++;
618 +          $Envlevels[$envlevel]=$envnum;
619 +          $currentenv="$ENV{LOCALTOP}/$ENV{INTwork}/${path}/Env_$envnum.mk";
620 +        }
621 + }
622 +
623 + sub Environment_end {
624 +        my $fd;
625 +
626 +        if ( $Arch ) {
627 +          $envlevel--;
628 +          if ( $envlevel < 0 ) {
629 +            print "Too many </Environent> Tags on $switch->line()\n";
630 +            exit;
631 +          }
632 +          close GNUmakefile;
633 +          # restore the last filehandle
634 +          $fd=pop @filehandlestack;
635 +          close $fd;
636 +          *GNUmakefile=$filehandlestack[$#filehandlestack];
637 +          if ( $envlevel < 1 ) {
638 +            $currentenv="$ENV{LOCALTOP}/$ENV{INTwork}/${path}/BuildFile.mk";
639 +          }
640 +          else {
641 +            $currentenv=
642 +             "$ENV{LOCALTOP}/$ENV{INTwork}/${path}/Env_$Envlevels[$envlevel]";
643 +          }
644 +        }
645 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines