ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildFile.pm
Revision: 1.21.2.26
Committed: Wed Oct 13 16:47:30 1999 UTC (25 years, 7 months ago) by williamc
Content type: text/plain
Branch: V0_9branch
Changes since 1.21.2.25: +3 -0 lines
Log Message:
Add name_% target

File Contents

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