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