| 6198 |
dpurdie |
1 |
########################################################################
|
|
|
2 |
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
|
| 227 |
dpurdie |
3 |
#
|
| 6198 |
dpurdie |
4 |
# Module name : GCC.PL
|
|
|
5 |
# Module type : JATS Utility
|
|
|
6 |
# Compiler(s) : Perl
|
|
|
7 |
# Environment(s): jats
|
| 227 |
dpurdie |
8 |
#
|
| 6198 |
dpurdie |
9 |
# Description : GCC C/C++ toolset
|
| 227 |
dpurdie |
10 |
#
|
| 6198 |
dpurdie |
11 |
#......................................................................#
|
| 227 |
dpurdie |
12 |
|
|
|
13 |
use strict;
|
|
|
14 |
use warnings;
|
|
|
15 |
|
| 4728 |
dpurdie |
16 |
# Global variables
|
| 4034 |
dpurdie |
17 |
our $ScmPlatform;
|
|
|
18 |
our $ScmNoToolsTest;
|
|
|
19 |
|
| 4728 |
dpurdie |
20 |
# Misc variables
|
|
|
21 |
my $UseGcov = 0;
|
| 7040 |
dpurdie |
22 |
my $UseProfile = 0;
|
| 4835 |
dpurdie |
23 |
my $LcovExplicitBranch = '';
|
| 4728 |
dpurdie |
24 |
my $UseCppcheck = 0;
|
| 5744 |
dpurdie |
25 |
my $GCCRPath;
|
| 6198 |
dpurdie |
26 |
my @ldFixups;
|
| 4728 |
dpurdie |
27 |
|
| 227 |
dpurdie |
28 |
##############################################################################
|
|
|
29 |
# Configuration information
|
|
|
30 |
# Cross reference from CrossCompiler Alias to actual paths
|
|
|
31 |
# Structure:
|
|
|
32 |
# Hash reference: Array of toolchain information
|
| 369 |
dpurdie |
33 |
# Mandatory
|
|
|
34 |
# ROOT => Root of compiler
|
|
|
35 |
# BASE => Base for binaries
|
|
|
36 |
# Optional
|
|
|
37 |
# CC_OPTS => Additonal Compiler options
|
| 4034 |
dpurdie |
38 |
# CC_OPTSP => Production Compiler options
|
|
|
39 |
# CC_OPTSD => Debug Compiler options
|
| 5744 |
dpurdie |
40 |
# CXX_OPTS => Additional C++ Options
|
| 6459 |
dpurdie |
41 |
# LDFLAGS => Linker flags
|
| 369 |
dpurdie |
42 |
# UNCONTROLLED => Boolean to create warning
|
| 6459 |
dpurdie |
43 |
# DEPRECATED => Boolean to create warning
|
|
|
44 |
# DISCONTINUED => Boolean to create error and not build anything
|
| 3967 |
dpurdie |
45 |
# PACKAGE_ARCH => Packageing architecture
|
|
|
46 |
# VERSION => Version reported by GCC
|
|
|
47 |
# MACHINE => Machine reported by GCC
|
| 5796 |
dpurdie |
48 |
# RPATH => Relative Path to compiler installed runtime
|
|
|
49 |
# Absolute or Relative
|
| 4034 |
dpurdie |
50 |
# COMPILER_OPTIONS => Toolset specific compiler initial options
|
|
|
51 |
# This is a comma seperated list
|
| 227 |
dpurdie |
52 |
my %ToolsetConfig = (
|
|
|
53 |
|
| 369 |
dpurdie |
54 |
'i386-unknown-linux-gnu' => {
|
| 5708 |
dpurdie |
55 |
ROOT => '/opt/crosstool/gcc-4.1.1-glibc-2.5/i586-unknown-linux-gnu',
|
|
|
56 |
BASE => 'bin/i586-unknown-linux-gnu-',
|
| 3967 |
dpurdie |
57 |
VERSION => '4.1.1',
|
|
|
58 |
MACHINE => 'i586-unknown-linux-gnu'
|
| 369 |
dpurdie |
59 |
},
|
| 227 |
dpurdie |
60 |
|
| 369 |
dpurdie |
61 |
'arm-9tdmi-linux-gnu' => {
|
| 5708 |
dpurdie |
62 |
ROOT => '/opt/crosstool/gcc-4.1.1-glibc-2.5/arm-9tdmi-linux-gnu',
|
|
|
63 |
BASE => 'bin/arm-9tdmi-linux-gnu-',
|
|
|
64 |
VERSION => '4.1.1',
|
|
|
65 |
MACHINE => 'arm-9tdmi-linux-gnu'
|
| 369 |
dpurdie |
66 |
},
|
| 247 |
dpurdie |
67 |
|
| 369 |
dpurdie |
68 |
'powerpc-603e-linux-gnu' => {
|
| 5708 |
dpurdie |
69 |
ROOT => '/opt/crosstool/gcc-4.1.1-glibc-2.5/powerpc-603e-linux-gnu',
|
|
|
70 |
BASE => 'bin/powerpc-603e-linux-gnu-',
|
| 3967 |
dpurdie |
71 |
VERSION => '4.1.1',
|
|
|
72 |
MACHINE => 'powerpc-603e-linux-gnu'
|
| 369 |
dpurdie |
73 |
},
|
| 337 |
dpurdie |
74 |
|
| 369 |
dpurdie |
75 |
'arm-926ejs-linux-gnueabi' => {
|
| 5708 |
dpurdie |
76 |
ROOT => '/opt/crosstool/gcc-4.4.3-glibc-2.9/arm-926ejs-linux-gnueabi',
|
|
|
77 |
BASE => 'bin/arm-926ejs-linux-gnueabi-',
|
|
|
78 |
CC_OPTS => '-Wno-psabi',
|
| 3967 |
dpurdie |
79 |
VERSION => '4.4.3',
|
|
|
80 |
MACHINE => 'arm-926ejs-linux-gnueabi'
|
| 369 |
dpurdie |
81 |
},
|
|
|
82 |
|
| 5708 |
dpurdie |
83 |
'arm-926ejs-linux-gnueabi-v2' => {
|
|
|
84 |
ROOT => '/opt/crosstool/gcc-5.2.0-glibc-2.17/arm-926ejs-linux-gnueabi',
|
|
|
85 |
BASE => 'bin/arm-926ejs-linux-gnueabi-',
|
|
|
86 |
CC_OPTS => '-Wno-psabi',
|
| 5736 |
dpurdie |
87 |
CXX_OPTS => '-std=gnu++11',
|
| 5708 |
dpurdie |
88 |
VERSION => '5.2.0',
|
|
|
89 |
MACHINE => 'arm-926ejs-linux-gnueabi'
|
|
|
90 |
},
|
|
|
91 |
|
|
|
92 |
'powerpc-603e-linux-gnu-v2' => {
|
|
|
93 |
ROOT => '/opt/crosstool/gcc-5.2.0-glibc-2.17/powerpc-603e-linux-gnu',
|
|
|
94 |
BASE => 'bin/powerpc-603e-linux-gnu-',
|
| 5736 |
dpurdie |
95 |
CXX_OPTS => '-std=gnu++11',
|
| 5708 |
dpurdie |
96 |
VERSION => '5.2.0',
|
|
|
97 |
MACHINE => 'powerpc-603e-linux-gnu'
|
|
|
98 |
},
|
|
|
99 |
|
| 3967 |
dpurdie |
100 |
'i686-linux-gnu' => {
|
|
|
101 |
ROOT => '/usr',
|
|
|
102 |
BASE => 'bin/',
|
|
|
103 |
PACKAGE_ARCH => 'i386',
|
|
|
104 |
VERSION => '4.6',
|
|
|
105 |
MACHINE => 'i686-linux-gnu'
|
|
|
106 |
},
|
|
|
107 |
|
| 5716 |
dpurdie |
108 |
'i686-vix_ubuntu12_c11-linux-gnu' => {
|
|
|
109 |
ROOT => '/opt/crosstool/gcc-5.2.0-glibc-2.17/i686-vix_ubuntu12_c11-linux-gnu',
|
|
|
110 |
BASE => 'bin/i686-vix_ubuntu12_c11-linux-gnu-',
|
|
|
111 |
PACKAGE_ARCH => 'i386',
|
| 5736 |
dpurdie |
112 |
CXX_OPTS => '-std=gnu++11',
|
| 5716 |
dpurdie |
113 |
VERSION => '5.2.0',
|
| 5744 |
dpurdie |
114 |
MACHINE => 'i686-vix_ubuntu12_c11-linux-gnu',
|
| 5796 |
dpurdie |
115 |
RPATH => '/lib/i686-vix_ubuntu12_c11-linux-gnu',
|
| 5716 |
dpurdie |
116 |
},
|
|
|
117 |
|
| 4109 |
dpurdie |
118 |
'arm-iwmmxt-linux-gnueabi' => {
|
| 5708 |
dpurdie |
119 |
ROOT => '/opt/marvel',
|
|
|
120 |
BASE => 'bin/arm-iwmmxt-linux-gnueabi-',
|
| 4109 |
dpurdie |
121 |
VERSION => '4.2.4',
|
|
|
122 |
MACHINE => 'arm-iwmmxt-linux-gnueabi'
|
|
|
123 |
},
|
|
|
124 |
|
| 5619 |
dpurdie |
125 |
'arm-unknown-linux-gnueabi-sk20-4.1.1.0' => {
|
| 5708 |
dpurdie |
126 |
ROOT => '/opt/arm-unknown-linux-gnueabi-sk20-4.1.1.0',
|
|
|
127 |
BASE => 'bin/arm-unknown-linux-gnueabi-',
|
| 5330 |
dpurdie |
128 |
VERSION => '4.8.2',
|
|
|
129 |
MACHINE => 'arm-unknown-linux-gnueabi'
|
|
|
130 |
},
|
|
|
131 |
|
| 6198 |
dpurdie |
132 |
'gmx-sdk-imx6-toolchain-5.0.0.0' => {
|
|
|
133 |
ROOT => '/opt/gmx-sdk-imx6-toolchain-5.0.0.0',
|
|
|
134 |
BASE => 'bin/arm-unknown-linux-gnueabi-',
|
|
|
135 |
VERSION => '4.9.1',
|
|
|
136 |
MACHINE => 'arm-unknown-linux-gnueabi',
|
|
|
137 |
COMPILER_OPTIONS => 'pic,brokenldscripts',
|
|
|
138 |
},
|
|
|
139 |
|
| 6276 |
dpurdie |
140 |
# Ubuntu14
|
| 4814 |
dpurdie |
141 |
'x86_64-linux-gnu' => {
|
|
|
142 |
ROOT => '/usr',
|
|
|
143 |
BASE => 'bin/',
|
|
|
144 |
PACKAGE_ARCH => 'amd64',
|
| 6276 |
dpurdie |
145 |
CXX_OPTS => '-std=gnu++11',
|
| 4814 |
dpurdie |
146 |
VERSION => '4.8',
|
| 4928 |
dpurdie |
147 |
MACHINE => 'x86_64-linux-gnu',
|
| 5115 |
dpurdie |
148 |
COMPILER_OPTIONS => 'pic' # Always create PIC
|
| 4814 |
dpurdie |
149 |
},
|
| 4109 |
dpurdie |
150 |
|
| 6276 |
dpurdie |
151 |
# Ubuntu16
|
| 6133 |
dpurdie |
152 |
'x86_64-linux-gnu-5.4' => {
|
|
|
153 |
ROOT => '/usr',
|
|
|
154 |
BASE => 'bin/',
|
|
|
155 |
PACKAGE_ARCH => 'amd64',
|
| 6276 |
dpurdie |
156 |
CXX_OPTS => '-std=gnu++11',
|
| 6133 |
dpurdie |
157 |
VERSION => '5.4.0',
|
|
|
158 |
MACHINE => 'x86_64-linux-gnu',
|
|
|
159 |
COMPILER_OPTIONS => 'pic' # Always create PIC
|
|
|
160 |
},
|
|
|
161 |
|
|
|
162 |
'x86_64-redhat-linux-4.8.5' => {
|
|
|
163 |
ROOT => '/usr',
|
|
|
164 |
BASE => 'bin/',
|
| 6177 |
dpurdie |
165 |
PACKAGE_ARCH => 'x86_64',
|
| 6276 |
dpurdie |
166 |
CXX_OPTS => '-std=gnu++11',
|
| 6133 |
dpurdie |
167 |
VERSION => '4.8.5',
|
|
|
168 |
MACHINE => 'x86_64-redhat-linux',
|
|
|
169 |
COMPILER_OPTIONS => 'pic' # Always create PIC
|
|
|
170 |
},
|
|
|
171 |
|
| 6798 |
dpurdie |
172 |
# STIB Parkeon
|
|
|
173 |
'arm-linux-gnueabi-4.6.3' => {
|
|
|
174 |
ROOT => '/opt/parkeon-arm-linux-gnueabi-4.6',
|
|
|
175 |
BASE => 'bin/arm-linux-gnueabi-',
|
|
|
176 |
PACKAGE_ARCH => 'armel',
|
|
|
177 |
#CXX_OPTS => '',
|
|
|
178 |
VERSION => '4.6.3',
|
|
|
179 |
MACHINE => 'arm-linux-gnueabi',
|
|
|
180 |
COMPILER_OPTIONS => 'pic' # Always create PIC
|
|
|
181 |
},
|
|
|
182 |
|
|
|
183 |
|
| 227 |
dpurdie |
184 |
#
|
|
|
185 |
# Old (not to be used) version of the embedded toolchain
|
| 4003 |
dpurdie |
186 |
# This was deprecated in favor of gcc-4.1.1-glibc-2.5
|
| 227 |
dpurdie |
187 |
# It is not possible to reproduce old packages using the old compiler
|
|
|
188 |
# This is a known issue
|
|
|
189 |
#
|
| 369 |
dpurdie |
190 |
'i386-unknown-linux-gnu.glibc-2.3.2' => {
|
| 5708 |
dpurdie |
191 |
ROOT => '/opt/crosstool/gcc-4.1.0-glibc-2.3.2/i386-unknown-linux-gnu',
|
|
|
192 |
BASE => 'bin/i386-unknown-linux-gnu-'
|
| 369 |
dpurdie |
193 |
},
|
| 227 |
dpurdie |
194 |
|
| 369 |
dpurdie |
195 |
'arm-9tdmi-linux-gnu.glibc-2.3.2' => {
|
| 5708 |
dpurdie |
196 |
ROOT => '/opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-9tdmi-linux-gnu',
|
|
|
197 |
BASE => 'bin/arm-9tdmi-linux-gnu-'
|
| 369 |
dpurdie |
198 |
},
|
| 227 |
dpurdie |
199 |
|
|
|
200 |
#
|
|
|
201 |
# Not too sure where this is used
|
|
|
202 |
#
|
| 369 |
dpurdie |
203 |
'armv4l-unknown-linux-gcc' => {
|
| 5708 |
dpurdie |
204 |
ROOT => '/opt/host/armv4l',
|
|
|
205 |
BASE => 'bin/armv4l-unknown-linux-'
|
| 369 |
dpurdie |
206 |
},
|
| 227 |
dpurdie |
207 |
|
|
|
208 |
#
|
|
|
209 |
# The compiler for the current local machine
|
|
|
210 |
#
|
| 369 |
dpurdie |
211 |
'i386-unknown-linux-gcc' => {
|
| 5708 |
dpurdie |
212 |
ROOT => '/usr',
|
|
|
213 |
BASE => 'bin/',
|
| 369 |
dpurdie |
214 |
UNCONTROLLED => 1,
|
| 3967 |
dpurdie |
215 |
PACKAGE_ARCH => 'i386',
|
| 369 |
dpurdie |
216 |
},
|
|
|
217 |
);
|
| 227 |
dpurdie |
218 |
|
|
|
219 |
#
|
|
|
220 |
# Cross reference from GCCTarget to GBE_MACHTYPE for which it can
|
|
|
221 |
# build using the 'native gcc'. This is NOT the preferred mode of operation
|
|
|
222 |
# as the compiler is not as controlled as the cross compilers.
|
|
|
223 |
#
|
|
|
224 |
my %NativeCompilers = (
|
|
|
225 |
'Linux i386' => 'linux_i386',
|
|
|
226 |
);
|
|
|
227 |
|
|
|
228 |
##############################################################################
|
|
|
229 |
# ToolsetInit()
|
|
|
230 |
# Runtime initialisation
|
|
|
231 |
#
|
|
|
232 |
##############################################################################
|
|
|
233 |
|
|
|
234 |
ToolsetInit();
|
|
|
235 |
|
|
|
236 |
sub ToolsetInit
|
|
|
237 |
{
|
| 5731 |
dpurdie |
238 |
my( $GCCTarget, $GCCToolchain, $GCCRoot, $GCCBin, $GCCAr, $GCCObjCopy, $GCCGcovTool );
|
| 4728 |
dpurdie |
239 |
my( $GCCFlags, $GCCFlagsP, $GCCFlagsD, $LDFlags );
|
| 5726 |
dpurdie |
240 |
my( $GCCXXFlags );
|
| 3967 |
dpurdie |
241 |
my( $PkgArch);
|
| 4034 |
dpurdie |
242 |
my( $arg_alias, $tools_found, $compiler_tool );
|
| 227 |
dpurdie |
243 |
|
|
|
244 |
#.. Toolset configuration
|
| 6798 |
dpurdie |
245 |
# Also $::ScmToolsetProperties{}
|
| 227 |
dpurdie |
246 |
#
|
|
|
247 |
$::ScmToolsetVersion = "1.0.0"; # our version
|
|
|
248 |
$::ScmToolsetGenerate = 0; # GEN generate optional
|
|
|
249 |
$::ScmToolsetCompilerPath = 1; # Exports Compiler path to makefile via SCM_COMPILERPATH
|
| 271 |
dpurdie |
250 |
$::ScmToolsetProgDependancies = 0; # handle Prog dependancies myself
|
| 339 |
dpurdie |
251 |
$::ScmToolsetSoName = 1; # Shared library supports SoName
|
| 227 |
dpurdie |
252 |
|
|
|
253 |
#.. Standard.rul requirements
|
|
|
254 |
#
|
|
|
255 |
$::s = "asm";
|
|
|
256 |
$::o = "o";
|
|
|
257 |
$::so = "so";
|
|
|
258 |
$::a = "a";
|
|
|
259 |
$::exe = "";
|
|
|
260 |
|
|
|
261 |
#.. Parse arguments
|
|
|
262 |
#
|
|
|
263 |
foreach $_ ( @::ScmToolsetArgs ) {
|
|
|
264 |
if (/^--Target=(.*)/) { # OS Version
|
|
|
265 |
$GCCTarget = "$1";
|
|
|
266 |
|
|
|
267 |
} elsif (/^--CrossAlias=(.*)/) { # CrossCompiler target-alias
|
|
|
268 |
$arg_alias = $1;
|
|
|
269 |
|
| 4728 |
dpurdie |
270 |
} elsif (/^--UseGcov/) { # Compile for code coverage
|
|
|
271 |
$UseGcov = 1;
|
|
|
272 |
|
| 7040 |
dpurdie |
273 |
} elsif (/^--UseProfile/) { # Compile for profiling
|
|
|
274 |
$UseProfile = 1;
|
|
|
275 |
|
| 4835 |
dpurdie |
276 |
} elsif (/^--LcovExplicitBranch/) { # Version of lcov requires explicit branch coverage
|
|
|
277 |
$LcovExplicitBranch = ' --rc lcov_branch_coverage=1';
|
|
|
278 |
|
| 4728 |
dpurdie |
279 |
} elsif (/^--UseCppcheck/) { # Use cppcheck as the lint tool
|
|
|
280 |
$UseCppcheck = 1;
|
|
|
281 |
|
| 4034 |
dpurdie |
282 |
} elsif (/^--CompilerTool=(.*)/) { # CrossCompiler located in package
|
|
|
283 |
$compiler_tool = $1;
|
|
|
284 |
|
| 227 |
dpurdie |
285 |
} else {
|
|
|
286 |
Message( "gcc toolset: unknown option $_ -- ignored\n" );
|
|
|
287 |
}
|
|
|
288 |
}
|
|
|
289 |
|
|
|
290 |
foreach $_ ( @::ScmPlatformArgs ) {
|
|
|
291 |
if (/^--product=(.*)/) { # GBE product
|
|
|
292 |
|
|
|
293 |
} else {
|
|
|
294 |
Message( "gcc toolset: unknown platform argument $_ -- ignored\n" );
|
|
|
295 |
}
|
|
|
296 |
}
|
|
|
297 |
|
|
|
298 |
Error ("TOOLSET/gcc - Target undefined" )
|
|
|
299 |
unless ($GCCTarget);
|
|
|
300 |
|
| 4034 |
dpurdie |
301 |
#
|
|
|
302 |
# If the toolset is not required, then do not process any futher
|
|
|
303 |
# We may not find the compiler
|
|
|
304 |
#
|
|
|
305 |
return
|
|
|
306 |
if ($ScmNoToolsTest);
|
|
|
307 |
|
| 227 |
dpurdie |
308 |
#.. Cross compile support
|
| 4034 |
dpurdie |
309 |
# Compiler provided in package, rather than install on machine
|
| 227 |
dpurdie |
310 |
#
|
| 4034 |
dpurdie |
311 |
if ( $compiler_tool )
|
|
|
312 |
{
|
|
|
313 |
#
|
|
|
314 |
# The GCC toolset will handle a compiler provided within a package
|
|
|
315 |
# Initial requirement was for ANDROID NDKs where the compiler is
|
|
|
316 |
# a part of the NDK and will change.
|
|
|
317 |
#
|
|
|
318 |
# Compilers in packages will have a file in gbe/COMPILERS/<compiler_tool>
|
|
|
319 |
# that contains data specifically designed for this toolset
|
|
|
320 |
#
|
|
|
321 |
Verbose("Locate compiler in package: $compiler_tool");
|
|
|
322 |
my @toolList;
|
|
|
323 |
my $toolPath;
|
|
|
324 |
my $toolPkg;
|
|
|
325 |
for my $entry (@{$::ScmBuildPkgRules{$ScmPlatform} })
|
|
|
326 |
{
|
|
|
327 |
my $tpath = join('/', $entry->{ROOT}, 'gbe', 'COMPILERS' , $compiler_tool);
|
|
|
328 |
if ( -f $tpath )
|
|
|
329 |
{
|
|
|
330 |
push @toolList, $entry->{NAME};
|
|
|
331 |
$toolPath = $tpath;
|
|
|
332 |
$toolPkg = $entry;
|
|
|
333 |
}
|
|
|
334 |
}
|
|
|
335 |
Error ("Multiple packages provide required compiler:", @toolList)
|
|
|
336 |
if ( scalar(@toolList) > 1 );
|
|
|
337 |
Error ("Required compiler not found in any package", "Compiler: $compiler_tool")
|
|
|
338 |
unless ( scalar(@toolList) == 1 );
|
|
|
339 |
|
|
|
340 |
#
|
|
|
341 |
# Process the compiler info file
|
|
|
342 |
# Rip out the data and create a hash of item/values
|
|
|
343 |
# File format:
|
|
|
344 |
# '#' is a line comment
|
|
|
345 |
# item=value
|
|
|
346 |
#
|
|
|
347 |
my %data;
|
|
|
348 |
open (my $DATA, '<', $toolPath ) || Error("Cannot open compiler datafile. $!", "File: $toolPath");
|
|
|
349 |
while ( <$DATA> )
|
|
|
350 |
{
|
|
|
351 |
$_ =~ s~\s+$~~;
|
|
|
352 |
next if ( m~^#~ );
|
|
|
353 |
m~(.*?)\s*=\s*(.*)~;
|
|
|
354 |
$data{$1} = $2;
|
|
|
355 |
}
|
|
|
356 |
close $DATA;
|
|
|
357 |
|
|
|
358 |
#
|
|
|
359 |
# Force this compilers data into the ToolsetConfig hash
|
|
|
360 |
#
|
|
|
361 |
$arg_alias = $compiler_tool;
|
|
|
362 |
%ToolsetConfig = ();
|
|
|
363 |
|
|
|
364 |
$ToolsetConfig{$arg_alias}{ROOT} = join('/', $toolPkg->{ROOT}, $data{ROOT} );
|
|
|
365 |
$ToolsetConfig{$arg_alias}{BASE} = $data{BASE} . '-';
|
|
|
366 |
$ToolsetConfig{$arg_alias}{CC_OPTS} = $data{CFLAGS};
|
|
|
367 |
$ToolsetConfig{$arg_alias}{CC_OPTSP} = $data{CFLAGSP};
|
|
|
368 |
$ToolsetConfig{$arg_alias}{CC_OPTSD} = $data{CFLAGSD};
|
| 5726 |
dpurdie |
369 |
$ToolsetConfig{$arg_alias}{CXX_OPTS} = $data{CXXFLAGS};
|
| 6459 |
dpurdie |
370 |
$ToolsetConfig{$arg_alias}{LDFLAGS} = $data{LDFLAGS};
|
| 4034 |
dpurdie |
371 |
$ToolsetConfig{$arg_alias}{VERSION} = $data{VERSION};
|
|
|
372 |
$ToolsetConfig{$arg_alias}{MACHINE} = $data{MACHINE};
|
|
|
373 |
$ToolsetConfig{$arg_alias}{COMPILER_OPTIONS} = $data{COMPILER_OPTIONS};
|
| 5744 |
dpurdie |
374 |
$ToolsetConfig{$arg_alias}{RAPTH} = $data{RPATH};
|
| 6459 |
dpurdie |
375 |
$ToolsetConfig{$arg_alias}{DEPRECATED} = $data{DEPRECATED};
|
|
|
376 |
$ToolsetConfig{$arg_alias}{DISCONTINUED} = $data{DISCONTINUED};
|
| 4034 |
dpurdie |
377 |
}
|
|
|
378 |
|
|
|
379 |
#.. Cross compile support
|
|
|
380 |
#
|
| 227 |
dpurdie |
381 |
# Toolchain=root,[bin]
|
|
|
382 |
#
|
|
|
383 |
if ( $arg_alias )
|
|
|
384 |
{
|
|
|
385 |
if ( exists $ToolsetConfig{ $arg_alias } )
|
|
|
386 |
{
|
| 369 |
dpurdie |
387 |
$GCCToolchain = $ToolsetConfig{ $arg_alias };
|
| 5330 |
dpurdie |
388 |
my $testCompilerPath = $GCCToolchain->{ROOT} . '/' . $GCCToolchain->{BASE} . 'gcc';
|
|
|
389 |
$tools_found = (-d $GCCToolchain->{ROOT}) && ( -f $testCompilerPath);
|
| 227 |
dpurdie |
390 |
Warning ("gcc toolset: CrossPlatform toolchain not found for: $arg_alias",
|
| 5708 |
dpurdie |
391 |
"Path : $GCCToolchain->{ROOT}" ,
|
| 7547 |
dpurdie |
392 |
"Compiler: $testCompilerPath "
|
| 5330 |
dpurdie |
393 |
) unless $tools_found;
|
| 227 |
dpurdie |
394 |
}
|
|
|
395 |
else
|
|
|
396 |
{
|
|
|
397 |
Error("gcc toolset: CrossPlatform Alias not configured: $arg_alias");
|
|
|
398 |
}
|
| 369 |
dpurdie |
399 |
|
|
|
400 |
Warning ("Uncontrolled toolchain used: $arg_alias")
|
|
|
401 |
if ( exists($GCCToolchain->{UNCONTROLLED}) && $GCCToolchain->{UNCONTROLLED} );
|
| 6459 |
dpurdie |
402 |
|
|
|
403 |
Warning ("Deprecated toolchain used: $arg_alias")
|
|
|
404 |
if ( exists($GCCToolchain->{DEPRECATED}) && $GCCToolchain->{DEPRECATED} );
|
|
|
405 |
|
|
|
406 |
Error ("Discontinued toolchain used: $arg_alias")
|
|
|
407 |
if ( exists($GCCToolchain->{DISCONTINUED}) && $GCCToolchain->{DISCONTINUED} );
|
| 227 |
dpurdie |
408 |
}
|
|
|
409 |
|
|
|
410 |
#
|
|
|
411 |
# If no Cross compiler toolchain is found (preferred method), then attempt
|
|
|
412 |
# to match a native compiler. Only known targets allow a native build
|
|
|
413 |
#
|
|
|
414 |
unless ( $tools_found )
|
|
|
415 |
{
|
|
|
416 |
if ( exists ( $NativeCompilers{$GCCTarget} ))
|
|
|
417 |
{
|
|
|
418 |
if ( $NativeCompilers{$GCCTarget} eq $::GBE_MACHTYPE )
|
|
|
419 |
{
|
|
|
420 |
$tools_found = 1;
|
| 369 |
dpurdie |
421 |
$GCCToolchain = undef;
|
| 227 |
dpurdie |
422 |
}
|
|
|
423 |
}
|
|
|
424 |
}
|
|
|
425 |
|
|
|
426 |
#
|
|
|
427 |
# Must have a toolset by now, either a cross compiler or Native
|
|
|
428 |
#
|
|
|
429 |
Error ("gcc toolset: Toolchain not found for: $GCCTarget" )
|
|
|
430 |
unless ( $tools_found );
|
|
|
431 |
|
|
|
432 |
|
| 369 |
dpurdie |
433 |
if ( defined $GCCToolchain )
|
| 227 |
dpurdie |
434 |
{
|
|
|
435 |
#
|
| 369 |
dpurdie |
436 |
# Parse GCCToolchain. Potential parts to create
|
|
|
437 |
# GCCRoot - Location to find the effective /usr/include directory
|
|
|
438 |
# GCCBin - Path to the gcc executable
|
|
|
439 |
# GCCAr - Path to the ar executable
|
| 4034 |
dpurdie |
440 |
# GCCFlags - Additional compiler flags. Also Production and Debug
|
| 227 |
dpurdie |
441 |
#
|
| 369 |
dpurdie |
442 |
$GCCRoot = $GCCToolchain->{ROOT};
|
|
|
443 |
$GCCBin = '${GCC_ROOT}/' . $GCCToolchain->{BASE} . 'gcc';
|
|
|
444 |
$GCCAr = '${GCC_ROOT}/' . $GCCToolchain->{BASE} . 'ar';
|
| 5731 |
dpurdie |
445 |
$GCCGcovTool = '${GCC_ROOT}/' . $GCCToolchain->{BASE} . 'gcov';
|
| 373 |
dpurdie |
446 |
$GCCObjCopy = '${GCC_ROOT}/' . $GCCToolchain->{BASE} . 'objcopy';
|
| 5796 |
dpurdie |
447 |
if (exists $GCCToolchain->{RPATH}) {
|
|
|
448 |
if( $GCCToolchain->{RPATH} =~ m~^/~ ) {
|
| 7547 |
dpurdie |
449 |
$GCCRPath = $GCCToolchain->{RPATH};
|
| 5796 |
dpurdie |
450 |
} else {
|
|
|
451 |
$GCCRPath = '${GCC_ROOT}/' . $GCCToolchain->{RPATH};
|
|
|
452 |
}
|
|
|
453 |
}
|
| 369 |
dpurdie |
454 |
$GCCFlags = $GCCToolchain->{CC_OPTS};
|
| 4034 |
dpurdie |
455 |
$GCCFlagsP = $GCCToolchain->{CC_OPTSP};
|
|
|
456 |
$GCCFlagsD = $GCCToolchain->{CC_OPTSD};
|
| 5726 |
dpurdie |
457 |
$GCCXXFlags = $GCCToolchain->{CXX_OPTS};
|
| 6459 |
dpurdie |
458 |
$LDFlags = $GCCToolchain->{LDFLAGS} if defined($GCCToolchain->{LDFLAGS});
|
| 3967 |
dpurdie |
459 |
$PkgArch = $GCCToolchain->{PACKAGE_ARCH};
|
| 6177 |
dpurdie |
460 |
SetGlobalOption('PACKAGE_ARCH', $PkgArch) if defined $PkgArch;
|
| 227 |
dpurdie |
461 |
}
|
|
|
462 |
else
|
|
|
463 |
{
|
| 373 |
dpurdie |
464 |
$GCCRoot = '/usr';
|
|
|
465 |
$GCCBin = 'gcc';
|
|
|
466 |
$GCCAr = 'ar';
|
|
|
467 |
$GCCObjCopy = 'objcopy';
|
| 227 |
dpurdie |
468 |
}
|
| 7547 |
dpurdie |
469 |
|
| 4728 |
dpurdie |
470 |
#
|
|
|
471 |
# When running under gcov we need to instruct GCC to perform code coverage
|
|
|
472 |
# generation in both C flags and LD flags
|
|
|
473 |
#
|
|
|
474 |
if ( $UseGcov )
|
|
|
475 |
{
|
|
|
476 |
$GCCFlags .= ' -coverage';
|
|
|
477 |
$LDFlags .= ' -coverage';
|
|
|
478 |
}
|
| 7547 |
dpurdie |
479 |
|
| 4728 |
dpurdie |
480 |
#
|
|
|
481 |
# When running with cppcheck we need to include it in our environment
|
|
|
482 |
#
|
|
|
483 |
if ( $UseCppcheck )
|
|
|
484 |
{
|
|
|
485 |
ToolsetRequire( "cppcheck" );
|
|
|
486 |
PlatformDefine( "CPPCHECK_PLATFORM := unix32" );
|
|
|
487 |
}
|
| 227 |
dpurdie |
488 |
|
| 7547 |
dpurdie |
489 |
|
| 227 |
dpurdie |
490 |
#.. Define GCC environment
|
|
|
491 |
#
|
|
|
492 |
PlatformDefine( "
|
|
|
493 |
#################################################
|
| 7547 |
dpurdie |
494 |
# GCC toolchain definitions
|
| 227 |
dpurdie |
495 |
#
|
|
|
496 |
#..");
|
| 369 |
dpurdie |
497 |
PlatformDefine( "GCC_TARGET := $GCCTarget" );
|
|
|
498 |
PlatformDefine( "GCC_ROOT := $GCCRoot" );
|
|
|
499 |
PlatformDefine( "GCC_CC := $GCCBin" );
|
|
|
500 |
PlatformDefine( "GCC_AR := $GCCAr" );
|
| 373 |
dpurdie |
501 |
PlatformDefine( "GCC_OBJCOPY := $GCCObjCopy" );
|
| 5731 |
dpurdie |
502 |
PlatformDefine( "GCC_GCOVTOOL := $GCCGcovTool" );
|
| 369 |
dpurdie |
503 |
PlatformDefine( "GCC_CFLAGS := $GCCFlags" ) if defined $GCCFlags;
|
| 4034 |
dpurdie |
504 |
PlatformDefine( "GCC_CFLAGSP := $GCCFlagsP" ) if defined $GCCFlagsP;
|
|
|
505 |
PlatformDefine( "GCC_CFLAGSD := $GCCFlagsD" ) if defined $GCCFlagsD;
|
| 4728 |
dpurdie |
506 |
PlatformDefine( "GCC_LDFLAGS := $LDFlags" ) if defined $LDFlags;
|
| 5726 |
dpurdie |
507 |
PlatformDefine( "GCC_CXXFLAGS := $GCCXXFlags" ) if defined $GCCXXFlags;
|
| 369 |
dpurdie |
508 |
|
| 5726 |
dpurdie |
509 |
|
| 227 |
dpurdie |
510 |
#
|
|
|
511 |
# Required since this toolset advertises: ScmToolsetCompilerPath
|
|
|
512 |
#
|
| 369 |
dpurdie |
513 |
PlatformDefine( "SCM_COMPILERPATH := \$\{GCC_CC\}" );
|
| 3967 |
dpurdie |
514 |
|
|
|
515 |
#
|
|
|
516 |
# Sanity checking
|
|
|
517 |
#
|
|
|
518 |
PlatformDefine( "GCC_EVERSION := " . $GCCToolchain->{VERSION} ) if defined $GCCToolchain->{VERSION};
|
|
|
519 |
PlatformDefine( "GCC_EMACHINE := " . $GCCToolchain->{MACHINE} ) if defined $GCCToolchain->{MACHINE};
|
|
|
520 |
|
|
|
521 |
#
|
|
|
522 |
# Option indication of packaging architecture
|
|
|
523 |
# Used by non-embedded systems for packaging. See debian_packager
|
|
|
524 |
#
|
|
|
525 |
PlatformDefine( "PACKAGE_ARCH := $PkgArch" ) if (defined $PkgArch);
|
| 369 |
dpurdie |
526 |
PlatformDefine( "" );
|
| 227 |
dpurdie |
527 |
|
|
|
528 |
#.. Piece the world together
|
|
|
529 |
#
|
| 3967 |
dpurdie |
530 |
Init( 'gcc' );
|
| 227 |
dpurdie |
531 |
ToolsetDefines( "gcc.def" );
|
|
|
532 |
ToolsetRules( "gcc.rul" );
|
|
|
533 |
ToolsetRules( "standard.rul" );
|
|
|
534 |
|
| 4094 |
dpurdie |
535 |
|
|
|
536 |
PlatformDefine( "CTAGS_EXE:= ctags" );
|
|
|
537 |
ToolsetRequire( "exctags" ); # and Exuberant Ctags
|
|
|
538 |
|
| 227 |
dpurdie |
539 |
# Create a standard data structure
|
|
|
540 |
# This is a hash of hashes
|
|
|
541 |
# The first hash is keyed by CompileOption keyword
|
|
|
542 |
# The second hash contains pairs of values to set or remove
|
|
|
543 |
#
|
|
|
544 |
%::ScmToolsetCompilerOptions =
|
|
|
545 |
(
|
|
|
546 |
#
|
|
|
547 |
# Control the thread model to use
|
|
|
548 |
# This will affect the compiler options and the linker options
|
|
|
549 |
#
|
|
|
550 |
'staticprogs' => { 'STATIC_PROGS' , '1' }, # Progams link staticlly
|
|
|
551 |
'no_staticprogs' => { 'STATIC_PROGS' , undef }, # Default
|
| 4034 |
dpurdie |
552 |
'noversiondll' => { 'NO_VERSIONED_DLLS', 1 }, # Matches usage elsewhere
|
| 5115 |
dpurdie |
553 |
'pic' => { 'GEN_PIC' , '1' }, # Force PIC for static libs
|
|
|
554 |
'nopic' => { 'GEN_PIC' , undef }, # No Pic on Static libs
|
| 7040 |
dpurdie |
555 |
'brokenldscripts' => { 'BROKEN_LDSCRIPTS' , 1 }, # the linker is broken and cannot handle linker scripts
|
| 227 |
dpurdie |
556 |
);
|
|
|
557 |
|
|
|
558 |
#
|
|
|
559 |
# Set default options
|
|
|
560 |
#
|
|
|
561 |
$::ScmCompilerOpts{'STATIC_PROGS'} = undef;
|
| 4034 |
dpurdie |
562 |
$::ScmCompilerOpts{'NO_VERSIONED_DLLS'} = undef;
|
| 7040 |
dpurdie |
563 |
$::ScmCompilerOpts{'USE_PROFILE'} = 1 if $UseProfile;
|
| 4034 |
dpurdie |
564 |
|
|
|
565 |
#
|
|
|
566 |
# Process toolset-specfic compiler options
|
|
|
567 |
#
|
|
|
568 |
if ( exists $GCCToolchain->{COMPILER_OPTIONS} )
|
|
|
569 |
{
|
|
|
570 |
CompileOptions('*', split(',',$GCCToolchain->{COMPILER_OPTIONS}) );
|
|
|
571 |
}
|
| 227 |
dpurdie |
572 |
}
|
|
|
573 |
|
| 4094 |
dpurdie |
574 |
###############################################################################
|
|
|
575 |
# ToolsetCTAGS()
|
|
|
576 |
# This subroutine takes the user options and builds the rules
|
|
|
577 |
# required to build the CTAGS database.
|
|
|
578 |
#
|
|
|
579 |
# Arguments:
|
|
|
580 |
# --xxx No arguments currently defined
|
|
|
581 |
#
|
|
|
582 |
# Output:
|
|
|
583 |
# [ctags:]
|
|
|
584 |
# $(EXCTAGS)
|
|
|
585 |
#
|
|
|
586 |
###############################################################################
|
| 227 |
dpurdie |
587 |
|
| 4094 |
dpurdie |
588 |
sub ToolsetCTAGS
|
|
|
589 |
{
|
| 7428 |
dpurdie |
590 |
EXCTAGS( @_ ) unless $ScmNoToolsTest;
|
| 4094 |
dpurdie |
591 |
}
|
|
|
592 |
|
|
|
593 |
|
| 227 |
dpurdie |
594 |
###############################################################################
|
|
|
595 |
# ToolsetCC( $source, $obj, \@args )
|
|
|
596 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
597 |
# required to compile the source file 'source' to 'obj'
|
|
|
598 |
#
|
|
|
599 |
###############################################################################
|
|
|
600 |
|
|
|
601 |
sub ToolsetCC
|
|
|
602 |
{
|
|
|
603 |
my( $source, $obj, $pArgs ) = @_;
|
|
|
604 |
my( $cflags, $file ) = "";
|
|
|
605 |
|
|
|
606 |
foreach $_ ( @$pArgs ) {
|
|
|
607 |
if (/--Shared$/) { # Building a 'shared' object
|
|
|
608 |
$cflags = "$cflags \$(SHCFLAGS)";
|
|
|
609 |
} else {
|
|
|
610 |
Message( "CC: unknown option $_ -- ignored\n" );
|
|
|
611 |
}
|
|
|
612 |
}
|
| 7547 |
dpurdie |
613 |
|
| 227 |
dpurdie |
614 |
MakePrint( "\n\t\$(CC)\n" );
|
|
|
615 |
if ( $cflags )
|
|
|
616 |
{ # object specific CFLAGS
|
|
|
617 |
MakePadded( 4, "\$(OBJDIR)/$obj.$::o:" );
|
|
|
618 |
MakePrint( "\tCFLAGS +=$cflags\n" );
|
|
|
619 |
}
|
|
|
620 |
|
|
|
621 |
$file = StripExt( $obj ); # Metric working file
|
|
|
622 |
ToolsetGenerate( "\$(OBJDIR)/$file.met" );
|
| 4728 |
dpurdie |
623 |
|
|
|
624 |
if ( $UseGcov )
|
|
|
625 |
{
|
|
|
626 |
ToolsetGenerate( '$(OBJDIR)/' . $file . '.gcno' );
|
|
|
627 |
ToolsetGenerate( '$(OBJDIR)/' . $file . '.gcda' );
|
|
|
628 |
}
|
| 227 |
dpurdie |
629 |
}
|
|
|
630 |
|
|
|
631 |
|
|
|
632 |
###############################################################################
|
|
|
633 |
# ToolsetCCDepend( $depend, \@sources )
|
|
|
634 |
# This subroutine takes the user options and builds the
|
|
|
635 |
# rule(s) required to build the dependencies for the source
|
|
|
636 |
# files 'sources' to 'depend'.
|
|
|
637 |
#
|
|
|
638 |
###############################################################################
|
|
|
639 |
|
|
|
640 |
sub ToolsetCCDepend
|
|
|
641 |
{
|
|
|
642 |
MakePrint( "\t\$(CCDEPEND)\n" );
|
|
|
643 |
}
|
|
|
644 |
|
|
|
645 |
|
|
|
646 |
###############################################################################
|
|
|
647 |
# ToolsetCXX( $source, $obj, \@args )
|
|
|
648 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
649 |
# required to compile the source file 'source' to 'obj'
|
|
|
650 |
#
|
|
|
651 |
###############################################################################
|
|
|
652 |
|
|
|
653 |
sub ToolsetCXX
|
|
|
654 |
{
|
|
|
655 |
my( $source, $obj, $pArgs ) = @_;
|
|
|
656 |
my( $cflags, $file ) = "";
|
|
|
657 |
|
|
|
658 |
foreach $_ ( @$pArgs ) {
|
|
|
659 |
if (/--Shared$/) { # Building a 'shared' object
|
|
|
660 |
$cflags = "$cflags \$(SHCXXFLAGS)";
|
|
|
661 |
} else {
|
|
|
662 |
Message( "CXX: unknown option $_ -- ignored\n" );
|
|
|
663 |
}
|
|
|
664 |
}
|
| 7547 |
dpurdie |
665 |
|
| 227 |
dpurdie |
666 |
MakePrint( "\n\t\$(CXX)\n" );
|
|
|
667 |
if ( $cflags )
|
|
|
668 |
{ # object specific CFLAGS
|
|
|
669 |
MakePadded( 4, "\$(OBJDIR)/$obj.$::o:" );
|
|
|
670 |
MakePrint( "\tCXXFLAGS +=$cflags\n" );
|
|
|
671 |
}
|
|
|
672 |
|
|
|
673 |
$file = StripExt( $obj ); # Metric working file
|
|
|
674 |
ToolsetGenerate( "\$(OBJDIR)/$file.met" );
|
| 4728 |
dpurdie |
675 |
|
|
|
676 |
if ( $UseGcov )
|
|
|
677 |
{
|
|
|
678 |
ToolsetGenerate( '$(OBJDIR)/' . $file . '.gcno' );
|
|
|
679 |
ToolsetGenerate( '$(OBJDIR)/' . $file . '.gcda' );
|
|
|
680 |
}
|
| 227 |
dpurdie |
681 |
}
|
|
|
682 |
|
|
|
683 |
|
|
|
684 |
###############################################################################
|
|
|
685 |
# ToolsetCXXDepend( $depend, \@sources )
|
|
|
686 |
# This subroutine takes the user options and builds the
|
|
|
687 |
# rule(s) required to build the dependencies for the source
|
|
|
688 |
# files 'sources' to 'depend'.
|
|
|
689 |
#
|
|
|
690 |
###############################################################################
|
|
|
691 |
|
|
|
692 |
sub ToolsetCXXDepend
|
|
|
693 |
{
|
| 287 |
dpurdie |
694 |
ToolsetCCDepend();
|
| 227 |
dpurdie |
695 |
}
|
|
|
696 |
|
|
|
697 |
|
|
|
698 |
###############################################################################
|
|
|
699 |
# ToolsetAS( $source, $obj, \@args )
|
|
|
700 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
701 |
# required to compile the source file 'source' to 'obj'
|
|
|
702 |
#
|
|
|
703 |
###############################################################################
|
|
|
704 |
|
|
|
705 |
sub ToolsetAS
|
|
|
706 |
{
|
|
|
707 |
MakePrint( "\n\t\$(AS)\n" );
|
|
|
708 |
}
|
|
|
709 |
|
|
|
710 |
sub ToolsetASDepend
|
|
|
711 |
{
|
|
|
712 |
}
|
|
|
713 |
|
|
|
714 |
|
|
|
715 |
###############################################################################
|
|
|
716 |
# ToolsetAR( $name, \@args, \@objs )
|
|
|
717 |
# This subroutine takes the user options and builds the rules
|
|
|
718 |
# required to build the library 'name'.
|
|
|
719 |
#
|
|
|
720 |
# Arguments:
|
|
|
721 |
# n/a
|
|
|
722 |
#
|
|
|
723 |
# Output:
|
|
|
724 |
# $(BINDIR)/name$.${a}: .... ]
|
|
|
725 |
# $(AR)
|
|
|
726 |
#
|
|
|
727 |
# name_ld += ... Linker command file
|
|
|
728 |
# :
|
|
|
729 |
#
|
|
|
730 |
# name_dp += ... Dependency list
|
|
|
731 |
# :
|
|
|
732 |
#
|
|
|
733 |
###############################################################################
|
|
|
734 |
|
|
|
735 |
sub ToolsetAR
|
|
|
736 |
{
|
|
|
737 |
my( $name, $pArgs, $pObjs ) = @_;
|
|
|
738 |
|
|
|
739 |
#.. Parse arguments
|
|
|
740 |
#
|
|
|
741 |
foreach $_ ( @$pArgs )
|
|
|
742 |
{
|
|
|
743 |
Message( "AR: unknown option $_ -- ignored\n" );
|
|
|
744 |
}
|
|
|
745 |
|
|
|
746 |
#.. Target
|
|
|
747 |
#
|
|
|
748 |
MakePrint( "#.. Library ($name)\n\n" ); # label
|
|
|
749 |
|
|
|
750 |
MakeEntry( "\$(LIBDIR)/$name\$(GBE_TYPE).$::a:\t",
|
|
|
751 |
"", "\\\n\t\t", ".$::o", @$pObjs );
|
|
|
752 |
|
|
|
753 |
#.. Build library rule (just append to standard rule)
|
|
|
754 |
#
|
|
|
755 |
MakePrint( "\n\t\$(AR)\n\n" );
|
|
|
756 |
}
|
|
|
757 |
|
|
|
758 |
|
|
|
759 |
###############################################################################
|
|
|
760 |
# ToolsetARMerge( $name, \@args, \@libs )
|
|
|
761 |
# This subroutine takes the user options and builds the rules
|
|
|
762 |
# required to build the library 'name' by merging the specified
|
|
|
763 |
# libaries
|
|
|
764 |
#
|
|
|
765 |
# Arguments:
|
|
|
766 |
# --xxx No arguments currently defined
|
|
|
767 |
#
|
|
|
768 |
# Output:
|
|
|
769 |
# [ $(LIBDIR)/name$.${a}: .... ]
|
|
|
770 |
# ...
|
|
|
771 |
#
|
|
|
772 |
###############################################################################
|
|
|
773 |
|
|
|
774 |
sub ToolsetARMerge
|
|
|
775 |
{
|
|
|
776 |
MakePrint( "\n\t\$(ARMERGE)\n\n" );
|
|
|
777 |
}
|
|
|
778 |
|
|
|
779 |
|
|
|
780 |
###############################################################################
|
| 289 |
dpurdie |
781 |
# ToolsetSHLD( $name, \@args, \@objs, \@libraries, $ver )
|
| 227 |
dpurdie |
782 |
# This subroutine takes the user options and builds the rules
|
| 339 |
dpurdie |
783 |
# required to link the Shared Library 'name'.
|
| 227 |
dpurdie |
784 |
#
|
|
|
785 |
# Arguments:
|
|
|
786 |
# n/a
|
|
|
787 |
#
|
|
|
788 |
# Output:
|
|
|
789 |
# $(LIBDIR)/name: $(LIBDIR)/shared
|
|
|
790 |
# ln -s $shared $name
|
|
|
791 |
#
|
|
|
792 |
# $(LIBDIR)/name.dep: $(GBE_OBJDIR)
|
|
|
793 |
# $(LIBDIR)/name.dep: $(GBE_LIBDIR)
|
|
|
794 |
# $(LIBDIR)/name.dep: $(GBE_PLATFORM).mk
|
|
|
795 |
# $(SHLDDEPEND)
|
|
|
796 |
#
|
|
|
797 |
# $(LIBDIR)/shared: SHNAME=name
|
|
|
798 |
# $(LIBDIR)/shared: SHBASE=base
|
|
|
799 |
# $(LIBDIR)/shared: $(LIBDIR)/name.dep \
|
|
|
800 |
# $(OBJECTS)
|
| 7547 |
dpurdie |
801 |
#
|
| 227 |
dpurdie |
802 |
# ifneq "$(findstring $(IFLAG),23)" ""
|
|
|
803 |
# -include "$(LIBDIR)/name.dep"
|
|
|
804 |
# endif
|
|
|
805 |
#
|
|
|
806 |
# name_ld += ...
|
|
|
807 |
# :
|
|
|
808 |
#
|
|
|
809 |
###############################################################################
|
|
|
810 |
|
|
|
811 |
sub ToolsetSHLD
|
|
|
812 |
{
|
| 289 |
dpurdie |
813 |
my( $name, $pArgs, $pObjs, $pLibs, $ver ) = @_;
|
| 6198 |
dpurdie |
814 |
my( $linkname, $soname, $shared, $dbgname, @preReqFiles, @scripts, $multi_scan );
|
| 4034 |
dpurdie |
815 |
my $sosuffix;
|
|
|
816 |
my $noVersionedLib = $::ScmCompilerOpts{'NO_VERSIONED_DLLS'};
|
| 6198 |
dpurdie |
817 |
my $brokenLd = $::ScmCompilerOpts{'BROKEN_LDSCRIPTS'};
|
| 7547 |
dpurdie |
818 |
my $isNodeFile = 0;
|
| 227 |
dpurdie |
819 |
|
|
|
820 |
#.. Parse arguments
|
|
|
821 |
#
|
|
|
822 |
foreach $_ ( @$pArgs )
|
|
|
823 |
{
|
|
|
824 |
if (/^--Def=(.*?)(\,(.*))?$/) { # Library definition
|
|
|
825 |
#
|
|
|
826 |
# Locate the Def file.
|
|
|
827 |
# If it is a generate file so it will be in the SRCS hash
|
|
|
828 |
# Otherwise the user will have to use Src to locate the file
|
|
|
829 |
#
|
| 6198 |
dpurdie |
830 |
my $def = MakeSrcResolve($1);
|
|
|
831 |
|
|
|
832 |
if ($brokenLd) {
|
|
|
833 |
# The linker cannot handle the linker script
|
|
|
834 |
# The work around is to split the script into two that it can handle
|
| 7547 |
dpurdie |
835 |
# Only works with a Linker Script with VERSION and EXTERN entries
|
|
|
836 |
my $index = scalar @ldFixups;
|
| 6198 |
dpurdie |
837 |
my %data;
|
|
|
838 |
$data{src} = $def;
|
|
|
839 |
$data{vs} = '$(OBJDIR)/linkscript_' . $index . '.def';
|
|
|
840 |
$data{ls} = '$(OBJDIR)/linkscript_' . $index . '.scr';
|
|
|
841 |
push @ldFixups, \%data;
|
|
|
842 |
|
|
|
843 |
push @scripts, $data{ls};
|
|
|
844 |
push @scripts, '--version-script=' . $data{vs};
|
|
|
845 |
|
|
|
846 |
push @preReqFiles, $data{vs};
|
|
|
847 |
push @preReqFiles, $data{ls};
|
|
|
848 |
|
|
|
849 |
} else {
|
|
|
850 |
# Normal operation. Linker is not broken
|
|
|
851 |
push @preReqFiles, $def;
|
|
|
852 |
if ( $1 =~ m~\.def$~ ) {
|
|
|
853 |
$def = '--version-script=' .$def; # Old def file
|
|
|
854 |
}
|
|
|
855 |
push @scripts, $def;
|
| 227 |
dpurdie |
856 |
}
|
| 6198 |
dpurdie |
857 |
|
| 227 |
dpurdie |
858 |
} elsif ( /^--MultiScan/i ) {
|
|
|
859 |
$multi_scan = 1;
|
|
|
860 |
|
|
|
861 |
} elsif ( /^--NoMultiScan/i ) {
|
|
|
862 |
$multi_scan = 0;
|
|
|
863 |
|
| 339 |
dpurdie |
864 |
} elsif ( /^--SoNameSuffix=(.*)/i ) {
|
|
|
865 |
$sosuffix = $1;
|
|
|
866 |
|
| 4034 |
dpurdie |
867 |
} elsif (/^--NoVersionDll/i) {
|
|
|
868 |
$noVersionedLib = 1;
|
|
|
869 |
|
| 7547 |
dpurdie |
870 |
# AÂ 'node' file is a specific shared library for Electron applications
|
|
|
871 |
# They have a fixed file extension of .node on all platforms
|
|
|
872 |
# Do not generate a Versioned DLL
|
|
|
873 |
} elsif (/^--Node$/i) {
|
|
|
874 |
$isNodeFile = 1;
|
|
|
875 |
$noVersionedLib = 1;
|
| 227 |
dpurdie |
876 |
} else {
|
|
|
877 |
Message( "SHLD: unknown option $_ -- ignored\n" );
|
|
|
878 |
}
|
|
|
879 |
}
|
|
|
880 |
|
| 4034 |
dpurdie |
881 |
#
|
| 6459 |
dpurdie |
882 |
# Determine the 'soname' if none has been provided
|
| 4034 |
dpurdie |
883 |
#
|
|
|
884 |
$sosuffix = '.' . $ver
|
|
|
885 |
unless ( defined $sosuffix );
|
|
|
886 |
$sosuffix = ''
|
|
|
887 |
if ( $noVersionedLib );
|
|
|
888 |
|
| 339 |
dpurdie |
889 |
#.. Various library names
|
| 227 |
dpurdie |
890 |
#
|
| 7547 |
dpurdie |
891 |
if ( $isNodeFile ) {
|
|
|
892 |
$linkname = "$name\$(GBE_TYPE)";
|
|
|
893 |
$linkname =~ s/^lib//;
|
|
|
894 |
} else {
|
|
|
895 |
$linkname = "$name\$(GBE_TYPE).$::so";
|
|
|
896 |
}
|
| 4034 |
dpurdie |
897 |
$shared = $noVersionedLib ? $linkname : "$linkname.$ver";
|
| 339 |
dpurdie |
898 |
$soname = "$linkname$sosuffix";
|
| 4034 |
dpurdie |
899 |
|
| 373 |
dpurdie |
900 |
my $shared_path = "\$(LIBDIR)/${shared}";
|
|
|
901 |
my $dbg_path = $shared_path . '.dbg';
|
| 227 |
dpurdie |
902 |
|
|
|
903 |
#.. Cleanup rules
|
|
|
904 |
#
|
|
|
905 |
# map Map file
|
|
|
906 |
# ln Link from LIBDIR to BINDIR
|
|
|
907 |
#
|
| 261 |
dpurdie |
908 |
ToolsetGenerate( "\$(LIBDIR)/${name}.map" );
|
|
|
909 |
ToolsetGenerate( "\$(LIBDIR)/${shared}" );
|
| 339 |
dpurdie |
910 |
ToolsetGenerate( "\$(BINDIR)/${soname}" );
|
| 373 |
dpurdie |
911 |
ToolsetGenerate( $dbg_path );
|
| 227 |
dpurdie |
912 |
|
|
|
913 |
#.. Build rules
|
|
|
914 |
#
|
|
|
915 |
# name Base name
|
|
|
916 |
# shared Library name, includes GBE_TYPE specification
|
|
|
917 |
#
|
|
|
918 |
my ($io) = ToolsetPrinter::New();
|
| 335 |
dpurdie |
919 |
my $dep = $io->SetShldTarget($shared);
|
| 227 |
dpurdie |
920 |
|
|
|
921 |
$io->Label( "Shared library", $name );
|
| 339 |
dpurdie |
922 |
PackageShlibAddFiles( $name, "\$(LIBDIR)/$shared" );
|
| 373 |
dpurdie |
923 |
PackageShlibAddFiles( $name, $dbg_path );
|
| 4034 |
dpurdie |
924 |
|
| 227 |
dpurdie |
925 |
$io->Prt( "\$(LIBDIR)/${shared}:\tSHBASE=${name}\n" );
|
| 339 |
dpurdie |
926 |
$io->Prt( "\$(LIBDIR)/${shared}:\tSHNAME=${soname}\n" );
|
|
|
927 |
$io->Prt( "\$(LIBDIR)/${shared}: \\\n\t\t${dep}" );
|
| 321 |
dpurdie |
928 |
$io->Entry( "", "", " \\\n\t\t", ".$::o", @$pObjs );
|
| 6198 |
dpurdie |
929 |
$io->Entry( "", "", " \\\n\t\t", "", @preReqFiles );
|
| 373 |
dpurdie |
930 |
$io->Prt( "\n\t\$(SHLD)" );
|
|
|
931 |
$io->Prt( "\n\t\$(call LDSTRIP,$shared_path,$dbg_path)\n\n" );
|
| 7547 |
dpurdie |
932 |
|
| 339 |
dpurdie |
933 |
#
|
|
|
934 |
# Create soft links
|
|
|
935 |
# 'Real Name' to its 'Link Name'
|
|
|
936 |
# 'Real Name' to 'SoName' in the BINDIR (for testing I think)
|
|
|
937 |
# 'Real Name' to 'SoName' in the LIBDIR (if different)
|
|
|
938 |
#
|
| 4034 |
dpurdie |
939 |
if ( $shared ne $linkname)
|
|
|
940 |
{
|
|
|
941 |
$io->Label( "Shared library Symbolic Links", $name );
|
| 5882 |
dpurdie |
942 |
PackageShlibAddFiles( $name, "\$(LIBDIR)/$linkname", 'symlink=1' );
|
| 4034 |
dpurdie |
943 |
$io->Prt( "\$(LIBDIR)/$linkname:\t\\\n" .
|
|
|
944 |
"\t\t\$(GBE_BINDIR)\\\n" .
|
|
|
945 |
"\t\t\$(LIBDIR)/${shared}\n" .
|
| 5882 |
dpurdie |
946 |
"\t\$(AA_PRE)(rm -f \$@; ln -s $shared \$@)\n\n" );
|
| 4034 |
dpurdie |
947 |
}
|
|
|
948 |
|
|
|
949 |
$io->Label( "Shared library BINDIR Symbolic Links", $name );
|
| 5882 |
dpurdie |
950 |
# PackageShlibAddFiles( $name, "\$(BINDIR)/$soname", 'symlink=1' );
|
| 4034 |
dpurdie |
951 |
$io->Prt( "\$(BINDIR)/$soname:\t\\\n" .
|
| 339 |
dpurdie |
952 |
"\t\t\$(GBE_BINDIR)\\\n" .
|
|
|
953 |
"\t\t\$(LIBDIR)/${shared}\n" .
|
| 4034 |
dpurdie |
954 |
"\t\$(AA_PRE)(rm -f \$@; ln -s ../\$(LIBDIR)/$shared \$@)\n\n" );
|
| 339 |
dpurdie |
955 |
|
| 4034 |
dpurdie |
956 |
if ( $soname ne $shared )
|
| 339 |
dpurdie |
957 |
{
|
|
|
958 |
$io->Label( "Shared library SoName Symbolic Links", $name );
|
| 5882 |
dpurdie |
959 |
PackageShlibAddFiles( $name, "\$(LIBDIR)/$soname", 'symlink=1' );
|
| 339 |
dpurdie |
960 |
$io->Prt( "\$(LIBDIR)/$soname:\t\\\n" .
|
|
|
961 |
"\t\t\$(GBE_LIBDIR)\\\n" .
|
|
|
962 |
"\t\t\$(LIBDIR)/${shared}\n" .
|
| 5882 |
dpurdie |
963 |
"\t\$(AA_PRE)(rm -f \$@; ln -s $shared \$@)\n" );
|
| 339 |
dpurdie |
964 |
}
|
|
|
965 |
|
| 227 |
dpurdie |
966 |
#.. Linker command file
|
|
|
967 |
#
|
|
|
968 |
# Now the fun part... piecing together a variable $(name_shld)
|
|
|
969 |
# which ends up in the command file.
|
|
|
970 |
#
|
| 339 |
dpurdie |
971 |
$io->Newline();
|
| 227 |
dpurdie |
972 |
$io->SetTag( "${name}_shld" ); # command tag
|
|
|
973 |
$io->SetTerm( "\n" );
|
|
|
974 |
|
|
|
975 |
$io->Label( "Linker commands", $name ); # label
|
|
|
976 |
|
|
|
977 |
# object list
|
|
|
978 |
$io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );
|
|
|
979 |
|
|
|
980 |
ToolsetLibStd( $pLibs ); # push standard libraries
|
|
|
981 |
|
| 6198 |
dpurdie |
982 |
$io->Cmd( "-Wl," . join (',', @scripts) ) if (@scripts);
|
| 227 |
dpurdie |
983 |
|
|
|
984 |
$io->Cmd( "-Wl,--start-group" ) if ($multi_scan);
|
|
|
985 |
$io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
|
|
|
986 |
$io->Cmd( "-Wl,--end-group" ) if ($multi_scan);
|
|
|
987 |
|
|
|
988 |
$io->Newline();
|
|
|
989 |
|
| 335 |
dpurdie |
990 |
#.. Dependency link,
|
|
|
991 |
# Create a library dependency file
|
|
|
992 |
# Create command file to build applicaton dependency list
|
|
|
993 |
# from the list of dependent libraries
|
|
|
994 |
#
|
|
|
995 |
# Create makefile directives to include the dependency
|
|
|
996 |
# list into the makefile.
|
|
|
997 |
#
|
|
|
998 |
$io->DepRules( $pLibs, \&ToolsetLibRecipe, "\$(LIBDIR)/${shared}" );
|
| 339 |
dpurdie |
999 |
$io->SHLDDEPEND($name, $soname);
|
| 227 |
dpurdie |
1000 |
}
|
|
|
1001 |
|
|
|
1002 |
|
|
|
1003 |
###############################################################################
|
| 271 |
dpurdie |
1004 |
# Function : ToolsetLD
|
| 227 |
dpurdie |
1005 |
#
|
| 271 |
dpurdie |
1006 |
# Description : Takes the user options and builds the rules required to
|
|
|
1007 |
# link the program 'name'.
|
| 227 |
dpurdie |
1008 |
#
|
| 271 |
dpurdie |
1009 |
# Inputs : $name - base name of the program
|
|
|
1010 |
# $pArgs - Ref to program arguments
|
|
|
1011 |
# $pObjs - Ref to program objects
|
|
|
1012 |
# $pLibs - Ref to program library list
|
| 227 |
dpurdie |
1013 |
#
|
| 271 |
dpurdie |
1014 |
# Returns : Nothing
|
| 227 |
dpurdie |
1015 |
#
|
| 271 |
dpurdie |
1016 |
# Output: : Rules and recipes to create a program
|
|
|
1017 |
# Create program rules and recipes
|
|
|
1018 |
# Create linker input script
|
|
|
1019 |
# Create library dependency list
|
|
|
1020 |
# Include library dependency information
|
| 227 |
dpurdie |
1021 |
#
|
|
|
1022 |
sub ToolsetLD
|
|
|
1023 |
{
|
|
|
1024 |
my( $name, $pArgs, $pObjs, $pLibs ) = @_;
|
|
|
1025 |
my $static = $::ScmCompilerOpts{'STATIC_PROGS'};
|
|
|
1026 |
my $multi_scan;
|
|
|
1027 |
|
|
|
1028 |
#.. Parse arguments
|
|
|
1029 |
#
|
|
|
1030 |
foreach $_ ( @$pArgs )
|
|
|
1031 |
{
|
|
|
1032 |
if ( m/^--Static$/ ) {
|
|
|
1033 |
$static = 1;
|
|
|
1034 |
|
|
|
1035 |
} elsif ( m/^--Shared/ ) {
|
|
|
1036 |
$static = 0;
|
|
|
1037 |
|
|
|
1038 |
} elsif ( /^--MultiScan/i ) {
|
|
|
1039 |
$multi_scan = 1;
|
|
|
1040 |
|
|
|
1041 |
} elsif ( /^--NoMultiScan/i ) {
|
|
|
1042 |
$multi_scan = 0;
|
|
|
1043 |
|
|
|
1044 |
} else {
|
|
|
1045 |
Message( "LD: unknown option $_ -- ignored\n" );
|
|
|
1046 |
}
|
|
|
1047 |
}
|
|
|
1048 |
|
| 271 |
dpurdie |
1049 |
#.. Names of programs and components
|
|
|
1050 |
#
|
|
|
1051 |
my $base = "\$(BINDIR)/${name}";
|
|
|
1052 |
my $full = $base . $::exe;
|
|
|
1053 |
my $map = $base . '.map';
|
|
|
1054 |
my $ld = $base . '.ld';
|
| 373 |
dpurdie |
1055 |
my $dbg = $base . '.dbg';
|
| 271 |
dpurdie |
1056 |
|
| 227 |
dpurdie |
1057 |
#.. Cleanup rules
|
|
|
1058 |
#
|
| 271 |
dpurdie |
1059 |
ToolsetGenerate( $ld );
|
|
|
1060 |
ToolsetGenerate( $map );
|
| 373 |
dpurdie |
1061 |
ToolsetGenerate( $dbg );
|
| 227 |
dpurdie |
1062 |
|
|
|
1063 |
#.. Build rules
|
|
|
1064 |
#
|
|
|
1065 |
my ($io) = ToolsetPrinter::New();
|
| 335 |
dpurdie |
1066 |
my $dep = $io->SetLdTarget( $name );
|
| 227 |
dpurdie |
1067 |
|
| 271 |
dpurdie |
1068 |
$io->Prt( "$full : $dep " );
|
|
|
1069 |
$io->Entry( "", "", "\\\n\t", ".$::o ", @$pObjs );
|
| 373 |
dpurdie |
1070 |
$io->Prt( "\n\t\$(LD)" );
|
|
|
1071 |
$io->Prt( "\n\t\$(call LDSTRIP,$full,$dbg)\n\n" );
|
| 227 |
dpurdie |
1072 |
|
| 271 |
dpurdie |
1073 |
|
| 227 |
dpurdie |
1074 |
#.. Linker command file
|
|
|
1075 |
#
|
|
|
1076 |
# Now the fun part... piecing together a variable $(name_ld)
|
|
|
1077 |
# which ends up in the command file.
|
|
|
1078 |
#
|
|
|
1079 |
$io->SetTag( "${name}_ld" ); # macro tag
|
|
|
1080 |
$io->SetTerm( "\n" );
|
|
|
1081 |
|
|
|
1082 |
$io->Label( "Linker commands", $name ); # label
|
|
|
1083 |
|
|
|
1084 |
$io->Cmd( "-static" ) if ($static); # Link as a static program
|
|
|
1085 |
|
|
|
1086 |
# object list
|
|
|
1087 |
$io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );
|
|
|
1088 |
|
|
|
1089 |
ToolsetLibStd( $pLibs ); # push standard libraries
|
|
|
1090 |
|
|
|
1091 |
# library list
|
|
|
1092 |
$io->Cmd( "-Wl,--start-group" ) if ($multi_scan);
|
|
|
1093 |
$io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
|
|
|
1094 |
$io->Cmd( "-Wl,--end-group" ) if ($multi_scan);
|
|
|
1095 |
|
| 5744 |
dpurdie |
1096 |
# Add Compilers sysroot library path
|
|
|
1097 |
# Only required for a 'native' compiler that is not fully installed on the host
|
| 6898 |
dpurdie |
1098 |
# ie: The run-time can't locate the required glibc components
|
| 5796 |
dpurdie |
1099 |
if ($GCCRPath)
|
|
|
1100 |
{
|
|
|
1101 |
$io->Cmd( "-Wl,-rpath=$GCCRPath" );
|
|
|
1102 |
$io->Cmd( "-Wl,--dynamic-linker=$GCCRPath/ld-linux.so.2" ) if ($GCCRPath);
|
|
|
1103 |
}
|
| 5744 |
dpurdie |
1104 |
|
| 227 |
dpurdie |
1105 |
$io->Newline();
|
|
|
1106 |
|
| 335 |
dpurdie |
1107 |
#.. Dependency link,
|
|
|
1108 |
# Create a library dependency file
|
|
|
1109 |
# Create command file to build applicaton dependency list
|
|
|
1110 |
# from the list of dependent libraries
|
|
|
1111 |
#
|
|
|
1112 |
# Create makefile directives to include the dependency
|
|
|
1113 |
# list into the makefile.
|
|
|
1114 |
#
|
|
|
1115 |
$io->DepRules( $pLibs, \&ToolsetLibRecipe, $base );
|
|
|
1116 |
$io->LDDEPEND();
|
| 271 |
dpurdie |
1117 |
|
|
|
1118 |
#.. Package up the program and other artifacts
|
|
|
1119 |
#
|
|
|
1120 |
PackageProgAddFiles ( $name, $full );
|
| 6294 |
dpurdie |
1121 |
PackageProgAddFiles ( $name, $dbg, "Class=debug" );
|
| 271 |
dpurdie |
1122 |
|
| 227 |
dpurdie |
1123 |
}
|
|
|
1124 |
|
| 4778 |
dpurdie |
1125 |
#-------------------------------------------------------------------------------
|
| 7547 |
dpurdie |
1126 |
# Function : ToolsetPostprocess
|
| 4778 |
dpurdie |
1127 |
#
|
|
|
1128 |
# Description : Last chance by the toolset to perform processing
|
|
|
1129 |
# All Directives have been processed
|
|
|
1130 |
#
|
|
|
1131 |
# If automated unit test are being used,
|
|
|
1132 |
# then we need to post process the results
|
|
|
1133 |
#
|
|
|
1134 |
# Inputs : None
|
|
|
1135 |
#
|
| 7547 |
dpurdie |
1136 |
# Returns :
|
| 4778 |
dpurdie |
1137 |
#
|
|
|
1138 |
sub ToolsetPostprocess
|
|
|
1139 |
{
|
|
|
1140 |
ToolsetPreprocessTests();
|
|
|
1141 |
ToolsetPostprocessTests();
|
|
|
1142 |
ToolsetCollateTestResults();
|
| 6198 |
dpurdie |
1143 |
ToolsetGenLdScripts();
|
| 4778 |
dpurdie |
1144 |
}
|
| 227 |
dpurdie |
1145 |
|
| 4728 |
dpurdie |
1146 |
###############################################################################
|
|
|
1147 |
# Function : ToolsetPreprocessTests
|
|
|
1148 |
#
|
| 7547 |
dpurdie |
1149 |
# Description : Generate $(OBJDIR)/lcov-baseline.info
|
| 5884 |
dpurdie |
1150 |
# Generate full coverage info
|
| 4728 |
dpurdie |
1151 |
#
|
|
|
1152 |
# Inputs : None
|
|
|
1153 |
#
|
|
|
1154 |
# Returns : Nothing
|
|
|
1155 |
#
|
|
|
1156 |
# Output: : Rules and recipes to run before unit tests
|
|
|
1157 |
#
|
|
|
1158 |
sub ToolsetPreprocessTests
|
|
|
1159 |
{
|
|
|
1160 |
my ($io) = ToolsetPrinter::New();
|
|
|
1161 |
if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
|
|
|
1162 |
{
|
| 5884 |
dpurdie |
1163 |
#
|
|
|
1164 |
# Setup Env so that the files created by GCOV are within the package
|
| 7547 |
dpurdie |
1165 |
# being created. Elsewise they will be created all over the file
|
| 5884 |
dpurdie |
1166 |
# system in the original location where the external objects were created.
|
|
|
1167 |
#
|
|
|
1168 |
$io->PrtLn('GCOV_PREFIX := $(abspath $(INTERFACEDIR)/gcov)' );
|
|
|
1169 |
$io->PrtLn('GCOV_PREFIX_STRIP := 0' );
|
|
|
1170 |
$io->PrtLn('export GCOV_PREFIX GCOV_PREFIX_STRIP' );
|
|
|
1171 |
$io->Newline();
|
|
|
1172 |
|
|
|
1173 |
#
|
|
|
1174 |
# GCOV_PKGBASE - used to 'extract' coverage artifacts
|
|
|
1175 |
# Used to limit the coverage report to files that are within this package
|
|
|
1176 |
# Ideally it should be the root of the package, but this is not always known
|
|
|
1177 |
# Use the first two path elements of the current package
|
|
|
1178 |
# Really just want to filter out compiler bits
|
| 7547 |
dpurdie |
1179 |
#
|
| 5884 |
dpurdie |
1180 |
|
|
|
1181 |
$io->PrtLn('GCOV_PKGBASE := $(subst $(space),/,$(space)$(wordlist 1,2,$(subst /,$(space),$(CURDIR))))' );
|
|
|
1182 |
$io->PrtLn('GCOV_VERBOSE := $(if $(VERBOSE_OPT),,--quiet)' );
|
|
|
1183 |
$io->Newline();
|
|
|
1184 |
|
| 4778 |
dpurdie |
1185 |
my $ruleName = 'preprocess_gcov_data';
|
| 4728 |
dpurdie |
1186 |
my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
|
|
|
1187 |
my $final=$finaldir . '/lcov-final.info';
|
| 7547 |
dpurdie |
1188 |
|
| 4778 |
dpurdie |
1189 |
ToolsetAddUnitTestPreProcess($ruleName);
|
|
|
1190 |
$io->PrtLn('.PHONY: ' . $ruleName );
|
| 6798 |
dpurdie |
1191 |
$io->PrtLn($ruleName . ': $(OBJDIR)' );
|
| 5884 |
dpurdie |
1192 |
$io->PrtLn("\t" . '${XX_PRE}$(rm) -f ${GCOV_PREFIX}/$(CURDIR)/$(OBJDIR)/*.gcda' );
|
|
|
1193 |
$io->PrtLn("\t" . '${XX_PRE}$(rm) -f $(OBJDIR)/*.gcda' );
|
| 4728 |
dpurdie |
1194 |
$io->PrtLn("\t" . '${XX_PRE}$(rm) -f ' . $final);
|
|
|
1195 |
$io->PrtLn("\t" . '${XX_PRE}lcov'
|
| 5884 |
dpurdie |
1196 |
. ' $(GCOV_VERBOSE)'
|
| 4835 |
dpurdie |
1197 |
. ' --capture'
|
|
|
1198 |
. ' --initial'
|
| 5884 |
dpurdie |
1199 |
. ' --base-directory $(CURDIR)'
|
| 4835 |
dpurdie |
1200 |
. ' --directory $(OBJDIR)'
|
| 7547 |
dpurdie |
1201 |
. ' --gcov-tool $(GCC_GCOVTOOL)'
|
| 5884 |
dpurdie |
1202 |
. ' --output-file $(OBJDIR)/lcov-baseline.info' );
|
| 4778 |
dpurdie |
1203 |
$io->Newline();
|
| 5884 |
dpurdie |
1204 |
ToolsetGenerate( '$(OBJDIR)/lcov-baseline.info' );
|
| 4728 |
dpurdie |
1205 |
}
|
|
|
1206 |
}
|
|
|
1207 |
|
|
|
1208 |
|
|
|
1209 |
###############################################################################
|
|
|
1210 |
# Function : ToolsetPostprocessTests
|
|
|
1211 |
#
|
| 5884 |
dpurdie |
1212 |
# Description : Merge this sub-components bits into the the final coverage
|
|
|
1213 |
# file in lcov-baseline.info
|
| 7547 |
dpurdie |
1214 |
#
|
| 5884 |
dpurdie |
1215 |
# Need to locate the .gcda files and place them in the same directory
|
|
|
1216 |
# as the .gcno files that were created during preprocssing
|
| 7547 |
dpurdie |
1217 |
#
|
| 5884 |
dpurdie |
1218 |
# Then we can add our trace bits into the file coverage file
|
| 4728 |
dpurdie |
1219 |
#
|
|
|
1220 |
# Inputs : None
|
|
|
1221 |
#
|
|
|
1222 |
# Returns : Nothing
|
|
|
1223 |
#
|
|
|
1224 |
# Output: : Rules and recipes to run after the unit tests
|
|
|
1225 |
#
|
|
|
1226 |
sub ToolsetPostprocessTests
|
|
|
1227 |
{
|
|
|
1228 |
my ($io) = ToolsetPrinter::New();
|
|
|
1229 |
if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
|
|
|
1230 |
{
|
| 4778 |
dpurdie |
1231 |
my $ruleName = 'postprocess_gcov_data';
|
| 4728 |
dpurdie |
1232 |
my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
|
|
|
1233 |
my $final=$finaldir . '/lcov-final.info';
|
| 7547 |
dpurdie |
1234 |
|
| 4778 |
dpurdie |
1235 |
ToolsetAddUnitTestPostProcess($ruleName);
|
|
|
1236 |
|
|
|
1237 |
$io->PrtLn('.PHONY: ' . $ruleName );
|
|
|
1238 |
$io->PrtLn($ruleName . ':' );
|
| 7547 |
dpurdie |
1239 |
$io->PrtPart("\t" . '$(XX_PRE)if [ -d "${GCOV_PREFIX}/$(CURDIR)/$(OBJDIR)" ]; then' );
|
| 5884 |
dpurdie |
1240 |
$io->PrtPart("\t\t" . 'cd ${GCOV_PREFIX}/$(CURDIR);');
|
|
|
1241 |
$io->PrtPart("\t\t" . 'find $(OBJDIR) -name \'*.gcda\' -exec cp --parent {} $(CURDIR) \\; ;');
|
|
|
1242 |
# $io->PrtPart("\t" . 'else');
|
|
|
1243 |
# $io->PrtPart("\t\t" . 'echo NO .gcda DATA for $(CURDIR);');
|
|
|
1244 |
$io->PrtLn ("\t" . 'fi' );
|
| 4728 |
dpurdie |
1245 |
$io->PrtLn ("\t" . '$(XX_PRE)$(mkdir) -p ' . $finaldir);
|
| 7547 |
dpurdie |
1246 |
$io->PrtPart("\t" . '$(XX_PRE)GCDA_COUNT=$$(find $(OBJDIR) -name "*.gcda" | wc -l);' );
|
| 5884 |
dpurdie |
1247 |
$io->PrtPart("\t" . 'if [ "$${GCDA_COUNT}" -eq "0" ]; then ');
|
| 4728 |
dpurdie |
1248 |
$io->PrtPart("\t\t" . 'if [ ! -e ' . $final . " ]; then");
|
|
|
1249 |
$io->PrtPart("\t\t\t" . '$(cp) $(OBJDIR)/lcov-baseline.info ' . $final . ';');
|
|
|
1250 |
$io->PrtPart("\t\t" . 'else');
|
|
|
1251 |
$io->PrtPart("\t\t\t" . 'lcov'
|
| 5884 |
dpurdie |
1252 |
. ' $(GCOV_VERBOSE)'
|
| 4835 |
dpurdie |
1253 |
. $LcovExplicitBranch
|
| 4728 |
dpurdie |
1254 |
. ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
|
|
|
1255 |
. ' --add-tracefile ' . $final
|
| 7547 |
dpurdie |
1256 |
. ' --gcov-tool $(GCC_GCOVTOOL)'
|
| 4728 |
dpurdie |
1257 |
. ' --output-file $(OBJDIR)/lcov-merge.info'
|
| 7547 |
dpurdie |
1258 |
. ';');
|
| 4728 |
dpurdie |
1259 |
$io->PrtPart("\t\t\t" . '$(rm) -f ' . $final . ';');
|
|
|
1260 |
$io->PrtPart("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . ';');
|
|
|
1261 |
$io->PrtPart("\t\t" . 'fi' . ';');
|
|
|
1262 |
$io->PrtPart("\t" . 'else');
|
|
|
1263 |
$io->PrtPart("\t\t" . 'lcov'
|
| 5884 |
dpurdie |
1264 |
. ' $(GCOV_VERBOSE)'
|
|
|
1265 |
. $LcovExplicitBranch
|
| 4728 |
dpurdie |
1266 |
. ' --capture'
|
| 5884 |
dpurdie |
1267 |
. ' --base-directory $(CURDIR)'
|
| 4728 |
dpurdie |
1268 |
. ' --directory $(OBJDIR)'
|
| 7547 |
dpurdie |
1269 |
. ' --gcov-tool $(GCC_GCOVTOOL)'
|
|
|
1270 |
. ' --output-file $(OBJDIR)/lcov-capture.info'
|
|
|
1271 |
. ';');
|
| 4728 |
dpurdie |
1272 |
$io->PrtPart("\t\t" . 'if [ ! -e ' . $final . " ]; then");
|
|
|
1273 |
$io->PrtPart("\t\t\t" . 'lcov'
|
| 5884 |
dpurdie |
1274 |
. ' $(GCOV_VERBOSE)'
|
| 4835 |
dpurdie |
1275 |
. $LcovExplicitBranch
|
| 4728 |
dpurdie |
1276 |
. ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
|
| 5884 |
dpurdie |
1277 |
. ' --add-tracefile $(OBJDIR)/lcov-capture.info'
|
| 7547 |
dpurdie |
1278 |
. ' --gcov-tool $(GCC_GCOVTOOL)'
|
| 4728 |
dpurdie |
1279 |
. ' --output-file ' . $final
|
| 7547 |
dpurdie |
1280 |
. ';');
|
| 4728 |
dpurdie |
1281 |
$io->PrtPart("\t\t" . 'else');
|
|
|
1282 |
$io->PrtPart("\t\t\t" . 'lcov'
|
| 5884 |
dpurdie |
1283 |
. ' $(GCOV_VERBOSE)'
|
| 4835 |
dpurdie |
1284 |
. $LcovExplicitBranch
|
| 4728 |
dpurdie |
1285 |
. ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
|
| 5884 |
dpurdie |
1286 |
. ' --add-tracefile $(OBJDIR)/lcov-capture.info'
|
| 4728 |
dpurdie |
1287 |
. ' --add-tracefile ' . $final
|
| 7547 |
dpurdie |
1288 |
. ' --gcov-tool $(GCC_GCOVTOOL)'
|
| 4728 |
dpurdie |
1289 |
. ' --output-file $(OBJDIR)/lcov-merge.info'
|
| 7547 |
dpurdie |
1290 |
. ';');
|
| 4728 |
dpurdie |
1291 |
$io->PrtPart("\t\t\t" . '$(rm) -f ' . $final . ';');
|
|
|
1292 |
$io->PrtPart("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . ';');
|
|
|
1293 |
$io->PrtPart("\t\t" . 'fi' . ';');
|
|
|
1294 |
$io->PrtLn ("\t" . 'fi');
|
| 4778 |
dpurdie |
1295 |
$io->Newline();
|
| 5817 |
dpurdie |
1296 |
|
|
|
1297 |
ToolsetGenerate ('$(OBJDIR)/lcov-capture.info' );
|
|
|
1298 |
ToolsetGenerate ($final);
|
|
|
1299 |
|
| 4728 |
dpurdie |
1300 |
}
|
|
|
1301 |
}
|
|
|
1302 |
|
|
|
1303 |
|
|
|
1304 |
###############################################################################
|
|
|
1305 |
# Function : ToolsetCollateTestResults
|
|
|
1306 |
#
|
| 5884 |
dpurdie |
1307 |
# Description : Process the lcov-final.info by
|
|
|
1308 |
# Extract parts generated by files in this package
|
|
|
1309 |
# Remove parts generated by files in the interface directory
|
|
|
1310 |
# They are the results of a 'BuildPkgArchive'
|
| 4728 |
dpurdie |
1311 |
#
|
|
|
1312 |
# Inputs : None
|
|
|
1313 |
#
|
|
|
1314 |
# Returns : Nothing
|
|
|
1315 |
#
|
| 7547 |
dpurdie |
1316 |
# Output: : Rules and recipes to run after unit test result
|
| 4728 |
dpurdie |
1317 |
# postprocessing.
|
|
|
1318 |
#
|
|
|
1319 |
sub ToolsetCollateTestResults
|
|
|
1320 |
{
|
|
|
1321 |
my ($io) = ToolsetPrinter::New();
|
|
|
1322 |
if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
|
|
|
1323 |
{
|
| 4778 |
dpurdie |
1324 |
my $ruleName = 'collate_gcov_results';
|
| 5884 |
dpurdie |
1325 |
my $finaldir = '$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
|
|
|
1326 |
my $final = $finaldir . '/lcov-final.info';
|
| 5885 |
dpurdie |
1327 |
my $finalTmp = $finaldir . '/lcov-extracted.info';
|
|
|
1328 |
my $finalTmp1 = $finaldir . '/lcov-filtered.info';
|
| 4778 |
dpurdie |
1329 |
|
| 5884 |
dpurdie |
1330 |
ToolsetGenerate ( $final );
|
|
|
1331 |
ToolsetGenerate ( $finalTmp );
|
|
|
1332 |
ToolsetGenerate ( $finalTmp1 );
|
|
|
1333 |
|
| 4778 |
dpurdie |
1334 |
ToolsetAddUnitTestCollateProcess($ruleName);
|
| 7547 |
dpurdie |
1335 |
|
| 4728 |
dpurdie |
1336 |
my $reportdir='$(PKGDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
|
|
|
1337 |
my $reportindex=$reportdir . '/index.html';
|
| 4778 |
dpurdie |
1338 |
$io->PrtLn('.PHONY: ' . $ruleName );
|
|
|
1339 |
$io->PrtLn($ruleName . ': ' . $reportindex);
|
| 5884 |
dpurdie |
1340 |
|
| 4728 |
dpurdie |
1341 |
$io->Newline();
|
|
|
1342 |
$io->PrtLn($reportindex . ': ' . $final);
|
| 5884 |
dpurdie |
1343 |
$io->PrtPart("\t" . 'lcov'
|
|
|
1344 |
. ' $(GCOV_VERBOSE)'
|
|
|
1345 |
. $LcovExplicitBranch
|
|
|
1346 |
. ' --extract '. $final .' "$(GCOV_PKGBASE)/*"'
|
| 7547 |
dpurdie |
1347 |
. ' --gcov-tool $(GCC_GCOVTOOL)'
|
| 5884 |
dpurdie |
1348 |
. ' --output-file ' . $finalTmp
|
| 7547 |
dpurdie |
1349 |
. ';');
|
| 5884 |
dpurdie |
1350 |
$io->PrtPart("\t" . 'lcov'
|
|
|
1351 |
. ' $(GCOV_VERBOSE)'
|
|
|
1352 |
. $LcovExplicitBranch
|
|
|
1353 |
. ' --remove '. $finalTmp .' "$(abspath $(INTERFACEDIR))/*"'
|
| 7547 |
dpurdie |
1354 |
. ' --gcov-tool $(GCC_GCOVTOOL)'
|
| 5884 |
dpurdie |
1355 |
. ' --output-file ' .$finalTmp1
|
| 7547 |
dpurdie |
1356 |
. ';');
|
| 4728 |
dpurdie |
1357 |
$io->PrtLn("\t" . 'genhtml'
|
| 5884 |
dpurdie |
1358 |
. ' $(GCOV_VERBOSE)'
|
| 4728 |
dpurdie |
1359 |
. ' --frames'
|
|
|
1360 |
. ' --show-details'
|
|
|
1361 |
. ' --function-coverage'
|
|
|
1362 |
. ' --branch-coverage'
|
|
|
1363 |
. ' --output-directory ' . $reportdir
|
|
|
1364 |
. ' --legend'
|
| 7547 |
dpurdie |
1365 |
. ' --demangle-cpp'
|
| 5885 |
dpurdie |
1366 |
. ' --title "$(GBE_PBASE) $(BUILDVER)"'
|
| 5884 |
dpurdie |
1367 |
. ' ' . $finalTmp1);
|
| 4778 |
dpurdie |
1368 |
$io->Newline();
|
| 4728 |
dpurdie |
1369 |
}
|
|
|
1370 |
}
|
|
|
1371 |
|
| 6198 |
dpurdie |
1372 |
#-------------------------------------------------------------------------------
|
| 7547 |
dpurdie |
1373 |
# Function : ToolsetGenLdScripts
|
| 6198 |
dpurdie |
1374 |
#
|
|
|
1375 |
# Description : Generate Linker (ld) scripts to to support the Broken Linker
|
|
|
1376 |
# Enabled via BROKEN_LDSCRIPTS
|
|
|
1377 |
# The linker cannot handle a linkerscript with a 'VERSION" section
|
|
|
1378 |
# The linker can handle a linker script with an EXTERN section
|
|
|
1379 |
# and a --version-script
|
| 7547 |
dpurdie |
1380 |
#
|
| 6198 |
dpurdie |
1381 |
# This workaround will take the linker script and break it into two
|
|
|
1382 |
# parts. This must be done at make-time in case the linker script is
|
|
|
1383 |
# generated.
|
| 7547 |
dpurdie |
1384 |
#
|
| 6198 |
dpurdie |
1385 |
# Use a feature of Pattern Rules. Handling of multiple targets
|
| 7547 |
dpurdie |
1386 |
# The pattern (%) is a '.'.
|
| 6198 |
dpurdie |
1387 |
# It may be substituted as $* in the output.
|
| 7547 |
dpurdie |
1388 |
#
|
| 6198 |
dpurdie |
1389 |
# file1%out file2%out : infile
|
|
|
1390 |
# SomeProg file1$*out file2$*out - Using pattern substitution
|
|
|
1391 |
# SomeProg file1.out file2.out - Alternate command
|
|
|
1392 |
#
|
| 7547 |
dpurdie |
1393 |
# Inputs : None
|
|
|
1394 |
#
|
| 6198 |
dpurdie |
1395 |
# Returns : Nothing
|
|
|
1396 |
#
|
|
|
1397 |
sub ToolsetGenLdScripts
|
|
|
1398 |
{
|
|
|
1399 |
return unless @ldFixups;
|
|
|
1400 |
Verbose('ToolsetGenLdScripts');
|
| 4728 |
dpurdie |
1401 |
|
| 6198 |
dpurdie |
1402 |
my ($io) = ToolsetPrinter::New();
|
|
|
1403 |
$io->PrtLn('# Broken Linker Support');
|
|
|
1404 |
foreach my $entry (@ldFixups)
|
|
|
1405 |
{
|
|
|
1406 |
(my $ls = $entry->{ls}) =~ s~\.~%~;
|
|
|
1407 |
(my $vs = $entry->{vs}) =~ s~\.~%~;
|
|
|
1408 |
|
|
|
1409 |
$io->Newline();
|
|
|
1410 |
$io->PrtLn("$vs $ls: $entry->{src} \$(SCM_MAKEFILE)" );
|
|
|
1411 |
|
|
|
1412 |
$io->PrtLn("\t\$(GBE_PERL) -Mjats_runtime_gcc -e splitscript -- --src=$entry->{src} --vs=$entry->{vs} --ls=$entry->{ls}" );
|
|
|
1413 |
ToolsetGenerate ($entry->{vs} );
|
|
|
1414 |
ToolsetGenerate ($entry->{ls} );
|
|
|
1415 |
}
|
|
|
1416 |
}
|
|
|
1417 |
|
| 4728 |
dpurdie |
1418 |
###############################################################################
|
|
|
1419 |
# ToolsetARLINT( $name, \@args, \@objs )
|
|
|
1420 |
# This subroutine takes the user options and builds the rules
|
|
|
1421 |
# required to lint the static library 'name'.
|
|
|
1422 |
#
|
|
|
1423 |
# Arguments:
|
|
|
1424 |
# --xxx No arguments currently defined
|
|
|
1425 |
#
|
|
|
1426 |
# Output:
|
|
|
1427 |
# [ $(LIBDIR)/name$_lint: .... ]
|
|
|
1428 |
# $(ARLINT)
|
|
|
1429 |
#
|
|
|
1430 |
###############################################################################
|
|
|
1431 |
|
|
|
1432 |
sub ToolsetARLINT
|
|
|
1433 |
{
|
|
|
1434 |
if ( $UseCppcheck )
|
|
|
1435 |
{
|
|
|
1436 |
CppcheckAR( @_ );
|
|
|
1437 |
}
|
|
|
1438 |
}
|
|
|
1439 |
|
|
|
1440 |
|
|
|
1441 |
###############################################################################
|
|
|
1442 |
# ToolsetSHLDLINT $name, \@args, \@objs, \@libraries )
|
|
|
1443 |
# This subroutine takes the user options and builds the rules
|
|
|
1444 |
# required to lint the shared library 'name'.
|
|
|
1445 |
#
|
|
|
1446 |
# Arguments:
|
|
|
1447 |
# (none)
|
|
|
1448 |
#
|
|
|
1449 |
# Output:
|
|
|
1450 |
# [ $(LIBDIR)/$name_lint: .... ]
|
|
|
1451 |
# $(SHLIBLINT)
|
|
|
1452 |
#
|
|
|
1453 |
###############################################################################
|
|
|
1454 |
|
|
|
1455 |
sub ToolsetSHLDLINT
|
|
|
1456 |
{
|
|
|
1457 |
if ( $UseCppcheck )
|
|
|
1458 |
{
|
|
|
1459 |
CppcheckSHLD( @_ );
|
|
|
1460 |
}
|
|
|
1461 |
}
|
|
|
1462 |
|
|
|
1463 |
|
|
|
1464 |
###############################################################################
|
|
|
1465 |
# ToolsetLD( $name, \@args, \@objs, \@libraries, \@csrc, \@cxxsrc )
|
|
|
1466 |
# This subroutine takes the user options and builds the rules
|
|
|
1467 |
# required to lint the program 'name'.
|
|
|
1468 |
#
|
|
|
1469 |
# Arguments:
|
|
|
1470 |
# (none)
|
|
|
1471 |
#
|
|
|
1472 |
# Output:
|
|
|
1473 |
# [ $(BINDIR)/$name_lint: .... ]
|
|
|
1474 |
# $(LDLINT)
|
|
|
1475 |
#
|
|
|
1476 |
###############################################################################
|
|
|
1477 |
|
|
|
1478 |
sub ToolsetLDLINT
|
|
|
1479 |
{
|
|
|
1480 |
if ( $UseCppcheck )
|
|
|
1481 |
{
|
|
|
1482 |
CppcheckLD( @_ );
|
|
|
1483 |
}
|
|
|
1484 |
}
|
|
|
1485 |
|
| 227 |
dpurdie |
1486 |
########################################################################
|
|
|
1487 |
#
|
|
|
1488 |
# Push standard "system" libraries. This is a helper function
|
|
|
1489 |
# used within this toolset.
|
|
|
1490 |
#
|
|
|
1491 |
# Arguments:
|
|
|
1492 |
# $plib Reference to library array.
|
|
|
1493 |
#
|
|
|
1494 |
########################################################################
|
|
|
1495 |
|
|
|
1496 |
sub ToolsetLibStd
|
|
|
1497 |
{
|
|
|
1498 |
}
|
|
|
1499 |
|
|
|
1500 |
|
|
|
1501 |
########################################################################
|
|
|
1502 |
#
|
| 7547 |
dpurdie |
1503 |
# Generate a linker object recipe. This is a helper function used
|
| 227 |
dpurdie |
1504 |
# within this toolset.
|
|
|
1505 |
#
|
|
|
1506 |
# Arguments:
|
|
|
1507 |
# $io I/O stream
|
|
|
1508 |
#
|
|
|
1509 |
# $target Name of the target
|
|
|
1510 |
#
|
|
|
1511 |
# $obj Library specification
|
|
|
1512 |
#
|
|
|
1513 |
########################################################################
|
|
|
1514 |
|
|
|
1515 |
sub ToolsetObjRecipe
|
|
|
1516 |
{
|
|
|
1517 |
my ($io, $target, $obj) = @_;
|
|
|
1518 |
|
|
|
1519 |
$io->Cmd( "\$(strip $obj).$::o" );
|
|
|
1520 |
}
|
|
|
1521 |
|
|
|
1522 |
|
|
|
1523 |
###############################################################################
|
|
|
1524 |
#
|
|
|
1525 |
# Parse a linker lib list
|
|
|
1526 |
# This is a helper function used within this toolset
|
|
|
1527 |
#
|
|
|
1528 |
# Arguments:
|
|
|
1529 |
# $target Name of the target
|
|
|
1530 |
#
|
|
|
1531 |
# $lib Library specification
|
|
|
1532 |
#
|
|
|
1533 |
# $tag Tag (user specified)
|
|
|
1534 |
#
|
|
|
1535 |
# $dp If building a depend list, the full target name.
|
|
|
1536 |
#
|
|
|
1537 |
###############################################################################
|
|
|
1538 |
|
|
|
1539 |
sub ToolsetLibRecipe
|
|
|
1540 |
{
|
|
|
1541 |
my ($io, $target, $lib, $dp) = @_;
|
|
|
1542 |
|
|
|
1543 |
if ( ! defined($dp) ) { # linker
|
|
|
1544 |
$lib =~ s/^lib//; # .. remove leading 'lib'
|
|
|
1545 |
$io->Cmd( "-l$lib" );
|
| 7547 |
dpurdie |
1546 |
|
| 227 |
dpurdie |
1547 |
} else { # depend
|
|
|
1548 |
$io->Cmd( "$dp:\t@(vlib2,$lib,GCC_LIB)" );
|
|
|
1549 |
|
|
|
1550 |
}
|
|
|
1551 |
}
|
|
|
1552 |
|
|
|
1553 |
#.. Successful termination
|
|
|
1554 |
1;
|
|
|
1555 |
|