Subversion Repositories DevTools

Rev

Rev 4728 | Rev 4814 | 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
 
4728 dpurdie 16
# Global variables
4034 dpurdie 17
our $ScmPlatform;
18
our $ScmNoToolsTest;
19
 
4728 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 );
4728 dpurdie 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
 
4728 dpurdie 174
        } elsif (/^--UseGcov/) {                # Compile for code coverage
175
            $UseGcov = 1;
176
 
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
    }
4728 dpurdie 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
    {
349
        $GCCFlags .= ' -coverage';
350
        $LDFlags  .= ' -coverage';
351
    }
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
    }
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;
4728 dpurdie 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" );
4728 dpurdie 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" );
4728 dpurdie 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
 
4778 dpurdie 947
  #-------------------------------------------------------------------------------
948
# Function        : ToolsetPostprocess 
949
#
950
# Description     : Last chance by the toolset to perform processing
951
#                   All Directives have been processed
952
#
953
#                   If automated unit test are being used,
954
#                   then we need to post process the results
955
#
956
# Inputs          : None
957
#
958
# Returns         : 
959
#
960
sub ToolsetPostprocess
961
{
962
    ToolsetPreprocessTests();
963
    ToolsetPostprocessTests();
964
    ToolsetCollateTestResults();
965
}
227 dpurdie 966
 
4728 dpurdie 967
###############################################################################
968
# Function        : ToolsetPreprocessTests
969
#
970
# Description     : 
971
#
972
# Inputs          : None
973
#
974
# Returns         : Nothing
975
#
976
# Output:         : Rules and recipes to run before unit tests
977
#
978
sub ToolsetPreprocessTests
979
{
980
    my ($io) = ToolsetPrinter::New();
981
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
982
    {
4778 dpurdie 983
        my $ruleName = 'preprocess_gcov_data';
4728 dpurdie 984
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
985
        my $final=$finaldir . '/lcov-final.info';
986
 
987
        ToolsetGenerate( '$(OBJDIR)/lcov-baseline.info' );
4778 dpurdie 988
        ToolsetAddUnitTestPreProcess($ruleName);
989
        $io->PrtLn('.PHONY: ' . $ruleName );
990
        $io->PrtLn($ruleName . ':' );
4728 dpurdie 991
 
992
        my $key;
993
        my $value;
994
        while(($key, $value) = each(%::OBJSOURCE))
995
        {
996
            $io->PrtLn("\t" . '$(XX_PRE)rm -f $(OBJDIR)/' . $key . ".gcda");
997
        }
998
        $io->PrtLn("\t" . '${XX_PRE}$(rm) -f ' . $final);
999
        $io->PrtLn("\t" . '${XX_PRE}lcov'
1000
                      . ' --rc lcov_branch_coverage=1'
1001
                      . ' --capture'
1002
                      . ' --initial'
1003
                      . ' --base-directory ' . $::Cwd
1004
                      . ' --directory $(OBJDIR)'
4778 dpurdie 1005
                      . ' --output-file $(OBJDIR)/lcov-baseline.info' );
1006
        $io->Newline();
4728 dpurdie 1007
    }
1008
}
1009
 
1010
 
1011
###############################################################################
1012
# Function        : ToolsetPostprocessTests
1013
#
1014
# Description     : 
1015
#
1016
# Inputs          : None
1017
#
1018
# Returns         : Nothing
1019
#
1020
# Output:         : Rules and recipes to run after the unit tests
1021
#
1022
sub ToolsetPostprocessTests
1023
{
1024
    my ($io) = ToolsetPrinter::New();
1025
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
1026
    {
4778 dpurdie 1027
        my $ruleName = 'postprocess_gcov_data';
4728 dpurdie 1028
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1029
        my $final=$finaldir . '/lcov-final.info';
1030
 
1031
        ToolsetGenerate( '$(OBJDIR)/lcov-capture.info' );
1032
        ToolsetGenerate( $final );
4778 dpurdie 1033
        ToolsetAddUnitTestPostProcess($ruleName);
1034
 
1035
        $io->PrtLn('.PHONY: ' . $ruleName );
1036
        $io->PrtLn($ruleName . ':' );
4728 dpurdie 1037
        $io->PrtLn("\t" . '$(eval GCDA_COUNT := $(shell find $(OBJDIR) -name "*.gcda"))');
1038
 
1039
        $io->PrtLn  ("\t" . '$(XX_PRE)$(mkdir) -p ' . $finaldir);
1040
        $io->PrtPart("\t" . '$(XX_PRE)if [ "$(GCDA_COUNT)" = "" ]; then');
1041
        $io->PrtPart("\t\t" . 'if [ ! -e ' . $final . " ]; then");
1042
        $io->PrtPart("\t\t\t" . '$(cp) $(OBJDIR)/lcov-baseline.info ' . $final . ';');
1043
        $io->PrtPart("\t\t" . 'else');
1044
        $io->PrtPart("\t\t\t" . 'lcov'
1045
                          . ' --rc lcov_branch_coverage=1'
1046
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1047
                          . ' --add-tracefile ' . $final
1048
                          . ' --output-file $(OBJDIR)/lcov-merge.info'
1049
                          . ';'); 
1050
        $io->PrtPart("\t\t\t" . '$(rm) -f ' . $final . ';');
1051
        $io->PrtPart("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . ';');
1052
        $io->PrtPart("\t\t" . 'fi' . ';');
1053
        $io->PrtPart("\t" . 'else');
1054
        $io->PrtPart("\t\t" . 'lcov'
1055
                        . ' --rc lcov_branch_coverage=1'
1056
                        . ' --capture'
1057
                        . ' --base-directory ' . $::Cwd
1058
                        . ' --directory $(OBJDIR)'
1059
                        . ' --output-file $(OBJDIR)/lcov-capture.info' 
1060
                        . ';'); 
1061
        $io->PrtPart("\t\t" . 'if [ ! -e ' . $final . " ]; then");
1062
        $io->PrtPart("\t\t\t" . 'lcov'
1063
                          . ' --rc lcov_branch_coverage=1'
1064
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1065
                          . ' --add-tracefile $(OBJDIR)/lcov-capture.info'
1066
                          . ' --output-file ' .  $final
1067
                          . ';'); 
1068
        $io->PrtPart("\t\t" . 'else');
1069
        $io->PrtPart("\t\t\t" . 'lcov'
1070
                          . ' --rc lcov_branch_coverage=1'
1071
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1072
                          . ' --add-tracefile $(OBJDIR)/lcov-capture.info'
1073
                          . ' --add-tracefile ' . $final
1074
                          . ' --output-file $(OBJDIR)/lcov-merge.info'
1075
                          . ';'); 
1076
        $io->PrtPart("\t\t\t" . '$(rm) -f ' . $final . ';');
1077
        $io->PrtPart("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . ';');
1078
        $io->PrtPart("\t\t" . 'fi' . ';');
1079
        $io->PrtLn  ("\t" . 'fi');
4778 dpurdie 1080
        $io->Newline();
4728 dpurdie 1081
    }
1082
}
1083
 
1084
 
1085
###############################################################################
1086
# Function        : ToolsetCollateTestResults
1087
#
1088
# Description     : 
1089
#
1090
# Inputs          : None
1091
#
1092
# Returns         : Nothing
1093
#
1094
# Output:         : Rules and recipes to run after unit test result 
1095
#                   postprocessing.
1096
#
1097
sub ToolsetCollateTestResults
1098
{
1099
    my ($io) = ToolsetPrinter::New();
1100
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
1101
    {
4778 dpurdie 1102
        my $ruleName = 'collate_gcov_results';
4728 dpurdie 1103
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1104
        my $final=$finaldir . '/lcov-final.info';
4778 dpurdie 1105
 
1106
        ToolsetAddUnitTestCollateProcess($ruleName);
4728 dpurdie 1107
 
1108
        my $reportdir='$(PKGDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1109
        my $reportindex=$reportdir . '/index.html';
1110
 
4778 dpurdie 1111
        $io->PrtLn('.PHONY: ' . $ruleName );
1112
        $io->PrtLn($ruleName . ': ' . $reportindex);
4728 dpurdie 1113
        $io->Newline();
1114
        $io->PrtLn($reportindex . ': ' . $final);
1115
        $io->PrtLn("\t" . 'genhtml'
1116
                      . ' --frames'
1117
                      . ' --show-details'
1118
                      . ' --function-coverage'
1119
                      . ' --branch-coverage'
1120
                      . ' --output-directory ' . $reportdir
1121
                      . ' --legend'
1122
                      . ' --demangle-cpp'
1123
                      . ' ' . $final);
4778 dpurdie 1124
        $io->Newline();
4728 dpurdie 1125
    }
1126
}
1127
 
1128
 
1129
###############################################################################
1130
#   ToolsetARLINT( $name, \@args, \@objs )
1131
#       This subroutine takes the user options and builds the rules
1132
#       required to lint the static library 'name'.
1133
#
1134
#   Arguments:
1135
#       --xxx                   No arguments currently defined
1136
#
1137
#   Output:
1138
#       [ $(LIBDIR)/name$_lint:   .... ]
1139
#           $(ARLINT)
1140
#
1141
###############################################################################
1142
 
1143
sub ToolsetARLINT
1144
{
1145
    if ( $UseCppcheck )
1146
    {
1147
        CppcheckAR( @_ );
1148
    }
1149
}
1150
 
1151
 
1152
###############################################################################
1153
#   ToolsetSHLDLINT $name, \@args, \@objs, \@libraries )
1154
#       This subroutine takes the user options and builds the rules
1155
#       required to lint the shared library 'name'.
1156
#
1157
#   Arguments:
1158
#       (none)
1159
#
1160
#   Output:
1161
#       [ $(LIBDIR)/$name_lint:   .... ]
1162
#           $(SHLIBLINT)
1163
#
1164
###############################################################################
1165
 
1166
sub ToolsetSHLDLINT
1167
{
1168
    if ( $UseCppcheck )
1169
    {
1170
        CppcheckSHLD( @_ );
1171
    }
1172
}
1173
 
1174
 
1175
###############################################################################
1176
#   ToolsetLD( $name, \@args, \@objs, \@libraries, \@csrc, \@cxxsrc )
1177
#       This subroutine takes the user options and builds the rules
1178
#       required to lint the program 'name'.
1179
#
1180
#   Arguments:
1181
#       (none)
1182
#
1183
#   Output:
1184
#       [ $(BINDIR)/$name_lint:   .... ]
1185
#           $(LDLINT)
1186
#
1187
###############################################################################
1188
 
1189
sub ToolsetLDLINT
1190
{
1191
    if ( $UseCppcheck )
1192
    {
1193
        CppcheckLD( @_ );
1194
    }
1195
}
1196
 
227 dpurdie 1197
########################################################################
1198
#
1199
#   Push standard "system" libraries. This is a helper function
1200
#   used within this toolset.
1201
#
1202
#   Arguments:
1203
#       $plib       Reference to library array.
1204
#
1205
########################################################################
1206
 
1207
sub ToolsetLibStd
1208
{
1209
}
1210
 
1211
 
1212
########################################################################
1213
#
1214
#   Generate a linker object recipe.  This is a helper function used 
1215
#   within this toolset.
1216
#
1217
#   Arguments:
1218
#       $io         I/O stream
1219
#
1220
#       $target     Name of the target
1221
#
1222
#       $obj        Library specification
1223
#
1224
########################################################################
1225
 
1226
sub ToolsetObjRecipe
1227
{
1228
    my ($io, $target, $obj) = @_;
1229
 
1230
    $io->Cmd( "\$(strip $obj).$::o" );
1231
}
1232
 
1233
 
1234
###############################################################################
1235
#
1236
#   Parse a linker lib list
1237
#   This is a helper function used within this toolset
1238
#
1239
#   Arguments:
1240
#       $target     Name of the target
1241
#
1242
#       $lib        Library specification
1243
#
1244
#       $tag        Tag (user specified)
1245
#
1246
#       $dp         If building a depend list, the full target name.
1247
#
1248
###############################################################################
1249
 
1250
sub ToolsetLibRecipe
1251
{
1252
    my ($io, $target, $lib, $dp) = @_;
1253
 
1254
    if ( ! defined($dp) ) {                     # linker
1255
        $lib =~ s/^lib//;                       # .. remove leading 'lib'
1256
        $io->Cmd( "-l$lib" );
1257
 
1258
    } else {                                    # depend
1259
        $io->Cmd( "$dp:\t@(vlib2,$lib,GCC_LIB)" );
1260
 
1261
    }
1262
}
1263
 
1264
#.. Successful termination
1265
1;
1266