Subversion Repositories DevTools

Rev

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

########################################################################
# Copyright (C) 2008 ERG Limited, All rights reserved
#
# Module name   : PLATFORM_CFG.PM
# Module type   : Makefile system
# Compiler(s)   : Perl
# Environment(s): jats
#
# Description   : Provides platform configuration information
#
#                 The main pupose of this configuration information is to
#                 prevent JATS from attempting to build software on
#                 a platform that does not support the required compilers
#
#                 ie: Its not possible to build PPC_302E on a windows
#                     Nor is it possbile to build WIN32 on a Sun Sparc
#
#                 This can be done via GBE_BUILDFILTER, but results in
#                 an unwieldy GBE_BUILDFILTER. Better to prune the
#                 targets at the start
#
#......................................................................#

require 5.008_002;
use strict;
use warnings;

package PlatformConfig;
use JatsError;

#
#   The following structure is a hash of arrays
#   The hash key is a supported machine type - one per machine
#   The data is an array of supported PLATFORMS
#
my %BuildAvailability = (
    'linux_i386' => [
        'ARM9TDMI',
        'LINUX86',
        'LINUX_ARMV4',
        'LINUX_EMU',
        'LINUX_ETX',
        'LINUX_I386',
        'PPC_603E',
        ],

    'solaris10_sparc32' => [
        'SOLARIS10_SPARC32',
        'SOLARIS10_SPARC64',
        'JAVA',
        ],

    'solaris10_x86' => [
        'SOLARIS10_X64',
        'SOLARIS10_X86',
        'JAVA',
        ],

    'sparc' => [
        'SOLARIS',
        'SOLARIS_I386',
        'SOLARIS_SPARC',
        'JAVA',
        ],

    'win32' => [
        'ACEX',
        'AMX',
        'AVR_IAR',
        'BORLAND',
        'CMOS386',
        'CMOS68K',
        'CSHARP',
        'CSHARP2005',
        'DAFBR_MOS',
        'DAFBR_WIN',
        'DF4OBE',
        'DOS16',
        'DOS32',
        'EEPP386',
        'EETP386',
        'EOS',
        'EOSM68K',
        'EOSP386',
        'GMPCA',
        'GO32',
        'H8S',
        'H400',
        'HK386PC',
        'HKAVM',
        'HKAVM2',
        'HKBCP',
        'HKDDU',
        'HKGAK',
        'HKMPR',
        'HKPCA',
        'INGEN',
        'JAVA',
        'MCR',
        'MERG',
        'MOS68K',
        'MOS68KRM',
        'MOSCF',
        'MPT',
        'NGBCP',
        'NGDDU',
        'PHARLAP',
        'THYRON',
        'VERIX',
        'VS2003',
        'VS2005',
        'WCEIT3000',
        'WCEPA961',
        'WCEPA962',
        'WCEPA962_500',
        'WCEPCM7220',
        'WCEPSION_420',
        'WCEPSION_500',
        'WCEPSION_500_emu',
        'WCEPSPC_arm',
        'WCEPSPC_emu',
        'WCEX86A420',
        'WCEX86A500',
        'WCEX86A500_SOM4455',
        'WIN32',
        ],
);

#
#   The above data will be reorganised and placed into the following
#   hash. This simplifies the data definition and lookup
#
my %BuildAvailabilityData;

#-------------------------------------------------------------------------------
# Function        : InitData
#
# Description     : Init data structures
#                   Done once
#
#                   Convert an array into a hash to simplify lookup
#
# Inputs          : None
#
# Returns         : Nothing
#
sub InitData
{
    #
    #   Only do this work once
    #
    return if exists $BuildAvailabilityData{'GENERIC'};

    #
    #   Validate build machine
    #
    Error (__PACKAGE__ . " : Unknown build machine type: $::GBE_MACHTYPE")
        unless ( exists $BuildAvailability{$::GBE_MACHTYPE} );

    #
    #   Convert the array into a hash to spped up access later
    #
    $BuildAvailabilityData{'GENERIC'} = 1;
    foreach ( @{$BuildAvailability{$::GBE_MACHTYPE}}  )
    {
        $BuildAvailabilityData{$_} = 1;
    }
}

#-------------------------------------------------------------------------------
# Function        : checkBuildAvailability
#
# Description     : Check that a given target can be be built on the
#                   current machine type
#
# Inputs          : $target             - Name of target platform
#
#
# Returns         : True if Target can be built on current machine
#
sub checkBuildAvailability
{
    my ($target) = @_;
    InitData();
    return exists $BuildAvailabilityData{$target};
}

1;