Subversion Repositories DevTools

Rev

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

Rev 4699 Rev 4700
Line 124... Line 124...
124
#
124
#
125
my %NativeCompilers = (
125
my %NativeCompilers = (
126
    'Linux i386'       => 'linux_i386',
126
    'Linux i386'       => 'linux_i386',
127
    );
127
    );
128
 
128
 
-
 
129
my $UseGcov = 0;
-
 
130
 
129
##############################################################################
131
##############################################################################
130
#   ToolsetInit()
132
#   ToolsetInit()
131
#       Runtime initialisation
133
#       Runtime initialisation
132
#
134
#
133
##############################################################################
135
##############################################################################
Line 135... Line 137...
135
ToolsetInit();
137
ToolsetInit();
136
 
138
 
137
sub ToolsetInit
139
sub ToolsetInit
138
{
140
{
139
    my( $GCCTarget, $GCCToolchain, $GCCRoot, $GCCBin, $GCCAr, $GCCObjCopy );
141
    my( $GCCTarget, $GCCToolchain, $GCCRoot, $GCCBin, $GCCAr, $GCCObjCopy );
140
    my( $GCCFlags,  $GCCFlagsP, $GCCFlagsD );
142
    my( $GCCFlags,  $GCCFlagsP, $GCCFlagsD, $LDFlags );
141
    my( $PkgArch);
143
    my( $PkgArch);
142
    my( $arg_alias, $tools_found, $compiler_tool );
144
    my( $arg_alias, $tools_found, $compiler_tool );
143
 
145
 
144
#.. Toolset configuration
146
#.. Toolset configuration
145
#
147
#
Line 164... Line 166...
164
            $GCCTarget = "$1";
166
            $GCCTarget = "$1";
165
 
167
 
166
        } elsif (/^--CrossAlias=(.*)/) {        # CrossCompiler target-alias
168
        } elsif (/^--CrossAlias=(.*)/) {        # CrossCompiler target-alias
167
            $arg_alias = $1;
169
            $arg_alias = $1;
168
 
170
 
-
 
171
        } elsif (/^--UseGcov/) {                # Compile for code coverage
-
 
172
            $UseGcov = 1;
-
 
173
 
169
        } elsif (/^--CompilerTool=(.*)/) {      # CrossCompiler located in package
174
        } elsif (/^--CompilerTool=(.*)/) {      # CrossCompiler located in package
170
            $compiler_tool = $1;
175
            $compiler_tool = $1;
171
 
176
 
172
        } else {
177
        } else {
173
            Message( "gcc toolset: unknown option $_ -- ignored\n" );
178
            Message( "gcc toolset: unknown option $_ -- ignored\n" );
Line 326... Line 331...
326
        $GCCRoot = '/usr';
331
        $GCCRoot = '/usr';
327
        $GCCBin = 'gcc';
332
        $GCCBin = 'gcc';
328
        $GCCAr = 'ar';
333
        $GCCAr = 'ar';
329
        $GCCObjCopy =  'objcopy';
334
        $GCCObjCopy =  'objcopy';
330
    }
335
    }
-
 
336
    
-
 
337
    #
-
 
338
    #   When running under gcov we need to instruct GCC to perform code coverage
-
 
339
    #   generation in both C flags and LD flags
-
 
340
    #
-
 
341
    if ( $UseGcov )
-
 
342
    {
-
 
343
        $GCCFlags=$GCCFlags . ' -coverage';
-
 
344
        $LDFlags=$LDFlags . ' -coverage';
-
 
345
    }
-
 
346
        
331
 
347
 
332
#.. Define GCC environment
348
#.. Define GCC environment
333
#
349
#
334
    PlatformDefine( "
350
    PlatformDefine( "
335
#################################################
351
#################################################
Line 342... Line 358...
342
    PlatformDefine( "GCC_AR             := $GCCAr" );
358
    PlatformDefine( "GCC_AR             := $GCCAr" );
343
    PlatformDefine( "GCC_OBJCOPY        := $GCCObjCopy" );
359
    PlatformDefine( "GCC_OBJCOPY        := $GCCObjCopy" );
344
    PlatformDefine( "GCC_CFLAGS         := $GCCFlags" ) if defined $GCCFlags;
360
    PlatformDefine( "GCC_CFLAGS         := $GCCFlags" ) if defined $GCCFlags;
345
    PlatformDefine( "GCC_CFLAGSP        := $GCCFlagsP" ) if defined $GCCFlagsP;
361
    PlatformDefine( "GCC_CFLAGSP        := $GCCFlagsP" ) if defined $GCCFlagsP;
346
    PlatformDefine( "GCC_CFLAGSD        := $GCCFlagsD" ) if defined $GCCFlagsD;
362
    PlatformDefine( "GCC_CFLAGSD        := $GCCFlagsD" ) if defined $GCCFlagsD;
-
 
363
    PlatformDefine( "GCC_LDFLAGS        := $LDFlags" ) if defined $LDFlags;
347
 
364
 
348
    #
365
    #
349
    #   Required since this toolset advertises: ScmToolsetCompilerPath
366
    #   Required since this toolset advertises: ScmToolsetCompilerPath
350
    #
367
    #
351
    PlatformDefine( "SCM_COMPILERPATH   := \$\{GCC_CC\}" );
368
    PlatformDefine( "SCM_COMPILERPATH   := \$\{GCC_CC\}" );
Line 899... Line 916...
899
    PackageProgAddFiles ( $name, $dbg );
916
    PackageProgAddFiles ( $name, $dbg );
900
 
917
 
901
}
918
}
902
 
919
 
903
 
920
 
-
 
921
###############################################################################
-
 
922
# Function        : ToolsetPreprocessTests
-
 
923
#
-
 
924
# Description     : 
-
 
925
#
-
 
926
# Inputs          : None
-
 
927
#
-
 
928
# Returns         : Nothing
-
 
929
#
-
 
930
# Output:         : Rules and recipes to run before unit tests
-
 
931
#
-
 
932
sub ToolsetPreprocessTests
-
 
933
{
-
 
934
    my ($io) = ToolsetPrinter::New();
-
 
935
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
-
 
936
    {
-
 
937
        my $key;
-
 
938
        my $value;
-
 
939
        while(($key, $value) = each(%::OBJSOURCE))
-
 
940
        {
-
 
941
            Verbose("$key ==> $value");
-
 
942
            $io->Prt("\t" . '$(XX_PRE)rm -f $(OBJDIR)/' . $key . ".gcda\n");
-
 
943
        }
-
 
944
        $io->Prt("\t" . '${XX_PRE}lcov'
-
 
945
                      . ' --capture'
-
 
946
                      . ' --initial'
-
 
947
                      . ' --base-directory ' . $::Cwd
-
 
948
                      . ' --directory $(OBJDIR)'
-
 
949
                      . ' --output-file $(OBJDIR)/lcov-baseline.info' 
-
 
950
                      . "\n"); 
-
 
951
    }
-
 
952
}
-
 
953
 
-
 
954
 
-
 
955
###############################################################################
-
 
956
# Function        : ToolsetPostprocessTests
-
 
957
#
-
 
958
# Description     : 
-
 
959
#
-
 
960
# Inputs          : None
-
 
961
#
-
 
962
# Returns         : Nothing
-
 
963
#
-
 
964
# Output:         : Rules and recipes to run after the unit tests
-
 
965
#
-
 
966
sub ToolsetPostprocessTests
-
 
967
{
-
 
968
    my ($io) = ToolsetPrinter::New();
-
 
969
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
-
 
970
    {
-
 
971
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
-
 
972
        my $final=$finaldir . '/lcov-final.info';
-
 
973
        
-
 
974
        $io->Prt("\t" . '$(eval GCDA_COUNT := $(shell find $(OBJDIR) -name "*.gcda"))' . "\n");
-
 
975
        
-
 
976
        $io->Prt("\t" . '$(XX_PRE)$(mkdir) -p ' . $finaldir . "\n");
-
 
977
        $io->Prt("\t" . '$(XX_PRE)if [ "$(GCDA_COUNT)" = "" ]; then' . " \\\n");
-
 
978
        $io->Prt("\t\t" . 'if [ ! -e ' . $final . " ]; then \\\n");
-
 
979
        $io->Prt("\t\t\t" . '$(cp) $(OBJDIR)/lcov-baseline.info ' . $final . "; \\\n");
-
 
980
        $io->Prt("\t\t" . 'else' . " \\\n");
-
 
981
        $io->Prt("\t\t\t" . 'lcov'
-
 
982
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
-
 
983
                          . ' --add-tracefile ' . $final
-
 
984
                          . ' --output-file $(OBJDIR)/lcov-merge.info'
-
 
985
                          . "; \\\n"); 
-
 
986
        $io->Prt("\t\t\t" . '$(rm) -f ' . $final . "; \\\n");
-
 
987
        $io->Prt("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . "; \\\n");
-
 
988
        $io->Prt("\t\t" . 'fi' . "; \\\n");
-
 
989
        $io->Prt("\t" . 'else' . " \\\n");
-
 
990
        $io->Prt("\t\t" . 'lcov'
-
 
991
                        . ' --capture'
-
 
992
                        . ' --base-directory ' . $::Cwd
-
 
993
                        . ' --directory $(OBJDIR)'
-
 
994
                        . ' --output-file $(OBJDIR)/lcov-capture.info' 
-
 
995
                        . "; \\\n"); 
-
 
996
        $io->Prt("\t\t" . 'if [ ! -e ' . $final . " ]; then \\\n");
-
 
997
        $io->Prt("\t\t\t" . 'lcov'
-
 
998
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
-
 
999
                          . ' --add-tracefile $(OBJDIR)/lcov-capture.info'
-
 
1000
                          . ' --output-file ' .  $final
-
 
1001
                          . "; \\\n"); 
-
 
1002
        $io->Prt("\t\t" . 'else' . " \\\n");
-
 
1003
        $io->Prt("\t\t\t" . 'lcov'
-
 
1004
                          . ' --add-tracefile $(OBJDIR)/lcov-baseline.info'
-
 
1005
                          . ' --add-tracefile $(OBJDIR)/lcov-capture.info'
-
 
1006
                          . ' --add-tracefile ' . $final
-
 
1007
                          . ' --output-file $(OBJDIR)/lcov-merge.info'
-
 
1008
                          . "; \\\n"); 
-
 
1009
        $io->Prt("\t\t\t" . '$(rm) -f ' . $final . "; \\\n");
-
 
1010
        $io->Prt("\t\t\t" . '$(mv) $(OBJDIR)/lcov-merge.info ' . $final . "; \\\n");
-
 
1011
        $io->Prt("\t\t" . 'fi' . "; \\\n");
-
 
1012
        $io->Prt("\t" . 'fi' . " \n");
-
 
1013
    }
-
 
1014
}
-
 
1015
 
-
 
1016
 
-
 
1017
 
-
 
1018
###############################################################################
-
 
1019
# Function        : ToolsetCollateTestResults
-
 
1020
#
-
 
1021
# Description     : 
-
 
1022
#
-
 
1023
# Inputs          : None
-
 
1024
#
-
 
1025
# Returns         : Nothing
-
 
1026
#
-
 
1027
# Output:         : Rules and recipes to run after unit test result 
-
 
1028
#                   postprocessing.
-
 
1029
#
-
 
1030
sub ToolsetCollateTestResults
-
 
1031
{
-
 
1032
    my ($io) = ToolsetPrinter::New();
-
 
1033
    if ( $UseGcov && scalar(keys %::OBJSOURCE) > 0 )
-
 
1034
    {
-
 
1035
        my $finaldir='$(LOCALDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
-
 
1036
        my $final=$finaldir . '/lcov-final.info';
-
 
1037
        
-
 
1038
        my $reportdir='$(PKGDIR)/lcov/$(GBE_PLATFORM)$(GBE_TYPE)';
-
 
1039
        my $reportindex=$reportdir . '/index.html';
-
 
1040
        
-
 
1041
        $io->Prt('collate_test_results: ' . $reportindex . "\n");
-
 
1042
        $io->Prt($reportindex . ': ' . $final . "\n");
-
 
1043
        $io->Prt("\t" . 'genhtml'
-
 
1044
                      . ' --frames'
-
 
1045
                      . ' --show-details'
-
 
1046
                      . ' --output-directory ' . $reportdir
-
 
1047
                      . ' --legend'
-
 
1048
                      . ' --demangle-cpp'
-
 
1049
                      . ' ' . $final
-
 
1050
                      . "\n");
-
 
1051
    }
-
 
1052
}
-
 
1053
 
904
########################################################################
1054
########################################################################
905
#
1055
#
906
#   Push standard "system" libraries. This is a helper function
1056
#   Push standard "system" libraries. This is a helper function
907
#   used within this toolset.
1057
#   used within this toolset.
908
#
1058
#