Subversion Repositories DevTools

Rev

Rev 227 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

# -*- mode: perl; tabs: 8; indent-width: 4; show-tabs: yes; -*-
#
# Module name   : TOOLSET/gnupro_h8
# Module type   : Makefile system
# Environment(s):
#
# Description:
#   Cygnus C/C++ toolset
#   A very simple toolset to support
#       1) C/C++ compiliation
#       2) Generation of libaries
#       3) Merging of libraries
#
#   Does not support ( because its not needed )
#       a) Shared libraries
#       b) Executables
#       c) Assembler files
#
# Version   Who   Date     Description
#           DDP   23-Nov-04 Created
#............................................................................#

##############################################################################
#   ToolsetInit()
#       Runtime initialisation
#
##############################################################################

ToolsetInit();

sub ToolsetInit
{
    my $GnuProVersion = "2.95.2 19991024";

#.. Parse arguments
#
    foreach $_ ( @args ) {
        Message( "gnupro_h8: unknown option $_ -- ignored\n" );
    }

#.. Standard.rul requirements
#
    $s = 'asm';
    $o = 'o';
    $a = 'a';
    $exe = "";

#.. Define environment
#
    Init( "gnupro_h8" );

    ToolsetDefine( "#################################################" );
    ToolsetDefine( "# Compiler version" );
    ToolsetDefine( "#" );
    ToolsetDefine( "GnuPro_Version      = \"$GnuProVersion\"" );
    ToolsetDefine( "" );
    ToolsetDefine( "#" );

    ToolsetDefines( "gnupro_h8.def" );
    ToolsetRules  ( "gnupro_h8.rul" );
    ToolsetRules  ( "standard.rul" );
}


###############################################################################
#   ToolsetCC( $source, $obj, \@args )
#       This subroutine takes the user options and builds the rule(s)
#       required to compile the source file 'source' to 'obj'
#
###############################################################################

sub ToolsetCC
{
    my( $source, $obj, $pArgs ) = @_;

    Debug( "CC:  $source -> $obj" );
    foreach ( @$pArgs ) {
        Debug( "option:    $_" );
        if ( /--Shared$/ ) {                    # Building a 'shared' object
            $cflags = "$cflags \$(SHCFLAGS)";
            Debug( "CC:    as shared object" );
        } else {                                # unknown option
            Message( "CC: unknown option $_ -- ignored\n" );
        }
    }

    MakePrint( "\n\t\$(CC)\n" );
    MakePrint( "\$(OBJDIR)/$i.${o}:\tCFLAGS +=$cflags\n" )
        if ( $cflags );
}

###############################################################################
#   ToolsetCCDepend( $depend, \@sources )
#       This subroutine takes the user options and builds the
#       rule(s) required to build the dependencies for the source
#       files 'sources' to 'depend'.
#
###############################################################################

sub ToolsetCCDepend
{
    MakePrint( "\t\$(CCDEPEND)\n" );
}


###############################################################################
#   ToolsetCXX( $source, $obj, \@args )
#       This subroutine takes the user options and builds the rule(s)
#       required to compile the source file 'source' to 'obj'
#
###############################################################################

sub ToolsetCXX
{
    my( $source, $obj, $pArgs ) = @_;
    my( $cflags ) = "";

    Debug( "CCX: $source -> $obj" );
    foreach ( @$pArgs ) {
        Debug( "option:    $_" );
        if ( /--Shared$/ ) {                    # Building a 'shared' object
            $cflags = "$cflags \$(SHCXXFLAGS)";
            Debug( "CCX:    as shared object" );
        } else {
            Message( "CCX: unknown option $_ -- ignored\n" );
        }
    }

    MakePrint( "\n\t\$(CXX)\n" );
    MakePrint( "\$(OBJDIR)/$i.${o}:\tCXXFLAGS +=$cflags\n" )
        if ( $cflags );
}


###############################################################################
#   ToolsetCXXDepend( $depend, \@sources )
#       This subroutine takes the user options and builds the
#       rule(s) required to build the dependencies for the source
#       files 'sources' to 'depend'.
#
###############################################################################

sub ToolsetCXXDepend
{
    #ToolsetCCDepend() handles both CC and CXX source
}



###############################################################################
#   ToolsetAR( $name, \@args, \@objs )
#       This subroutine takes the user options and builds the rules
#       required to build the library 'name'.
#
#   Arguments:
#       n/a
#
#   Output:
#       [ $(BINDIR)/name$.${a}:   .... ]
#           $(AR)
#
###############################################################################

sub ToolsetAR
{
    my( $name, $pArgs, $pObjs ) = @_;

#.. Parse arguments
#
    foreach $_ ( @$pArgs ) 
    {
        Message( "AR: unknown option $_ -- ignored\n" );
    }

#
    MakeEntry( "\$(LIBDIR)/$name\$(GBE_TYPE).${a}:\t", "", " \\\n\t\t", ".${o}", @$pObjs );

#.. Build library rule (just append to standard rule)
#
    MakePrint( "\n\t\$(AR)\n\n" );
}


###############################################################################
#   ToolsetARMerge()
#       Generate the recipe to merge libraries.
#       The dependency list is created by the caller.
#
###############################################################################

sub ToolsetARMerge
{
    MakePrint( "\n\t\$(ARMERGE)\n\n" );
}


#.. Successful termination
1;