Subversion Repositories DevTools

Rev

Rev 337 | Rev 369 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 337 Rev 339
Line 91... Line 91...
91
#
91
#
92
    $::ScmToolsetVersion = "1.0.0";             # our version
92
    $::ScmToolsetVersion = "1.0.0";             # our version
93
    $::ScmToolsetGenerate = 0;                  # GEN generate optional
93
    $::ScmToolsetGenerate = 0;                  # GEN generate optional
94
    $::ScmToolsetCompilerPath = 1;              # Exports Compiler path to makefile via SCM_COMPILERPATH
94
    $::ScmToolsetCompilerPath = 1;              # Exports Compiler path to makefile via SCM_COMPILERPATH
95
    $::ScmToolsetProgDependancies = 0;          # handle Prog dependancies myself
95
    $::ScmToolsetProgDependancies = 0;          # handle Prog dependancies myself
-
 
96
    $::ScmToolsetSoName = 1;                    # Shared library supports SoName
96
 
97
 
97
#.. Standard.rul requirements
98
#.. Standard.rul requirements
98
#
99
#
99
    $::s = "asm";
100
    $::s = "asm";
100
    $::o = "o";
101
    $::o = "o";
Line 442... Line 443...
442
 
443
 
443
 
444
 
444
###############################################################################
445
###############################################################################
445
#   ToolsetSHLD( $name, \@args, \@objs, \@libraries, $ver )
446
#   ToolsetSHLD( $name, \@args, \@objs, \@libraries, $ver )
446
#       This subroutine takes the user options and builds the rules
447
#       This subroutine takes the user options and builds the rules
447
#       required to link the program 'name'.
448
#       required to link the Shared Library 'name'.
448
#
449
#
449
#   Arguments:
450
#   Arguments:
450
#   n/a
451
#   n/a
451
#
452
#
452
#   Output:
453
#   Output:
Line 473... Line 474...
473
###############################################################################
474
###############################################################################
474
 
475
 
475
sub ToolsetSHLD
476
sub ToolsetSHLD
476
{
477
{
477
    my( $name, $pArgs, $pObjs, $pLibs, $ver ) = @_;
478
    my( $name, $pArgs, $pObjs, $pLibs, $ver ) = @_;
478
    my( $shared, $def, $def_pref, $multi_scan );
479
    my( $linkname, $soname, $shared, $def, $def_pref, $multi_scan );
-
 
480
    my $sosuffix = '.' . $ver;
479
 
481
 
480
#.. Parse arguments
482
#.. Parse arguments
481
#
483
#
482
    foreach $_ ( @$pArgs )
484
    foreach $_ ( @$pArgs )
483
    {
485
    {
Line 496... Line 498...
496
            $multi_scan = 1;
498
            $multi_scan = 1;
497
 
499
 
498
        } elsif ( /^--NoMultiScan/i ) {
500
        } elsif ( /^--NoMultiScan/i ) {
499
            $multi_scan = 0;
501
            $multi_scan = 0;
500
 
502
 
-
 
503
        } elsif ( /^--SoNameSuffix=(.*)/i ) {
-
 
504
            $sosuffix = $1;
-
 
505
 
501
        } else {
506
        } else {
502
            Message( "SHLD: unknown option $_ -- ignored\n" );
507
            Message( "SHLD: unknown option $_ -- ignored\n" );
503
        }
508
        }
504
    }
509
    }
505
 
510
 
506
#.. Full name of shared library
511
#.. Various library names
507
#
512
#
508
    $shared = "$name\$(GBE_TYPE).$::so.$ver";
513
    $linkname = "$name\$(GBE_TYPE).$::so";
509
 
-
 
510
#.. Install and package the shared libraries that are generated
514
    $shared = "$linkname.$ver";
511
#
-
 
512
    PackageShlibAddFiles( $name, "\$(LIBDIR)/${name}\$(GBE_TYPE).$::so" );
-
 
513
    PackageShlibAddFiles( $name, "\$(LIBDIR)/$shared" );
515
    $soname = "$linkname$sosuffix";
514
 
516
 
515
#.. Cleanup rules
517
#.. Cleanup rules
516
#
518
#
517
#   map     Map file
519
#   map     Map file
518
#   ln      Link from LIBDIR to BINDIR
520
#   ln      Link from LIBDIR to BINDIR
519
#
521
#
520
    ToolsetGenerate( "\$(LIBDIR)/${name}.map" );
522
    ToolsetGenerate( "\$(LIBDIR)/${name}.map" );
521
    ToolsetGenerate( "\$(LIBDIR)/${shared}" );
523
    ToolsetGenerate( "\$(LIBDIR)/${shared}" );
522
    ToolsetGenerate( "\$(BINDIR)/${shared}" );
524
    ToolsetGenerate( "\$(BINDIR)/${soname}" );
523
 
525
 
524
#.. Build rules
526
#.. Build rules
525
#
527
#
526
#   name        Base name
528
#   name        Base name
527
#   shared      Library name, includes GBE_TYPE specification
529
#   shared      Library name, includes GBE_TYPE specification
528
#
530
#
529
    my ($io) = ToolsetPrinter::New();
531
    my ($io) = ToolsetPrinter::New();
530
    my $dep = $io->SetShldTarget($shared);
532
    my $dep = $io->SetShldTarget($shared);
531
 
533
 
532
    $io->Label( "Shared library", $name );
534
    $io->Label( "Shared library", $name );
533
 
-
 
534
    $io->Prt( "\$(LIBDIR)/${name}\$(GBE_TYPE).$::so:\t\\\n" .
-
 
535
              "\t\t\$(GBE_BINDIR)\\\n" .
-
 
536
              "\t\t\$(LIBDIR)/${shared}\n" .
535
    PackageShlibAddFiles( $name, "\$(LIBDIR)/$shared" );
537
              "\t\@(rm -f \$@; ln -s ./$shared \$@)\n" .
-
 
538
              "\t\@(rm -f \$(BINDIR)/$shared; ln -s ../\$(LIBDIR)/$shared \$(BINDIR)/$shared)\n\n" );
-
 
539
 
536
    
540
    $io->Prt( "\$(LIBDIR)/${shared}:\tSHBASE=${name}\n" );
537
    $io->Prt( "\$(LIBDIR)/${shared}:\tSHBASE=${name}\n" );
541
    $io->Prt( "\$(LIBDIR)/${shared}:\tSHNAME=${shared}\n" );
538
    $io->Prt( "\$(LIBDIR)/${shared}:\tSHNAME=${soname}\n" );
542
    $io->Prt( "\$(LIBDIR)/${shared}: \\\n\t\t$dep" );
539
    $io->Prt( "\$(LIBDIR)/${shared}: \\\n\t\t${dep}" );
543
    $io->Entry( "", "", " \\\n\t\t", ".$::o", @$pObjs );
540
    $io->Entry( "", "", " \\\n\t\t", ".$::o", @$pObjs );
544
    $io->Prt( "\\\n\t\t$def" ) if($def);
541
    $io->Prt( "\\\n\t\t$def" ) if($def);
545
    $io->Prt( "\n\t\$(SHLD)\n\n" );
542
    $io->Prt( "\n\t\$(SHLD)\n\n" );
546
    
543
    
547
 
544
 
-
 
545
#
-
 
546
#   Create soft links
-
 
547
#       'Real Name' to its 'Link Name'
-
 
548
#       'Real Name' to 'SoName' in the BINDIR (for testing I think)
-
 
549
#       'Real Name' to 'SoName' in the LIBDIR (if different)
-
 
550
#
-
 
551
    $io->Label( "Shared library Symbolic Links", $name );
-
 
552
    PackageShlibAddFiles( $name, "\$(LIBDIR)/$linkname" );
-
 
553
    $io->Prt( "\$(LIBDIR)/$linkname:\t\\\n" .
-
 
554
              "\t\t\$(GBE_BINDIR)\\\n" .
-
 
555
              "\t\t\$(LIBDIR)/${shared}\n" .
-
 
556
              "\t\$(AA_PRE)(rm -f \$@; ln -s ./$shared \$@)\n" .
-
 
557
              "\t\$(AA_PRE)(rm -f \$(BINDIR)/$soname; ln -s ../\$(LIBDIR)/$shared \$(BINDIR)/$soname)\n\n" );
-
 
558
 
-
 
559
    if ( $soname ne $shared && $soname ne $linkname)
-
 
560
    {
-
 
561
        $io->Label( "Shared library SoName Symbolic Links", $name );
-
 
562
        PackageShlibAddFiles( $name, "\$(LIBDIR)/$soname" );
-
 
563
        $io->Prt( "\$(LIBDIR)/$soname:\t\\\n" .
-
 
564
                  "\t\t\$(GBE_LIBDIR)\\\n" .
-
 
565
                  "\t\t\$(LIBDIR)/${shared}\n" .
-
 
566
                  "\t\$(AA_PRE)(rm -f \$@; ln -s ./$shared \$@)\n" );
-
 
567
    }
-
 
568
 
548
#.. Linker command file
569
#.. Linker command file
549
#
570
#
550
#       Now the fun part... piecing together a variable $(name_shld)
571
#       Now the fun part... piecing together a variable $(name_shld)
551
#       which ends up in the command file.
572
#       which ends up in the command file.
552
#
573
#
-
 
574
    $io->Newline();
553
    $io->SetTag( "${name}_shld" );              # command tag
575
    $io->SetTag( "${name}_shld" );              # command tag
554
    $io->SetTerm( "\n" );
576
    $io->SetTerm( "\n" );
555
 
577
 
556
    $io->Label( "Linker commands", $name );     # label
578
    $io->Label( "Linker commands", $name );     # label
557
 
579
 
Line 575... Line 597...
575
    #
597
    #
576
    #       Create makefile directives to include the dependency
598
    #       Create makefile directives to include the dependency
577
    #       list into the makefile.
599
    #       list into the makefile.
578
    #
600
    #
579
    $io->DepRules( $pLibs, \&ToolsetLibRecipe, "\$(LIBDIR)/${shared}" );
601
    $io->DepRules( $pLibs, \&ToolsetLibRecipe, "\$(LIBDIR)/${shared}" );
580
    $io->SHLDDEPEND($name, $shared);
602
    $io->SHLDDEPEND($name, $soname);
581
}
603
}
582
 
604
 
583
 
605
 
584
###############################################################################
606
###############################################################################
585
# Function        : ToolsetLD
607
# Function        : ToolsetLD