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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines