Subversion Repositories DevTools

Rev

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

Rev 255 Rev 261
Line 114... Line 114...
114
 
114
 
115
#.. Toolset configuration
115
#.. Toolset configuration
116
#
116
#
117
    $::ScmToolsetVersion = "1.0.0";             # our version
117
    $::ScmToolsetVersion = "1.0.0";             # our version
118
    $::ScmToolsetGenerate = 0;                  # generate optional
118
    $::ScmToolsetGenerate = 0;                  # generate optional
119
    $::ScmToolsetIFLAG3 = 1;                    # supports IFLAG3
119
    $::ScmToolsetProgDependancies = 0;          # handle Prog dependancies myself
120
 
120
 
121
#.. define Visual C/C+ environment
121
#.. define Visual C/C+ environment
122
    Init( "visualc" );
122
    Init( "visualc" );
123
    ToolsetDefines( $toolset_info->{'def'} );
123
    ToolsetDefines( $toolset_info->{'def'} );
124
    PlatformDefine ("VSCOMPILER\t= $toolset_info->{'VSCOMPILER'}" );
124
    PlatformDefine ("VSCOMPILER\t= $toolset_info->{'VSCOMPILER'}" );
Line 863... Line 863...
863
        $io->Prt( "\$(LIBDIR)/${full}:\tCFLAGS+=\$(SHCFLAGS)\n" );
863
        $io->Prt( "\$(LIBDIR)/${full}:\tCFLAGS+=\$(SHCFLAGS)\n" );
864
        $io->Prt( "\$(LIBDIR)/${full}:\tCXXLAGS+=\$(SHCXXFLAGS)\n" );
864
        $io->Prt( "\$(LIBDIR)/${full}:\tCXXLAGS+=\$(SHCXXFLAGS)\n" );
865
        $io->Prt( "\$(LIBDIR)/${full}:\t$export_file\n" ) if ($export_file );
865
        $io->Prt( "\$(LIBDIR)/${full}:\t$export_file\n" ) if ($export_file );
866
        $io->Prt( "\$(LIBDIR)/${full}:\t$res\n" ) if ( $res );
866
        $io->Prt( "\$(LIBDIR)/${full}:\t$res\n" ) if ( $res );
867
 
867
 
868
        $io->Entry( "\$(LIBDIR)/${full}: \\\n\t\t\$(OBJDIR)/${base}",
868
        $io->Entry( "\$(LIBDIR)/${full}: \$(LIBDIR)/${lib}.dep \\\n\t\t\$(OBJDIR)/${base}",
869
            "", " \\\n\t\t", ".$::o", @$pObjs );
869
            "", " \\\n\t\t", ".$::o", @$pObjs );
870
 
870
 
871
        $io->Prt( " \\\n\t\t$def" ) if ( $link_with_def );
871
        $io->Prt( " \\\n\t\t$def" ) if ( $link_with_def );
872
        $io->Prt( " \\\n\t\t\$(LIBDIR)/${lib}.dep\n" );
-
 
873
        $io->Prt( "\t\$(SHLD)\n" );
872
        $io->Prt( "\n\t\$(SHLD)\n" );
874
 
873
 
875
        $io->Newline();
874
        $io->Newline();
876
 
875
 
877
        #.. Linker command file
876
        #.. Linker command file
878
        #
877
        #
Line 977... Line 976...
977
sub ToolsetSHLDLINT
976
sub ToolsetSHLDLINT
978
{
977
{
979
    PCLintSHLIB( @_ );
978
    PCLintSHLIB( @_ );
980
}
979
}
981
 
980
 
982
 
-
 
983
###############################################################################
981
###############################################################################
984
#   ToolsetLD( $name, \@args, \@objs, \@libraries )
-
 
985
#       This subroutine takes the user options and builds the rules
-
 
986
#       required to link the program 'name'.
-
 
987
#
-
 
988
#   Arguments:
-
 
989
#       (none)
-
 
990
#
-
 
991
#   Output:
-
 
992
#       $(BINDIR)/name: \
-
 
993
#                       OBJS .... \
-
 
994
#                       $(BINDIR)/name.dep
-
 
995
#           $(LD)
-
 
996
#
-
 
997
#       $(BINDIR)/name.dep: $(BINDIR)
-
 
998
#       $(BINDIR)/name.dep: $(GBE_PLATFORM).mk
-
 
999
#           $(LDDEPEND)
982
# Function        : ToolsetLD
1000
#
-
 
1001
#       ifeq "$(IFLAG)" "3"
-
 
1002
#       -include        "$(BINDIR)/name.dep"
-
 
1003
#       endif
-
 
1004
#
983
#
1005
#       name_ld += ...
984
# Description     : Takes the user options and builds the rules required to
1006
#           :
985
#                   link the program 'name'.
1007
#
986
#
1008
#       name_dp += ...
987
# Inputs          : $name           - base name of the program
-
 
988
#                   $pArgs          - Ref to program arguments
-
 
989
#                   $pObjs          - Ref to program objects
-
 
990
#                   $pLibs          - Ref to program library list
-
 
991
#
1009
#           :
992
# Returns         : Nothing
-
 
993
#
-
 
994
# Output:         : Rules and recipes to create a program
-
 
995
#                       Create program rules and recipes
-
 
996
#                       Create linker input script
-
 
997
#                       Create library dependency list
-
 
998
#                       Include library dependency information
1010
#
999
#
1011
###############################################################################
-
 
1012
 
-
 
1013
sub ToolsetLD
1000
sub ToolsetLD
1014
{
1001
{
1015
    my ( $name, $pArgs, $pObjs, $pLibs ) = @_;
1002
    my ( $name, $pArgs, $pObjs, $pLibs ) = @_;
1016
    my ( $full ) = $name."$::exe";
-
 
1017
    my ( $res, @reslist );
1003
    my ( $res, @reslist );
1018
    my $no_pdb =$pdb_none;
1004
    my $no_pdb =$pdb_none;
1019
    our( $entry, $noaddlibs );
1005
    our( $entry, $noaddlibs );
1020
 
1006
 
1021
#.. Parse arguments
1007
#.. Parse arguments
Line 1037... Line 1023...
1037
            Message( "vcwin32 LD: unknown option $_ -- ignored\n" );
1023
            Message( "vcwin32 LD: unknown option $_ -- ignored\n" );
1038
 
1024
 
1039
        }
1025
        }
1040
    }
1026
    }
1041
 
1027
 
-
 
1028
#.. Names of important files
-
 
1029
#
-
 
1030
    my $base = "\$(BINDIR)/${name}";
-
 
1031
    my $full = $base . $::exe;
-
 
1032
    my $map  = $base . '.map';
-
 
1033
    my $pdb  = $base . '.pdb';
-
 
1034
    my $dep  = $base . '.dep';
-
 
1035
 
-
 
1036
 
1042
#.. Cleanup rules
1037
#.. Cleanup rules
1043
#
1038
#
1044
#   dep             Dependency file
1039
#   dep             Dependency file
1045
#   ld              Linker command file
1040
#   ld              Linker command file
1046
#   map             Map file
1041
#   map             Map file
1047
#   pdb             Microsoft C/C++ program database
1042
#   pdb             Microsoft C/C++ program database
1048
#   ilk             Microsoft Linker Database
1043
#   ilk             Microsoft Linker Database
1049
#   res             Compiled resource script
1044
#   res             Compiled resource script
1050
#   .exe.manifest   Manifest file (VS2005)
1045
#   exe.manifest    Manifest file (VS2005)
1051
#
1046
#
1052
    ToolsetGenerate( "\$(BINDIR)/${name}.dep" );
1047
    ToolsetGenerate( $dep );
1053
    ToolsetGenerate( "\$(BINDIR)/${name}.ld" );
1048
    ToolsetGenerate( $map );
1054
    ToolsetGenerate( "\$(BINDIR)/${name}.map" );
1049
    ToolsetGenerate( $pdb );
1055
    ToolsetGenerate( "\$(BINDIR)/${name}.pdb" );
1050
    ToolsetGenerate( $base . '.ld' );
1056
    ToolsetGenerate( "\$(BINDIR)/${name}.ilk" );
1051
    ToolsetGenerate( $base . '.ilk' );
1057
    ToolsetGenerate( "\$(BINDIR)/${name}.exe.manifest" ) if $toolset_info->{'GenManifest'};
1052
    ToolsetGenerate( $full . '.manifest' ) if $toolset_info->{'GenManifest'};
1058
 
1053
 
1059
#.. Linker command
1054
#.. Linker command
1060
#
1055
#
1061
    my ($io) = ToolsetPrinter::New();
1056
    my ($io) = ToolsetPrinter::New();
1062
 
1057
 
1063
    $io->Prt( "\\\n\t\t$res " ) if ( $res );
1058
    $io->Prt( "$full : $dep " );
-
 
1059
    $io->Entry( "", "", "\\\n\t", ".$::o ", @$pObjs );
1064
    $io->Prt( "\\\n\t\t\$(BINDIR)/${name}.dep\n".
1060
    $io->Prt( "\\\n\t$res " ) if ( $res );
1065
              "\t\$(LD)\n\n" );
1061
    $io->Prt( "\n\t\$(LD)\n\n" );
1066
 
-
 
1067
 
1062
 
1068
    $io->LDDEPEND( $name );                     # standard LDDEPEND rules
-
 
1069
 
1063
 
1070
#.. Linker command file
1064
#.. Linker command file
1071
#
1065
#
1072
#       Now piece together a variable $(name_ld) which ends up in
1066
#       Now piece together a variable $(name_ld) which ends up in
1073
#       the command file linking the application.
1067
#       the command file linking the application.
1074
#
1068
#
1075
    $io->SetTag( "${name}_ld" );                # macro tag
1069
    $io->SetTag( "${name}_ld" );                # macro tag
1076
 
1070
 
1077
    $io->Label( "Linker commands", $name );     # label
1071
    $io->Label( "Linker commands", $name );     # label
1078
 
1072
 
1079
    $io->Cmd( "-out:\$(subst /,\\\\,\$(BINDIR)/${full})" );
1073
    $io->Cmd( "-out:\$(subst /,\\\\,$full)" );
1080
    $io->Cmd( "-pdb:\$(subst /,\\\\,\$(BINDIR)/${name}).pdb" ) unless ($no_pdb);
1074
    $io->Cmd( "-pdb:\$(subst /,\\\\,$pdb)" )        unless ($no_pdb);
1081
    $io->Cmd( "-debug:none" )                                  if ($no_pdb);
1075
    $io->Cmd( "-debug:none" )                       if ($no_pdb);
1082
    $io->Cmd( "-pdb:none" )                                    if ($no_pdb);
1076
    $io->Cmd( "-pdb:none" )                         if ($no_pdb);
1083
    $io->Cmd( "-entry:$entry" )                                if ($entry);
1077
    $io->Cmd( "-entry:$entry" )                     if ($entry);
1084
    $io->Cmd( "-map:\$(subst /,\\\\,\$(BINDIR)/${name}).map" );
1078
    $io->Cmd( "-map:\$(subst /,\\\\,$map)" );
1085
    $io->Cmd( "-nodefaultlib:LIBC" );
1079
    $io->Cmd( "-nodefaultlib:LIBC" );
1086
    $io->Cmd( "-machine:IX86" );
1080
    $io->Cmd( "-machine:IX86" );
1087
    $io->Cmd( "\$(subst /,\\\\,$res)" ) if ( $res );
1081
    $io->Cmd( "\$(subst /,\\\\,$res)" )             if ( $res );
1088
 
-
 
1089
    ToolsetLibStd( $pLibs )                     # push standard libraries
-
 
1090
        unless ( $noaddlibs );
-
 
1091
 
-
 
1092
                                                # object list
-
 
1093
    $io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );
-
 
1094
 
-
 
1095
                                                # library list
-
 
1096
    $io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
-
 
1097
 
1082
 
-
 
1083
    ToolsetLibStd( $pLibs ) unless ( $noaddlibs );      # push standard libraries
-
 
1084
    $io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );  # object list
-
 
1085
    $io->LibList( $name, $pLibs, \&ToolsetLibRecipe );  # library list
1098
    $io->Newline();
1086
    $io->Newline();
1099
 
1087
 
-
 
1088
#.. Library dependency information
-
 
1089
#   Rules to include a .dep file when required
-
 
1090
#
-
 
1091
    $io->LDDEPEND( $name );
-
 
1092
 
1100
#.. Dependencies
1093
#.. Dependencies
1101
#
1094
#
1102
#       Now piece together a variable $(name_dp) which ends up in
1095
#       Now piece together a variable $(name_dp) which ends up in
1103
#       the command file building the application dependency list.
1096
#       the command file building the application dependency list.
1104
#
1097
#
1105
    $io->SetTag( "${name}_dp" );                # macro tag
1098
    $io->SetTag( "${name}_dp" );                                # macro tag
1106
                                                
-
 
1107
    $io->DepRules( $name, $pLibs,               # library depends rules
1099
    $io->DepRules( $name, $pLibs, \&ToolsetLibRecipe, $full );  # library depends rules
1108
        \&ToolsetLibRecipe, "\$(BINDIR)/${full}" );
-
 
1109
 
-
 
1110
    $io->Newline();
1100
    $io->Newline();
1111
 
1101
 
1112
#.. Compile up the resource file
1102
#.. Compile up the resource file
1113
#
1103
#
1114
    ToolsetRCrecipe( $res, @reslist )
1104
    ToolsetRCrecipe( $res, @reslist )
1115
        if ( $res );
1105
        if ( $res );
1116
 
1106
 
1117
#.. Package up the PDB file with the program
1107
#.. Package up the program and the PDB
1118
#
1108
#
-
 
1109
    PackageProgAddFiles ( $name, $full );
1119
    PackageProgAddFiles ( $name, "\$(BINDIR)/${name}.pdb", "Class=debug" ) unless ( $no_pdb );
1110
    PackageProgAddFiles ( $name, $pdb, "Class=debug" ) unless ( $no_pdb );
1120
 
1111
 
1121
#
1112
#
1122
#   Track the name of the possible target file
1113
#   Track the name of the possible target file
1123
#   Used when creating Visual Studio projects
1114
#   Used when creating Visual Studio projects
1124
#
1115
#
1125
    $target_file_exe = "\$(BINDIR)/${full}";
1116
    $target_file_exe = $full;
1126
}
1117
}
1127
 
1118
 
1128
 
1119
 
1129
###############################################################################
1120
###############################################################################
1130
#   ToolsetLD( $name, \@args, \@objs, \@libraries, \@csrc, \@cxxsrc )
1121
#   ToolsetLD( $name, \@args, \@objs, \@libraries, \@csrc, \@cxxsrc )