ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/BuildFile.pm
(Generate patch)

Comparing COMP/SCRAM/src/BuildSystem/BuildFile.pm (file contents):
Revision 1.3 by williamc, Wed Sep 6 10:17:28 2000 UTC vs.
Revision 1.28 by sashby, Wed Mar 9 19:28:19 2005 UTC

# Line 1 | Line 1
1 < # BuildFile
1 > #____________________________________________________________________
2 > # File: BuildFile.pm
3 > #____________________________________________________________________
4 > #  
5 > # Author: Shaun Ashby <Shaun.Ashby@cern.ch>
6 > # Update: 2003-12-03 19:03:15+0100
7 > # Revision: $Id$
8   #
9 < # Interface
10 < # ---------
11 < # new(ConfigArea)
6 < # ParseBuildFile($base,$path,$file)
7 < # ParseBuildFileExport(filename)
8 < # BlockClassPath() : Return the class path
9 < # ignore()      : return 1 if directory should be ignored 0 otherwise
10 <
9 > # Copyright: 2003 (C) Shaun Ashby
10 > #
11 > #--------------------------------------------------------------------
12   package BuildSystem::BuildFile;
12 use ActiveDoc::SimpleDoc;
13 use BuildSystem::ToolBox;
13   require 5.004;
14 + use Exporter;
15 + use BuildSystem::TagUtils;
16 + use BuildSystem::BuildDataUtils;
17 + use ActiveDoc::SimpleDoc;
18  
19 < BEGIN {
20 < $buildfile="BuildFile";
18 < }
19 <
20 < sub new {
21 <        my $class=shift;
22 <        my $self={};
23 <        bless $self, $class;
24 <        $self->{area}=shift;
25 <        $self->{toolbox}=$self->{area}->toolbox();
26 <        $self->{Arch}=1;
27 <        push @{$self->{ARCHBLOCK}}, $self->{Arch};
28 <        return $self;
29 < }
30 <
31 < sub ignore {
32 <        my $self=shift;
33 <        return (defined $self->{ignore})?$self->{ignore}:0;
34 < }
35 <
36 < sub _initswitcher {
37 <        my $self=shift;
38 <        my $switch=ActiveDoc::SimpleDoc->new();
39 <        my $parse="makebuild";
40 <        $switch->newparse($parse);
41 <        $switch->addignoretags($parse);
42 <        $self->_commontags($switch,$parse);
43 <        $switch->addtag($parse,"Build", \&Build_start, $self);
44 <        $switch->addtag($parse,"none",
45 <                                        \&OutToMakefile,$self,
46 <                                        \&OutToMakefile, $self,
47 <                                        "", $self);
48 <        $switch->addtag($parse,"Bin",
49 <                                        \&Bin_start,$self,
50 <                                        \&OutToScreen, $self,
51 <                                        "", $self);
52 <        $switch->addtag($parse,"LibType",
53 <                                        \&LibType_Start,$self,
54 <                                        \&LibType_text, $self,
55 <                                        \&LibType_end,$self);
56 <        $switch->addtag($parse,"ConfigurationClass",
57 <                                        \&Class_StartTag,$self,
58 <                                        \&OutToMakefile, $self,
59 <                                        "", $self);
60 <        $switch->addtag($parse,"ClassPath",
61 <                                        \&setBlockClassPath,$self,
62 <                                        \&OutToMakefile, $self,
63 <                                        "", $self);
64 <        $switch->addtag($parse,"AssociateGroup",
65 <                                        "",$self,
66 <                                        \&AssociateGroup,$self,
67 <                                        "", $self);
68 <        $switch->addtag($parse,"Environment",
69 <                                        \&Environment_start,$self,
70 <                                        \&OutToMakefile, $self,
71 <                                        \&Environment_end,$self);
72 <        $switch->addtag($parse,"Export",
73 <                                        \&export_start,$self,
74 <                                        \&OutToMakefile, $self,
75 <                                        \&export_end,$self);
76 <        return $switch;
77 < }
78 <
79 < sub _commontags {
80 <        my $self=shift;
81 <        my $switch=shift;
82 <        my $parse=shift;
83 <
84 <        $switch->grouptag("Export",$parse);
85 <        $switch->addtag($parse,"Use",\&Use_start,$self,
86 <                                               \&OutToMakefile, $self,
87 <                                                "", $self);
88 <        $switch->addtag($parse,"Group",\&Group_start,$self,
89 <                                               \&OutToMakefile, $self,
90 <                                                "", $self);
91 <        $switch->grouptag("Group",$parse);
92 <        $switch->addtag($parse,"External",
93 <                                        \&External_StartTag,$self,
94 <                                        \&OutToMakefile, $self,
95 <                                        "", $self);
96 <        $switch->addtag($parse,"lib",
97 <                                        \&lib_start,$self,
98 <                                        \&OutToMakefile, $self,
99 <                                        "", $self);
100 <        $switch->addtag($parse,"Architecture",
101 <                                        \&Arch_Start,$self,
102 <                                        \&OutToMakefile, $self,
103 <                                        \&Arch_End,$self);
104 <        $switch->addtag($parse,"INCLUDE_PATH",
105 <                                        \&IncludePath_Start,$self,
106 <                                        \&OutToMakefile, $self,
107 <                                        "",$self);
108 <        return $switch;
109 < }
110 <
111 < sub ParseBuildFile {
112 <        my $self=shift;
113 <        my $base=shift;
114 <        my $path=shift;
115 <        my $filename=shift @_;
116 <        my $fullfilename;
117 <        if ( $filename!~/^\// ) {
118 <         $fullfilename="$base/$path/$filename";
119 <        }
120 <        else {
121 <         $fullfilename=$filename;
122 <        }
123 <        $self->{path}=$path;
124 <        #print "Processing $fullfilename\n";
125 <        $numbins=0;
126 <        $self->{envnum}=0;
127 <        $self->{envlevel}=0;
128 <        $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/".
129 <                                                                "BuildFile.mk";
130 <        $self->{switch}=$self->_initswitcher();
131 <        $self->{switch}->filetoparse($fullfilename);
132 <
133 < #       $self->{switch}->{Strict_no_cr}='no';
134 <        #open a temporary gnumakefile to store output.
135 <        use Utilities::AddDir;
136 <        AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}");
137 <        my $fh=FileHandle->new();
138 <        open ( $fh, ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk"
139 <          ) or die 'Unable to open /$ENV{INTwork}/".$self->{path}."/BuildFile.mk $!\n';
140 <        @{$self->{filehandlestack}}=($fh);
141 <        # make an alias
142 <        *GNUmakefile=$fh;
143 <        if ( -e $ENV{LatestBuildFile} ) {
144 <          print GNUmakefile "include $ENV{LatestBuildFile}\n";
145 <        }
146 < #       print "writing to :\n".
147 < #               "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/BuildFile.mk\n";
148 <        $ENV{LatestBuildFile}="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk";
149 <        $self->{switch}->parse("makebuild"); # sort out supported tags
150 <        if ( $numbins > 0 ) {
151 <         print GNUmakefile <<ENDTEXT;
152 < ifndef BINMODE
153 < help::
154 < \t\@echo Generic Binary targets
155 < \t\@echo ----------------------
156 < endif
157 < ENDTEXT
158 <         foreach $target ( keys %$targettypes ) {
159 <         print GNUmakefile <<ENDTEXT;
160 < ifndef BINMODE
161 < help::
162 < \t\@echo $target
163 < endif
164 < ENDTEXT
165 <         }
166 <        }
167 <        close GNUmakefile;
168 < }
169 <
170 < sub ParseBuildFile_Export {
171 <        my $self=shift;
172 <        my $filename=shift;
173 <        my $bf=BuildSystem::BuildFile->new($self->{area});
174 <        if ( defined $self->{remoteproject} ) {
175 <           $bf->{remoteproject}=$self->{remoteproject};
176 <        }
177 <        $bf->_parseexport($filename);
178 <        undef $bf;
179 < }
180 <
181 < sub _location {
182 <        my $self=shift;
183 <        use File::Basename;
184 <
185 <        return dirname($self->{switch}->filetoparse());
186 < }
187 <
188 < sub _parseexport {
189 <        my $self=shift;
190 <        my $filename=shift;
191 <
192 <        my $switchex=ActiveDoc::SimpleDoc->new();
193 <        $switchex->filetoparse($filename);
194 <        $switchex->newparse("export");
195 <        $switchex->addignoretags("export");
196 <        $switchex->addtag("export","Export",
197 <                                        \&export_start_export,$self,
198 <                                        \&OutToMakefile, $self,
199 <                                        \&export_end_export,$self);
200 <        $self->_commontags($switchex,"export");
201 <        $switchex->allowgroup("__export","export");
202 < #       $switchex->{Strict_no_cr}='no';
203 <        $self->{switch}=$switchex;
204 <        $switchex->parse("export"); # sort out supported tags
205 < }
206 <
207 < sub _pushremoteproject {
208 <        my $self=shift;
209 <        my $path=shift;
210 <        
211 <        if ( defined $self->{remoteproject} ) {
212 <          push @{$self->{rpstack}}, $self->{remoteproject};
213 <        }
214 <        $self->{remoteproject}=$path;
215 < }
216 <
217 < sub _popremoteproject {
218 <        my $self=shift;
219 <        if ( $#{$self->{rpstack}} >=0 ) {
220 <          $self->{remoteproject}=pop @{$self->{rpstack}};
221 <        }
222 <        else {
223 <          undef $self->{remoteproject};
224 <        }
225 < }
226 <
227 < sub _toolmapper {
228 <        my $self=shift;
229 <        if ( ! defined $self->{mapper} ) {
230 <           require BuildSystem::ToolMapper;
231 <           $self->{mapper}=BuildSystem::ToolMapper->new();
232 <        }
233 <        return $self->{mapper};
234 < }
235 <
236 <
237 < # ---- Tag routines
238 <
239 < #-- Override a class type with the <ConfigurationClass type=xxx> tag
240 < #   the type tag will pick up a pre-defined class type from project space.
241 <
242 < sub Class_StartTag {
243 <        my $self=shift;
244 <        my $name=shift;
245 <        my $hashref=shift;
246 <        
247 <        if ( $self->{Arch} ) {
248 <         if ( defined $$hashref{'type'} ) {
249 <                $ClassName=$$hashref{'type'};
250 <         }
251 <        }
252 < }
253 <
254 < sub IncludePath_Start {
255 <        my $self=shift;
256 <        my $name=shift;
257 <        my $hashref=shift;
258 <
259 <        $self->{switch}->checktag( $name, $hashref, 'path');
260 <        if ( $self->{Arch} ) {
261 <          print GNUmakefile "INCLUDE+=".$self->_location()."/".
262 <                                                $$hashref{'path'}."\n";
263 <        }
264 < }
19 > @ISA=qw(Exporter BuildSystem::BuildDataUtils);
20 > @EXPORT_OK=qw( );
21  
22   #
23 < # generic build tag
24 < #
25 < sub Build_start {
26 <        my $self=shift;
27 <        my $name=shift;
28 <        my $hashref=shift;
29 <
30 <        $self->{switch}->checktag($name,$hashref,'class');
31 <        if ( $self->{Arch} ) {
32 <
33 <          # -- determine the build products name
34 <          my $name;
35 <          if ( exists $$hashref{'name'} ) {
36 <            $name=$$hashref{'name'};
37 <          }
38 <          else {
39 <            $self->{switch}->parseerror("No name specified for build product");
40 <            #$name="\$(buildname)";
41 <          }
42 <
43 <          # -- check we have a lookup for the class type
44 <          my $mapper=$self->_toolmapper();
45 <          if ( ! $mapper->exists($$hashref{'class'}) ) {
46 <            $self->{switch}->parseerror("Unknown class : ".$$hashref{'class'});
47 <          }
48 <          else {
49 <           my @types=$self->_toolmapper()->types($$hashref{'class'});
50 <           my @deftypes=$self->_toolmapper()->defaulttypes($$hashref{'class'});
51 <
52 <           my $fh=$self->{filehandlestack}[0];
53 <           my @targets=();
54 <
55 <           # -- generate generic targets
56 <           print $fh "ifndef _BuildLink_\n";
57 <           print $fh "# -- Generic targets\n";
58 <           push @targets, $$hashref{'class'};
59 <           foreach $dtype ( @deftypes ) {
60 <            print $fh $$hashref{'class'}."::".$$hashref{'class'}."_".
61 <                                                                $dtype."\n";
62 <           }
63 <           print $fh "\n";
64 <
65 <           # -- generate targets for each type
66 <           foreach $type ( @types ) {
67 <
68 <            # -- generic name for each type
69 <            my $pattern=$$hashref{'class'}."_".$type;
70 <            my $dirname=$$hashref{'class'}."_".$type."_".$name;
71 <            print $fh "# ------ $pattern rules ---------------\n";
72 <            print $fh $$hashref{'class'}."_".$type."::".$$hashref{'class'}.
73 <                                                        "_".$type."_$name\n\n";
74 <
75 <            # -- create a new directory for each type
76 <            push @targets, $pattern;
77 <            my $dirname=$$hashref{'class'}."_".$type."_".$name;
78 <            my $here="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/".$dirname;
79 <            my $makefile=$here."/BuildFile.mk";
80 < #           AddDir::adddir($here);
81 <
82 <            # -- create link targets to the directory
83 <            push @targets, $dirname;
84 <            print $fh "# -- Link Targets to $type directories\n";
85 <            print $fh "$dirname: make_$dirname\n";
86 <            print $fh "\t\@cd $here; \\\n";
87 <            print $fh "\t\$(MAKE) LatestBuildFile=$makefile _BuildLink_=1".
88 <                        " workdir=$here ".
89 <                        " -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \n\n";
90 <
91 <            # -- write target to make makefile for each directory
92 <            print $fh "# -- Build target directories\n";
93 <            print $fh "make_$dirname:\n";
94 <            print $fh "\tif [ ! -e \"$makefile\" ]; then \\\n";
95 <            print $fh "\t if [ ! -d \"$here\" ]; then \\\n";
96 <            print $fh "\t  mkdir $here; \\\n";
97 <            print $fh "\t fi;\\\n";
98 <            print $fh "\t cd $dirname; \\\n";
99 <            print $fh "\t echo include ".$self->{currentenv}." > ".
100 <                                                        "$makefile; \\\n";
101 <            print $fh "\t echo VPATH+=$ENV{LOCALTOP}/".$self->{path}.
102 <                                        " >> $makefile; \\\n";
103 <            print $fh "\t echo buildname=$name >> $makefile;\\\n";
104 <            print $fh "\t echo ".$dirname.":".$pattern." >> $makefile;\\\n";
105 <            if ( defined (my @file=$mapper->rulesfile($$hashref{'class'})) ) {
106 <             foreach $f ( @file ) {
107 <              print $fh "\t echo -include $f >> $makefile; \\\n";
108 <             }
109 <            }
110 <            print $fh "\tfi\n";
111 <            print $fh "\n";
112 < #           print $typefile "$name :\n";
113 < #           print $typefile "\t\$(_quietbuild_)";
114 < #           print $typefile $mapper->template($$hashref{'class'},$type)."\n";
115 < #           print $typefile "\t\$(_quietstamp_)";
116 < #           print $typefile "$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n";
117 <
118 <            # -- cleaning targets
119 <            push @targets, "clean_$dirname";
120 <            print $fh "# -- cleaning targets\n";
121 <            print $fh "clean::clean_$dirname\n";
122 <            print $fh "clean_".$dirname."::\n";
123 <            print $fh "\t\@echo cleaning $dirname\n";
124 <            print $fh "\t\@if [ -d $here ]; then \\\n";
125 <            print $fh "\tcd $here; \\\n";
126 <            print $fh "\t\$(MAKE) LatestBuildFile=$makefile workdir=".
127 <                        $here." _BuildLink_=1 -f ".
128 <                        "\$(TOOL_HOME)/basics.mk clean; \\\n";
129 <            print $fh "\tfi\n\n";
130 <
131 <
132 <          }
133 <          # -- help targets
134 <          print $fh "helpheader::\n";
135 <          print $fh "\t\@echo Targets available:\n";
136 <          print $fh "\t\@echo ------------------\n\n";
137 <          print $fh "help::helpheader\n";
138 <          foreach $target ( @targets ) {
139 <            print $fh "help::\n";
140 <            print $fh "\t\@echo $target\n"
141 <          }
142 <          print $fh "endif\n";
143 <         } # end else
144 <        }
145 < }
146 <
147 < sub Bin_start {
148 <        my $self=shift;
393 <        my $name=shift;
394 <        my $hashref=shift;
395 <
396 <        my $fileclass;
397 <        my @tools;
398 <        my $tool;
399 <        my $filename;
400 <        my $objectname;
401 <        
402 <        $self->{switch}->checktag($name,$hashref,'file');
403 <        if ( $self->{Arch} ) {
404 <        if ( ! defined $$hashref{name} ) {
405 <                ($$hashref{name}=$$hashref{file})=~s/\..*//;
406 <        }
407 <        ($filename=$$hashref{file})=~s/\..*//;
408 <
409 <        # Create a new directory for each binary target
410 <        my $dirname="bin_".$$hashref{name};
411 <        AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname");
412 <        open (binGNUmakefile,
413 <           ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die           "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/".
414 <           "BuildFile.mk $!\n";
415 <
416 <        # Create the link targets
417 <        $numbins++;
418 <        my $fh=$self->{filehandlestack}[0];
419 <        print $fh <<ENDTEXT;
420 <
421 < # Link Targets to binary directories
422 < ifdef BINMODE
423 < # We dont want to build a library here
424 < override files:=
425 < endif
426 < ifndef BINMODE
427 <
428 < define stepdown_$$hashref{'name'}
429 < if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
430 < cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\
431 < \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\
432 < fi
433 < endef
434 <
435 < define stepdown2_$$hashref{'name'}
436 < if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
437 < cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\
438 < \$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\
439 < fi
440 <
441 < endef
442 <
443 < bin_$$hashref{'name'}_%:: dummy
444 <        \@\$(stepdown2_$$hashref{'name'})
445 <
446 < $$hashref{'name'}_%:: dummy
447 <        \@\$(stepdown_$$hashref{'name'})
448 <
449 < help bin bin_debug bin_debug_local bin_insure bin_Insure clean $$hashref{'name'}:: dummy
450 <        \@\$(stepdown_$$hashref{'name'})
451 <
452 < binfiles+=$$hashref{'file'}
453 < locbinfiles+=$dirname/$$hashref{'file'}
454 < endif
455 <
456 <
457 < ENDTEXT
458 <
459 <
460 < # the binary specifics makefile
461 <        print binGNUmakefile "include ".$self->{currentenv}."\n";
462 <        print binGNUmakefile "VPATH+=$ENV{LOCALTOP}/$self{path}\n";
463 <
464 < # alias for bin_Insure
465 <        print binGNUmakefile <<ENDTEXT;
466 <
467 < bin_insure:bin_Insure
468 < ifdef MAKETARGET_bin_insure
469 < MAKETARGET_$$hashref{name}_Insure=1
470 < endif
471 <
472 < # debuggging target
473 < $$hashref{'name'}_echo_% :: echo_%
474 <
475 < # help targets
476 < help::
477 < \t\@echo Targets For $$hashref{'name'}
478 < \t\@echo -------------------------------------
479 < \t\@echo $$hashref{'name'}  - default build
480 < \t\@echo bin_$$hashref{'name'}_clean - executable specific cleaning
481 < ENDTEXT
482 <
483 < # Make generic rules for each type
484 <        $targettypes={
485 <                "bin" => 'o',
486 <                "bin_debug" => 'd',
487 <                "bin_debug_local" => 'l_d',
488 <                "bin_Insure" => 'Insure'
489 <        };
490 <        #
491 <        foreach $target ( keys %$targettypes ) {
492 <          print binGNUmakefile <<ENDTEXT;
493 <
494 < # Type $target specifics
495 < ifdef MAKETARGET_$target
496 < MAKETARGET_$$hashref{name}_$$targettypes{$target}=1
497 < endif
498 < $target ::$$hashref{name}_$$targettypes{$target}
499 <
500 < bintargets+=$$hashref{name}_$$targettypes{$target}
501 < help::
502 < \t\@echo $$hashref{name}_$$targettypes{$target}
503 < clean::
504 < \t\@if [ -f \$(binarystore)/$$hashref{name}_$$targettypes{$target} ]; then \\
505 < \techo Removing \$(binarystore)/$$hashref{name}; \\
506 < \trm \$(binarystore)/$$hashref{name}_$$targettypes{$target}; \\
507 < \tfi
508 <
509 < ENDTEXT
510 <          ($objectname=$$hashref{file})=~s/\..*/_$$targettypes{$target}\.o/;
511 <          ${"objectname_$$targettypes{$target}"}=$objectname;
512 <          print binGNUmakefile "$objectname:$$hashref{name}.dep\n";
513 <        } # end loop
514 <
515 <        print binGNUmakefile "$$hashref{name}_Insure.exe:.psrc\n";
516 <        print binGNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
517 <        print binGNUmakefile "\t\$(CClinkCmdDebug)\n";
518 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
519 <        print binGNUmakefile "$$hashref{name}_l_d.exe:$objectname_d\n";
520 <        print binGNUmakefile "\t\$(CClinkCmdDebugLocal)\n";
521 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
522 <        print binGNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
523 <        print binGNUmakefile "\t\$(CClinkCmdInsure)\n";
524 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
525 <        print binGNUmakefile "$$hashref{name}_o.exe:$objectname_o\n";
526 <        print binGNUmakefile "\t\$(CClinkCmd)\n";
527 <        print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
528 <        print binGNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
529 <        print binGNUmakefile "-include $$hashref{name}.dep\n";
530 < print binGNUmakefile <<ENDTEXT;
531 < clean::
532 < \t\@if [ -f \$(binarystore)/$$hashref{name} ]; then \\
533 < \techo Removing \$(binarystore)/$$hashref{name}; \\
534 < \trm \$(binarystore)/$$hashref{name}; \\
535 < \tfi
536 <
537 < $$hashref{name}_d.exe:\$(libslocal_d)
538 < $$hashref{name}_o.exe:\$(libslocal)
539 < ifdef MCCABE_DATA_DIR
540 < $$hashref{name}_mccabe.exe: \$(libslocal_d) \$(MCCABE_DATA_DIR)/mccabeinstr/instplus.cpp
541 < endif
542 < $$hashref{name}_Insure.exe:\$(libslocal_I)
543 < $$hashref{name}_d:$$hashref{name}_d.exe
544 <        \@cp $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
545 < $$hashref{name}_l_d:$$hashref{name}_l_d.exe
546 <        \@cp $$hashref{name}_l_d.exe \$(binarystore)/$$hashref{name}
547 < $$hashref{name}_Insure:$$hashref{name}_Insure.exe
548 <        \@cp $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure
549 < $$hashref{name}:$$hashref{name}_d.exe
550 <        \@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
551 < $$hashref{name}_o:$$hashref{name}_o.exe
552 <        \@mv $$hashref{name}_o.exe \$(binarystore)/$$hashref{name}
553 < binfiles+=$$hashref{file}
554 < ENDTEXT
555 <        }
556 <        close binGNUmakefile;
557 < }
558 <
559 < sub External_StartTag {
560 <        my $self=shift;
561 <        my $name=shift;
562 <        my $hashref=shift;
563 <        
564 <        my $tool;
565 <        if ( $self->{Arch} ) {
566 <        $self->{switch}->checktag($name,$hashref,'ref');
567 <
568 <        # -- oo toolbox stuff
569 <        # - get the appropriate tool object
570 <        $$hashref{'ref'}=~tr[A-Z][a-z];
571 <        if ( ! exists $$hashref{'version'} ) {
572 <         $tool=$self->{toolbox}->gettool($$hashref{'ref'});
573 <        }
574 <        else {
575 <         $tool=$self->{toolbox}->gettool($$hashref{'ref'},$$hashref{'version'});
576 <        }
577 <        if ( ! defined $tool ) {
578 <          $self->{switch}->parseerror("Unknown Tool Specified ("
579 <                                                        .$$hashref{'ref'}.")");
580 <        }
581 <
582 <        # -- old fashioned GNUmakefile stuff
583 <        print GNUmakefile $$hashref{'ref'};
584 <        if ( defined $$hashref{'version'} ) {
585 <                print GNUmakefile "_V_".$$hashref{'version'};
586 <        }
587 <        print GNUmakefile "=true\n";
588 <        
589 <        # -- Sub system also specified?
590 <        if ( exists $$hashref{'use'} ) {
591 <           # -- look for a buildfile
592 <           my @paths=$tool->getfeature("INCLUDE");
593 <           my $file="";
594 <           my ($path,$testfile);
595 <           foreach $path ( @paths ) {
596 <             $testfile=$path."/".$$hashref{'use'}."/BuildFile" ;
597 <             if ( -f $testfile ) {
598 <                $file=$testfile;
599 <                $self->_pushremoteproject($path);
600 <             }
601 <           }
602 <           if ( $file eq "" ) {
603 <             $self->{switch}->parseerror("Unable to find SubSystem $testfile");
604 <           }
605 <           $self->ParseBuildFile_Export($file);
606 <           $self->_popremoteproject();
607 <         }
608 <        }
609 < }      
610 <
611 < sub Group_start {
612 <        my $self=shift;
613 <        my $name=shift;
614 <        my $hashref=shift;
615 <        
616 <        $self->{switch}->checktag($name, $hashref, 'name');
617 <        if ( $self->{Arch} ) {
618 <        print GNUmakefile "GROUP_".$$hashref{'name'};
619 <        if ( defined $$hashref{'version'} ) {
620 <                print GNUmakefile "_V_".$$hashref{'version'};
621 <        }
622 <        print GNUmakefile "=true\n";
623 <        }
624 < }      
625 <
626 < sub Use_start {
627 <        my $self=shift;
628 <        my $name=shift;
629 <        my $hashref=shift;
630 <        my $filename;
631 <        use Utilities::SCRAMUtils;
632 <        
633 <        $self->{switch}->checktag($name, $hashref, "name");
634 <        if ( $self->{Arch} ) {
635 <        if ( exists $$hashref{'group'} ) {
636 <          print GNUmakefile "GROUP_".$$hashref{'group'}."=true\n";
637 <        }
638 <        if ( ! defined $self->{remoteproject} ) {
639 <          $filename=SCRAMUtils::checkfile(
640 <                "/$ENV{INTsrc}/$$hashref{name}/BuildFile");
641 <        }
642 <        else {
643 <          $filename=$self->{remoteproject}."/$$hashref{name}/BuildFile";
644 <        print "trying $filename\n";
645 <          if ( ! -f $filename ) { $filename=""; };
646 <        }
647 <        if ( $filename ne "" ) {
648 <          $self->ParseBuildFile_Export( $filename );
649 <        }
650 <        else {
651 <           $self->{switch}->parseerror("Unable to detect Appropriate ".
652 <                "decription file for <$name name=".$$hashref{name}.">");
653 <        }
654 <        }
655 < }
656 <
657 < sub CheckBuildFile {
658 <         my $self=shift;
659 <         my $classdir=shift;
660 <         my $ClassName="";
661 <         my $thisfile="$classdir/$buildfile";
23 > sub new()
24 >   ###############################################################
25 >   # new                                                         #
26 >   ###############################################################
27 >   # modified : Wed Dec  3 19:03:22 2003 / SFA                   #
28 >   # params   :                                                  #
29 >   #          :                                                  #
30 >   # function :                                                  #
31 >   #          :                                                  #
32 >   ###############################################################
33 >   {
34 >   my $proto=shift;
35 >   my $class=ref($proto) || $proto;
36 >   my $self={};
37 >  
38 >   bless $self,$class;
39 >
40 >   $self->{DEPENDENCIES} = {};
41 >   $self->{content} = {};
42 >   return $self;
43 >   }
44 >
45 > sub _initparser()
46 >   {
47 >   my $self=shift;
48 >
49 >   $self->{simpledoc}=ActiveDoc::SimpleDoc->new();
50 >   $self->{simpledoc}->newparse("builder");
51 >   $self->{simpledoc}->addignoretags("builder");
52 >
53 >   # For blank lines do nothing:
54 >   $self->{simpledoc}->addtag("builder","none",
55 >                              "", $self,
56 >                              "", $self,
57 >                              "", $self);
58 >  
59 >   # Define the tags to be used in this class:
60 >   $self->{simpledoc}->addtag("builder","classpath",
61 >                              \&BuildSystem::TagUtils::classpathtagOpen, $self,
62 >                              "", $self,
63 >                              "", $self);
64 >
65 >   $self->{simpledoc}->addtag("builder","productstore",
66 >                              \&BuildSystem::TagUtils::productstoretagOpen, $self,
67 >                              "", $self,
68 >                              "", $self);
69 >
70 >   $self->{simpledoc}->addtag("builder","architecture",
71 >                              \&BuildSystem::TagUtils::archtagOpen, $self,
72 >                              "", $self,
73 >                              \&BuildSystem::TagUtils::archtagClose, $self);
74 >
75 >   $self->{simpledoc}->addtag("builder","include_path",
76 >                              \&BuildSystem::TagUtils::includetagOpen, $self,
77 >                              "", $self,
78 >                              "", $self);
79 >  
80 >   $self->{simpledoc}->addtag("builder","define_group",
81 >                              \&BuildSystem::TagUtils::groupdeftagOpen, $self,
82 >                              "", $self,
83 >                              \&BuildSystem::TagUtils::groupdeftagClose, $self);
84 >  
85 >   $self->{simpledoc}->addtag("builder","group",
86 >                              \&BuildSystem::TagUtils::grouptagOpen, $self,
87 >                              "", $self,
88 >                              "", $self);
89 >  
90 >   $self->{simpledoc}->addtag("builder","lib",
91 >                              \&BuildSystem::TagUtils::libtagOpen, $self,
92 >                              "", $self,
93 >                              "", $self);
94 >
95 >   $self->{simpledoc}->addtag("builder","export",
96 >                              \&BuildSystem::TagUtils::exporttagOpen, $self,
97 >                              "", $self,
98 >                              \&BuildSystem::TagUtils::exporttagClose, $self);
99 >
100 >   $self->{simpledoc}->addtag("builder","use",
101 >                              \&BuildSystem::TagUtils::usetagOpen, $self,
102 >                              "", $self,
103 >                              "", $self);
104 >  
105 >   $self->{simpledoc}->addtag("builder","libtype",
106 >                              \&BuildSystem::TagUtils::libtypetagOpen, $self,
107 >                              "", $self,
108 >                              "", $self);
109 >
110 >   $self->{simpledoc}->addtag("builder","skip",
111 >                              \&BuildSystem::TagUtils::skiptagOpen, $self,
112 >                              \&BuildSystem::TagUtils::skiptagMessage, $self,
113 >                              \&BuildSystem::TagUtils::skiptagClose, $self);
114 >
115 >   $self->{simpledoc}->addtag("builder","makefile",
116 >                              \&BuildSystem::TagUtils::makefiletagOpen, $self,
117 >                              \&BuildSystem::TagUtils::makefiletagContent, $self,
118 >                              \&BuildSystem::TagUtils::makefiletagClose, $self);
119 >
120 >   $self->{simpledoc}->addtag("builder","flags",
121 >                              \&BuildSystem::TagUtils::flagstagOpen, $self,
122 >                              "", $self,
123 >                              "", $self);
124 >  
125 >   $self->{simpledoc}->addtag("builder","bin",
126 >                              \&BuildSystem::TagUtils::binarytagOpen, $self,
127 >                              "", $self,
128 >                              \&BuildSystem::TagUtils::binarytagClose, $self);
129 >  
130 >   $self->{simpledoc}->addtag("builder","module",
131 >                              \&BuildSystem::TagUtils::moduletagOpen, $self,
132 >                              "", $self,
133 >                              \&BuildSystem::TagUtils::moduletagClose, $self);
134 >  
135 >   $self->{simpledoc}->addtag("builder","application",
136 >                              \&BuildSystem::TagUtils::applicationtagOpen, $self,
137 >                              "", $self,
138 >                              \&BuildSystem::TagUtils::applicationtagClose, $self);
139 >
140 >   $self->{simpledoc}->addtag("builder","library",
141 >                              \&BuildSystem::TagUtils::librarytagOpen, $self,
142 >                              "", $self,
143 >                              \&BuildSystem::TagUtils::librarytagClose, $self);
144 >
145 > #    $self->{simpledoc}->addtag("builder"," ",
146 > #                             \&BuildSystem::TagUtils::  ,$self,
147 > #                             \&BuildSystem::TagUtils::  ,$self,
148 > #                             \&BuildSystem::TagUtils::  ,$self);
149  
150 <         if ( -e $ENV{LOCALTOP}."/".$thisfile ) {
151 <            $DefaultBuildfile="$ENV{LOCALTOP}/$thisfile";
665 <            $self->ParseBuildFile($ENV{LOCALTOP}, $classdir, $buildfile);
666 <         }
667 <         elsif ( -e $ENV{RELEASETOP}."/".$thisfile ) {
668 <            $DefaultBuildfile="$ENV{RELEASETOP}/$thisfile";
669 <            $self->ParseBuildFile($ENV{RELEASETOP}, $classdir, $buildfile);
670 <         }
671 <         return $ClassName;
672 < }
673 <
674 < # List association groups between <AssociateGroup> tags
675 < # seperated by newlines or spaces
676 < sub AssociateGroup {
677 <        my $self=shift;
678 <        my $name=shift;
679 <        my $string=shift;
680 <        my $word;
681 <
682 <        if ( $self->{Arch} ) {
683 <        foreach $word ( (split /\s/, $string) ){
684 <                chomp $word;
685 <                next if /^#/;
686 <                if ( $word=~/none/ ) {
687 <                        $self->{ignore}=1;
688 <                }
689 <        }
690 <        }
691 < }
692 <
693 < sub Arch_Start {
694 <        my $self=shift;
695 <        my $name=shift;
696 <        my $hashref=shift;
697 <
698 <        $self->{switch}->checktag($name, $hashref,'name');
699 <        ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($self->{Arch}=1)
700 <                                                : ($self->{Arch}=0);
701 <        push @{$self->{ARCHBLOCK}}, $self->{Arch};
702 < }
703 <
704 < sub Arch_End {
705 <        my $self=shift;
706 <        my $name=shift;
707 <
708 <        pop @{$self->{ARCHBLOCK}};
709 <        $self->{Arch}=$self->{ARCHBLOCK}[$#{$self->{ARCHBLOCK}}];
710 < }
711 <
712 < # Split up the Class Block String into a useable array
713 < sub _CutBlock {
714 <    my $self=shift;
715 <    my $string= shift @_;
716 <    @BlockClassA = split /\//, $string;
717 < }
718 <
719 < sub OutToMakefile {
720 <        my $self=shift;
721 <        my $name=shift;
722 <        my @vars=@_;
723 <
724 <        if ( $self->{Arch} ) {
725 <          print GNUmakefile @vars;
726 <        }
727 < }
728 <
729 < sub OutToScreen {
730 <        my $name=shift;
731 <        my @vars=@_;
732 <
733 <        if ( $self->{Arch} ) {
734 <          print @vars;
735 <        }
736 < }
737 < sub setBlockClassPath {
738 <        my $self=shift;
739 <        my $name=shift;
740 <        my $hashref=shift;
741 <
742 <        $self->{switch}->checktag($name, $hashref, 'path');
743 <        $self->{BlockClassPath}=$self->{BlockClassPath}.":".$$hashref{path};
744 <        $self->_CutBlock($$hashref{path});
745 < }
746 <
747 < sub BlockClassPath {
748 <        my $self=shift;
749 <        return $self->{BlockClassPath};
750 < }
751 <
752 < sub export_start_export {
753 <        my $self=shift;
754 <        my $name=shift;
755 <        my $hashref=shift;
756 <
757 <        $self->{switch}->opengroup("__export");
758 < }
759 <
760 < sub export_start {
761 <        my $self=shift;
762 <        my $name=shift;
763 <        my $hashref=shift;
764 <
765 <        $self->{switch}->opengroup("__export");
766 <        if ( exists $$hashref{autoexport} ) {
767 <          print GNUmakefile "scram_autoexport=".$$hashref{autoexport}."\n";
768 <          if ( $$hashref{autoexport}=~/true/ ) {
769 <           $self->{switch}->allowgroup("__export","makebuild");
770 <          }
771 <          else {
772 <           $self->{switch}->disallowgroup("__export","makebuild");
773 <          }
774 <        }
775 <        # -- allow default setting from other makefiles
776 <        print GNUmakefile "ifeq (\$(scram_autoexport),true)\n";
777 < }
778 <
779 < sub export_end_export {
780 <        my $self=shift;
781 <        $self->{switch}->closegroup("__export");
782 < }
783 <
784 < sub export_end {
785 <        my $self=shift;
786 <        $self->{switch}->closegroup("__export");
787 <        print GNUmakefile "endif\n";
788 < }
150 >   return $self->{simpledoc};
151 >   }
152  
153 < #
154 < # Standard lib tag
155 < #
156 < sub lib_start {
157 <        my $self=shift;
158 <        my $name=shift;
159 <        my $hashref=shift;
160 <
161 <        $self->{switch}->checktag($name, $hashref, 'name');
162 <        if ( $self->{Arch} ) {
163 <           print GNUmakefile "lib+=$$hashref{name}\n";
164 <        }
165 < }
153 > sub parse()
154 >   {
155 >   my $self=shift;
156 >   my ($filename)=@_;
157 >
158 >   $self->{simpledoc}=$self->_initparser();
159 >   $self->{simpledoc}->filetoparse($filename);
160 >   $self->{simpledoc}->parse("builder");
161 >  
162 >   # We're done with the SimpleDoc object so delete it:
163 >   delete $self->{simpledoc};
164 >   }
165 >
166 > sub _initbranchparser()
167 >   {
168 >   my $self=shift;
169 >
170 >   $self->{simpledoc}=ActiveDoc::SimpleDoc->new();
171 >   $self->{simpledoc}->newparse("branchbuilder");
172 >   $self->{simpledoc}->addignoretags("branchbuilder");
173 >
174 >   # For blank lines do nothing:
175 >   $self->{simpledoc}->addtag("branchbuilder","none",
176 >                              "", $self,
177 >                              "", $self,
178 >                              "", $self);
179 >  
180 >   # Define the tags to be used in this class:
181 >   $self->{simpledoc}->addtag("branchbuilder","productstore",
182 >                              \&BuildSystem::TagUtils::productstoretagOpen, $self,
183 >                              "", $self,
184 >                              "", $self);
185 >  
186 >   $self->{simpledoc}->addtag("branchbuilder","architecture",
187 >                              \&BuildSystem::TagUtils::archtagOpen, $self,
188 >                              "", $self,
189 >                              \&BuildSystem::TagUtils::archtagClose, $self);
190 >
191 >   $self->{simpledoc}->addtag("branchbuilder","include_path",
192 >                              \&BuildSystem::TagUtils::includetagOpen, $self,
193 >                              "", $self,
194 >                              "", $self);
195 >  
196 >   $self->{simpledoc}->addtag("branchbuilder","export",
197 >                              \&BuildSystem::TagUtils::exporttagOpen, $self,
198 >                              "", $self,
199 >                              \&BuildSystem::TagUtils::exporttagClose, $self);
200 >
201 >   $self->{simpledoc}->addtag("branchbuilder","define_group",
202 >                              \&BuildSystem::TagUtils::groupdeftagOpen, $self,
203 >                              "", $self,
204 >                              \&BuildSystem::TagUtils::groupdeftagClose, $self);
205 >  
206 >   $self->{simpledoc}->addtag("branchbuilder","group",
207 >                              \&BuildSystem::TagUtils::grouptagOpen, $self,
208 >                              "", $self,
209 >                              "", $self);
210 >  
211 >   $self->{simpledoc}->addtag("branchbuilder","lib",
212 >                              \&BuildSystem::TagUtils::libtagOpen, $self,
213 >                              "", $self,
214 >                              "", $self);
215 >
216 >   $self->{simpledoc}->addtag("branchbuilder","use",
217 >                              \&BuildSystem::TagUtils::usetagOpen, $self,
218 >                              "", $self,
219 >                              "", $self);
220 >  
221 >   $self->{simpledoc}->addtag("branchbuilder","libtype",
222 >                              \&BuildSystem::TagUtils::libtypetagOpen, $self,
223 >                              "", $self,
224 >                              "", $self);
225 >  
226 >   $self->{simpledoc}->addtag("branchbuilder","makefile",
227 >                              \&BuildSystem::TagUtils::makefiletagOpen, $self,
228 >                              \&BuildSystem::TagUtils::makefiletagContent, $self,
229 >                              \&BuildSystem::TagUtils::makefiletagClose, $self);
230 >
231 >   $self->{simpledoc}->addtag("branchbuilder","flags",
232 >                              \&BuildSystem::TagUtils::flagstagOpen, $self,
233 >                              "", $self,
234 >                              "", $self);
235 >  
236 >   $self->{simpledoc}->addtag("branchbuilder","bin",
237 >                              \&BuildSystem::TagUtils::binarytagOpen, $self,
238 >                              "", $self,
239 >                              \&BuildSystem::TagUtils::binarytagClose, $self);
240 >  
241 >   $self->{simpledoc}->addtag("branchbuilder","module",
242 >                              \&BuildSystem::TagUtils::moduletagOpen, $self,
243 >                              "", $self,
244 >                              \&BuildSystem::TagUtils::moduletagClose, $self);
245 >  
246 >   $self->{simpledoc}->addtag("branchbuilder","application",
247 >                              \&BuildSystem::TagUtils::applicationtagOpen, $self,
248 >                              "", $self,
249 >                              \&BuildSystem::TagUtils::applicationtagClose, $self);
250 >
251 >   $self->{simpledoc}->addtag("branchbuilder","library",
252 >                              \&BuildSystem::TagUtils::librarytagOpen, $self,
253 >                              "", $self,
254 >                              \&BuildSystem::TagUtils::librarytagClose, $self);
255 >  
256 >   return $self->{simpledoc};
257 >   }
258 >
259 > sub parsebranchfiles()
260 >   {
261 >   my $self=shift;
262 >   my ($filenames)=@_; # array ref
263 >   # List of buildfiles:
264 >   $self->{localpaths}=$filenames;
265 >   $self->{simpledoc}=$self->_initbranchparser();
266 >   # We iterate over an array of files to be read in turn: all
267 >   # build data will be stored in the same BuildFile object:
268 >   $self->{simpledoc}->parsefilelist("branchbuilder",$filenames);
269 >   # We're done with the SimpleDoc object so delete it:
270 >   delete $self->{simpledoc};
271 >   }
272 >
273 > sub productcollector()
274 >   {
275 >   my $self=shift;
276 >   my ($name,$typeshort,$typefull)=@_;
277 >   # Create a new Product object for storage of data:
278 >   use BuildSystem::Product;
279 >   my $product = BuildSystem::Product->new();
280 >   # Store the name:
281 >   $product->name($name);
282 >   $product->type($typeshort);
283 >   # Store the files:
284 >   $product->_files($self->{id}->{'file'},$self->{localpaths});
285 >   # Store the data content:
286 >   $product->_data($self->{tagcontent});
287 >   # And store in a hash (all build products in same place):
288 >   $self->{content}->{BUILDPRODUCTS}->{$typefull}->{$name} = $product;
289 >   }
290 >
291 > sub pushlevel
292 >   {
293 >   my $self = shift;
294 >   my ($info)=@_;
295 >  
296 >   $self->{id} = $info if (defined $info);
297 >   $self->{nested} = 1;
298 >   $self->{tagcontent}={};
299 >   }
300 >
301 > sub poplevel
302 >   {
303 >   my $self = shift;
304 >   delete $self->{id};
305 >   delete $self->{nested};
306 >   delete $self->{tagcontent};
307 >   }
308 >
309 > sub dependencies()
310 >   {
311 >   my $self=shift;
312 >   # Make a copy of the variable so that
313 >   # we don't have a DEPENDENCIES entry in RAWDATA:
314 >   my %DEPS=%{$self->{DEPENDENCIES}};
315 >   delete $self->{DEPENDENCIES};
316 >   return \%DEPS;
317 >   }
318 >
319 > sub skippeddirs()
320 >   {
321 >   my $self=shift;
322 >   my ($here)=@_;
323 >   my $skipped;
324 >
325 >   if ($self->{content}->{SKIPPEDDIRS}->[0] == 1)
326 >      {
327 >      $skipped = [ @{$self->{content}->{SKIPPEDDIRS}} ];
328 >      delete $self->{content}->{SKIPPEDDIRS};
329 >      }
330 >  
331 >   delete $self->{content}->{SKIPPEDDIRS};
332 >   return $skipped;
333 >   }
334  
335   #
336 < # libtype specification
336 > # All data access methods are inherited from BuildDataUtils.
337   #
338 < sub LibType_Start {
808 <        my $self=shift;
809 <        my $name=shift;
810 <        my $hashref=shift;
811 <
812 <        if ( $self->{Arch} ) {
813 <        if ( defined $self->{libtype_conext} ) {
814 <          $self->{switch}->parseerror("<$name> tag cannot be specified".
815 <                " without a </$name> tag to close previous context");
816 <        }
817 <        else {
818 <        $self->{libtype_conext}=1;
819 <        $self->{switch}->checktag($name, $hashref, 'type');
820 <        
821 <        print GNUmakefile "# Specify Library Type\n";
822 <        print GNUmakefile "DefaultLibsOff=yes\n";
823 <        if ( $$hashref{'type'}=~/^archive/i ) {
824 <          print GNUmakefile "LibArchive=true\n";
825 <        }
826 <        elsif ($$hashref{'type'}=~/debug_archive/i ) {
827 <          print GNUmakefile "LibDebugArchive=true\n";
828 <        }
829 <        elsif ($$hashref{'type'}=~/debug_shared/i ) {
830 <          print GNUmakefile "LibDebugShared=true\n";
831 <        }
832 <        elsif ($$hashref{'type'}=~/shared/i ) {
833 <          print GNUmakefile 'LibShared=true'."\n";
834 <        }
835 <        print GNUmakefile "\n";
836 <        }
837 <        }
838 < }
839 <
840 < sub LibType_text {
841 <        my $self=shift;
842 <        my $name=shift;
843 <        my $string=shift;
844 <
845 <        if ( $self->{Arch} ) {
846 <          $string=~s/\n/ /g;
847 <          print GNUmakefile "libmsg::\n\t\@echo Library info: ";
848 <          print GNUmakefile $string;
849 <          print GNUmakefile "\n";
850 <        }
851 < }
852 <
853 < sub LibType_end {
854 <        my $self=shift;
855 <        my $name=shift;
856 <
857 <        undef $self->{libtype_conext};
858 < }
859 <
860 < sub Environment_start {
861 <        my $self=shift;
862 <        my $name=shift;
863 <        my $hashref=shift;
864 <
865 <        if ( $self->{Arch} ) {
866 <          $self->{envnum}++;
867 <
868 <          # open a new Environment File
869 <          my $envfile="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_".
870 <                $self->{envnum}.".mk";
871 <          use FileHandle;
872 <          my $fh=FileHandle->new();
873 <          open ($fh,">$envfile") or die "Unable to open file $envfile \n$!\n";
874 <          push @{$self->{filehandlestack}}, $fh;
875 <          *GNUmakefile=$fh;
876 <
877 <          # include the approprate environment file
878 <          if ( $self->{envlevel} == 0 ) {
879 <             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/".
880 <                $self->{path}."/BuildFile.mk\n";
881 <          }
882 <          else {
883 <             print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/".
884 <                $self->{path}."/Env_".$self->{Envlevels}[$self->{envlevel}].".mk\n";
885 <          }
886 <          $self->{envlevel}++;
887 <          $self->{Envlevels}[$self->{envlevel}]=$self->{envnum};
888 <          $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk";
889 <        }
890 < }
891 <
892 < sub Environment_end {
893 <        my $self=shift;
894 <        my $fd;
895 <
896 <        if ( $self->{Arch} ) {
897 <          $self->{envlevel}--;
898 <          if ( $self->{envlevel} < 0 ) {
899 <            print "Too many </Environent> Tags on $self->{switch}->line()\n";
900 <            exit 1;
901 <          }
902 <          close GNUmakefile;
903 <          # restore the last filehandle
904 <          $fd=pop @{$self->{filehandlestack}};
905 <          close $fd;
906 <          *GNUmakefile=$self->{filehandlestack}[$#{$self->{filehandlestack}}];
907 <          if ( $self->{envlevel} < 1 ) {
908 <            $self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/".
909 <                        "BuildFile.mk";
910 <          }
911 <          else {
912 <            $self->{currentenv}=
913 <             "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_".
914 <                $self->{Envlevels}[$self->{envlevel}];
915 <          }
916 <        }
917 < }
338 > 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines