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