Subversion Repositories DevTools

Rev

Rev 4723 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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