1 |
– |
#!/usr/local/bin/perl5 |
2 |
– |
# |
3 |
– |
|
1 |
|
package BuildFile; |
2 |
+ |
require 5.001; |
3 |
|
require Exporter; |
4 |
|
@ISA = qw(Exporter); |
5 |
|
@EXPORT = qw(CheckBuildFile ParseBuildFile @BlockClassA $DefaultBuildFile); |
7 |
|
BEGIN { |
8 |
|
use ToolBox; |
9 |
|
$buildfile="BuildFile"; |
10 |
< |
#$toolbox=ToolBox->new(); |
10 |
> |
$toolbox=ToolBox->new(); |
11 |
|
} |
12 |
|
|
13 |
|
#Parse the BuildFile |
29 |
|
'ConfigurationClass' => \&OutToMakefile, |
30 |
|
'AssociateGroup' => \&AssociateGroup, |
31 |
|
'none' => \&OutToMakefile, |
32 |
< |
'Bin' => \&OutToMakefile, |
32 |
> |
'Bin' => 'none', |
33 |
|
'Bin_StartTag' => \&Bin_start, |
34 |
|
'ClassPath' => \&OutToMakefile, |
35 |
|
'ClassPath_StartTag' => \&setBlockClassPath |
36 |
|
}; |
37 |
< |
use Switcher; |
37 |
> |
use Utilities::Switcher; |
38 |
|
$switch=Switcher->new($SupportedTags, $fullfilename); |
39 |
|
$switch->{Strict_no_cr}='no'; |
40 |
|
#open a temporary gnumakefile to store output. |
41 |
< |
use AddDir; |
42 |
< |
adddir("$ENV{LOCALTOP}/$ENV{INTwork}/${path}"); |
41 |
> |
use Utilities::AddDir; |
42 |
> |
AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/${path}"); |
43 |
|
open ( GNUmakefile, ">$ENV{LOCALTOP}/$ENV{INTwork}/${path}/BuildFile.mk") or die 'Unable to open /$ENV{INTwork}/${path}/BuildFile.mk $!\n'; |
44 |
|
if ( -e $ENV{LatestBuildFile} ) { |
45 |
|
print GNUmakefile "include $ENV{LatestBuildFile}\n"; |
102 |
|
my $fileclass; |
103 |
|
my @tools; |
104 |
|
my $tool; |
105 |
+ |
my $filename; |
106 |
+ |
my $objectname; |
107 |
|
|
108 |
|
$hashref=$switch->SetupValueHash(\@vars); |
109 |
|
$switch->checkparam($hashref, $name, 'file'); |
110 |
|
if ( ! defined $$hashref{name} ) { |
111 |
|
($$hashref{name}=$$hashref{file})=~s/\..*//; |
112 |
|
} |
113 |
< |
$fileclass=getclass($file); |
114 |
< |
$toolbox->maketargets("exe",$fileclass, $$hashref{name}, $file ); |
115 |
< |
print GNUmakefile "bin::$file\n\n"; |
113 |
> |
# This stuff for later |
114 |
> |
#$fileclass=$toolbox->getclass($file); |
115 |
> |
#$toolbox->maketargets("exe",$fileclass, $$hashref{name}, $file ); |
116 |
> |
($filename=$$hashref{file})=~s/\..*//; |
117 |
> |
($objectname=$$hashref{file})=~s/\..*/\.o/; |
118 |
> |
($objectname_d=$$hashref{file})=~s/\..*/_d\.o/; |
119 |
> |
($objectname_Insure=$$hashref{file})=~s/\..*/_Insure\.o/; |
120 |
> |
print GNUmakefile "bin:$$hashref{name}\n"; |
121 |
> |
print GNUmakefile "bin_debug:$$hashref{name}_d\n"; |
122 |
> |
print GNUmakefile "bin_insure:$$hashref{name}_Insure\n"; |
123 |
> |
print GNUmakefile ".INTERMEDIATE::$$hashref{name}_d.exe\n"; |
124 |
> |
print GNUmakefile ".INTERMEDIATE::$$hashref{name}_Insure.exe\n"; |
125 |
> |
print GNUmakefile ".INTERMEDIATE::$$hashref{name}.exe\n"; |
126 |
> |
print GNUmakefile "$$hashref{name}_Insure:.psrc\n"; |
127 |
> |
print GNUmakefile "$$hashref{name}_d.exe:$objectname_d\n"; |
128 |
> |
print GNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n"; |
129 |
> |
print GNUmakefile "$$hashref{name}.exe:$objectname\n"; |
130 |
> |
print GNUmakefile "$objectname:$$hashref{name}.dep\n"; |
131 |
> |
print GNUmakefile "$objectname_d:$$hashref{name}.dep\n"; |
132 |
> |
print GNUmakefile "$objectname_Insure:$$hashref{name}.dep\n"; |
133 |
> |
print GNUmakefile "$$hashref{name}.dep:$$hashref{file}\n"; |
134 |
> |
print GNUmakefile "-include $$hashref{name}.dep\n"; |
135 |
> |
# print GNUmakefile "$$hashref{name}:$$hashref{file}\n"; |
136 |
> |
print GNUmakefile "$$hashref{name}_d:$$hashref{name}_d.exe\n"; |
137 |
> |
print GNUmakefile "\t\@mv $$hashref{name}_d.exe \$(binarystore)/". |
138 |
> |
"$$hashref{name}\n"; |
139 |
> |
print GNUmakefile "$$hashref{name}_Insure:$$hashref{name}_Insure.exe\n"; |
140 |
> |
print GNUmakefile "\t\@mv $$hashref{name}_Insure.exe \$(binarystore)/". |
141 |
> |
"$$hashref{name}_Insure\n"; |
142 |
> |
print GNUmakefile "$$hashref{name}:$$hashref{name}.exe\n"; |
143 |
> |
print GNUmakefile "\t\@mv $$hashref{name}.exe \$(binarystore)/". |
144 |
> |
"$$hashref{name}\n"; |
145 |
> |
print GNUmakefile "binfiles+=$filename\n"; |
146 |
> |
print GNUmakefile "bintargets+=$$hashref{name} $$hashref{name}_d\n"; |
147 |
> |
print GNUmakefile "#files+=$$hashref{file}\n"; |
148 |
> |
|
149 |
|
} |
150 |
|
|
151 |
|
sub External_StartTag { |
154 |
|
my $hashref; |
155 |
|
|
156 |
|
$hashref=$switch->SetupValueHash(\@vars); |
157 |
+ |
$$hashref{'ref'}=~tr[A-Z][a-z]; |
158 |
|
print GNUmakefile $$hashref{'ref'}; |
159 |
|
if ( defined $$hashref{'version'} ) { |
160 |
|
print GNUmakefile "_V_".$$hashref{'version'}; |
197 |
|
my @vars=@_; |
198 |
|
my $hashref; |
199 |
|
my $filename; |
200 |
< |
use SCRAMUtils; |
200 |
> |
use Utilities::SCRAMUtils; |
201 |
|
|
202 |
|
$hashref=$switch->SetupValueHash(\@vars); |
203 |
|
$switch->checkparam($hashref, $name, "name"); |
208 |
|
print GNUmakefile "local__$$hashref{name}=true\n"; |
209 |
|
} |
210 |
|
|
211 |
< |
sub CheckBuildFile($directory) { |
211 |
> |
sub CheckBuildFile { |
212 |
|
my $classdir=shift; |
213 |
|
$ClassName=""; |
214 |
|
$thisfile="$classdir/$buildfile"; |
239 |
|
} |
240 |
|
|
241 |
|
# Split up the Class Block String into a useable array |
242 |
< |
sub _CutBlock($string) { |
242 |
> |
sub _CutBlock { |
243 |
|
my $string= shift @_; |
244 |
|
@BlockClassA = split /\//, $string; |
245 |
|
} |