ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildFile.pm
Revision: 1.21.2.36
Committed: Wed Dec 1 15:42:15 1999 UTC (25 years, 5 months ago) by williamc
Content type: text/plain
Branch: V0_9branch
CVS Tags: V0_10_11, V0_10_10, V0_10_9, V0_10_8, V0_10_7, V0_10_6
Changes since 1.21.2.35: +4 -4 lines
Log Message:
make silent scramdsbuild calls

File Contents

# Content
1 package BuildFile;
2 require 5.001;
3 require Exporter;
4 @ISA = qw(Exporter);
5 @EXPORT = qw(CheckBuildFile ParseBuildFile @BlockClassA $DefaultBuildFile);
6
7 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 $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,
30 'Group' => \&OutToMakefile,
31 'Group_StartTag' => \&Group_start,
32 'External' => \&OutToMakefile,
33 'External_StartTag' => \&External_StartTag,
34 'ConfigurationClass_StartTag' => \&Class_StartTag,
35 'ConfigurationClass' => \&OutToMakefile,
36 'AssociateGroup' => \&AssociateGroup,
37 'none' => \&OutToMakefile,
38 'Bin' => 'none',
39 'Bin_StartTag' => \&Bin_start,
40 'ClassPath' => \&OutToMakefile,
41 'ClassPath_StartTag' => \&setBlockClassPath,
42 'Environment' => \&OutToMakefile,
43 'Environment_StartTag' => \&Environment_start,
44 'Environment_EndTag' => \&Environment_end,
45 'export' => \&OutToMakefile,
46 'export_StartTag' => \&export_start,
47 'export_EndTag' => \&export_end,
48 'lib' => \&OutToMakefile,
49 'lib_StartTag' => \&lib_start,
50 'lib_EndTag' => 'none',
51 'ignore' => 'none',
52 'ignore_EndTag' => \&ignoretag_end,
53 'ignore_StartTag' => \&ignoretag,
54 'Architecture_StartTag' => \&Arch_Start,
55 'Architecture_EndTag' => \&Arch_End,
56 'Architecture' => \&OutToMakefile,
57 'LibType_StartTag' => \&LibType_Start,
58 'LibType_EndTag' => 'none',
59 #'LibType' => \&OutToScreen
60 'LibType' => \&LibType_text
61 };
62 use Utilities::Switcher;
63 $switch=Switcher->new($SupportedTags, $fullfilename);
64 $switch->{Strict_no_cr}='no';
65 #open a temporary gnumakefile to store output.
66 use Utilities::AddDir;
67 AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/${path}");
68 my $fh=FileHandle->new();
69 open ( $fh, ">$ENV{LOCALTOP}/$ENV{INTwork}/${path}/BuildFile.mk"
70 ) or die 'Unable to open /$ENV{INTwork}/${path}/BuildFile.mk $!\n';
71 @filehandlestack=($fh);
72 # make an alias
73 # open ( GNUmakefile, ">&=$fh") or die 'Unable to create alias for '.
74 # "Filehandle $!\n";
75 *GNUmakefile=$fh;
76 if ( -e $ENV{LatestBuildFile} ) {
77 print GNUmakefile "include $ENV{LatestBuildFile}\n";
78 }
79 # print "writing to :\n".
80 # "$ENV{LOCALTOP}/$ENV{INTwork}/${path}/BuildFile.mk\n";
81 $ENV{LatestBuildFile}="$ENV{LOCALTOP}/$ENV{INTwork}/${path}/BuildFile.mk";
82 $switch->parse(); # sort out supported tags
83 if ( $numbins > 0 ) {
84 print GNUmakefile <<ENDTEXT;
85 ifndef BINMODE
86 help::
87 \t\@echo Generic Binary targets
88 \t\@echo ----------------------
89 endif
90 ENDTEXT
91 foreach $target ( keys %$targettypes ) {
92 print GNUmakefile <<ENDTEXT;
93 ifndef BINMODE
94 help::
95 \t\@echo $target
96 endif
97 ENDTEXT
98 }
99 }
100 close GNUmakefile;
101 }
102
103 sub ParseBuildFile_Export {
104 my $filename=shift;
105 use Tool;
106 # This hash defines which Document Elements we can use
107 my $SupportedTags={
108 'none' => 'none',
109 'export' => \&OutToMakefile,
110 'export_StartTag' => \&use_export_start,
111 'export_EndTag' => \&use_export_end,
112 'lib_StartTag' => \&lib_start,
113 'External_StartTag' => \&Ext_start_export,
114 'lib' => 'none'
115 };
116 use Utilities::Switcher;
117 $switchex=Switcher->new($SupportedTags, $filename);
118 $switchex->{Strict_no_cr}='no';
119 $switchex->parse(); # sort out supported tags
120 }
121
122 sub initialterms() {
123 my $name=shift;
124 my @string=@_;
125
126 $_=join "", @string;
127 chomp;
128 SWITCH: {
129 last SWITCH if /^#/;
130 if ( /^.*BlockClassPath.*/i ) {
131 s/^.*BlockClassPath *= *//;
132 _CutBlock($_);
133 last SWITCH;
134 }
135 } # end SWITCH
136 }
137
138 # Tag routines - called by the Switcher when tag found
139
140
141
142 #-- Override a class type with the <ConfigurationClass type=xxx> tag
143 # the type tag will pick up a pre-defined class type from project space.
144
145 sub Class_StartTag {
146 my $name=shift;
147 my $hashref;
148 my @vars=@_;
149
150 $hashref=$switch->SetupValueHash(\@vars);
151 if ( $Arch ) {
152 if ( defined $$hashref{'type'} ) {
153 $ClassName=$$hashref{'type'};
154 }
155 }
156 }
157
158 sub ClassPath_StartTag {
159 my $name=shift;
160 my @vars=@_;
161 my $hashref;
162
163 $hashref=$switch->SetupValueHash(\@vars);
164 if ( $Arch ) {
165 if ( defined $$hashref{'defaultpath'} ) {
166 }
167 }
168 }
169
170 sub Bin_start {
171 my $name=shift;
172 my @vars=@_;
173 my $hashref;
174 my $fileclass;
175 my @tools;
176 my $tool;
177 my $filename;
178 my $objectname;
179
180 $hashref=$switch->SetupValueHash(\@vars);
181 $switch->checkparam($hashref, $name, 'file');
182 if ( $Arch ) {
183 if ( ! defined $$hashref{name} ) {
184 ($$hashref{name}=$$hashref{file})=~s/\..*//;
185 }
186 # This stuff for later
187 #$fileclass=$toolbox->getclass($file);
188 #$toolbox->maketargets("exe",$fileclass, $$hashref{name}, $file );
189
190 ($filename=$$hashref{file})=~s/\..*//;
191
192 # Create a new directory for each binary target
193 my $dirname="bin_".$$hashref{name};
194 AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname");
195 open (binGNUmakefile,
196 ">$ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname/BuildFile.mk") or die "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname/".
197 "BuildFile.mk $!\n";
198
199 # Create the link targets
200 $numbins++;
201 my $fh=$filehandlestack[0];
202 print $fh <<ENDTEXT;
203
204 # Link Targets to binary directories
205 ifdef BINMODE
206 # We dont want to build a library here
207 override files:=
208 endif
209 ifndef BINMODE
210
211 define stepdown_$$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 datestamp \$\@; \\
215 fi
216 endef
217
218 define stepdown2_$$hashref{'name'}
219 if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname" ]; then \\
220 cd $ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname; \\
221 \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/${path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\
222 fi
223
224 endef
225
226 bin_$$hashref{'name'}_%:: dummy
227 \@\$(stepdown2_$$hashref{'name'})
228
229 $$hashref{'name'}_%:: dummy
230 \@\$(stepdown_$$hashref{'name'})
231
232 help bin bin_debug bin_debug_local bin_insure bin_Insure clean $$hashref{'name'}:: dummy
233 \@\$(stepdown_$$hashref{'name'})
234
235 binfiles+=$$hashref{'file'}
236 endif
237
238
239 ENDTEXT
240
241
242 # the binary specifics makefile
243 print binGNUmakefile "include $currentenv\n";
244 print binGNUmakefile "VPATH+=$ENV{LOCALTOP}/${path}\n";
245
246 # alias for bin_Insure
247 print binGNUmakefile <<ENDTEXT;
248
249 bin_insure:bin_Insure
250 ifdef MAKETARGET_bin_insure
251 MAKETARGET_$$hashref{name}_Insure=1
252 endif
253
254 # debuggging target
255 $$hashref{'name'}_echo_% :: echo_%
256
257 # help targets
258 help::
259 \t\@echo Targets For $$hashref{'name'}
260 \t\@echo -------------------------------------
261 \t\@echo $$hashref{'name'} - default build
262 \t\@echo bin_$$hashref{'name'}_clean - executable specific cleaning
263 ENDTEXT
264
265 # Make generic rules for each type
266 $targettypes={
267 "bin" => 'o',
268 "bin_debug" => 'd',
269 "bin_debug_local" => 'l_d',
270 "bin_Insure" => 'Insure'
271 };
272 #
273 foreach $target ( keys %$targettypes ) {
274 print binGNUmakefile <<ENDTEXT;
275
276 # Type $target specifics
277 ifdef MAKETARGET_$target
278 MAKETARGET_$$hashref{name}_$$targettypes{$target}=1
279 endif
280 $target ::$$hashref{name}_$$targettypes{$target}
281
282 bintargets+=$$hashref{name}_$$targettypes{$target}
283 help::
284 \t\@echo $$hashref{name}_$$targettypes{$target}
285 clean::
286 \t\@if [ -f \$(binarystore)/$$hashref{name}_$$targettypes{$target} ]; then \\
287 \techo Removing \$(binarystore)/$$hashref{name}; \\
288 \trm \$(binarystore)/$$hashref{name}_$$targettypes{$target}; \\
289 \tfi
290
291 ENDTEXT
292 ($objectname=$$hashref{file})=~s/\..*/_$$targettypes{$target}\.o/;
293 ${"objectname_$$targettypes{$target}"}=$objectname;
294 print binGNUmakefile "$objectname:$$hashref{name}.dep\n";
295 } # end loop
296
297 print binGNUmakefile "$$hashref{name}_Insure.exe:.psrc\n";
298 print binGNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
299 print binGNUmakefile "\t\$(CClinkCmdDebug)\n";
300 print binGNUmakefile "\t\@\$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
301 print binGNUmakefile "$$hashref{name}_l_d.exe:$objectname_d\n";
302 print binGNUmakefile "\t\$(CClinkCmdDebugLocal)\n";
303 print binGNUmakefile "\t\@\$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
304 print binGNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
305 print binGNUmakefile "\t\$(CClinkCmdInsure)\n";
306 print binGNUmakefile "\t\@\$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
307 print binGNUmakefile "$$hashref{name}_o.exe:$objectname_o\n";
308 print binGNUmakefile "\t\$(CClinkCmd)\n";
309 print binGNUmakefile "\t\@\$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
310 print binGNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
311 print binGNUmakefile "-include $$hashref{name}.dep\n";
312 print binGNUmakefile <<ENDTEXT;
313 clean::
314 \t\@if [ -f \$(binarystore)/$$hashref{name} ]; then \\
315 \techo Removing \$(binarystore)/$$hashref{name}; \\
316 \trm \$(binarystore)/$$hashref{name}; \\
317 \tfi
318
319 $$hashref{name}_d.exe:\$(libslocal_d)
320 $$hashref{name}_o.exe:\$(libslocal)
321 ifdef MCCABE_DATA_DIR
322 $$hashref{name}_mccabe.exe: \$(libslocal_d) \$(MCCABE_DATA_DIR)/mccabeinstr/instplus.cpp
323 endif
324 $$hashref{name}_Insure.exe:\$(libslocal_I)
325 $$hashref{name}_d:$$hashref{name}_d.exe
326 \@cp $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
327 $$hashref{name}_l_d:$$hashref{name}_l_d.exe
328 \@cp $$hashref{name}_l_d.exe \$(binarystore)/$$hashref{name}
329 $$hashref{name}_Insure:$$hashref{name}_Insure.exe
330 \@cp $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure
331 $$hashref{name}:$$hashref{name}_d.exe
332 \@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
333 $$hashref{name}_o:$$hashref{name}_o.exe
334 \@mv $$hashref{name}_o.exe \$(binarystore)/$$hashref{name}
335 binfiles+=$$hashref{file}
336 ENDTEXT
337 }
338 close binGNUmakefile;
339 }
340
341 sub Ext_start_export {
342 my $name=shift;
343 my @vars=@_;
344 my $hashref;
345
346 $hashref=$switch->SetupValueHash(\@vars);
347 if ( $Arch ) {
348 if ( $switchex->context('export') ) {
349 $$hashref{'ref'}=~tr[A-Z][a-z];
350 print GNUmakefile $$hashref{'ref'};
351 if ( defined $$hashref{'version'} ) {
352 print GNUmakefile "_V_".$$hashref{'version'};
353 }
354 print GNUmakefile "=true\n";
355 }
356 }
357 }
358
359 sub External_StartTag {
360 my $name=shift;
361 my @vars=@_;
362 my $hashref;
363
364 $hashref=$switch->SetupValueHash(\@vars);
365 if ( $Arch ) {
366 $$hashref{'ref'}=~tr[A-Z][a-z];
367 print GNUmakefile $$hashref{'ref'};
368 if ( defined $$hashref{'version'} ) {
369 print GNUmakefile "_V_".$$hashref{'version'};
370 }
371 print GNUmakefile "=true\n";
372 }
373
374 }
375
376 sub Group_start {
377 my $name=shift;
378 my @vars=@_;
379 my $hashref;
380
381 $hashref=$switch->SetupValueHash(\@vars);
382 $switch->checkparam($hashref, $name, 'name');
383 if ( $Arch ) {
384 print GNUmakefile "GROUP_".$$hashref{'name'};
385 if ( defined $$hashref{'version'} ) {
386 print GNUmakefile "_V_".$$hashref{'version'};
387 }
388 print GNUmakefile "=true\n";
389 }
390 }
391
392 sub External {
393 my $name=shift;
394 my @vars=@_;
395 # Will simply collect string into a seperate buffer for processind
396 # at the tag closure - used for specifying product defaults
397 # --- Oh oh all of string already in external buffer @!
398 }
399
400 sub External_EndTag {
401 my $name=shift;
402 my @vars=@_;
403
404 # process buffer and check consistency with product dtd
405 }
406
407 sub Use_start {
408 my $name=shift;
409 my @vars=@_;
410 my $hashref;
411 my $filename;
412 use Utilities::SCRAMUtils;
413
414 $hashref=$switch->SetupValueHash(\@vars);
415 $switch->checkparam($hashref, $name, "name");
416 if ( $Arch ) {
417 $filename=SCRAMUtils::checkfile(
418 "$ENV{INTsrc}/$$hashref{name}/BuildFile");
419 if ( $filename ne "" ) {
420 ParseBuildFile_Export( $filename );
421 }
422 }
423 }
424
425 sub CheckBuildFile {
426 my $classdir=shift;
427 $ClassName="";
428 $thisfile="$classdir/$buildfile";
429
430 if ( -e $ENV{LOCALTOP}."/".$thisfile ) {
431 $DefaultBuildfile="$ENV{LOCALTOP}/$thisfile";
432 ParseBuildFile($ENV{LOCALTOP}, $classdir, $buildfile);
433 }
434 elsif ( -e $ENV{RELEASETOP}."/".$thisfile ) {
435 $DefaultBuildfile="$ENV{RELEASETOP}/$thisfile";
436 ParseBuildFile($ENV{RELEASETOP}, $classdir, $buildfile);
437 }
438 return $ClassName;
439 }
440
441 # List association groups between <AssociateGroup> tags
442 # seperated by newlines or spaces
443 sub AssociateGroup {
444 my $name=shift;
445 my @vars=@_;
446 my $word;
447
448 foreach $word ( @vars ){
449 chomp $word;
450 next if /^#/;
451 push @groups, $word;
452 }
453 }
454
455 sub ignoretag {
456 my $name=shift;
457 my @vars=@_;
458
459 $Arch=0;
460 push @ARCHBLOCK, $Arch;
461 }
462
463 sub ignoretag_end {
464 my $name=shift;
465 my @vars=@_;
466
467 pop @ARCHBLOCK;
468 $Arch=$ARCHBLOCK[$#ARCHBLOCK];
469 }
470
471 sub Arch_Start {
472 my $name=shift;
473 my @vars=@_;
474 my $hashref;
475
476 $hashref=$toolswitch->SetupValueHash( \@vars );
477 $toolswitch->checkparam($hashref, $name, 'name');
478 #( ($$hashref{name}=~/$ENV{SCRAM_ARCH}/) )?$Arch=1:$Arch=0;
479 ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($Arch=1) : ($Arch=0);
480 push @ARCHBLOCK, $Arch;
481 }
482 sub Arch_End {
483 my $name=shift;
484 my @vars=@_;
485
486 pop @ARCHBLOCK;
487 $Arch=$ARCHBLOCK[$#ARCHBLOCK];
488 }
489
490 # Split up the Class Block String into a useable array
491 sub _CutBlock {
492 my $string= shift @_;
493 @BlockClassA = split /\//, $string;
494 }
495
496 sub OutToMakefile {
497 my $name=shift;
498 my @vars=@_;
499
500 if ( $Arch ) {
501 print GNUmakefile @vars;
502 }
503 }
504 sub OutToScreen {
505 my $name=shift;
506 my @vars=@_;
507
508 if ( $Arch ) {
509 print @vars;
510 }
511 }
512 sub setBlockClassPath {
513 my $name=shift;
514 my @vars=@_;
515 my $hashref;
516
517 $hashref=$switch->SetupValueHash(\@vars);
518 $switch->checkparam($hashref, $name, 'path');
519 $BlockClassPath=$BlockClassPath.":".$$hashref{path};
520 _CutBlock($$hashref{path});
521 }
522
523 sub use_export_start {
524 #Set up a toolfile object
525 $exporttool=Tool->new();
526 }
527
528 sub use_export_end {
529 #Write toolfile object to disk
530 $exporttool->envtomake(\*GNUmakefile);
531 }
532
533 sub export_start {
534 my $name=shift;
535 my @vars=@_;
536 my $hashref;
537
538 $hashref=$switch->SetupValueHash(\@vars);
539 if ( exists $$hashref{autoexport} ) {
540 print GNUmakefile "scram_autoexport=".$$hashref{autoexport}."\n";
541 }
542 #Set up a toolfile object
543 print GNUmakefile "ifeq (\$(scram_autoexport),true)\n";
544 }
545
546 sub export_end {
547 #Write toolfile object to disk
548 print GNUmakefile "endif\n";
549 }
550
551 #
552 # Export Mode Lib Tag --- NO LONGER IN USE
553 #
554 sub lib_start_export {
555 my $name=shift;
556 my @vars=@_;
557 my $hashref;
558
559 $hashref=$switchex->SetupValueHash( \@vars );
560 $switchex->checkparam($hashref, $name, 'name');
561 if ( $Arch ) {
562 if ( $switchex->context('export') ) {
563 #If export mode then add this env to the export tool
564 $exporttool->addenv('lib',$$hashref{name});
565 }
566 }
567 }
568
569 #
570 # Standard lib tag
571 #
572 sub lib_start {
573 my $name=shift;
574 my @vars=@_;
575 my $hashref;
576
577 $hashref=$switch->SetupValueHash( \@vars );
578 $switch->checkparam($hashref, $name, 'name');
579 if ( $Arch ) {
580 print GNUmakefile "lib+=$$hashref{name}\n";
581 }
582 }
583
584 #
585 # libtype specification
586 #
587 sub LibType_Start {
588 my $name=shift;
589 my @vars=@_;
590 my $hashref;
591
592 if ( $Arch ) {
593 $hashref=$switch->SetupValueHash( \@vars );
594 $switch->checkparam($hashref, $name, 'type');
595
596 print GNUmakefile "# Specify Library Type\n";
597 print GNUmakefile "DefaultLibsOff=yes\n";
598 if ( $$hashref{'type'}=~/^archive/i ) {
599 print GNUmakefile "LibArchive=true\n";
600 }
601 elsif ($$hashref{'type'}=~/debug_archive/i ) {
602 print GNUmakefile "LibDebugArchive=true\n";
603 }
604 elsif ($$hashref{'type'}=~/debug_shared/i ) {
605 print GNUmakefile "LibDebugShared=true\n";
606 }
607 elsif ($$hashref{'type'}=~/shared/i ) {
608 print GNUmakefile 'LibShared=true'."\n";
609 }
610 print GNUmakefile "\n";
611 }
612 }
613 sub LibType_text {
614 my $name=shift;
615 my @vars=@_;
616
617 if ( $Arch ) {
618 print GNUmakefile "libmsg::\n\t\@echo Library info: ";
619 print GNUmakefile @vars;
620 print GNUmakefile "\n";
621 }
622 }
623
624 sub Environment_start {
625 my $name=shift;
626 my @vars=@_;
627 my $hashref;
628
629 if ( $Arch ) {
630 $envnum++;
631
632 # open a new Environment File
633 my $envfile="$ENV{LOCALTOP}/$ENV{INTwork}/${path}/Env_$envnum.mk";
634 use FileHandle;
635 my $fh=FileHandle->new();
636 open ($fh,">$envfile") or die "Unable to open file $envfile \n$!\n";
637 push @filehandlestack, $fh;
638 *GNUmakefile=$fh;
639
640 # include the approprate environment file
641 if ( $envlevel == 0 ) {
642 print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/${path}/".
643 "BuildFile.mk\n";
644 }
645 else {
646 print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/${path}/".
647 "Env_$Envlevels[$envlevel]\.mk\n";
648 }
649 $envlevel++;
650 $Envlevels[$envlevel]=$envnum;
651 $currentenv="$ENV{LOCALTOP}/$ENV{INTwork}/${path}/Env_$envnum.mk";
652 }
653 }
654
655 sub Environment_end {
656 my $fd;
657
658 if ( $Arch ) {
659 $envlevel--;
660 if ( $envlevel < 0 ) {
661 print "Too many </Environent> Tags on $switch->line()\n";
662 exit;
663 }
664 close GNUmakefile;
665 # restore the last filehandle
666 $fd=pop @filehandlestack;
667 close $fd;
668 *GNUmakefile=$filehandlestack[$#filehandlestack];
669 if ( $envlevel < 1 ) {
670 $currentenv="$ENV{LOCALTOP}/$ENV{INTwork}/${path}/BuildFile.mk";
671 }
672 else {
673 $currentenv=
674 "$ENV{LOCALTOP}/$ENV{INTwork}/${path}/Env_$Envlevels[$envlevel]";
675 }
676 }
677 }