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
 
16
##############################################################################
17
#   Configuration information
18
#   Cross reference from CrossCompiler Alias to actual paths
19
#   Structure:
20
#   Hash reference: Array of toolchain information
21
#           Root of compiler
22
#           Path to gcc
23
#           Path to ar
24
#
25
#
26
my %ToolsetConfig = (
27
    #
28
    #   Preferred version of the embedded toolchain
29
    #
30
    'i386-unknown-linux-gnu' => ['/opt/crosstool/gcc-4.1.1-glibc-2.5/i586-unknown-linux-gnu',
31
                                 'bin/i586-unknown-linux-gnu-gcc' ],
32
 
247 dpurdie 33
    'arm-9tdmi-linux-gnu'    => ['/opt/crosstool/gcc-4.1.1-glibc-2.5/arm-9tdmi-linux-gnu',
227 dpurdie 34
                                 'bin/arm-9tdmi-linux-gnu-gcc' ],
35
 
247 dpurdie 36
    'powerpc-603e-linux-gnu' => ['/opt/crosstool/gcc-4.1.1-glibc-2.5/powerpc-603e-linux-gnu',
37
                                 'bin/powerpc-603e-linux-gnu-gcc'],
38
 
227 dpurdie 39
    #
40
    #   Old (not to be used) version of the embedded toolchain
41
    #   This was depricated in favor of gcc-4.1.1-glibc-2.5
42
    #   It is not possible to reproduce old packages using the old compiler
43
    #   This is a known issue
44
    #
45
    'i386-unknown-linux-gnu.glibc-2.3.2' => ['/opt/crosstool/gcc-4.1.0-glibc-2.3.2/i386-unknown-linux-gnu',
46
                                 'bin/i386-unknown-linux-gnu-gcc' ],
47
 
48
    'arm-9tdmi-linux-gnu.glibc-2.3.2'    => ['/opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-9tdmi-linux-gnu',
49
                                 'bin/arm-9tdmi-linux-gnu-gcc' ],
50
 
51
    #
52
    #   Not too sure where this is used
53
    #
54
    'armv4l-unknown-linux-gcc' => [ '/opt/host/armv4l',
55
                                    'bin/armv4l-unknown-linux-gcc' ],
56
 
57
    #
58
    #   The compiler for the current local machine
59
    #
60
    'i386-unknown-linux-gcc' => [ '/opt/host/i386',
61
                                  'bin/i386-unknown-linux-gcc' ],
62
 
63
    );
64
 
65
#
66
#   Cross reference from GCCTarget to GBE_MACHTYPE for which it can
67
#   build using the 'native gcc'. This is NOT the preferred mode of operation
68
#   as the compiler is not as controlled as the cross compilers.
69
#
70
my %NativeCompilers = (
71
    'Linux i386'       => 'linux_i386',
72
    );
73
 
74
##############################################################################
75
#   ToolsetInit()
76
#       Runtime initialisation
77
#
78
##############################################################################
79
 
80
ToolsetInit();
81
 
82
sub ToolsetInit
83
{
84
    my( $GCCTarget, @GCCToolchain, $GCCRoot, $GCCBin, $GCCAr );
85
    my( $arg_alias, $tools_found );
86
 
87
#.. Toolset configuration
88
#
89
    $::ScmToolsetVersion = "1.0.0";             # our version
90
    $::ScmToolsetGenerate = 0;                  # GEN generate optional
91
    $::ScmToolsetIFLAG3 = 1;                    # IFLAG3 supported
92
    $::ScmToolsetCompilerPath = 1;              # Exports Compiler path to makefile via SCM_COMPILERPATH
93
 
94
#.. Standard.rul requirements
95
#
96
    $::s = "asm";
97
    $::o = "o";
98
    $::so = "so";
99
    $::a = "a";
100
    $::exe = "";
101
 
102
#.. Parse arguments
103
#
104
    foreach $_ ( @::ScmToolsetArgs ) {
105
        if (/^--Target=(.*)/) {                 # OS Version
106
            $GCCTarget = "$1";
107
 
108
        } elsif (/^--CrossAlias=(.*)/) {        # CrossCompiler target-alias
109
            $arg_alias = $1;
110
 
111
        } else {
112
            Message( "gcc toolset: unknown option $_ -- ignored\n" );
113
        }
114
    }
115
 
116
    foreach $_ ( @::ScmPlatformArgs ) {
117
        if (/^--product=(.*)/) {                # GBE product
118
 
119
        } else {
120
            Message( "gcc toolset: unknown platform argument $_ -- ignored\n" );
121
        }
122
    }
123
 
124
    Error ("TOOLSET/gcc - Target undefined" )
125
        unless ($GCCTarget);
126
 
127
#.. Cross compile support
128
#
129
#   Toolchain=root,[bin]
130
#
131
    if ( $arg_alias )
132
    {
133
        if ( exists $ToolsetConfig{ $arg_alias } )
134
        {
135
            @GCCToolchain = @{$ToolsetConfig{ $arg_alias }};
136
            $tools_found = (-d $GCCToolchain[0]);
137
            Warning ("gcc toolset: CrossPlatform toolchain not found for: $arg_alias",
138
                     "Path: $GCCToolchain[0]" ) unless $tools_found;
139
        }
140
        else
141
        {
142
            Error("gcc toolset: CrossPlatform Alias not configured: $arg_alias");
143
        }
144
    }
145
 
146
    #
147
    #   If no Cross compiler toolchain is found (preferred method), then attempt
148
    #   to match a native compiler. Only known targets allow a native build
149
    #
150
    unless ( $tools_found )
151
    {
152
        if ( exists ( $NativeCompilers{$GCCTarget} ))
153
        {
154
            if ( $NativeCompilers{$GCCTarget} eq $::GBE_MACHTYPE )
155
            {
156
                $tools_found = 1;
157
                @GCCToolchain = ();
158
            }
159
        }
160
    }
161
 
162
    #
163
    #   Must have a toolset by now, either a cross compiler or Native
164
    #
165
    Error ("gcc toolset: Toolchain not found for: $GCCTarget" )
166
        unless ( $tools_found );
167
 
168
 
169
    if ( @GCCToolchain )
170
    {
171
        #
172
        #   Parse GCCToolchain. Potentially three parts
173
        #   [0] - GCCRoot - Location to find the effective /usr/include directory
174
        #   [1] - GCCBin  - Path to the gcc executable
175
        #                   If relative, then its relative to GCCRoot
176
        #   [2] - GCCAr   - Path to the ar executable
177
        #                   If relative, then its relative to GCCRoot
178
        #                   If not defined then its the same as GCCBin with gcc replaced with ar
179
        #
180
        $GCCRoot = $GCCToolchain[0];
181
 
182
        #   GCC_CC definition
183
        #
184
        if ( $GCCToolchain[1] )
185
        {                                           # user specification
186
            if ( substr($GCCToolchain[1],0,1) ne "/") {
187
                $GCCBin = $GCCToolchain[0].'/'.$GCCToolchain[1];
188
            } else {
189
                $GCCBin = $GCCToolchain[1];         # abs path
190
            }
191
        }
192
        else
193
        {                                           # default
194
            $GCCBin = $GCCToolchain[0] . '/bin/gcc';
195
        }
196
 
197
        #   GCC_AR definition
198
        #
199
        if ( defined($GCCToolchain[2]) && $GCCToolchain[2] )
200
        {                                           # user specification
201
            if ( substr($GCCToolchain[2],0,1) ne "/") {
202
                $GCCAr = $GCCToolchain[0].'/'.$GCCToolchain[2];
203
            } else {
204
                $GCCAr = $GCCToolchain[2];          # abs path
205
            }
206
        } 
207
        else 
208
        {                                           # default, base on GCCBin
209
            $GCCAr = substr($GCCBin,0,length($GCCBin)-3)."ar";
210
        }
211
    }
212
    else
213
    {
214
        $GCCRoot = "/usr";
215
        $GCCBin = "gcc";
216
        $GCCAr = "ar";
217
    }
218
 
219
#.. Define GCC environment
220
#
221
    PlatformDefine( "
222
#################################################
223
# GCC toolchain definitions 
224
#
225
#..");
226
    PlatformDefine( "GCC_TARGET\t".     ":=$GCCTarget" );
227
    PlatformDefine( "GCC_ROOT\t".       ":=$GCCRoot" );
228
    PlatformDefine( "GCC_CC\t\t".       ":=$GCCBin" );
229
    PlatformDefine( "GCC_AR\t\t".       ":=$GCCAr" );
230
    PlatformDefine( "" );
231
 
232
    #
233
    #   Required since this toolset advertises: ScmToolsetCompilerPath
234
    #
235
    PlatformDefine( "SCM_COMPILERPATH\t\t".       ":=$GCCBin" );
236
 
237
 
238
#.. Piece the world together
239
#
240
    Init( "gcc" );
241
    ToolsetDefines( "gcc.def" );
242
    ToolsetRules( "gcc.rul" );
243
    ToolsetRules( "standard.rul" );
244
 
245
#   Create a standard data structure
246
#   This is a hash of hashes
247
#       The first hash is keyed by CompileOption keyword
248
#       The second hash contains pairs of values to set or remove
249
#
250
    %::ScmToolsetCompilerOptions =
251
    (
252
        #
253
        #   Control the thread model to use
254
        #   This will affect the compiler options and the linker options
255
        #
256
        'staticprogs'        => { 'STATIC_PROGS' , '1' },      # Progams link staticlly
257
        'no_staticprogs'     => { 'STATIC_PROGS' , undef },    # Default
258
    );
259
 
260
    #
261
    #   Set default options
262
    #
263
    $::ScmCompilerOpts{'STATIC_PROGS'} = undef;
264
}
265
 
266
 
267
###############################################################################
268
#   ToolsetCC( $source, $obj, \@args )
269
#       This subroutine takes the user options and builds the rule(s)
270
#       required to compile the source file 'source' to 'obj'
271
#
272
###############################################################################
273
 
274
sub ToolsetCC
275
{
276
    my( $source, $obj, $pArgs ) = @_;
277
    my( $cflags, $file ) = "";
278
 
279
    foreach $_ ( @$pArgs ) {
280
        if (/--Shared$/) {                      # Building a 'shared' object
281
            $cflags  = "$cflags \$(SHCFLAGS)";
282
        } else {
283
            Message( "CC: unknown option $_ -- ignored\n" );
284
        }
285
    }
286
 
287
    MakePrint( "\n\t\$(CC)\n" );
288
    if ( $cflags )
289
    {                                           # object specific CFLAGS
290
        MakePadded( 4, "\$(OBJDIR)/$obj.$::o:" );
291
        MakePrint( "\tCFLAGS +=$cflags\n" );
292
    }
293
 
294
    $file = StripExt( $obj );                   # Metric working file
295
    ToolsetGenerate( "\$(OBJDIR)/$file.met" );
296
}
297
 
298
 
299
###############################################################################
300
#   ToolsetCCDepend( $depend, \@sources )
301
#       This subroutine takes the user options and builds the
302
#       rule(s) required to build the dependencies for the source
303
#       files 'sources' to 'depend'.
304
#
305
###############################################################################
306
 
307
sub ToolsetCCDepend
308
{
309
    MakePrint( "\t\$(CCDEPEND)\n" );
310
}
311
 
312
 
313
###############################################################################
314
#   ToolsetCXX( $source, $obj, \@args )
315
#       This subroutine takes the user options and builds the rule(s)
316
#       required to compile the source file 'source' to 'obj'
317
#
318
###############################################################################
319
 
320
sub ToolsetCXX
321
{
322
    my( $source, $obj, $pArgs ) = @_;
323
    my( $cflags, $file ) = "";
324
 
325
    foreach $_ ( @$pArgs ) {
326
        if (/--Shared$/) {                      # Building a 'shared' object
327
            $cflags  = "$cflags \$(SHCXXFLAGS)";
328
        } else {
329
            Message( "CXX: unknown option $_ -- ignored\n" );
330
        }
331
    }
332
 
333
    MakePrint( "\n\t\$(CXX)\n" );
334
    if ( $cflags )
335
    {                                           # object specific CFLAGS
336
        MakePadded( 4, "\$(OBJDIR)/$obj.$::o:" );
337
        MakePrint( "\tCXXFLAGS +=$cflags\n" );
338
    }
339
 
340
    $file = StripExt( $obj );                   # Metric working file
341
    ToolsetGenerate( "\$(OBJDIR)/$file.met" );
342
}
343
 
344
 
345
###############################################################################
346
#   ToolsetCXXDepend( $depend, \@sources )
347
#       This subroutine takes the user options and builds the
348
#       rule(s) required to build the dependencies for the source
349
#       files 'sources' to 'depend'.
350
#
351
###############################################################################
352
 
353
sub ToolsetCXXDepend
354
{
355
    #ToolsetCCDepend() handles both CC and CXX source
356
}
357
 
358
 
359
###############################################################################
360
#   ToolsetAS( $source, $obj, \@args )
361
#       This subroutine takes the user options and builds the rule(s)
362
#       required to compile the source file 'source' to 'obj'
363
#
364
###############################################################################
365
 
366
sub ToolsetAS
367
{
368
    MakePrint( "\n\t\$(AS)\n" );
369
}
370
 
371
sub ToolsetASDepend
372
{
373
}
374
 
375
 
376
###############################################################################
377
#   ToolsetAR( $name, \@args, \@objs )
378
#       This subroutine takes the user options and builds the rules
379
#       required to build the library 'name'.
380
#
381
#   Arguments:
382
#       n/a
383
#
384
#   Output:
385
#       $(BINDIR)/name$.${a}:   .... ]
386
#           $(AR)
387
#
388
#       name_ld += ...  Linker command file
389
#           :
390
#
391
#       name_dp += ...  Dependency list
392
#           :
393
#
394
###############################################################################
395
 
396
sub ToolsetAR
397
{
398
    my( $name, $pArgs, $pObjs ) = @_;
399
 
400
#.. Parse arguments
401
#
402
    foreach $_ ( @$pArgs )
403
    {
404
        Message( "AR: unknown option $_ -- ignored\n" );
405
    }
406
 
407
#.. Target
408
#
409
    MakePrint( "#.. Library ($name)\n\n" );     # label
410
 
411
    MakeEntry( "\$(LIBDIR)/$name\$(GBE_TYPE).$::a:\t",
412
        "", "\\\n\t\t", ".$::o", @$pObjs );
413
 
414
#.. Build library rule (just append to standard rule)
415
#
416
    MakePrint( "\n\t\$(AR)\n\n" );
417
}
418
 
419
 
420
###############################################################################
421
#   ToolsetARMerge( $name, \@args, \@libs )
422
#       This subroutine takes the user options and builds the rules
423
#       required to build the library 'name' by merging the specified
424
#       libaries
425
#
426
#   Arguments:
427
#       --xxx                   No arguments currently defined
428
#
429
#   Output:
430
#       [ $(LIBDIR)/name$.${a}:   .... ]
431
#           ...
432
#
433
###############################################################################
434
 
435
sub ToolsetARMerge
436
{
437
    MakePrint( "\n\t\$(ARMERGE)\n\n" );
438
}
439
 
440
 
441
###############################################################################
442
#   ToolsetSHLD( $name, \@args, \@objs, \@libraries )
443
#       This subroutine takes the user options and builds the rules
444
#       required to link the program 'name'.
445
#
446
#   Arguments:
447
#   n/a
448
#
449
#   Output:
450
#       $(LIBDIR)/name:     $(LIBDIR)/shared
451
#           ln -s $shared $name
452
#
453
#       $(LIBDIR)/name.dep: $(GBE_OBJDIR)
454
#       $(LIBDIR)/name.dep: $(GBE_LIBDIR)
455
#       $(LIBDIR)/name.dep: $(GBE_PLATFORM).mk
456
#           $(SHLDDEPEND)
457
#
458
#       $(LIBDIR)/shared:   SHNAME=name
459
#       $(LIBDIR)/shared:   SHBASE=base
460
#       $(LIBDIR)/shared:   $(LIBDIR)/name.dep  \
461
#           $(OBJECTS)
462
#                           
463
#       ifneq "$(findstring $(IFLAG),23)" ""
464
#       -include            "$(LIBDIR)/name.dep"
465
#       endif
466
#
467
#       name_ld += ...
468
#           :
469
#
470
###############################################################################
471
 
472
sub ToolsetSHLD
473
{
474
    my( $name, $pArgs, $pObjs, $pLibs ) = @_;
475
    my( $shared, $def, $def_pref, $multi_scan );
476
 
477
#.. Parse arguments
478
#
479
    foreach $_ ( @$pArgs )
480
    {
481
        if (/^--Def=(.*?)(\,(.*))?$/) {         # Library definition
482
            #
483
            #   Locate the Def file.
484
            #   If it is a generate file so it will be in the SRCS hash
485
            #   Otherwise the user will have to use Src to locate the file
486
            #
487
            $def = MakeSrcResolve($1);
488
            $def_pref = '';
489
            if ( $1 =~ m~\.def$~ ) {
490
                $def_pref = '--version-script='; # Old def file
491
            }
492
        } elsif ( /^--MultiScan/i ) {
493
            $multi_scan = 1;
494
 
495
        } elsif ( /^--NoMultiScan/i ) {
496
            $multi_scan = 0;
497
 
498
        } else {
499
            Message( "SHLD: unknown option $_ -- ignored\n" );
500
        }
501
    }
502
 
503
#.. Full name of shared library
504
#
505
    $shared = "$name\$(GBE_TYPE).$::so.$::SHLIB_VER{ $name }";
506
 
507
#.. Install and package the shared libraries that are generated
508
#
509
    PackageShlibAddFiles( $name, "\$(LIBDIR)/${name}\$(GBE_TYPE).$::so" );
510
    PackageShlibAddFiles( $name, "\$(LIBDIR)/$shared" );
511
 
512
#.. Cleanup rules
513
#
514
#   dep     Dependency file
515
#   map     Map file
516
#   ln      Link from LIBDIR to BINDIR
517
#
518
    ToolsetProg( "\$(LIBDIR)/${name}.dep" );
519
    ToolsetProg( "\$(LIBDIR)/${name}.map" );
520
    ToolsetProg( "\$(LIBDIR)/${shared}" );
521
    ToolsetProg( "\$(BINDIR)/${shared}" );
522
 
523
#.. Build rules
524
#
525
#   name        Base name
526
#   shared      Library name, includes GBE_TYPE specification
527
#
528
    my ($io) = ToolsetPrinter::New();
529
 
530
    $io->Label( "Shared library", $name );
531
 
532
    $io->Prt( "\$(LIBDIR)/${name}\$(GBE_TYPE).$::so:\t\\\n" .
533
              "\t\t\$(GBE_BINDIR)\\\n" .
534
              "\t\t\$(LIBDIR)/${shared}\n" .
535
              "\t\@(rm -f \$@; ln -s ./$shared \$@)\n" .
536
              "\t\@(rm -f \$(BINDIR)/$shared; ln -s ../\$(LIBDIR)/$shared \$(BINDIR)/$shared)\n\n" );
537
 
538
    $io->SHLDDEPEND($name, $name, $shared);     # std SHLDDEPEND rules
539
 
540
    $io->Prt( "\$(LIBDIR)/${shared}:\tSHBASE=${name}\n" );
541
    $io->Prt( "\$(LIBDIR)/${shared}:\tSHNAME=${shared}\n" );
542
    $io->Entry( "\$(LIBDIR)/${shared}:\t", "", "\\\n\t\t", ".$::o", @$pObjs );
543
    $io->Prt( "\\\n\t\t$def" ) if($def);
544
    $io->Prt( "\\\n\t\t\$(LIBDIR)/${name}.dep\n" );
545
    $io->Prt( "\t\$(SHLD)\n\n" );
546
 
547
 
548
#.. Linker command file
549
#
550
#       Now the fun part... piecing together a variable $(name_shld)
551
#       which ends up in the command file.
552
#
553
    $io->SetTag( "${name}_shld" );              # command tag
554
    $io->SetTerm( "\n" );
555
 
556
    $io->Label( "Linker commands", $name );     # label
557
 
558
                                                # object list
559
    $io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );
560
 
561
    ToolsetLibStd( $pLibs );                    # push standard libraries
562
 
563
    $io->Cmd( "-Wl,$def_pref$def" ) if ($def);
564
 
565
    $io->Cmd( "-Wl,--start-group" ) if ($multi_scan);
566
    $io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
567
    $io->Cmd( "-Wl,--end-group" ) if ($multi_scan);
568
 
569
    $io->Newline();
570
 
571
#.. Dependency link,
572
#
573
#       Now piece together a variable $(name_dp) which ends up in
574
#       the command file building the application dependency list.
575
#
576
    $io->SetTag( "${name}_shdp" );              # command tag
577
    $io->SetTerm();
578
 
579
    $io->DepRules( $name, $pLibs,               # library depends rules
580
        \&ToolsetLibRecipe, "$shared" );
581
 
582
    $io->Newline();
583
}
584
 
585
 
586
###############################################################################
587
#   ToolsetLD( $name, \@args, \@objs, \@libraries )
588
#       This subroutine takes the user options and builds the rules
589
#       required to link the program 'name'.
590
#
591
#   Arguments:
592
#       n/a
593
#
594
#   Output:
595
#       $(BINDIR)/name:
596
#                       $(BINDIR)/name.dep
597
#           $(LD)
598
#                               
599
#       $(BINDIR)/name.dep:     $(GBE_BINDIR)
600
#       $(BINDIR)/name.dep:     $(GBE_PLATFORM).mk
601
#               $(LDDEPEND)
602
#
603
#       ifeq "$(IFLAG)" "3"
604
#       -include        "$(BINDIR)/name.dep"
605
#       endif
606
#
607
#       name_ld += ...
608
#           :
609
#
610
###############################################################################
611
 
612
sub ToolsetLD
613
{
614
    my( $name, $pArgs, $pObjs, $pLibs ) = @_;
615
    my $static = $::ScmCompilerOpts{'STATIC_PROGS'};
616
    my $multi_scan;
617
 
618
#.. Parse arguments
619
#
620
    foreach $_ ( @$pArgs )
621
    {
622
        if ( m/^--Static$/ ) {
623
            $static = 1;
624
 
625
        } elsif ( m/^--Shared/ ) {
626
            $static = 0;
627
 
628
        } elsif ( /^--MultiScan/i ) {
629
            $multi_scan = 1;
630
 
631
        } elsif ( /^--NoMultiScan/i ) {
632
            $multi_scan = 0;
633
 
634
        } else {
635
            Message( "LD: unknown option $_ -- ignored\n" );
636
        }
637
    }
638
 
639
#.. Cleanup rules
640
#
641
    ToolsetProg( "\$(BINDIR)/${name}.ld" );
642
    ToolsetProg( "\$(BINDIR)/${name}.dep" );
643
    ToolsetProg( "\$(BINDIR)/${name}.map" );
644
 
645
#.. Build rules
646
#
647
    my ($io) = ToolsetPrinter::New();
648
 
649
    $io->Prt( "\\\n\t\t\$(BINDIR)/${name}.dep\n" .
650
              "\t\$(LD)\n\n" );
651
    $io->LDDEPEND( $name );                     # standard LDDEPEND rules
652
    $io->Newline();
653
 
654
#.. Linker command file
655
#
656
#       Now the fun part... piecing together a variable $(name_ld)
657
#       which ends up in the command file.
658
#
659
    $io->SetTag( "${name}_ld" );                # macro tag
660
    $io->SetTerm( "\n" );
661
 
662
    $io->Label( "Linker commands", $name );     # label
663
 
664
    $io->Cmd( "-static" ) if ($static);         # Link as a static program
665
 
666
                                                # object list
667
    $io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );
668
 
669
    ToolsetLibStd( $pLibs );                    # push standard libraries
670
 
671
                                                # library list
672
    $io->Cmd( "-Wl,--start-group" ) if ($multi_scan);
673
    $io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
674
    $io->Cmd( "-Wl,--end-group" ) if ($multi_scan);
675
 
676
    $io->Newline();
677
 
678
#.. Dependency link,
679
#
680
#       Now piece together a variable $(name_dp) which ends up in
681
#       the command file building the application dependency list.
682
#
683
    $io->SetTag( "${name}_dp" );                # macro tag
684
    $io->SetTerm();
685
 
686
    $io->DepRules( $name, $pLibs,               # library depends rules
687
        \&ToolsetLibRecipe, "\$(BINDIR)/${name}" );
688
 
689
    $io->Newline();
690
}
691
 
692
 
693
########################################################################
694
#
695
#   Push standard "system" libraries. This is a helper function
696
#   used within this toolset.
697
#
698
#   Arguments:
699
#       $plib       Reference to library array.
700
#
701
########################################################################
702
 
703
sub ToolsetLibStd
704
{
705
}
706
 
707
 
708
########################################################################
709
#
710
#   Generate a linker object recipe.  This is a helper function used 
711
#   within this toolset.
712
#
713
#   Arguments:
714
#       $io         I/O stream
715
#
716
#       $target     Name of the target
717
#
718
#       $obj        Library specification
719
#
720
########################################################################
721
 
722
sub ToolsetObjRecipe
723
{
724
    my ($io, $target, $obj) = @_;
725
 
726
    $io->Cmd( "\$(strip $obj).$::o" );
727
}
728
 
729
 
730
###############################################################################
731
#
732
#   Parse a linker lib list
733
#   This is a helper function used within this toolset
734
#
735
#   Arguments:
736
#       $target     Name of the target
737
#
738
#       $lib        Library specification
739
#
740
#       $tag        Tag (user specified)
741
#
742
#       $dp         If building a depend list, the full target name.
743
#
744
###############################################################################
745
 
746
sub ToolsetLibRecipe
747
{
748
    my ($io, $target, $lib, $dp) = @_;
749
 
750
    if ( ! defined($dp) ) {                     # linker
751
        $lib =~ s/^lib//;                       # .. remove leading 'lib'
752
        $io->Cmd( "-l$lib" );
753
 
754
    } else {                                    # depend
755
        $io->Cmd( "$dp:\t@(vlib2,$lib,GCC_LIB)" );
756
 
757
    }
758
}
759
 
760
#.. Successful termination
761
1;
762