Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
279 dpurdie 1
########################################################################
2
# Copyright (C) 2008 ERG Limited, All rights reserved
3
#
4
# Module name   : PLATFORM_CFG.PM
5
# Module type   : Makefile system
6
# Compiler(s)   : Perl
7
# Environment(s): jats
8
#
9
# Description   : Provides platform configuration information
10
#
11
#                 The main pupose of this configuration information is to
12
#                 prevent JATS from attempting to build software on
13
#                 a platform that does not support the required compilers
14
#
15
#                 ie: Its not possible to build PPC_302E on a windows
16
#                     Nor is it possbile to build WIN32 on a Sun Sparc
17
#
18
#                 This can be done via GBE_BUILDFILTER, but results in
19
#                 an unwieldy GBE_BUILDFILTER. Better to prune the
20
#                 targets at the start
21
#
22
#......................................................................#
23
 
24
require 5.008_002;
25
use strict;
26
use warnings;
27
 
28
package PlatformConfig;
29
use JatsError;
30
 
31
#
32
#   The following structure is a hash of arrays
33
#   The hash key is a supported machine type - one per machine
34
#   The data is an array of supported PLATFORMS
35
#
36
my %BuildAvailability = (
37
    'linux_i386' => [
38
        'ARM9TDMI',
39
        'LINUX86',
40
        'LINUX_ARMV4',
41
        'LINUX_EMU',
42
        'LINUX_ETX',
43
        'LINUX_I386',
44
        'PPC_603E',
45
        ],
46
 
47
    'solaris10_sparc32' => [
48
        'SOLARIS10_SPARC32',
49
        'SOLARIS10_SPARC64',
50
        'JAVA',
51
        ],
52
 
53
    'solaris10_x86' => [
54
        'SOLARIS10_X64',
55
        'SOLARIS10_X86',
56
        'JAVA',
57
        ],
58
 
59
    'sparc' => [
281 dpurdie 60
        'SOLARIS',
279 dpurdie 61
        'SOLARIS_I386',
62
        'SOLARIS_SPARC',
63
        'JAVA',
64
        ],
65
 
66
    'win32' => [
67
        'ACEX',
68
        'AMX',
69
        'AVR_IAR',
70
        'BORLAND',
71
        'CMOS386',
72
        'CMOS68K',
73
        'CSHARP',
74
        'CSHARP2005',
75
        'DAFBR_MOS',
76
        'DAFBR_WIN',
77
        'DF4OBE',
78
        'DOS16',
79
        'DOS32',
80
        'EEPP386',
81
        'EETP386',
82
        'EOS',
83
        'EOSM68K',
84
        'EOSP386',
85
        'GMPCA',
86
        'GO32',
87
        'H8S',
283 dpurdie 88
        'H400',
279 dpurdie 89
        'HK386PC',
90
        'HKAVM',
91
        'HKAVM2',
92
        'HKBCP',
93
        'HKDDU',
94
        'HKGAK',
95
        'HKMPR',
96
        'HKPCA',
97
        'INGEN',
98
        'JAVA',
99
        'MCR',
100
        'MERG',
101
        'MOS68K',
102
        'MOS68KRM',
103
        'MOSCF',
104
        'MPT',
105
        'NGBCP',
106
        'NGDDU',
107
        'PHARLAP',
108
        'THYRON',
109
        'VERIX',
110
        'VS2003',
111
        'VS2005',
112
        'WCEIT3000',
113
        'WCEPA961',
114
        'WCEPA962',
115
        'WCEPA962_500',
116
        'WCEPCM7220',
117
        'WCEPSION_420',
118
        'WCEPSION_500',
119
        'WCEPSION_500_emu',
120
        'WCEPSPC_arm',
121
        'WCEPSPC_emu',
122
        'WCEX86A420',
123
        'WCEX86A500',
124
        'WCEX86A500_SOM4455',
125
        'WIN32',
126
        ],
127
);
128
 
129
#
130
#   The above data will be reorganised and placed into the following
131
#   hash. This simplifies the data definition and lookup
132
#
133
my %BuildAvailabilityData;
134
 
135
#-------------------------------------------------------------------------------
136
# Function        : InitData
137
#
138
# Description     : Init data structures
139
#                   Done once
140
#
141
#                   Convert an array into a hash to simplify lookup
142
#
143
# Inputs          : None
144
#
145
# Returns         : Nothing
146
#
147
sub InitData
148
{
149
    #
150
    #   Only do this work once
151
    #
152
    return if exists $BuildAvailabilityData{'GENERIC'};
153
 
154
    #
155
    #   Validate build machine
156
    #
157
    Error (__PACKAGE__ . " : Unknown build machine type: $::GBE_MACHTYPE")
158
        unless ( exists $BuildAvailability{$::GBE_MACHTYPE} );
159
 
160
    #
161
    #   Convert the array into a hash to spped up access later
162
    #
163
    $BuildAvailabilityData{'GENERIC'} = 1;
164
    foreach ( @{$BuildAvailability{$::GBE_MACHTYPE}}  )
165
    {
166
        $BuildAvailabilityData{$_} = 1;
167
    }
168
}
169
 
170
#-------------------------------------------------------------------------------
171
# Function        : checkBuildAvailability
172
#
173
# Description     : Check that a given target can be be built on the
174
#                   current machine type
175
#
176
# Inputs          : $target             - Name of target platform
177
#
178
#
179
# Returns         : True if Target can be built on current machine
180
#
181
sub checkBuildAvailability
182
{
183
    my ($target) = @_;
184
    InitData();
185
    return exists $BuildAvailabilityData{$target};
186
}
187
 
188
1;
189