Subversion Repositories DevTools

Rev

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