Subversion Repositories DevTools

Rev

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

Rev 7428 Rev 7547
Line 387... Line 387...
387
            $GCCToolchain = $ToolsetConfig{ $arg_alias };
387
            $GCCToolchain = $ToolsetConfig{ $arg_alias };
388
            my $testCompilerPath = $GCCToolchain->{ROOT} . '/' . $GCCToolchain->{BASE} . 'gcc';
388
            my $testCompilerPath = $GCCToolchain->{ROOT} . '/' . $GCCToolchain->{BASE} . 'gcc';
389
            $tools_found = (-d $GCCToolchain->{ROOT}) && ( -f $testCompilerPath);
389
            $tools_found = (-d $GCCToolchain->{ROOT}) && ( -f $testCompilerPath);
390
            Warning ("gcc toolset: CrossPlatform toolchain not found for: $arg_alias",
390
            Warning ("gcc toolset: CrossPlatform toolchain not found for: $arg_alias",
391
                     "Path    : $GCCToolchain->{ROOT}" ,
391
                     "Path    : $GCCToolchain->{ROOT}" ,
392
                     "Compiler: $testCompilerPath " 
392
                     "Compiler: $testCompilerPath "
393
                      ) unless $tools_found;
393
                      ) unless $tools_found;
394
        }
394
        }
395
        else
395
        else
396
        {
396
        {
397
            Error("gcc toolset: CrossPlatform Alias not configured: $arg_alias");
397
            Error("gcc toolset: CrossPlatform Alias not configured: $arg_alias");
Line 444... Line 444...
444
        $GCCAr =  '${GCC_ROOT}/' . $GCCToolchain->{BASE} . 'ar';
444
        $GCCAr =  '${GCC_ROOT}/' . $GCCToolchain->{BASE} . 'ar';
445
        $GCCGcovTool = '${GCC_ROOT}/' . $GCCToolchain->{BASE} . 'gcov';
445
        $GCCGcovTool = '${GCC_ROOT}/' . $GCCToolchain->{BASE} . 'gcov';
446
        $GCCObjCopy =  '${GCC_ROOT}/' . $GCCToolchain->{BASE} . 'objcopy';
446
        $GCCObjCopy =  '${GCC_ROOT}/' . $GCCToolchain->{BASE} . 'objcopy';
447
        if (exists $GCCToolchain->{RPATH}) {
447
        if (exists $GCCToolchain->{RPATH}) {
448
            if( $GCCToolchain->{RPATH} =~ m~^/~ ) {
448
            if( $GCCToolchain->{RPATH} =~ m~^/~ ) {
449
                $GCCRPath = $GCCToolchain->{RPATH}; 
449
                $GCCRPath = $GCCToolchain->{RPATH};
450
            } else {
450
            } else {
451
                $GCCRPath = '${GCC_ROOT}/' . $GCCToolchain->{RPATH};
451
                $GCCRPath = '${GCC_ROOT}/' . $GCCToolchain->{RPATH};
452
            }
452
            }
453
        }
453
        }
454
        $GCCFlags = $GCCToolchain->{CC_OPTS};
454
        $GCCFlags = $GCCToolchain->{CC_OPTS};
Line 464... Line 464...
464
        $GCCRoot = '/usr';
464
        $GCCRoot = '/usr';
465
        $GCCBin = 'gcc';
465
        $GCCBin = 'gcc';
466
        $GCCAr = 'ar';
466
        $GCCAr = 'ar';
467
        $GCCObjCopy =  'objcopy';
467
        $GCCObjCopy =  'objcopy';
468
    }
468
    }
469
    
469
 
470
    #
470
    #
471
    #   When running under gcov we need to instruct GCC to perform code coverage
471
    #   When running under gcov we need to instruct GCC to perform code coverage
472
    #   generation in both C flags and LD flags
472
    #   generation in both C flags and LD flags
473
    #
473
    #
474
    if ( $UseGcov )
474
    if ( $UseGcov )
475
    {
475
    {
476
        $GCCFlags .= ' -coverage';
476
        $GCCFlags .= ' -coverage';
477
        $LDFlags  .= ' -coverage';
477
        $LDFlags  .= ' -coverage';
478
    }
478
    }
479
    
479
 
480
    #
480
    #
481
    #   When running with cppcheck we need to include it in our environment
481
    #   When running with cppcheck we need to include it in our environment
482
    #
482
    #
483
    if ( $UseCppcheck )
483
    if ( $UseCppcheck )
484
    {
484
    {
485
        ToolsetRequire( "cppcheck" );
485
        ToolsetRequire( "cppcheck" );
486
        PlatformDefine( "CPPCHECK_PLATFORM := unix32" );
486
        PlatformDefine( "CPPCHECK_PLATFORM := unix32" );
487
    }
487
    }
488
        
488
 
489
 
489
 
490
#.. Define GCC environment
490
#.. Define GCC environment
491
#
491
#
492
    PlatformDefine( "
492
    PlatformDefine( "
493
#################################################
493
#################################################
494
# GCC toolchain definitions 
494
# GCC toolchain definitions
495
#
495
#
496
#..");
496
#..");
497
    PlatformDefine( "GCC_TARGET         := $GCCTarget" );
497
    PlatformDefine( "GCC_TARGET         := $GCCTarget" );
498
    PlatformDefine( "GCC_ROOT           := $GCCRoot" );
498
    PlatformDefine( "GCC_ROOT           := $GCCRoot" );
499
    PlatformDefine( "GCC_CC             := $GCCBin" );
499
    PlatformDefine( "GCC_CC             := $GCCBin" );
Line 608... Line 608...
608
            $cflags  = "$cflags \$(SHCFLAGS)";
608
            $cflags  = "$cflags \$(SHCFLAGS)";
609
        } else {
609
        } else {
610
            Message( "CC: unknown option $_ -- ignored\n" );
610
            Message( "CC: unknown option $_ -- ignored\n" );
611
        }
611
        }
612
    }
612
    }
613
                   
-
 
-
 
613
 
614
    MakePrint( "\n\t\$(CC)\n" );
614
    MakePrint( "\n\t\$(CC)\n" );
615
    if ( $cflags )
615
    if ( $cflags )
616
    {                                           # object specific CFLAGS
616
    {                                           # object specific CFLAGS
617
        MakePadded( 4, "\$(OBJDIR)/$obj.$::o:" );
617
        MakePadded( 4, "\$(OBJDIR)/$obj.$::o:" );
618
        MakePrint( "\tCFLAGS +=$cflags\n" );
618
        MakePrint( "\tCFLAGS +=$cflags\n" );
Line 660... Line 660...
660
            $cflags  = "$cflags \$(SHCXXFLAGS)";
660
            $cflags  = "$cflags \$(SHCXXFLAGS)";
661
        } else {
661
        } else {
662
            Message( "CXX: unknown option $_ -- ignored\n" );
662
            Message( "CXX: unknown option $_ -- ignored\n" );
663
        }
663
        }
664
    }
664
    }
665
                   
-
 
-
 
665
 
666
    MakePrint( "\n\t\$(CXX)\n" );
666
    MakePrint( "\n\t\$(CXX)\n" );
667
    if ( $cflags )
667
    if ( $cflags )
668
    {                                           # object specific CFLAGS
668
    {                                           # object specific CFLAGS
669
        MakePadded( 4, "\$(OBJDIR)/$obj.$::o:" );
669
        MakePadded( 4, "\$(OBJDIR)/$obj.$::o:" );
670
        MakePrint( "\tCXXFLAGS +=$cflags\n" );
670
        MakePrint( "\tCXXFLAGS +=$cflags\n" );
Line 796... Line 796...
796
#
796
#
797
#       $(LIBDIR)/shared:   SHNAME=name
797
#       $(LIBDIR)/shared:   SHNAME=name
798
#       $(LIBDIR)/shared:   SHBASE=base
798
#       $(LIBDIR)/shared:   SHBASE=base
799
#       $(LIBDIR)/shared:   $(LIBDIR)/name.dep  \
799
#       $(LIBDIR)/shared:   $(LIBDIR)/name.dep  \
800
#           $(OBJECTS)
800
#           $(OBJECTS)
801
#                           
-
 
-
 
801
#
802
#       ifneq "$(findstring $(IFLAG),23)" ""
802
#       ifneq "$(findstring $(IFLAG),23)" ""
803
#       -include            "$(LIBDIR)/name.dep"
803
#       -include            "$(LIBDIR)/name.dep"
804
#       endif
804
#       endif
805
#
805
#
806
#       name_ld += ...
806
#       name_ld += ...
Line 813... Line 813...
813
    my( $name, $pArgs, $pObjs, $pLibs, $ver ) = @_;
813
    my( $name, $pArgs, $pObjs, $pLibs, $ver ) = @_;
814
    my( $linkname, $soname, $shared, $dbgname, @preReqFiles, @scripts, $multi_scan );
814
    my( $linkname, $soname, $shared, $dbgname, @preReqFiles, @scripts, $multi_scan );
815
    my $sosuffix;
815
    my $sosuffix;
816
    my $noVersionedLib = $::ScmCompilerOpts{'NO_VERSIONED_DLLS'};
816
    my $noVersionedLib = $::ScmCompilerOpts{'NO_VERSIONED_DLLS'};
817
    my $brokenLd = $::ScmCompilerOpts{'BROKEN_LDSCRIPTS'};
817
    my $brokenLd = $::ScmCompilerOpts{'BROKEN_LDSCRIPTS'};
-
 
818
    my $isNodeFile = 0;
818
 
819
 
819
#.. Parse arguments
820
#.. Parse arguments
820
#
821
#
821
    foreach $_ ( @$pArgs )
822
    foreach $_ ( @$pArgs )
822
    {
823
    {
Line 829... Line 830...
829
            my $def = MakeSrcResolve($1);
830
            my $def = MakeSrcResolve($1);
830
 
831
 
831
            if ($brokenLd) {
832
            if ($brokenLd) {
832
                #   The linker cannot handle the linker script
833
                #   The linker cannot handle the linker script
833
                #   The work around is to split the script into two that it can handle
834
                #   The work around is to split the script into two that it can handle
834
                #   Only works with a Linker Script with VERSION and EXTERN entries    
835
                #   Only works with a Linker Script with VERSION and EXTERN entries
835
                my $index = scalar @ldFixups; 
836
                my $index = scalar @ldFixups;
836
                my %data;
837
                my %data;
837
                $data{src} = $def;
838
                $data{src} = $def;
838
                $data{vs} = '$(OBJDIR)/linkscript_' . $index . '.def';
839
                $data{vs} = '$(OBJDIR)/linkscript_' . $index . '.def';
839
                $data{ls} = '$(OBJDIR)/linkscript_' . $index . '.scr';
840
                $data{ls} = '$(OBJDIR)/linkscript_' . $index . '.scr';
840
                push @ldFixups, \%data;
841
                push @ldFixups, \%data;
Line 864... Line 865...
864
            $sosuffix = $1;
865
            $sosuffix = $1;
865
 
866
 
866
        } elsif (/^--NoVersionDll/i) {
867
        } elsif (/^--NoVersionDll/i) {
867
            $noVersionedLib = 1;
868
            $noVersionedLib = 1;
868
 
869
 
-
 
870
        #   A 'node' file is a specific shared library for Electron applications
-
 
871
        #       They have a fixed file extension of .node on all platforms
-
 
872
        #       Do not generate a Versioned DLL
-
 
873
        } elsif (/^--Node$/i) {
-
 
874
            $isNodeFile = 1;
-
 
875
            $noVersionedLib = 1;
869
        } else {
876
        } else {
870
            Message( "SHLD: unknown option $_ -- ignored\n" );
877
            Message( "SHLD: unknown option $_ -- ignored\n" );
871
        }
878
        }
872
    }
879
    }
873
 
880
 
Line 879... Line 886...
879
    $sosuffix = ''
886
    $sosuffix = ''
880
        if ( $noVersionedLib );
887
        if ( $noVersionedLib );
881
 
888
 
882
#.. Various library names
889
#.. Various library names
883
#
890
#
-
 
891
    if ( $isNodeFile ) {
-
 
892
        $linkname = "$name\$(GBE_TYPE)";
-
 
893
        $linkname =~ s/^lib//;
-
 
894
    } else {
884
    $linkname = "$name\$(GBE_TYPE).$::so";
895
        $linkname = "$name\$(GBE_TYPE).$::so";
-
 
896
    }
885
    $shared = $noVersionedLib ? $linkname : "$linkname.$ver";
897
    $shared = $noVersionedLib ? $linkname : "$linkname.$ver";
886
    $soname = "$linkname$sosuffix";
898
    $soname = "$linkname$sosuffix";
887
 
899
 
888
    my $shared_path = "\$(LIBDIR)/${shared}";
900
    my $shared_path = "\$(LIBDIR)/${shared}";
889
    my $dbg_path =  $shared_path . '.dbg';
901
    my $dbg_path =  $shared_path . '.dbg';
Line 915... Line 927...
915
    $io->Prt( "\$(LIBDIR)/${shared}: \\\n\t\t${dep}" );
927
    $io->Prt( "\$(LIBDIR)/${shared}: \\\n\t\t${dep}" );
916
    $io->Entry( "", "", " \\\n\t\t", ".$::o", @$pObjs );
928
    $io->Entry( "", "", " \\\n\t\t", ".$::o", @$pObjs );
917
    $io->Entry( "", "", " \\\n\t\t", "", @preReqFiles );
929
    $io->Entry( "", "", " \\\n\t\t", "", @preReqFiles );
918
    $io->Prt( "\n\t\$(SHLD)" );
930
    $io->Prt( "\n\t\$(SHLD)" );
919
    $io->Prt( "\n\t\$(call LDSTRIP,$shared_path,$dbg_path)\n\n" );
931
    $io->Prt( "\n\t\$(call LDSTRIP,$shared_path,$dbg_path)\n\n" );
920
    
932
 
921
#
933
#
922
#   Create soft links
934
#   Create soft links
923
#       'Real Name' to its 'Link Name'
935
#       'Real Name' to its 'Link Name'
924
#       'Real Name' to 'SoName' in the BINDIR (for testing I think)
936
#       'Real Name' to 'SoName' in the BINDIR (for testing I think)
925
#       'Real Name' to 'SoName' in the LIBDIR (if different)
937
#       'Real Name' to 'SoName' in the LIBDIR (if different)
Line 1109... Line 1121...
1109
    PackageProgAddFiles ( $name, $dbg, "Class=debug" );
1121
    PackageProgAddFiles ( $name, $dbg, "Class=debug" );
1110
 
1122
 
1111
}
1123
}
1112
 
1124
 
1113
  #-------------------------------------------------------------------------------
1125
  #-------------------------------------------------------------------------------
1114
# Function        : ToolsetPostprocess 
1126
# Function        : ToolsetPostprocess
1115
#
1127
#
1116
# Description     : Last chance by the toolset to perform processing
1128
# Description     : Last chance by the toolset to perform processing
1117
#                   All Directives have been processed
1129
#                   All Directives have been processed
1118
#
1130
#
1119
#                   If automated unit test are being used,
1131
#                   If automated unit test are being used,
1120
#                   then we need to post process the results
1132
#                   then we need to post process the results
1121
#
1133
#
1122
# Inputs          : None
1134
# Inputs          : None
1123
#
1135
#
1124
# Returns         : 
1136
# Returns         :
1125
#
1137
#
1126
sub ToolsetPostprocess
1138
sub ToolsetPostprocess
1127
{
1139
{
1128
    ToolsetPreprocessTests();
1140
    ToolsetPreprocessTests();
1129
    ToolsetPostprocessTests();
1141
    ToolsetPostprocessTests();
Line 1132... Line 1144...
1132
}
1144
}
1133
 
1145
 
1134
###############################################################################
1146
###############################################################################
1135
# Function        : ToolsetPreprocessTests
1147
# Function        : ToolsetPreprocessTests
1136
#
1148
#
1137
# Description     : Generate $(OBJDIR)/lcov-baseline.info 
1149
# Description     : Generate $(OBJDIR)/lcov-baseline.info
1138
#                   Generate full coverage info
1150
#                   Generate full coverage info
1139
#
1151
#
1140
# Inputs          : None
1152
# Inputs          : None
1141
#
1153
#
1142
# Returns         : Nothing
1154
# Returns         : Nothing
Line 1148... Line 1160...
1148
    my ($io) = ToolsetPrinter::New();
1160
    my ($io) = ToolsetPrinter::New();
1149
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
1161
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
1150
    {
1162
    {
1151
        #
1163
        #
1152
        #   Setup Env so that the files created by GCOV are within the package
1164
        #   Setup Env so that the files created by GCOV are within the package
1153
        #   being created. Elsewise they will be created all over the file 
1165
        #   being created. Elsewise they will be created all over the file
1154
        #   system in the original location where the external objects were created.
1166
        #   system in the original location where the external objects were created.
1155
        #
1167
        #
1156
        $io->PrtLn('GCOV_PREFIX := $(abspath $(INTERFACEDIR)/gcov)' );
1168
        $io->PrtLn('GCOV_PREFIX := $(abspath $(INTERFACEDIR)/gcov)' );
1157
        $io->PrtLn('GCOV_PREFIX_STRIP := 0' );
1169
        $io->PrtLn('GCOV_PREFIX_STRIP := 0' );
1158
        $io->PrtLn('export GCOV_PREFIX GCOV_PREFIX_STRIP' );
1170
        $io->PrtLn('export GCOV_PREFIX GCOV_PREFIX_STRIP' );
Line 1162... Line 1174...
1162
        #   GCOV_PKGBASE - used to 'extract' coverage artifacts
1174
        #   GCOV_PKGBASE - used to 'extract' coverage artifacts
1163
        #   Used to limit the coverage report to files that are within this package
1175
        #   Used to limit the coverage report to files that are within this package
1164
        #   Ideally it should be the root of the package, but this is not always known
1176
        #   Ideally it should be the root of the package, but this is not always known
1165
        #   Use the first two path elements of the current package
1177
        #   Use the first two path elements of the current package
1166
        #       Really just want to filter out compiler bits
1178
        #       Really just want to filter out compiler bits
1167
        #     
1179
        #
1168
 
1180
 
1169
        $io->PrtLn('GCOV_PKGBASE :=  $(subst $(space),/,$(space)$(wordlist 1,2,$(subst /,$(space),$(CURDIR))))' );
1181
        $io->PrtLn('GCOV_PKGBASE :=  $(subst $(space),/,$(space)$(wordlist 1,2,$(subst /,$(space),$(CURDIR))))' );
1170
        $io->PrtLn('GCOV_VERBOSE :=  $(if $(VERBOSE_OPT),,--quiet)' );
1182
        $io->PrtLn('GCOV_VERBOSE :=  $(if $(VERBOSE_OPT),,--quiet)' );
1171
        $io->Newline();
1183
        $io->Newline();
1172
 
1184
 
1173
        my $ruleName = 'preprocess_gcov_data';
1185
        my $ruleName = 'preprocess_gcov_data';
1174
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1186
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1175
        my $final=$finaldir . '/lcov-final.info';
1187
        my $final=$finaldir . '/lcov-final.info';
1176
        
1188
 
1177
        ToolsetAddUnitTestPreProcess($ruleName);
1189
        ToolsetAddUnitTestPreProcess($ruleName);
1178
        $io->PrtLn('.PHONY: ' . $ruleName );
1190
        $io->PrtLn('.PHONY: ' . $ruleName );
1179
        $io->PrtLn($ruleName . ': $(OBJDIR)' );
1191
        $io->PrtLn($ruleName . ': $(OBJDIR)' );
1180
        $io->PrtLn("\t" . '${XX_PRE}$(rm) -f ${GCOV_PREFIX}/$(CURDIR)/$(OBJDIR)/*.gcda' );
1192
        $io->PrtLn("\t" . '${XX_PRE}$(rm) -f ${GCOV_PREFIX}/$(CURDIR)/$(OBJDIR)/*.gcda' );
1181
        $io->PrtLn("\t" . '${XX_PRE}$(rm) -f $(OBJDIR)/*.gcda' );
1193
        $io->PrtLn("\t" . '${XX_PRE}$(rm) -f $(OBJDIR)/*.gcda' );
Line 1184... Line 1196...
1184
                        . ' $(GCOV_VERBOSE)'
1196
                        . ' $(GCOV_VERBOSE)'
1185
                        . ' --capture'
1197
                        . ' --capture'
1186
                        . ' --initial'
1198
                        . ' --initial'
1187
                        . ' --base-directory $(CURDIR)'
1199
                        . ' --base-directory $(CURDIR)'
1188
                        . ' --directory $(OBJDIR)'
1200
                        . ' --directory $(OBJDIR)'
1189
                        . ' --gcov-tool $(GCC_GCOVTOOL)' 
1201
                        . ' --gcov-tool $(GCC_GCOVTOOL)'
1190
                       . ' --output-file $(OBJDIR)/lcov-baseline.info' );
1202
                       . ' --output-file $(OBJDIR)/lcov-baseline.info' );
1191
        $io->Newline();
1203
        $io->Newline();
1192
        ToolsetGenerate( '$(OBJDIR)/lcov-baseline.info' );
1204
        ToolsetGenerate( '$(OBJDIR)/lcov-baseline.info' );
1193
    }
1205
    }
1194
}
1206
}
Line 1197... Line 1209...
1197
###############################################################################
1209
###############################################################################
1198
# Function        : ToolsetPostprocessTests
1210
# Function        : ToolsetPostprocessTests
1199
#
1211
#
1200
# Description     : Merge this sub-components bits into the the final coverage
1212
# Description     : Merge this sub-components bits into the the final coverage
1201
#                   file in lcov-baseline.info
1213
#                   file in lcov-baseline.info
1202
#                   
1214
#
1203
#                   Need to locate the .gcda files and place them in the same directory
1215
#                   Need to locate the .gcda files and place them in the same directory
1204
#                   as the .gcno files that were created during preprocssing
1216
#                   as the .gcno files that were created during preprocssing
1205
#                   
1217
#
1206
#                   Then we can add our trace bits into the file coverage file
1218
#                   Then we can add our trace bits into the file coverage file
1207
#
1219
#
1208
# Inputs          : None
1220
# Inputs          : None
1209
#
1221
#
1210
# Returns         : Nothing
1222
# Returns         : Nothing
Line 1217... Line 1229...
1217
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
1229
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
1218
    {
1230
    {
1219
        my $ruleName = 'postprocess_gcov_data';
1231
        my $ruleName = 'postprocess_gcov_data';
1220
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1232
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1221
        my $final=$finaldir . '/lcov-final.info';
1233
        my $final=$finaldir . '/lcov-final.info';
1222
        
1234
 
1223
        ToolsetAddUnitTestPostProcess($ruleName);
1235
        ToolsetAddUnitTestPostProcess($ruleName);
1224
 
1236
 
1225
        $io->PrtLn('.PHONY: ' . $ruleName );
1237
        $io->PrtLn('.PHONY: ' . $ruleName );
1226
        $io->PrtLn($ruleName . ':' );
1238
        $io->PrtLn($ruleName . ':' );
1227
        $io->PrtPart("\t" . '$(XX_PRE)if [ -d "${GCOV_PREFIX}/$(CURDIR)/$(OBJDIR)" ]; then' ); 
1239
        $io->PrtPart("\t" . '$(XX_PRE)if [ -d "${GCOV_PREFIX}/$(CURDIR)/$(OBJDIR)" ]; then' );
1228
        $io->PrtPart("\t\t" . 'cd ${GCOV_PREFIX}/$(CURDIR);');
1240
        $io->PrtPart("\t\t" . 'cd ${GCOV_PREFIX}/$(CURDIR);');
1229
        $io->PrtPart("\t\t" . 'find $(OBJDIR) -name \'*.gcda\' -exec cp --parent {} $(CURDIR) \\; ;');
1241
        $io->PrtPart("\t\t" . 'find $(OBJDIR) -name \'*.gcda\' -exec cp --parent {} $(CURDIR) \\; ;');
1230
#        $io->PrtPart("\t" . 'else');
1242
#        $io->PrtPart("\t" . 'else');
1231
#        $io->PrtPart("\t\t" . 'echo NO .gcda DATA for $(CURDIR);');
1243
#        $io->PrtPart("\t\t" . 'echo NO .gcda DATA for $(CURDIR);');
1232
        $io->PrtLn  ("\t" . 'fi' );
1244
        $io->PrtLn  ("\t" . 'fi' );
1233
        $io->PrtLn  ("\t" . '$(XX_PRE)$(mkdir) -p ' . $finaldir);
1245
        $io->PrtLn  ("\t" . '$(XX_PRE)$(mkdir) -p ' . $finaldir);
1234
        $io->PrtPart("\t" . '$(XX_PRE)GCDA_COUNT=$$(find $(OBJDIR) -name "*.gcda" | wc -l);' ); 
1246
        $io->PrtPart("\t" . '$(XX_PRE)GCDA_COUNT=$$(find $(OBJDIR) -name "*.gcda" | wc -l);' );
1235
        $io->PrtPart("\t" . 'if [ "$${GCDA_COUNT}" -eq "0" ]; then ');
1247
        $io->PrtPart("\t" . 'if [ "$${GCDA_COUNT}" -eq "0" ]; then ');
1236
        $io->PrtPart("\t\t" . 'if [ ! -e ' . $final . " ]; then");
1248
        $io->PrtPart("\t\t" . 'if [ ! -e ' . $final . " ]; then");
1237
        $io->PrtPart("\t\t\t" . '$(cp) $(OBJDIR)/lcov-baseline.info ' . $final . ';');
1249
        $io->PrtPart("\t\t\t" . '$(cp) $(OBJDIR)/lcov-baseline.info ' . $final . ';');
1238
        $io->PrtPart("\t\t" . 'else');
1250
        $io->PrtPart("\t\t" . 'else');
1239
        $io->PrtPart("\t\t\t" . 'lcov'
1251
        $io->PrtPart("\t\t\t" . 'lcov'
1240
                          . ' $(GCOV_VERBOSE)'
1252
                          . ' $(GCOV_VERBOSE)'
1241
                          . $LcovExplicitBranch
1253
                          . $LcovExplicitBranch
1242
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1254
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1243
                          . ' --add-tracefile ' . $final
1255
                          . ' --add-tracefile ' . $final
1244
                          . ' --gcov-tool $(GCC_GCOVTOOL)' 
1256
                          . ' --gcov-tool $(GCC_GCOVTOOL)'
1245
                          . ' --output-file $(OBJDIR)/lcov-merge.info'
1257
                          . ' --output-file $(OBJDIR)/lcov-merge.info'
1246
                          . ';'); 
1258
                          . ';');
1247
        $io->PrtPart("\t\t\t" . '$(rm) -f ' . $final . ';');
1259
        $io->PrtPart("\t\t\t" . '$(rm) -f ' . $final . ';');
1248
        $io->PrtPart("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . ';');
1260
        $io->PrtPart("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . ';');
1249
        $io->PrtPart("\t\t" . 'fi' . ';');
1261
        $io->PrtPart("\t\t" . 'fi' . ';');
1250
        $io->PrtPart("\t" . 'else');
1262
        $io->PrtPart("\t" . 'else');
1251
        $io->PrtPart("\t\t" . 'lcov'
1263
        $io->PrtPart("\t\t" . 'lcov'
1252
                        . ' $(GCOV_VERBOSE)'
1264
                        . ' $(GCOV_VERBOSE)'
1253
                        . $LcovExplicitBranch
1265
                        . $LcovExplicitBranch
1254
                        . ' --capture'
1266
                        . ' --capture'
1255
                        . ' --base-directory $(CURDIR)'
1267
                        . ' --base-directory $(CURDIR)'
1256
                        . ' --directory $(OBJDIR)'
1268
                        . ' --directory $(OBJDIR)'
1257
                        . ' --gcov-tool $(GCC_GCOVTOOL)' 
1269
                        . ' --gcov-tool $(GCC_GCOVTOOL)'
1258
                        . ' --output-file $(OBJDIR)/lcov-capture.info' 
1270
                        . ' --output-file $(OBJDIR)/lcov-capture.info'
1259
                        . ';'); 
1271
                        . ';');
1260
        $io->PrtPart("\t\t" . 'if [ ! -e ' . $final . " ]; then");
1272
        $io->PrtPart("\t\t" . 'if [ ! -e ' . $final . " ]; then");
1261
        $io->PrtPart("\t\t\t" . 'lcov'
1273
        $io->PrtPart("\t\t\t" . 'lcov'
1262
                          . ' $(GCOV_VERBOSE)'
1274
                          . ' $(GCOV_VERBOSE)'
1263
                          . $LcovExplicitBranch
1275
                          . $LcovExplicitBranch
1264
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1276
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1265
                          . ' --add-tracefile $(OBJDIR)/lcov-capture.info'
1277
                          . ' --add-tracefile $(OBJDIR)/lcov-capture.info'
1266
                          . ' --gcov-tool $(GCC_GCOVTOOL)' 
1278
                          . ' --gcov-tool $(GCC_GCOVTOOL)'
1267
                          . ' --output-file ' .  $final
1279
                          . ' --output-file ' .  $final
1268
                          . ';'); 
1280
                          . ';');
1269
        $io->PrtPart("\t\t" . 'else');
1281
        $io->PrtPart("\t\t" . 'else');
1270
        $io->PrtPart("\t\t\t" . 'lcov'
1282
        $io->PrtPart("\t\t\t" . 'lcov'
1271
                          . ' $(GCOV_VERBOSE)'
1283
                          . ' $(GCOV_VERBOSE)'
1272
                          . $LcovExplicitBranch
1284
                          . $LcovExplicitBranch
1273
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1285
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
1274
                          . ' --add-tracefile $(OBJDIR)/lcov-capture.info'
1286
                          . ' --add-tracefile $(OBJDIR)/lcov-capture.info'
1275
                          . ' --add-tracefile ' . $final
1287
                          . ' --add-tracefile ' . $final
1276
                          . ' --gcov-tool $(GCC_GCOVTOOL)' 
1288
                          . ' --gcov-tool $(GCC_GCOVTOOL)'
1277
                          . ' --output-file $(OBJDIR)/lcov-merge.info'
1289
                          . ' --output-file $(OBJDIR)/lcov-merge.info'
1278
                          . ';'); 
1290
                          . ';');
1279
        $io->PrtPart("\t\t\t" . '$(rm) -f ' . $final . ';');
1291
        $io->PrtPart("\t\t\t" . '$(rm) -f ' . $final . ';');
1280
        $io->PrtPart("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . ';');
1292
        $io->PrtPart("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . ';');
1281
        $io->PrtPart("\t\t" . 'fi' . ';');
1293
        $io->PrtPart("\t\t" . 'fi' . ';');
1282
        $io->PrtLn  ("\t" . 'fi');
1294
        $io->PrtLn  ("\t" . 'fi');
1283
        $io->Newline();
1295
        $io->Newline();
Line 1299... Line 1311...
1299
#
1311
#
1300
# Inputs          : None
1312
# Inputs          : None
1301
#
1313
#
1302
# Returns         : Nothing
1314
# Returns         : Nothing
1303
#
1315
#
1304
# Output:         : Rules and recipes to run after unit test result 
1316
# Output:         : Rules and recipes to run after unit test result
1305
#                   postprocessing.
1317
#                   postprocessing.
1306
#
1318
#
1307
sub ToolsetCollateTestResults
1319
sub ToolsetCollateTestResults
1308
{
1320
{
1309
    my ($io) = ToolsetPrinter::New();
1321
    my ($io) = ToolsetPrinter::New();
Line 1318... Line 1330...
1318
        ToolsetGenerate ( $final );
1330
        ToolsetGenerate ( $final );
1319
        ToolsetGenerate ( $finalTmp );
1331
        ToolsetGenerate ( $finalTmp );
1320
        ToolsetGenerate ( $finalTmp1 );
1332
        ToolsetGenerate ( $finalTmp1 );
1321
 
1333
 
1322
        ToolsetAddUnitTestCollateProcess($ruleName);
1334
        ToolsetAddUnitTestCollateProcess($ruleName);
1323
        
1335
 
1324
        my $reportdir='$(PKGDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1336
        my $reportdir='$(PKGDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
1325
        my $reportindex=$reportdir . '/index.html';
1337
        my $reportindex=$reportdir . '/index.html';
1326
        $io->PrtLn('.PHONY: ' . $ruleName );
1338
        $io->PrtLn('.PHONY: ' . $ruleName );
1327
        $io->PrtLn($ruleName . ': ' . $reportindex);
1339
        $io->PrtLn($ruleName . ': ' . $reportindex);
1328
 
1340
 
Line 1330... Line 1342...
1330
        $io->PrtLn($reportindex . ': ' . $final);
1342
        $io->PrtLn($reportindex . ': ' . $final);
1331
        $io->PrtPart("\t" . 'lcov'
1343
        $io->PrtPart("\t" . 'lcov'
1332
                        . ' $(GCOV_VERBOSE)'
1344
                        . ' $(GCOV_VERBOSE)'
1333
                        . $LcovExplicitBranch
1345
                        . $LcovExplicitBranch
1334
                        . ' --extract '. $final .' "$(GCOV_PKGBASE)/*"'
1346
                        . ' --extract '. $final .' "$(GCOV_PKGBASE)/*"'
1335
                        . ' --gcov-tool $(GCC_GCOVTOOL)' 
1347
                        . ' --gcov-tool $(GCC_GCOVTOOL)'
1336
                        . ' --output-file ' . $finalTmp
1348
                        . ' --output-file ' . $finalTmp
1337
                        . ';'); 
1349
                        . ';');
1338
        $io->PrtPart("\t" . 'lcov'
1350
        $io->PrtPart("\t" . 'lcov'
1339
                        . ' $(GCOV_VERBOSE)'
1351
                        . ' $(GCOV_VERBOSE)'
1340
                        . $LcovExplicitBranch
1352
                        . $LcovExplicitBranch
1341
                        . ' --remove '. $finalTmp .' "$(abspath $(INTERFACEDIR))/*"'
1353
                        . ' --remove '. $finalTmp .' "$(abspath $(INTERFACEDIR))/*"'
1342
                        . ' --gcov-tool $(GCC_GCOVTOOL)' 
1354
                        . ' --gcov-tool $(GCC_GCOVTOOL)'
1343
                        . ' --output-file ' .$finalTmp1
1355
                        . ' --output-file ' .$finalTmp1
1344
                        . ';'); 
1356
                        . ';');
1345
        $io->PrtLn("\t" . 'genhtml'
1357
        $io->PrtLn("\t" . 'genhtml'
1346
                      . ' $(GCOV_VERBOSE)'
1358
                      . ' $(GCOV_VERBOSE)'
1347
                      . ' --frames'
1359
                      . ' --frames'
1348
                      . ' --show-details'
1360
                      . ' --show-details'
1349
                      . ' --function-coverage'
1361
                      . ' --function-coverage'
1350
                      . ' --branch-coverage'
1362
                      . ' --branch-coverage'
1351
                      . ' --output-directory ' . $reportdir
1363
                      . ' --output-directory ' . $reportdir
1352
                      . ' --legend'
1364
                      . ' --legend'
1353
                      . ' --demangle-cpp' 
1365
                      . ' --demangle-cpp'
1354
                      . ' --title "$(GBE_PBASE) $(BUILDVER)"'
1366
                      . ' --title "$(GBE_PBASE) $(BUILDVER)"'
1355
                      . ' ' . $finalTmp1);
1367
                      . ' ' . $finalTmp1);
1356
        $io->Newline();
1368
        $io->Newline();
1357
    }
1369
    }
1358
}
1370
}
1359
 
1371
 
1360
#-------------------------------------------------------------------------------
1372
#-------------------------------------------------------------------------------
1361
# Function        : ToolsetGenLdScripts 
1373
# Function        : ToolsetGenLdScripts
1362
#
1374
#
1363
# Description     : Generate Linker (ld) scripts to to support the Broken Linker
1375
# Description     : Generate Linker (ld) scripts to to support the Broken Linker
1364
#                   Enabled via BROKEN_LDSCRIPTS
1376
#                   Enabled via BROKEN_LDSCRIPTS
1365
#                   The linker cannot handle a linkerscript with a 'VERSION" section
1377
#                   The linker cannot handle a linkerscript with a 'VERSION" section
1366
#                   The linker can handle a linker script with an EXTERN section
1378
#                   The linker can handle a linker script with an EXTERN section
1367
#                   and a --version-script
1379
#                   and a --version-script
1368
#                   
1380
#
1369
#                   This workaround will take the linker script and break it into two
1381
#                   This workaround will take the linker script and break it into two
1370
#                   parts. This must be done at make-time in case the linker script is
1382
#                   parts. This must be done at make-time in case the linker script is
1371
#                   generated.
1383
#                   generated.
1372
#                   
1384
#
1373
#                   Use a feature of Pattern Rules. Handling of multiple targets
1385
#                   Use a feature of Pattern Rules. Handling of multiple targets
1374
#                   The pattern (%) is a '.'. 
1386
#                   The pattern (%) is a '.'.
1375
#                   It may be substituted as $* in the output.
1387
#                   It may be substituted as $* in the output.
1376
#                   
1388
#
1377
#                   file1%out file2%out : infile
1389
#                   file1%out file2%out : infile
1378
#                       SomeProg file1$*out file2$*out      - Using pattern substitution
1390
#                       SomeProg file1$*out file2$*out      - Using pattern substitution
1379
#                       SomeProg file1.out file2.out        - Alternate command
1391
#                       SomeProg file1.out file2.out        - Alternate command
1380
#                   
1392
#
1381
# Inputs          : None 
1393
# Inputs          : None
1382
#
1394
#
1383
# Returns         : Nothing
1395
# Returns         : Nothing
1384
#
1396
#
1385
sub ToolsetGenLdScripts
1397
sub ToolsetGenLdScripts
1386
{
1398
{
Line 1486... Line 1498...
1486
}
1498
}
1487
 
1499
 
1488
 
1500
 
1489
########################################################################
1501
########################################################################
1490
#
1502
#
1491
#   Generate a linker object recipe.  This is a helper function used 
1503
#   Generate a linker object recipe.  This is a helper function used
1492
#   within this toolset.
1504
#   within this toolset.
1493
#
1505
#
1494
#   Arguments:
1506
#   Arguments:
1495
#       $io         I/O stream
1507
#       $io         I/O stream
1496
#
1508
#
Line 1529... Line 1541...
1529
    my ($io, $target, $lib, $dp) = @_;
1541
    my ($io, $target, $lib, $dp) = @_;
1530
 
1542
 
1531
    if ( ! defined($dp) ) {                     # linker
1543
    if ( ! defined($dp) ) {                     # linker
1532
        $lib =~ s/^lib//;                       # .. remove leading 'lib'
1544
        $lib =~ s/^lib//;                       # .. remove leading 'lib'
1533
        $io->Cmd( "-l$lib" );
1545
        $io->Cmd( "-l$lib" );
1534
    
1546
 
1535
    } else {                                    # depend
1547
    } else {                                    # depend
1536
        $io->Cmd( "$dp:\t@(vlib2,$lib,GCC_LIB)" );
1548
        $io->Cmd( "$dp:\t@(vlib2,$lib,GCC_LIB)" );
1537
 
1549
 
1538
    }
1550
    }
1539
}
1551
}