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