Subversion Repositories DevTools

Rev

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

Rev 317 Rev 335
Line 1... Line -...
1
# -*- mode: perl; indent-width: 4; show-tabs: yes; -*-
-
 
2
#
1
#
3
# Module name   : vcwce
2
# Module name   : vcwce
4
# Module type   : Makefile system
3
# Module type   : Makefile system
5
# Compiler(s)   : ANSI C
4
# Compiler(s)   : ANSI C
6
# Environment(s): WCE
5
# Environment(s): WCE
Line 23... Line 22...
23
my $target_file_exe;
22
my $target_file_exe;
24
my $pdb_none;
23
my $pdb_none;
25
 
24
 
26
##############################################################################
25
##############################################################################
27
#   Toolchain information
26
#   Toolchain information
28
#   Abstarct out minor toolchain differences into a data structure
27
#   Abstract out minor toolchain differences into a data structure
29
#
28
#
30
my $toolchain_info;
29
my $toolchain_info;
31
my %ToolChainData =
30
my %ToolChainData =
32
    (
31
    (
33
        'EVC4'      =>  {  'def'        => 'vcwce.def' ,
32
        'EVC4'      =>  {  'def'        => 'vcwce.def' ,
Line 96... Line 95...
96
 
95
 
97
#.. Toolset configuration
96
#.. Toolset configuration
98
#
97
#
99
    $::ScmToolsetVersion = "1.0.0";             # our version
98
    $::ScmToolsetVersion = "1.0.0";             # our version
100
    $::ScmToolsetGenerate = 0;                  # generate optional
99
    $::ScmToolsetGenerate = 0;                  # generate optional
-
 
100
    $::ScmToolsetProgDependancies = 0;          # handle Prog dependancies myself
101
 
101
 
102
#.. Parse arguments
102
#.. Parse arguments
103
#
103
#
104
    Debug( "vcwce(ToolsetArgs=@::ScmToolsetArgs)" );
104
    Debug( "vcwce(ToolsetArgs=@::ScmToolsetArgs)" );
105
 
105
 
Line 741... Line 741...
741
#
741
#
742
###############################################################################
742
###############################################################################
743
 
743
 
744
sub ToolsetCXXDepend
744
sub ToolsetCXXDepend
745
{
745
{
746
    MakePrint( "\t\$(CCDEPEND)\n" );
746
    ToolsetCCDepend();
747
}
747
}
748
 
748
 
749
 
749
 
750
###############################################################################
750
###############################################################################
751
#   ToolsetAS( $source, $obj, \@args )
751
#   ToolsetAS( $source, $obj, \@args )
Line 1084... Line 1084...
1084
        my $full = $lib.".$::so";
1084
        my $full = $lib.".$::so";
1085
        my $link_with_def;
1085
        my $link_with_def;
1086
 
1086
 
1087
    #.. Cleanup rules
1087
    #.. Cleanup rules
1088
    #
1088
    #
1089
    #   dep     Dependency file
-
 
1090
    #   ld      Linker command file
1089
    #   ld      Linker command file
1091
    #   map     Map file
1090
    #   map     Map file
1092
    #   pdb     Microsoft C/C++ program database
1091
    #   pdb     Microsoft C/C++ program database
1093
    #   ilk     Microsoft Linker Database
1092
    #   ilk     Microsoft Linker Database
1094
    #
1093
    #
1095
        ToolsetGenerate( "\$(LIBDIR)/${lib}.ld" );
1094
        ToolsetGenerate( "\$(LIBDIR)/${lib}.ld" );
1096
        ToolsetGenerate( "\$(LIBDIR)/${lib}.dep" );
-
 
1097
        ToolsetGenerate( "\$(LIBDIR)/${lib}.map" );
1095
        ToolsetGenerate( "\$(LIBDIR)/${lib}.map" );
1098
        ToolsetGenerate( "\$(LIBDIR)/${lib}.exp" );
1096
        ToolsetGenerate( "\$(LIBDIR)/${lib}.exp" );
1099
        ToolsetGenerate( "\$(LIBDIR)/${lib}.ilk" );
1097
        ToolsetGenerate( "\$(LIBDIR)/${lib}.ilk" );
1100
        ToolsetGenerate( "\$(LIBDIR)/${full}" );
1098
        ToolsetGenerate( "\$(LIBDIR)/${full}" );
1101
 
1099
 
Line 1211... Line 1209...
1211
        PackageShlibAddFiles( $base, "\$(LIBDIR)/${full}" );
1209
        PackageShlibAddFiles( $base, "\$(LIBDIR)/${full}" );
1212
 
1210
 
1213
        #
1211
        #
1214
        #   Generate Shared Library dependency information
1212
        #   Generate Shared Library dependency information
1215
        #
1213
        #
1216
        $io->SHLDDEPEND( $lib, $name, $lib );   # std SHLDDEPEND rules
1214
        my $dep = $io->SetShldTarget( $lib );
1217
 
1215
 
1218
        #
1216
        #
1219
        #   Generate rules and recipes to create the body of the shared
1217
        #   Generate rules and recipes to create the body of the shared
1220
        #   library. Several build variables are overiden when creating
1218
        #   library. Several build variables are overiden when creating
1221
        #   a shared library.
1219
        #   a shared library.
Line 1225... Line 1223...
1225
        $io->Prt( "\$(LIBDIR)/${full}:\tCFLAGS+=\$(SHCFLAGS)\n" );
1223
        $io->Prt( "\$(LIBDIR)/${full}:\tCFLAGS+=\$(SHCFLAGS)\n" );
1226
        $io->Prt( "\$(LIBDIR)/${full}:\tCXXLAGS+=\$(SHCXXFLAGS)\n" );
1224
        $io->Prt( "\$(LIBDIR)/${full}:\tCXXLAGS+=\$(SHCXXFLAGS)\n" );
1227
        $io->Prt( "\$(LIBDIR)/${full}:\t$export_file\n" ) if ($export_file );
1225
        $io->Prt( "\$(LIBDIR)/${full}:\t$export_file\n" ) if ($export_file );
1228
        $io->Prt( "\$(LIBDIR)/${full}:\t$res\n" ) if ( $res );
1226
        $io->Prt( "\$(LIBDIR)/${full}:\t$res\n" ) if ( $res );
1229
 
1227
 
1230
        $io->Entry( "\$(LIBDIR)/${full}: \\\n\t\t\$(OBJDIR)/${base}",
1228
        $io->Entry( "\$(LIBDIR)/${full}: $dep \\\n\t\t\$(OBJDIR)/${base}",
1231
            "", " \\\n\t\t", ".$::o", @$pObjs );
1229
            "", " \\\n\t\t", ".$::o", @$pObjs );
1232
 
1230
 
1233
        $io->Prt( " \\\n\t\t$def" ) if ( $link_with_def );
1231
        $io->Prt( " \\\n\t\t$def" ) if ( $link_with_def );
1234
        $io->Prt( " \\\n\t\t\$(LIBDIR)/${lib}.dep\n" );
-
 
1235
        $io->Prt( "\t\$(SHLD)\n" );
1232
        $io->Prt( "\n\t\$(SHLD)\n" );
1236
 
1233
 
1237
        $io->Newline();
1234
        $io->Newline();
1238
 
1235
 
1239
        #.. Linker command file
1236
        #.. Linker command file
1240
        #
1237
        #
Line 1265... Line 1262...
1265
        $io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
1262
        $io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
1266
 
1263
 
1267
        $io->Newline();
1264
        $io->Newline();
1268
 
1265
 
1269
        #.. Dependency link,
1266
        #.. Dependency link,
-
 
1267
        #   Create a library dependency file
-
 
1268
        #       Create command file to build applicaton dependency list
-
 
1269
        #       from the list of dependent libraries
1270
        #
1270
        #
1271
        #       Now piece together a variable $(name_dp) which ends up in
1271
        #       Create makefile directives to include the dependency
1272
        #       the command file building the application dependency list.
1272
        #       list into the makefile.
1273
        #
1273
        #
1274
        $io->SetTag( "${lib}_shdp" );          # command tag
-
 
1275
 
-
 
1276
        $io->DepRules( $name, $pLibs,           # library depends rules
-
 
1277
            \&ToolsetLibRecipe, "\$(LIBDIR)/${full}" );
1274
        $io->DepRules( $pLibs, \&ToolsetLibRecipe, "\$(LIBDIR)/${full}" );
1278
 
-
 
1279
        $io->Newline();
1275
        $io->SHLDDEPEND( $name, $lib );
1280
    }
1276
    }
1281
 
1277
 
1282
    ToolsetLibStd( $pLibs )                    # push standard libraries
1278
    ToolsetLibStd( $pLibs )                    # push standard libraries
1283
        unless ( $noaddlibs );
1279
        unless ( $noaddlibs );
1284
 
1280
 
Line 1338... Line 1334...
1338
    PCLintSHLIB( @_ );
1334
    PCLintSHLIB( @_ );
1339
}
1335
}
1340
 
1336
 
1341
 
1337
 
1342
###############################################################################
1338
###############################################################################
1343
#   ToolsetLD( $name, \@args, \@objs, \@libraries )
-
 
1344
#       This subroutine takes the user options and builds the rules
-
 
1345
#       required to link the program 'name'.
-
 
1346
#
-
 
1347
#   Arguments:
-
 
1348
#       (none)
-
 
1349
#
-
 
1350
#   Output:
-
 
1351
#       $(BINDIR)/name: \
-
 
1352
#                       OBJS .... \
-
 
1353
#                       $(BINDIR)/name.dep
-
 
1354
#           $(LD)
-
 
1355
#
-
 
1356
#       $(BINDIR)/name.dep: $(BINDIR)
-
 
1357
#       $(BINDIR)/name.dep: $(GBE_PLATFORM).mk
-
 
1358
#           $(LDDEPEND)
1339
# Function        : ToolsetLD
1359
#
-
 
1360
#       ifeq "$(IFLAG)" "3"
-
 
1361
#       -include        "$(BINDIR)/name.dep"
-
 
1362
#       endif
-
 
1363
#
1340
#
1364
#       name_ld += ...
1341
# Description     : Takes the user options and builds the rules required to
1365
#           :
1342
#                   link the program 'name'.
1366
#
1343
#
1367
#       name_dp += ...
1344
# Inputs          : $name           - base name of the program
-
 
1345
#                   $pArgs          - Ref to program arguments
-
 
1346
#                   $pObjs          - Ref to program objects
-
 
1347
#                   $pLibs          - Ref to program library list
-
 
1348
#
1368
#           :
1349
# Returns         : Nothing
-
 
1350
#
-
 
1351
# Output:         : Rules and recipes to create a program
-
 
1352
#                       Create program rules and recipes
-
 
1353
#                       Create linker input script
-
 
1354
#                       Create library dependency list
-
 
1355
#                       Include library dependency information
1369
#
1356
#
1370
###############################################################################
-
 
1371
 
-
 
1372
sub ToolsetLD
1357
sub ToolsetLD
1373
{
1358
{
1374
    my ( $name, $pArgs, $pObjs, $pLibs ) = @_;
1359
    my ( $name, $pArgs, $pObjs, $pLibs ) = @_;
1375
    my ( $full ) = $name."$::exe";
-
 
1376
    my ( $res, @reslist );
1360
    my ( $res, @reslist );
1377
    my $no_pdb =$pdb_none;
1361
    my $no_pdb =$pdb_none;
1378
    our( $entry, $noaddlibs );
1362
    our( $entry, $noaddlibs );
1379
 
1363
 
1380
#.. Parse arguments
1364
#.. Parse arguments
Line 1396... Line 1380...
1396
            Message( "vcwce LD: unknown option $_ -- ignored\n" );
1380
            Message( "vcwce LD: unknown option $_ -- ignored\n" );
1397
 
1381
 
1398
        }
1382
        }
1399
    }
1383
    }
1400
 
1384
 
-
 
1385
#.. Names of important files
-
 
1386
#
-
 
1387
    my $base = "\$(BINDIR)/${name}";
-
 
1388
    my $full = $base . $::exe;
-
 
1389
    my $map  = $base . '.map';
-
 
1390
    my $pdb  = $base . '.pdb';
-
 
1391
 
-
 
1392
 
1401
#.. Cleanup rules
1393
#.. Cleanup rules
1402
#
1394
#
1403
#   dep     Dependency file
-
 
1404
#   ld      Linker command file
1395
#   ld      Linker command file
1405
#   map     Map file
1396
#   map     Map file
1406
#   pdb     Microsoft C/C++ program database
1397
#   pdb     Microsoft C/C++ program database
1407
#   ilk     Microsoft Linker Database
1398
#   ilk     Microsoft Linker Database
1408
#   res     Compiled resource script
1399
#   res     Compiled resource script
1409
#
1400
#
1410
    ToolsetGenerate( "\$(BINDIR)/${name}.dep" );
1401
    ToolsetGenerate( $map );
1411
    ToolsetGenerate( "\$(BINDIR)/${name}.ld" );
1402
    ToolsetGenerate( $pdb );
1412
    ToolsetGenerate( "\$(BINDIR)/${name}.map" );
-
 
1413
    ToolsetGenerate( "\$(BINDIR)/${name}.pdb" );
1403
    ToolsetGenerate( $base . '.ld' );
1414
    ToolsetGenerate( "\$(BINDIR)/${name}.ilk" );
1404
    ToolsetGenerate( $base . '.ilk' );
1415
 
1405
 
1416
#.. Linker command
1406
#.. Toolset Printer
1417
#
1407
#
1418
    my ($io) = ToolsetPrinter::New();
1408
    my ($io) = ToolsetPrinter::New();
-
 
1409
    my $dep = $io->SetLdTarget( $name );
1419
 
1410
 
-
 
1411
#
-
 
1412
#.. Linker command
-
 
1413
#
1420
    $io->Prt( "\\\n\t\t$res " ) if ( $res );
1414
    $io->Prt( "$full : $dep " );
-
 
1415
    $io->Entry( "", "", "\\\n\t", ".$::o ", @$pObjs );
1421
    $io->Prt( "\\\n\t\t\$(BINDIR)/${name}.dep\n".
1416
    $io->Prt( "\\\n\t$res " ) if ( $res );
1422
              "\t\$(LD)\n\n" );
1417
    $io->Prt( "\n\t\$(LD)\n\n" );
1423
 
-
 
1424
 
-
 
1425
    $io->LDDEPEND( $name );                     # standard LDDEPEND rules
-
 
1426
 
1418
 
1427
#.. Linker command file
1419
#.. Linker command file
1428
#
1420
#
1429
#       Now piece together a variable $(name_ld) which ends up in
1421
#       Now piece together a variable $(name_ld) which ends up in
1430
#       the command file linking the application.
1422
#       the command file linking the application.
1431
#
1423
#
1432
    $io->SetTag( "${name}_ld" );                # macro tag
1424
    $io->SetTag( "${name}_ld" );                # macro tag
1433
 
1425
 
1434
    $io->Label( "Linker commands", $name );     # label
1426
    $io->Label( "Linker commands", $name );     # label
1435
 
1427
 
1436
    $io->Cmd( "-out:\$(subst /,\\\\,\$(BINDIR)/${full})" );
1428
    $io->Cmd( "-out:\$(subst /,\\\\,$full)" );
1437
    $io->Cmd( "-pdb:\$(subst /,\\\\,\$(BINDIR)/${name}).pdb" ) unless ($no_pdb);
1429
    $io->Cmd( "-pdb:\$(subst /,\\\\,$pdb)" )        unless ($no_pdb);
1438
    $io->Cmd( "-debug:none" )                                  if ($no_pdb);
1430
    $io->Cmd( "-debug:none" )                                  if ($no_pdb);
1439
    $io->Cmd( "-pdb:none" )                                    if ($no_pdb);
1431
    $io->Cmd( "-pdb:none" )                                    if ($no_pdb);
1440
    $io->Cmd( "-entry:$entry" )                                if ($entry);
1432
    $io->Cmd( "-entry:$entry" )                                if ($entry);
1441
    $io->Cmd( "-map:\$(subst /,\\\\,\$(BINDIR)/${name}).map" );
1433
    $io->Cmd( "-map:\$(subst /,\\\\,$map)" );
1442
    $io->Cmd( "\$(subst /,\\\\,$res)" ) if ( $res );
1434
    $io->Cmd( "\$(subst /,\\\\,$res)" )             if ( $res );
1443
 
-
 
1444
    ToolsetLibStd( $pLibs )                     # push standard libraries
-
 
1445
        unless ( $noaddlibs );
-
 
1446
 
-
 
1447
                                                # object list
-
 
1448
    $io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );
-
 
1449
 
-
 
1450
                                                # library list
-
 
1451
    $io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
-
 
1452
 
1435
 
-
 
1436
    ToolsetLibStd( $pLibs ) unless ( $noaddlibs );      # push standard libraries
-
 
1437
    $io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );  # object list
-
 
1438
    $io->LibList( $name, $pLibs, \&ToolsetLibRecipe );  # library list
1453
    $io->Newline();
1439
    $io->Newline();
1454
 
1440
 
1455
#.. Dependencies
1441
    #.. Dependency link,
1456
#
-
 
1457
#       Now piece together a variable $(name_dp) which ends up in
1442
    #   Create a library dependency file
1458
#       the command file building the application dependency list.
1443
    #       Create command file to build applicaton dependency list
-
 
1444
    #       from the list of dependent libraries
1459
#
1445
    #
1460
    $io->SetTag( "${name}_dp" );                # macro tag
1446
    #       Create makefile directives to include the dependency
1461
                                                
1447
    #       list into the makefile.
-
 
1448
    #
1462
    $io->DepRules( $name, $pLibs,               # library depends rules
1449
    $io->DepRules( $pLibs, \&ToolsetLibRecipe, $full );
1463
        \&ToolsetLibRecipe, "\$(BINDIR)/${full}" );
-
 
1464
 
-
 
1465
    $io->Newline();
1450
    $io->LDDEPEND();
1466
 
1451
 
1467
#.. Compile up the resource file
1452
#.. Compile up the resource file
1468
#
1453
#
1469
    ToolsetRCrecipe( $res, @reslist )
1454
    ToolsetRCrecipe( $res, @reslist )
1470
        if ( $res );
1455
        if ( $res );
1471
 
1456
 
1472
#.. Package up the PDB file with the program
1457
#.. Package up the PDB file with the program
1473
#
1458
#
-
 
1459
    PackageProgAddFiles ( $name, $full );
1474
    PackageProgAddFiles ( $name, "\$(BINDIR)/${name}.pdb", "Class=debug" ) unless ( $no_pdb );
1460
    PackageProgAddFiles ( $name, $pdb, "Class=debug" ) unless ( $no_pdb );
1475
 
1461
 
1476
#
1462
#
1477
#   Track the name of the possible target file
1463
#   Track the name of the possible target file
1478
#   Used when creating Visual Studio projects
1464
#   Used when creating Visual Studio projects
1479
#
1465
#
1480
    $target_file_exe = "\$(BINDIR)/${full}";
1466
    $target_file_exe = $full;
1481
}
1467
}
1482
 
1468
 
1483
 
1469
 
1484
###############################################################################
1470
###############################################################################
1485
#   ToolsetLD( $name, \@args, \@objs, \@libraries, \@csrc, \@cxxsrc )
1471
#   ToolsetLD( $name, \@args, \@objs, \@libraries, \@csrc, \@cxxsrc )
Line 1607... Line 1593...
1607
    push @result, "\$(OBJDIR)/$name.res";
1593
    push @result, "\$(OBJDIR)/$name.res";
1608
 
1594
 
1609
    #
1595
    #
1610
    #   Process each user file
1596
    #   Process each user file
1611
    #
1597
    #
1612
    for (split( ',', $files ))
1598
    for (split( '\s*,\s*', $files ))
1613
    {
1599
    {
1614
        #
1600
        #
1615
        #   Locate the file.
1601
        #   Locate the file.
1616
        #   If it is a generate file so it will be in the SRCS hash
1602
        #   If it is a generate file so it will be in the SRCS hash
1617
        #   Other wise the use will have to use Src to locate the file
1603
        #   Other wise the use will have to use Src to locate the file