2 |
|
# |
3 |
|
# Interface |
4 |
|
# --------- |
5 |
< |
# new(toolbox) : A new BuildSetup |
5 |
> |
# new(ConfigArea) : 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->{toolbox}=shift; |
23 |
> |
$self->{area}=shift; |
24 |
> |
$self->{toolbox}=$self->{area}->toolbox(); |
25 |
|
#$self->init(); |
26 |
|
return $self; |
27 |
|
} |
58 |
|
|
59 |
|
# -- print out tool/ version info |
60 |
|
my ($tool,$toolobj,$f,$val,$version); |
61 |
< |
foreach $tool ( $self->{toolbox}->tools() ) { |
62 |
< |
$version=$self->{toolbox}->defaultversion($tool); |
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 |
< |
# -- set up the different version -- externals |
67 |
< |
foreach $version ( $self->{toolbox}->versions($tool) ) { |
68 |
< |
$toolobj=$self->{toolbox}->gettool($tool,$version); |
69 |
< |
@deps=$toolobj->getfeature("_externals"); |
68 |
< |
foreach $d ( @deps ) { |
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() ) { |
72 |
> |
} |
73 |
> |
# -- tool info |
74 |
> |
print $fout "ifdef ".$tool."_V_".$version."\n"; |
75 |
> |
foreach $f ( $toolobj->features() ) { |
76 |
|
foreach $val ( $toolobj->getfeature($f) ) { |
77 |
|
print $fout "\t".$f." += ".$val."\n"; |
78 |
|
} |
78 |
– |
} |
79 |
– |
print $fout "endif\n"; |
79 |
|
} |
80 |
+ |
print $fout "endif\n"; |
81 |
|
} |
82 |
|
# some addittional processing of specific vars |
83 |
|
print $fout 'INCLUDEPATH+=$(addprefix -I,$(INCLUDE))'."\n"; |
86 |
|
print $fout 'lib+=$(extralib)'."\n"; |
87 |
|
print $fout 'LDLIBS+=$(addprefix -l,$(lib))'."\n"; |
88 |
|
print $fout 'LDLIBS+=$(addprefix -l,$(REQUIRES))'."\n"; |
89 |
– |
|
89 |
|
undef $fout; |
90 |
+ |
|
91 |
+ |
$self->verbose("End Configuration Setup"); |
92 |
|
} |
93 |
|
} |
94 |
|
|
97 |
|
my $THISDIR=shift; |
98 |
|
my @Targets=@_; |
99 |
|
my $DefaultBuildFile=""; |
99 |
– |
my $Class=""; |
100 |
|
|
101 |
|
# -- Create working directory |
102 |
|
chdir $ENV{LOCALTOP}; |
114 |
|
$self->_generateexternals($ENV{LOCALTOP}."/".$ENV{INTwork}."/clientmakefile"); |
115 |
|
|
116 |
|
# set up the workdir variable |
117 |
< |
$ENV{workdir}=$ENV{INTwork}."/".$ClassDir; |
117 |
> |
#$ENV{workdir}=$ENV{INTwork}."/".$ClassDir; |
118 |
> |
$ENV{workdir}=$ENV{INTwork}."/".$THISDIR; |
119 |
|
my $fullworkdir=$ENV{LOCALTOP}."/".$ENV{workdir}; |
120 |
|
|
121 |
|
# set up projdeps variable |
126 |
|
elsif ( -e $ENV{RELEASETOP}."/".$projectfile ) { |
127 |
|
$ENV{projectfile}=$ENV{RELEASETOP}."/".$projectfile; |
128 |
|
} |
129 |
< |
if ( $DefaultBuildFile eq "" ) { |
130 |
< |
# Map Relevant makefile classmakefile directory |
131 |
< |
my $classmakefile=$ENV{projconfigdir}."/".$Class."_makefile.mk"; |
132 |
< |
if ( -e $ENV{LOCALTOP}."/".$classmakefile ) { |
133 |
< |
$ENV{classmakefile}=$ENV{LOCALTOP}."/".$classmakefile; |
134 |
< |
} |
135 |
< |
elsif ( -e $ENV{RELEASETOP}."/".$classmakefile ) { |
136 |
< |
$ENV{classmakefile}=$ENV{RELEASETOP}."/".$classmakefile; |
129 |
> |
if ( (! defined $DefaultBuildFile) || ($DefaultBuildFile eq "") ) { |
130 |
> |
# -- Create a makefile from the class BuildFile |
131 |
> |
my $classbuildfile=$ENV{LOCALTOP}."/". |
132 |
> |
$ENV{projconfigdir}."/".$Class."_BuildFile"; |
133 |
> |
$self->verbose("Processing Class BuildFile $classbuildfile"); |
134 |
> |
my $classmakefile; |
135 |
> |
if ( -f $classbuildfile ) { |
136 |
> |
$classmakefile=$ENV{LOCALTOP}."/".$ENV{INTwork}. |
137 |
> |
"/".$Class."_makefile.mk"; |
138 |
> |
if ( SCRAMUtils::dated($classmakefile, $classbuildfile) ) { |
139 |
> |
# -- generate the new makefile if out of date |
140 |
> |
$self->verbose("Generating $classmakefile from $classbuildfile"); |
141 |
> |
my $classbf=BuildSystem::BuildFile->new($self->{area}); |
142 |
> |
undef $ENV{LatestBuildFile}; |
143 |
> |
$classbf->GenerateMakefile($classbuildfile, $classmakefile); |
144 |
> |
undef $ENV{LatestBuildFile}; # we dont want this included in the |
145 |
> |
# hierarchy |
146 |
> |
} |
147 |
|
} |
148 |
|
else { |
149 |
< |
print "\nUnable to locate $classmakefile\n"; |
150 |
< |
print " Not in $ENV{LOCALTOP}\n"; |
151 |
< |
print " Not in $ENV{RELEASETOP}\n"; |
152 |
< |
exit 1; |
149 |
> |
$classmakefile=$ENV{LOCALTOP}."/". |
150 |
> |
$ENV{projconfigdir}."/".$Class."_makefile.mk"; |
151 |
> |
if ( ! -f $classmakefile ) { |
152 |
> |
$self->error("Unable to find matching ".$Class."_BuildFile or ". |
153 |
> |
$Class."_makefile.mk"); |
154 |
> |
} |
155 |
|
} |
156 |
< |
$DefaultBuildFile=$ENV{classmakefile}; # TODO - only for override |
157 |
< |
} |
156 |
> |
# Map Relevant makefile classmakefile directory |
157 |
> |
$ENV{classmakefile}=$classmakefile; |
158 |
> |
$DefaultBuildFile=$ENV{classmakefile}; |
159 |
> |
} |
160 |
|
|
161 |
|
$ENV{ClassDir}=$ClassDir; |
162 |
|
$ENV{Class}=$Class; |
177 |
|
} |
178 |
|
} |
179 |
|
$targetnumber=$#Targets; |
180 |
+ |
$ENV{"MAKETARGETS"}=""; |
181 |
|
foreach $word ( @Targets ) { |
182 |
|
if ( $word=~/.*=.*/ ) { # if we have an assignment it cant be a target |
183 |
|
$targetnumber--; |
184 |
|
} |
185 |
|
else { |
186 |
+ |
# set some variables for use in makefiles |
187 |
|
$ENV{"MAKETARGET_".$word}=$word; |
188 |
+ |
if ( $ENV{"MAKETARGETS"} ne "" ) { |
189 |
+ |
$ENV{"MAKETARGETS"}=$ENV{"MAKETARGETS"}." ".$word; |
190 |
+ |
} |
191 |
+ |
else { |
192 |
+ |
$ENV{"MAKETARGETS"}=$word; |
193 |
+ |
} |
194 |
|
} |
195 |
|
} |
196 |
|
|
225 |
|
|
226 |
|
$thispath="."; |
227 |
|
# bootstrap from project buildfile if it exists |
228 |
< |
my $bf=BuildSystem::BuildFile->new($self->{toolbox}); |
228 |
> |
my $bf=BuildSystem::BuildFile->new($self->{area}); |
229 |
|
$bf->CheckBuildFile($ENV{projconfigdir}); |
230 |
|
|
231 |
|
my @ClassPaths=split /:/, $bf->BlockClassPath(); |