2 |
|
# |
3 |
|
# Interface |
4 |
|
# --------- |
5 |
< |
# new() : A new BuildSetup |
5 |
> |
# new(toolbox) : A new BuildSetup |
6 |
|
# BuildSetup(directory,targets) : prepare the ground for a build and build |
7 |
|
# getclass(directory) : return (Class, ClassDir, BuildFileobject) |
8 |
|
# associated with directory |
20 |
|
my $class=shift; |
21 |
|
my $self={}; |
22 |
|
bless $self,$class; |
23 |
< |
$self->init(); |
23 |
> |
$self->{toolbox}=shift; |
24 |
> |
#$self->init(); |
25 |
|
return $self; |
26 |
|
} |
27 |
|
|
28 |
|
sub init { |
29 |
|
my $self=shift; |
30 |
< |
$self->{toolbox}=BuildSystem::ToolBox->new(); |
30 |
> |
$self->{toolbox}=BuildSystem::ToolBox->new($ENV{LOCALTOP}); |
31 |
|
} |
32 |
|
|
33 |
|
sub _generateexternals { |
36 |
|
|
37 |
|
# -- specifiy these files for dependency information |
38 |
|
my $depfile=$ENV{projconfigdir}."/External_Dependencies"; |
39 |
< |
my $clientfile="$ENV{LOCALTOP}/.SCRAM/$ENV{SCRAM_ARCH}/clientsettings"; |
40 |
< |
my $clientreq="$ENV{LOCALTOP}/.SCRAM/$ENV{SCRAM_ARCH}/". |
41 |
< |
"clientsettings_reqs"; |
39 |
> |
|
40 |
> |
# -- get list of dependent files |
41 |
> |
my $datadir=$ENV{LOCALTOP}."/.SCRAM/".$ENV{SCRAM_ARCH}; |
42 |
> |
$fdir=FileHandle->new(); |
43 |
> |
opendir $fdir, $datadir or die |
44 |
> |
"unable to access $datadir $!\n"; |
45 |
> |
my @depfiles=grep !/^\.\.?$/, readdir $fdir; |
46 |
> |
undef $fdir; |
47 |
> |
for (my $i=0; $i<=$#depfiles; $i++ ) { |
48 |
> |
$depfiles[$i]=$datadir."/".$depfiles[$i]; |
49 |
> |
} |
50 |
> |
|
51 |
|
# -- do we need to rebuild? |
52 |
< |
if ( SCRAMUtils::dated($outfile,$depfile, $clientfile,$clientreq) ) { |
52 |
> |
if ( SCRAMUtils::dated($outfile,@depfiles) ) { |
53 |
|
print "Configuring Local Area\n"; |
54 |
|
# -- open output file |
55 |
|
my $fout=FileHandle->new(); |
56 |
|
$fout->open(">".$outfile) or die "Unable to open $outfile for output". |
57 |
|
$!."\n"; |
58 |
|
|
49 |
– |
# -- cludge in the dependencies - need to go via toolbox really |
50 |
– |
my $fh=FileHandle->new(); |
51 |
– |
open ($fh, "<$clientreq" ); |
52 |
– |
while( <$fh> ) { |
53 |
– |
print $fout $_; |
54 |
– |
} |
55 |
– |
undef $fh; |
56 |
– |
|
59 |
|
# -- print out tool/ version info |
60 |
|
my ($tool,$toolobj,$f,$val,$version); |
61 |
|
foreach $toolpair ( $self->{toolbox}->tools() ) { |
62 |
|
$tool=$$toolpair[0]; |
63 |
|
$version=$$toolpair[1]; |
64 |
+ |
# default versions |
65 |
|
print $fout "ifdef $tool\n".$tool."_V_".$version."=true\nendif\n"; |
66 |
|
$toolobj=$self->{toolbox}->gettool($tool,$version); |
67 |
+ |
# -- externals |
68 |
+ |
@deps=$toolobj->getfeature("_externals"); |
69 |
+ |
foreach $d ( @deps ) { |
70 |
+ |
$d=~tr[A-Z][a-z]; |
71 |
+ |
print $fout "ifdef ".$tool."_V_".$version."\n $d=true\nendif\n"; |
72 |
+ |
} |
73 |
+ |
# -- tool info |
74 |
|
print $fout "ifdef ".$tool."_V_".$version."\n"; |
75 |
|
foreach $f ( $toolobj->features() ) { |
76 |
|
foreach $val ( $toolobj->getfeature($f) ) { |
125 |
|
elsif ( -e $ENV{RELEASETOP}."/".$projectfile ) { |
126 |
|
$ENV{projectfile}=$ENV{RELEASETOP}."/".$projectfile; |
127 |
|
} |
118 |
– |
else { |
119 |
– |
print "Warning : Unable to find $projectfile\n"; |
120 |
– |
} |
128 |
|
if ( $DefaultBuildFile eq "" ) { |
129 |
|
# Map Relevant makefile classmakefile directory |
130 |
|
my $classmakefile=$ENV{projconfigdir}."/".$Class."_makefile.mk"; |