Subversion Repositories DevTools

Rev

Rev 4700 | Rev 4726 | Go to most recent revision | Details | Compare with Previous | 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' => [
4109 dpurdie 38
        'ANDROIDARM',
39
        'ANDROIDMIPS',
40
        'ANDROIDX86',
4324 dpurdie 41
        'ANDROID',
4109 dpurdie 42
        'ARM9TDMI',
337 dpurdie 43
        'COBRA',
4109 dpurdie 44
        'JAVA',
279 dpurdie 45
        'LINUX86',
46
        'LINUX_ARMV4',
47
        'LINUX_EMU',
48
        'LINUX_ETX',
49
        'LINUX_I386',
4109 dpurdie 50
        'PPC_603E',
51
        'SK20',
3967 dpurdie 52
        'UBUNTU12',
4700 alewis 53
        'UBUNTU12_INSTRUMENT',
279 dpurdie 54
        ],
55
 
4162 dpurdie 56
    'linux_x64' => [
57
        'LINUX_I386',
58
        ],
59
 
279 dpurdie 60
    'solaris10_sparc32' => [
61
        'SOLARIS10_SPARC32',
62
        'SOLARIS10_SPARC64',
63
        'JAVA',
64
        ],
65
 
66
    'solaris10_x86' => [
67
        'SOLARIS10_X64',
68
        'SOLARIS10_X86',
69
        'JAVA',
70
        ],
71
 
72
    'sparc' => [
281 dpurdie 73
        'SOLARIS',
279 dpurdie 74
        'SOLARIS_I386',
75
        'SOLARIS_SPARC',
76
        'JAVA',
77
        ],
78
 
79
    'win32' => [
80
        'ACEX',
81
        'AMX',
363 dpurdie 82
        'ARM_I5100',
279 dpurdie 83
        'AVR_IAR',
84
        'BORLAND',
85
        'CMOS386',
86
        'CMOS68K',
87
        'CSHARP',
88
        'CSHARP2005',
291 dpurdie 89
        'CSHARP2008',
347 dpurdie 90
        'CSHARP2010',
4192 dpurdie 91
        'CSHARP2012',
279 dpurdie 92
        'DAFBR_MOS',
93
        'DAFBR_WIN',
289 dpurdie 94
        'DELPHI7',
279 dpurdie 95
        'DF4OBE',
96
        'DOS16',
97
        'DOS32',
98
        'EEPP386',
99
        'EETP386',
100
        'EOS',
101
        'EOSM68K',
102
        'EOSP386',
103
        'GMPCA',
104
        'GO32',
105
        'H8S',
283 dpurdie 106
        'H400',
279 dpurdie 107
        'HK386PC',
108
        'HKAVM',
109
        'HKAVM2',
110
        'HKBCP',
111
        'HKDDU',
112
        'HKGAK',
113
        'HKMPR',
114
        'HKPCA',
115
        'INGEN',
3832 dpurdie 116
        'INTELLECT',
279 dpurdie 117
        'JAVA',
118
        'MCR',
119
        'MERG',
120
        'MOS68K',
121
        'MOS68KRM',
122
        'MOSCF',
123
        'MPT',
3564 dpurdie 124
        'VSDEVRC',
279 dpurdie 125
        'NGBCP',
126
        'NGDDU',
127
        'PHARLAP',
345 dpurdie 128
        'PHP',
371 dpurdie 129
        'RIORDS',
279 dpurdie 130
        'THYRON',
315 dpurdie 131
        'VB6',
279 dpurdie 132
        'VERIX',
383 dpurdie 133
        'VIXITP',
279 dpurdie 134
        'VS2003',
135
        'VS2005',
291 dpurdie 136
        'VS2008',
347 dpurdie 137
        'VS2010',
4192 dpurdie 138
        'VS2012',
355 dpurdie 139
        'WCEIPA280',
279 dpurdie 140
        'WCEIT3000',
399 dpurdie 141
        'WCENAUTIZX5',
279 dpurdie 142
        'WCEPA961',
143
        'WCEPA962',
144
        'WCEPA962_500',
145
        'WCEPCM7220',
146
        'WCEPSION_420',
147
        'WCEPSION_500',
148
        'WCEPSION_500_emu',
303 dpurdie 149
        'WCEPSION_500_VS2005',
279 dpurdie 150
        'WCEPSPC_arm',
151
        'WCEPSPC_emu',
152
        'WCEX86A420',
153
        'WCEX86A500',
154
        'WCEX86A500_SOM4455',
155
        'WIN32',
156
        ],
157
);
158
 
159
#
4551 dpurdie 160
#   Convert Machine Type to Machine Class
161
#       These match the Release Manager and BuildTool definitions
162
#       Used for GENERIC Processing
163
#
164
my %MachineTypeToClass = (
165
      linux_i386        => 'LINUX',
166
      linux_x64         => 'LINUX',
167
      solaris10_sparc32 => 'SOLARIS',
168
      solaris10_x86     => 'SOLARIS',
169
      sparc             => 'SOLARIS',
170
      win32             => 'WIN32',
171
);
172
#
279 dpurdie 173
#   The above data will be reorganised and placed into the following
174
#   hash. This simplifies the data definition and lookup
175
#
176
my %BuildAvailabilityData;
177
 
4725 dpurdie 178
#   A hash of 'special' known targets
179
#   Simply used to reduce JATS warnings about some psuedo targets
4551 dpurdie 180
my %knownSpecial;
181
 
279 dpurdie 182
#-------------------------------------------------------------------------------
183
# Function        : InitData
184
#
185
# Description     : Init data structures
186
#                   Done once
187
#
4551 dpurdie 188
#                   Convert the $BuildAvailability entry array into a hash to 
189
#                   simplify lookup. Add in thr three types of GENERIC target:
190
#                       GENERIC         - can be built on ANY machine
191
#                       GENERIC_XXX     - can be built on machine of class XXX
192
#                       MACH_YYY        - can be built on MACHTYPE YYY
279 dpurdie 193
#
194
# Inputs          : None
195
#
196
# Returns         : Nothing
197
#
198
sub InitData
199
{
200
    #
201
    #   Only do this work once
202
    #
203
    return if exists $BuildAvailabilityData{'GENERIC'};
204
 
205
    #
206
    #   Validate build machine
207
    #
208
    Error (__PACKAGE__ . " : Unknown build machine type: $::GBE_MACHTYPE")
209
        unless ( exists $BuildAvailability{$::GBE_MACHTYPE} );
210
 
211
    #
4551 dpurdie 212
    #   Convert the array into a hash to speed up access later
279 dpurdie 213
    #
4551 dpurdie 214
    $BuildAvailabilityData{'GENERIC'} = 2;
279 dpurdie 215
    foreach ( @{$BuildAvailability{$::GBE_MACHTYPE}}  )
216
    {
217
        $BuildAvailabilityData{$_} = 1;
218
    }
4551 dpurdie 219
 
220
#   #
221
#   #   Insert GENERIC_<MachClass>
222
#   #
223
#   Error (__PACKAGE__ . " : Unknown build machine class: $::GBE_MACHTYPE")
224
#       unless ( exists $MachineTypeToClass{$::GBE_MACHTYPE} );
225
#   $BuildAvailabilityData{join('_','GENERIC', $MachineTypeToClass{$::GBE_MACHTYPE} )} = 2;
226
#
227
#   #
228
#   #   Insert MachType definition
229
#   #   These are of the form MACH_xxxx
230
#   #
231
#   $BuildAvailabilityData{join('_','MACH', uc($::GBE_MACHTYPE) )} = 2;
232
#
233
#   #
234
#   #   Create a hash of special 'known' targets
235
#   #
236
   $knownSpecial{'GENERIC'} = 2;
237
#   foreach my $machtype ( keys %MachineTypeToClass ) {
238
#       $knownSpecial{join('_','MACH', uc($machtype) )} = 2;
239
#       $knownSpecial{join('_','GENERIC', $MachineTypeToClass{$machtype} )} = 2;
240
#   }
279 dpurdie 241
}
242
 
243
#-------------------------------------------------------------------------------
244
# Function        : checkBuildAvailability
245
#
246
# Description     : Check that a given target can be be built on the
4551 dpurdie 247
#                   current machine type. Also indicate if it is a GENERIC
248
#                   target; one that can always be built.
279 dpurdie 249
#
250
# Inputs          : $target             - Name of target platform
251
#
252
#
4551 dpurdie 253
# Returns         : 0                   - target cannot be built
254
#                   1                   - target can be built, subject to build filter
255
#                   2                   - target can be built, is Generic           
279 dpurdie 256
#
257
sub checkBuildAvailability
258
{
259
    my ($target) = @_;
4551 dpurdie 260
    Error("Internal: checkBuildAvailability. No argument specified") unless $target;
261
 
279 dpurdie 262
    InitData();
4551 dpurdie 263
    if (exists $BuildAvailabilityData{$target})
264
    {
265
        return $BuildAvailabilityData{$target} ;
266
    }
267
    return 0;
279 dpurdie 268
}
269
 
4551 dpurdie 270
#-------------------------------------------------------------------------------
271
# Function        : checkKnownSpecial
272
#
273
# Description     : Check that a given (special) target is known to JATS
274
#                   Used to suppress warnings about GENERIC targets not known
275
#                   to the current machine type.
276
#
277
# Inputs          : $target             - Name of target platform
278
#
279
#
280
# Returns         : 0                   - target not known
281
#                   1                   - target is known to JATS
282
#
283
sub checkKnownSpecial
284
{
285
    my ($target) = @_;
286
    Error("Internal: checkKnown. No argument specified") unless $target;
287
 
288
    InitData();
289
    if (exists $knownSpecial{$target})
290
    {
291
        return $knownSpecial{$target} ;
292
    }
293
    return 0;
294
}
295
 
296
 
279 dpurdie 297
1;
298