Subversion Repositories DevTools

Rev

Rev 6133 | Blame | Last modification | View Log | RSS feed

###############################################################################
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
#
# File:         PLATFORM/LMOS_DEVLINUX.cfg
#
# Contents:     LMOS_DEVLINUX Build support
#
#               This package is used during the processing of the build.pl file
#               Values provided by this package are used to extend the Platform
#               information as platforms are being created. This provides a
#               powerful set of mechanism to extend the entire JATS toolset
#
###############################################################################

use strict;
use warnings;

package LMOS_DEVLINUX_Build;
use JatsError;
use Storable qw(dclone);

#-------------------------------------------------------------------------------
# Function        : new_platform
#
# Description     : Called when a new platform is being created
#                   The function can extend the build information
#
#                   The 'LINUX' platform will be converted into a 'suitable'
#                   platform for the current machine.
#
# Inputs          : $pInfo          - Reference to the platform build info hash
#
# Returns         : Nothing yet
#

sub new_platform
{
    my $class = shift;              # Not really a class, but its called like a class
    my $pInfo  = shift;

    #
    #   Get the list of targets that have been tagged as LMOS and DEVLINUX
    #
    my @targets;   
    my @lmosTargets = PlatformConfig::getTargetsByTag('LMOS');
    my @devLinuxTargets = PlatformConfig::getTargetsByTag('DEVLINUX');

    my %lmosTargetsMap = map {$_ => 1} @lmosTargets;
    foreach ( @devLinuxTargets )
    {
        if (exists $lmosTargetsMap{$_} )
        {
            push @targets, $_;
        }
    }
    
    #
    #   Ignore this platform if there is no way that it can be built on the
    #   current machine.
    #
    unless ( @targets )
    {
        Verbose ("LMOS_DEVLINUX will not build on this machine type: $::GBE_MACHTYPE");
        $pInfo->{NOT_AVAILABLE} = 1;
        return;
    }

    #
    #   Instantiate all targets
    #
    foreach my $target ( @targets )
    {
        LMOS_DEVLINUX_generic(  dclone($pInfo), 'LMOS_' . $target );
    }

    #
    #   All done
    #   Mark the original entry as a TEMPLATE so that it won't be added
    #   We have added cloned copies of it
    #
    $pInfo->{TEMPLATE} = 1;
}

#-------------------------------------------------------------------------------
# Function        : LMOS_DEVLINUX_generic
#
# Description     : Take a clone of the buildinfo structure and specialise it
#                   for the required target
#
# Inputs          : $pInfo       - A clone of the buildinfo data
#                   $target      - Name of the target platform
#
# Returns         : Nothing
#                   The buildinfo MUST be added to the build system
#
sub LMOS_DEVLINUX_generic
{
    my ($pInfo, $target) = @_;
    Debug("LMOS_DEVLINUX_generic: $target");

    #
    #   Request that a simple BuildAlias be created for this platform
    #   Use the original name of the TARGET
    #
    $pInfo->{ALIAS} = $pInfo->{TARGET};

#    #
#    #   Specify the hardware family
#    #   Will be used to create an ALIAS
#    #
#    $pInfo->{HARDWARE} = uc($arch);
    
    #
    #   Alter the 'TARGET' name
    #   This is allowed (expected)
    #
    $pInfo->{TARGET} = uc($target);

    #
    #   Register this 'new' buildinfo entry with the build system
    #
    ::AddBuildPlatformEntry( $pInfo );
}

1;