|
1 # Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 # All rights reserved. |
|
3 # This component and the accompanying materials are made available |
|
4 # under the terms of "Eclipse Public License v1.0" |
|
5 # which accompanies this distribution, and is available |
|
6 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 # |
|
8 # Initial Contributors: |
|
9 # Nokia Corporation - initial contribution. |
|
10 # |
|
11 # Contributors: |
|
12 # |
|
13 # Description: |
|
14 # Processes an mmp file and sets up subroutines to return the data |
|
15 # |
|
16 # |
|
17 |
|
18 package Mmp; |
|
19 |
|
20 require Exporter; |
|
21 @ISA=qw(Exporter); |
|
22 |
|
23 @EXPORT=qw( |
|
24 Mmp_SetVerbose |
|
25 Mmp_ProcessL |
|
26 |
|
27 Mmp_ABI |
|
28 Mmp_AifStruct |
|
29 Mmp_AllowDllData |
|
30 Mmp_CompressTarget |
|
31 Mmp_ASSPExports |
|
32 Mmp_ASSPLibList |
|
33 Mmp_BuildAsARM |
|
34 Mmp_BitMapStruct |
|
35 Mmp_CallDllEntryPoints |
|
36 Mmp_Capability |
|
37 Mmp_CapabilityFlags |
|
38 Mmp_DataLinkAddress |
|
39 Mmp_DebugLibList |
|
40 Mmp_Def |
|
41 Mmp_DocHash |
|
42 Mmp_ExportUnfrozen |
|
43 Mmp_FirstLib |
|
44 Mmp_FixedProcess |
|
45 Mmp_HeapSize |
|
46 Mmp_LibList |
|
47 Mmp_LinkAs |
|
48 Mmp_LinkAsBase |
|
49 Mmp_ExportLibrary |
|
50 Mmp_NewLib |
|
51 Mmp_NoExportLibrary |
|
52 Mmp_Macros |
|
53 Mmp_MmpFlag |
|
54 Mmp_PlatTxt2D |
|
55 Mmp_ProcessPriority |
|
56 Mmp_ResourceStruct |
|
57 Mmp_SmpSafe |
|
58 Mmp_RamTargets |
|
59 Mmp_RomTargets |
|
60 Mmp_SourceStruct |
|
61 Mmp_StackSize |
|
62 Mmp_StatLibList |
|
63 Mmp_SysIncPaths |
|
64 Mmp_Trg |
|
65 Mmp_TrgType |
|
66 Mmp_UidList |
|
67 Mmp_UserIncPaths |
|
68 Mmp_SrcDbg |
|
69 Mmp_StdCpp |
|
70 Mmp_NoStdCpp |
|
71 Mmp_WarningLevel |
|
72 Mmp_LinkerOptions |
|
73 Mmp_Reset |
|
74 Mmp_Uids |
|
75 Mmp_Version |
|
76 Mmp_SecureId |
|
77 Mmp_VendorId |
|
78 Mmp_Replace |
|
79 Mmp_ARMFPU |
|
80 Mmp_SetIgnoreMissingDef |
|
81 Mmp_StringTable |
|
82 Mmp_CompressTargetMode |
|
83 Mmp_CodePagingTargetMode |
|
84 Mmp_DataPagingTargetMode |
|
85 Mmp_CheckSourceMMPMetaData |
|
86 Mmp_CheckSourceMMPIncludes |
|
87 Mmp_IsWideCharMain |
|
88 Mmp_IsDebuggable |
|
89 Mmp_IsFeatureVariant |
|
90 Mmp_TestedMacros |
|
91 ); |
|
92 |
|
93 |
|
94 use Genutl; |
|
95 use Prepfile; |
|
96 use Pathutl; |
|
97 use Trgtype; |
|
98 use CheckSource; |
|
99 use Cwd; |
|
100 |
|
101 my %ProcessPriorityNames = ( |
|
102 LOW=>'Low', |
|
103 BACKGROUND=>'Background', |
|
104 FOREGROUND=>'Foreground', |
|
105 HIGH=>'High', |
|
106 WINDOWSERVER=>'WindowServer', |
|
107 FILESERVER=>'FileServer', |
|
108 REALTIMESERVER=>'RealTimeServer', |
|
109 SUPERVISOR=>'SuperVisor' |
|
110 ); |
|
111 |
|
112 my %CapabilityNames; |
|
113 |
|
114 my %Mode; |
|
115 |
|
116 my $ABI; |
|
117 my @AifStruct; |
|
118 my $AllowDllData=0; |
|
119 |
|
120 use constant COMPRESS => 0; |
|
121 use constant NOCOMPRESS => 1; |
|
122 my $CompressTarget=COMPRESS; # compress the target binary (negative logic) |
|
123 use constant NOCOMPRESSIONMETHOD => 0; |
|
124 use constant INFLATECOMPRESSIONMETHOD => 1; |
|
125 use constant BYTEPAIRCOMPRESSIONMETHOD => 2; |
|
126 my $CompressTargetMethod=NOCOMPRESSIONMETHOD; #NONE |
|
127 |
|
128 my $ASSPABISwitch=0; |
|
129 my $ASSPExports=0; |
|
130 my @ASSPLibList; |
|
131 my @BitMapStruct; |
|
132 my $BuildAsARM=0; |
|
133 my $CallDllEntryPoints=0; |
|
134 my $Capability; |
|
135 my @CapabilityFlags=(0,0); |
|
136 my %CurSource; |
|
137 my $DataLinkAddress=''; |
|
138 my @DebugLibList; |
|
139 my %Def; |
|
140 $Def{Path}=''; |
|
141 $Def{Base}=''; |
|
142 $Def{Ext}=''; |
|
143 my %DocHash; |
|
144 my $ExportUnfrozen=0; |
|
145 my $FirstLib; |
|
146 my $FixedProcess=0; |
|
147 my %HeapSize; |
|
148 my @LangList; |
|
149 my @LibList; |
|
150 my $LinkAs; |
|
151 my $LinkAsBase; |
|
152 my $ExportLibrary; |
|
153 my $NoExportLibrary; |
|
154 my @Macros; |
|
155 my %MmpFlag; |
|
156 my $NewLib; |
|
157 my @PlatTxt2D; |
|
158 my $ProcessPriority=''; |
|
159 my @ResourceStruct; |
|
160 my @RamTargets; |
|
161 my @RomTargets=({}); # include default |
|
162 my $SmpSafe = 0; |
|
163 my @SourceStruct; |
|
164 my $StackSize=''; |
|
165 my @StatLibList; |
|
166 my $StdCpp = 0; |
|
167 my $NoStdCpp = 0; |
|
168 my @SysIncPaths; |
|
169 my $Trg; |
|
170 my %TrgType; |
|
171 my @UidList; |
|
172 my @UserIncPaths; |
|
173 my $SrcDbg=0; |
|
174 my %Compiler; |
|
175 my %LinkerOptions; |
|
176 my %Version; |
|
177 my $SecureId; |
|
178 my $VendorId; |
|
179 my %Replace; |
|
180 my $ARMFPU; |
|
181 my $IgnoreMissingDef=0; |
|
182 my @StringTableStruct; |
|
183 my $CodePagingTargetMode; # 0-N/A, 1-UNPAGED, 2-PAGED |
|
184 my $DataPagingTargetMode; # 0-N/A, 1-UNPAGED, 2-PAGED |
|
185 my $WideCharMain=0; |
|
186 my $IsDebuggable; # 0-NON_DEBUGGABLE, 1-DEBUGGABLE,2-DEBUGGABLE_UDEBONLY |
|
187 my $FeatureVariant=0; |
|
188 use constant NOTPAGED => 0; |
|
189 use constant UNPAGED => 1; |
|
190 use constant PAGED => 2; |
|
191 use constant NON_DEBUGGABLE => 0; |
|
192 use constant DEBUGGABLE => 1; |
|
193 use constant DEBUGGABLE_UDEBONLY => 2; |
|
194 my %CheckSourceMMPMetaData; |
|
195 my %CheckSourceMMPIncludes; |
|
196 my %mmptestedMacrosHash; |
|
197 |
|
198 # List of deprecated 2nd UIDs. These are checked in a Secure Platform |
|
199 my %deprecatedUIDs= |
|
200 ( |
|
201 "0x10005e32" => "Unmigrated FEP detected from use of UID 0x10005e32 ", |
|
202 "0x10004cc1" => "Unmigrated Application Initaliser (CEikLibrary deriver) detected from use of UID 0x10004cc1 ", |
|
203 "0x10003a30" => "Unmigrated Conarc plugin detected from use of UID 0x10003a30", |
|
204 "0x10003a19" => "Unmigrated Recogniser detected from use of UID 0x10003a19", |
|
205 "0x10003a37" => "Unmigrated Recogniser detected from use of UID 0x10003a37", |
|
206 "0x10003a34" => "Unmigrated CTL detected from use of UID 0x10003a34" |
|
207 ); |
|
208 |
|
209 |
|
210 sub Mmp_Reset() { |
|
211 undef $ABI; |
|
212 undef @AifStruct; |
|
213 $AllowDllData=0; |
|
214 $CompressTarget=COMPRESS; |
|
215 $CompressTargetMethod=NOCOMPRESSIONMETHOD; |
|
216 $ASSPABISwitch=0; |
|
217 $ASSPExports=0; |
|
218 $BuildAsARM=0; |
|
219 undef @ASSPLibList; |
|
220 undef @BitMapStruct; |
|
221 $CallDllEntryPoints=0; |
|
222 undef $Capability; |
|
223 @CapabilityFlags=(0,0); |
|
224 undef $VendorId; |
|
225 $DataLinkAddress=''; |
|
226 undef @DebugLibList; |
|
227 undef %Def; |
|
228 $Def{Path}=''; |
|
229 $Def{Base}=''; |
|
230 $Def{Ext}=''; |
|
231 undef %DocHash; |
|
232 $ExportUnfrozen=0; |
|
233 undef $FirstLib; |
|
234 $FixedProcess=0; |
|
235 undef %HeapSize; |
|
236 undef @LangList; |
|
237 undef @LibList; |
|
238 undef $LinkAs; |
|
239 undef $LinkAsBase; |
|
240 undef $ExportLibrary; |
|
241 undef @Macros; |
|
242 undef %MmpFlag; |
|
243 undef $NewLib; |
|
244 undef @PlatTxt2D; |
|
245 $ProcessPriority=''; |
|
246 undef @ResourceStruct; |
|
247 undef @RamTargets; |
|
248 @RomTargets=({}); # include default |
|
249 undef @SourceStruct; |
|
250 $StackSize=''; |
|
251 undef @StatLibList; |
|
252 $SmpSafe = 0; |
|
253 $StdCpp = 0; |
|
254 $NoStdCpp = 0; |
|
255 undef @SysIncPaths; |
|
256 undef $Trg; |
|
257 undef %TrgType; |
|
258 undef @UidList; |
|
259 undef @UserIncPaths; |
|
260 $SrcDbg=0; |
|
261 undef %Compiler; |
|
262 undef %LinkerOptions; |
|
263 undef %Version; |
|
264 $IgnoreMissingDef=0; |
|
265 undef $ARMFPU; |
|
266 undef @StringTableStruct; |
|
267 $CodePagingTargetMode=0; # default N/A |
|
268 $DataPagingTargetMode=0; # default N/A |
|
269 $IsDebuggable=0; # Default = 0 (Not debuggable) |
|
270 undef %mmptestedMacrosHash; |
|
271 } |
|
272 |
|
273 BEGIN { |
|
274 $Mode{'Verbose'}=0; |
|
275 |
|
276 %CapabilityNames = ( |
|
277 |
|
278 TCB => (1<<0), |
|
279 COMMDD => (1<<1), |
|
280 POWERMGMT => (1<<2), |
|
281 MULTIMEDIADD => (1<<3), |
|
282 READDEVICEDATA => (1<<4), |
|
283 WRITEDEVICEDATA => (1<<5), |
|
284 DRM => (1<<6), |
|
285 TRUSTEDUI => (1<<7), |
|
286 PROTSERV => (1<<8), |
|
287 DISKADMIN => (1<<9), |
|
288 NETWORKCONTROL => (1<<10), |
|
289 ALLFILES => (1<<11), |
|
290 SWEVENT => (1<<12), |
|
291 NETWORKSERVICES => (1<<13), |
|
292 LOCALSERVICES => (1<<14), |
|
293 READUSERDATA => (1<<15), |
|
294 WRITEUSERDATA => (1<<16), |
|
295 LOCATION => (1<<17), |
|
296 SURROUNDINGSDD => (1<<18), |
|
297 USERENVIRONMENT => (1<<19), |
|
298 #old capability names have zero value |
|
299 ROOT => 0, |
|
300 MEDIADD => 0, |
|
301 READSYSTEMDATA => 0, |
|
302 WRITESYSTEMDATA => 0, |
|
303 SOUNDDD => 0, |
|
304 UIDD => 0, |
|
305 KILLANYPROCESS => 0, |
|
306 DEVMAN => 0, |
|
307 PHONENETWORK => 0, |
|
308 LOCALNETWORK => 0 |
|
309 ); |
|
310 my $all=0; |
|
311 foreach (keys %CapabilityNames) |
|
312 { |
|
313 $all = $all | $CapabilityNames{$_}; |
|
314 } |
|
315 $CapabilityNames{"ALL"} = $all; |
|
316 } |
|
317 |
|
318 sub Mmp_SetVerbose () { |
|
319 $Mode{'Verbose'}=1; |
|
320 } |
|
321 |
|
322 sub Mmp_SetIgnoreMissingDef() { |
|
323 $IgnoreMissingDef = 1; |
|
324 } |
|
325 |
|
326 sub Mmp_ProcessL ($$$$) { |
|
327 my ($EPOCPath, $MMPFILE, $Plat_ref, $BuildIncList)=@_; |
|
328 my $emulator = $$Plat_ref{OS} ne 'EPOC32'; |
|
329 |
|
330 if ($Mode{Verbose}) { |
|
331 &Prepfile_SetVerbose; |
|
332 } |
|
333 |
|
334 # Generate macro usage information and add variant build includes |
|
335 my $options = '-dU'; |
|
336 foreach ( @$BuildIncList ) |
|
337 { |
|
338 $options .= ' -I ' . &Path_PrefixWithDriveAndQuote($_); |
|
339 } |
|
340 |
|
341 # preprocess the project description file |
|
342 my @Mmp2D; |
|
343 Prepfile_SetCmdOptions($options); |
|
344 eval { &Prepfile_ProcessL(\@Mmp2D, $MMPFILE, &main::VariantFile(), @{$$Plat_ref{MmpMacros}}); }; |
|
345 Prepfile_SetCmdOptions(''); |
|
346 die $@ if $@; |
|
347 |
|
348 my @checkSourceMacros; |
|
349 foreach (@{$$Plat_ref{MmpMacros}}) { |
|
350 $_=uc $_; |
|
351 push @checkSourceMacros, " $_=_____$_"; |
|
352 } |
|
353 |
|
354 my $current = cwd; |
|
355 $current =~ s/\//\\/g; |
|
356 $current =~ s/^[a-zA-Z]://; |
|
357 |
|
358 # Mimic what the current parsing routine does in terms of include paths and .mmp files |
|
359 my @checkSourceUserIncludePaths; |
|
360 push @checkSourceUserIncludePaths, "$ENV{EPOCROOT}epoc32\\include"; |
|
361 push @checkSourceUserIncludePaths, "\."; |
|
362 push @checkSourceUserIncludePaths, $current; |
|
363 my @checkSourceSystemIncludePaths = (); |
|
364 |
|
365 CheckSource_Includes($MMPFILE, %CheckSourceMMPIncludes, &main::VariantFile(), @checkSourceMacros, @checkSourceUserIncludePaths, @checkSourceSystemIncludePaths, $CheckSource_NoUserSystemDistinction); |
|
366 |
|
367 my $NoStrictDef=0; |
|
368 my $TrgPath=''; |
|
369 my $TrgType; |
|
370 |
|
371 my $MmpPath=&Path_Split('Path', $MMPFILE); |
|
372 |
|
373 my @MmpDie=(); |
|
374 my @MmpWarn=(); |
|
375 my @MmpDiagnostic=(); |
|
376 my @MmpMigrationNote=(); |
|
377 |
|
378 my (%CheckAif, %CheckASSPLib, %CheckDoc, %CheckLang, %CheckLib, %CheckMacro, %CheckResrc, %CheckSrc, %CheckStatLib, %CheckSysInc, %CheckSysResrc, %CheckUserInc); |
|
379 |
|
380 my ($CheckDef); |
|
381 |
|
382 my ($CheckRamTargets, $CheckRomTargets); |
|
383 |
|
384 my ($OtherPlatSwitch, $PlatTxtSwitch); |
|
385 |
|
386 my (%CurBitMap, $CurBitMapSrcPath); |
|
387 $CurBitMapSrcPath=$MmpPath; |
|
388 |
|
389 my (%CurResource, %ResourceCheckLang); |
|
390 |
|
391 my %CurStringTable; |
|
392 my ($CurSrcPath, $MmpMacro, $Line); |
|
393 $CurSrcPath=$MmpPath; |
|
394 |
|
395 # include the .MMP file as a document |
|
396 @{$DocHash{$MmpPath}}=(&Path_Split('File', $MMPFILE)); |
|
397 $CheckDoc{$MMPFILE}='zero - specified by default'; |
|
398 |
|
399 # process the data structure |
|
400 my $CurFile=$MMPFILE; |
|
401 LINE: foreach $Line (@Mmp2D) { |
|
402 my $LineNum=shift @$Line; |
|
403 $_=shift @$Line; |
|
404 if ($LineNum eq '#') { |
|
405 $CurFile=$_; |
|
406 next LINE; |
|
407 } |
|
408 |
|
409 # Get details of tested macros affecting the MMP file |
|
410 # We get this from -dU preprocessor option |
|
411 if (/^#define$/ && "@$Line" =~ /^(\w+(?:\([^\)]*\))?)(?:\s(\S.*?))?\s*$/) |
|
412 { |
|
413 # Record macro details for defined tested macro |
|
414 $mmptestedMacrosHash{$1} = $2 ? "\'$2\'" : 'defined'; |
|
415 next LINE; |
|
416 } |
|
417 elsif (/^#undef$/) |
|
418 { |
|
419 # Record macro details for undefined tested macro |
|
420 $mmptestedMacrosHash{"@$Line"} = 'undefined'; |
|
421 next LINE; |
|
422 } |
|
423 |
|
424 $CurFile = &Path_Norm ($CurFile); |
|
425 |
|
426 $_=uc $_; |
|
427 |
|
428 my $mainElement = $_; |
|
429 |
|
430 if ($PlatTxtSwitch) { |
|
431 if (/^END$/o) { |
|
432 $PlatTxtSwitch=0; |
|
433 next LINE; |
|
434 } |
|
435 push @PlatTxt2D, [ "$CurFile($LineNum)", $_, @$Line ]; |
|
436 next LINE; |
|
437 } |
|
438 if ($OtherPlatSwitch) { |
|
439 if (/^END$/o) { |
|
440 $OtherPlatSwitch=0; |
|
441 next LINE; |
|
442 } |
|
443 next LINE; |
|
444 } |
|
445 # ----------- handle body of START BITMAP ... END ------------- |
|
446 if (%CurBitMap) { |
|
447 if (/^SOURCE$/o) { |
|
448 unless (@$Line>1) { |
|
449 push @MmpDie, "$CurFile($LineNum) : Not enough arguments for Bitmap keyword SOURCE\n"; |
|
450 } |
|
451 my $cldepth = shift @$Line; |
|
452 my @ClDepths = split(/,/, $cldepth); |
|
453 foreach (@ClDepths) { |
|
454 $_ = lc $_; # bmconv can't handle upper-case 'C's |
|
455 unless (/^c?\d\d?a?$/o) { |
|
456 push @MmpDie, "$CurFile($LineNum) : BITMAP color depth \"$_\" - unexpected format\n"; |
|
457 } |
|
458 } |
|
459 @ClDepths = (@ClDepths) x @$Line; # make a sufficiently long list of color depths |
|
460 foreach (@$Line) { |
|
461 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, "BITMAP SOURCE", $_, $LineNum, $CheckSource_PhysicalCheck, $CurBitMapSrcPath); |
|
462 $_ = &Path_Norm($_); |
|
463 |
|
464 $_=lc $_; # bmconv generates a header with case-sensitive enums |
|
465 my $bitmap = "$CurBitMapSrcPath$_"; |
|
466 push @{$CurBitMap{Source}}, { # sources must be kept in order |
|
467 Src=>$bitmap, |
|
468 ClDepth=>shift @ClDepths # take next color depth from the list |
|
469 }; |
|
470 unless (-e $bitmap) { |
|
471 push @MmpWarn, "$CurFile($LineNum) : BITMAP source \"$CurBitMapSrcPath$_\" not found\n"; |
|
472 } |
|
473 } |
|
474 next LINE; |
|
475 } |
|
476 if (/^END$/o) { |
|
477 $CurBitMapSrcPath=$MmpPath; |
|
478 my %BitMap=%CurBitMap; |
|
479 undef %CurBitMap; |
|
480 push @BitMapStruct, \%BitMap; |
|
481 next LINE; |
|
482 } |
|
483 if (/^SOURCEPATH$/o) { |
|
484 unless ($CurBitMapSrcPath=shift @$Line) { |
|
485 push @MmpDie, "$CurFile($LineNum) : No path specified with Bitmap keyword SOURCEPATH\n"; |
|
486 next LINE; |
|
487 } |
|
488 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, "BITMAP SOURCEPATH", $CurBitMapSrcPath, $LineNum, $CheckSource_PhysicalCheck); |
|
489 $CurBitMapSrcPath = &Path_Norm($CurBitMapSrcPath); |
|
490 |
|
491 $CurBitMapSrcPath=~s-^(.*[^\\])$-$1\\-o; # ensure path ends with a backslash |
|
492 $CurBitMapSrcPath=&Path_MakeAbs($CurFile,$CurBitMapSrcPath); |
|
493 if (@$Line) { |
|
494 push @MmpWarn, "$CurFile($LineNum) : Too many arguments for Bitmap keyword SOURCEPATH\n"; |
|
495 } |
|
496 next LINE; |
|
497 } |
|
498 if (/^HEADER$/o) { |
|
499 if ($CurBitMap{Hdr}) { |
|
500 push @MmpWarn, "$CurFile($LineNum) : Bitmap HEADER already specified at line $CurBitMap{Hdr}\n"; |
|
501 next LINE; |
|
502 } |
|
503 $CurBitMap{Hdr}="$CurFile($LineNum)"; |
|
504 if (@$Line) { |
|
505 push @MmpWarn, "$CurFile($LineNum) : Bitmap keyword HEADER takes no arguments\n"; |
|
506 } |
|
507 next LINE; |
|
508 } |
|
509 |
|
510 |
|
511 if (/^TARGETPATH$/o) { |
|
512 if ($CurBitMap{TrgPath}) { |
|
513 push @MmpWarn, "$CurFile($LineNum) : Bitmap TARGETPATH already specified\n"; |
|
514 next LINE; |
|
515 } |
|
516 unless ($CurBitMap{TrgPath}=shift @$Line) { |
|
517 push @MmpDie, "$CurFile($LineNum) : No path specified with Bitmap keyword TARGETPATH\n"; |
|
518 next LINE; |
|
519 } |
|
520 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, "BITMAP TARGETPATH", $CurBitMap{TrgPath}, $LineNum); |
|
521 $CurBitMap{TrgPath} = &Path_Norm($CurBitMap{TrgPath}); |
|
522 |
|
523 $CurBitMap{TrgPath}=~s-^\\(.*)$-$1-o; # remove leading backslash, if any |
|
524 $CurBitMap{TrgPath}=~s-^(.*[^\\])$-$1\\-o; # ensure path ends with a backslash |
|
525 $CurBitMap{TrgPath}="z\\$CurBitMap{TrgPath}"; |
|
526 if (@$Line) { |
|
527 push @MmpWarn, "$CurFile($LineNum) : Too many arguments for Bitmap keyword TARGETPATH\n"; |
|
528 } |
|
529 next LINE; |
|
530 } |
|
531 push @MmpWarn, "$CurFile($LineNum) : Unrecognised Bitmap Keyword \"$_\"\n"; |
|
532 } |
|
533 |
|
534 # ----------- handle body of START RESOURCE ... END ------------- |
|
535 if (%CurResource) { |
|
536 if (/^END$/o) { |
|
537 $CurResource{SrcPath}=$CurSrcPath; |
|
538 my %Resource=%CurResource; |
|
539 undef %CurResource; |
|
540 push @ResourceStruct, \%Resource; |
|
541 undef %ResourceCheckLang; |
|
542 next LINE; |
|
543 } |
|
544 if (/^HEADER$/o) { |
|
545 if ($CurResource{Hdr}) { |
|
546 push @MmpWarn, "$CurFile($LineNum) : Resource HEADER already specified at line $CurResource{Hdr}\n"; |
|
547 next LINE; |
|
548 } |
|
549 elsif ($CurResource{Hdronly}) { |
|
550 push @MmpWarn, "$CurFile($LineNum) : Resource HEADERONLY already specified at line $CurResource{Hdr}\n"; |
|
551 next LINE; |
|
552 } |
|
553 $CurResource{Hdr}="$CurFile($LineNum)"; |
|
554 if (@$Line) { |
|
555 push @MmpWarn, "$CurFile($LineNum) : Resource keyword HEADER takes no arguments\n"; |
|
556 } |
|
557 next LINE; |
|
558 } |
|
559 if (/^HEADERONLY$/o) { |
|
560 if ($CurResource{Hdronly}) { |
|
561 push @MmpWarn, "$CurFile($LineNum) : Resource HEADERONLY already specified at line $CurResource{Hdr}\n"; |
|
562 next LINE; |
|
563 } |
|
564 elsif ($CurResource{Hdr}) { |
|
565 push @MmpWarn, "$CurFile($LineNum) : Resource HEADER already specified at line $CurResource{Hdr}\n"; |
|
566 next LINE; |
|
567 } |
|
568 $CurResource{Hdronly}="$CurFile($LineNum)"; |
|
569 if (@$Line) { |
|
570 push @MmpWarn, "$CurFile($LineNum) : Resource keyword HEADERONLY takes no arguments\n"; |
|
571 } |
|
572 next LINE; |
|
573 } |
|
574 |
|
575 if (/^LANG$/o) { |
|
576 if (@$Line) { |
|
577 my $Candidate; |
|
578 foreach $Candidate (@$Line) { |
|
579 if ($ResourceCheckLang{$Candidate}) { |
|
580 push @MmpWarn, "$CurFile($LineNum) : Duplicate Language \"$Candidate\" at line $ResourceCheckLang{$Candidate}\n"; |
|
581 next; |
|
582 } |
|
583 push @{$CurResource{Lang}}, $Candidate; |
|
584 $ResourceCheckLang{$Candidate}="$CurFile($LineNum)"; |
|
585 } |
|
586 next LINE; |
|
587 } |
|
588 push @MmpWarn, "$CurFile($LineNum) : No Languages specified for keyword LANG\n"; |
|
589 next LINE; |
|
590 } |
|
591 if (/^TARGET$/o) { |
|
592 if ($CurResource{BaseTrg}) { |
|
593 push @MmpWarn, "$CurFile($LineNum) : Resource TARGET already specified\n"; |
|
594 next LINE; |
|
595 } |
|
596 my $src=shift @$Line; |
|
597 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, "RESOURCE TARGET", $src, $LineNum); |
|
598 |
|
599 $src = &Path_Norm($src); |
|
600 $CurResource{BaseTrg}=&Path_Split('Base',$src); |
|
601 unless ($CurResource{BaseTrg}) { |
|
602 push @MmpDie, "$CurFile($LineNum) : No name specified with Resource keyword TARGET\n"; |
|
603 next LINE; |
|
604 } |
|
605 if (@$Line) { |
|
606 push @MmpWarn, "$CurFile($LineNum) : Too many arguments for Resource keyword TARGET\n"; |
|
607 } |
|
608 next LINE; |
|
609 } |
|
610 if (/^TARGETPATH$/o) { |
|
611 if ($CurResource{TrgPath}) { |
|
612 push @MmpWarn, "$CurFile($LineNum) : Resource TARGETPATH already specified\n"; |
|
613 next LINE; |
|
614 } |
|
615 unless ($CurResource{TrgPath}=shift @$Line) { |
|
616 push @MmpDie, "$CurFile($LineNum) : No path specified with Resource keyword TARGETPATH\n"; |
|
617 next LINE; |
|
618 } |
|
619 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, "RESOURCE TARGETPATH", $CurResource{TrgPath}, $LineNum); |
|
620 $CurResource{TrgPath} = &Path_Norm($CurResource{TrgPath}); |
|
621 |
|
622 $CurResource{TrgPath}=~s-^\\(.*)$-$1-o; # remove leading backslash, if any |
|
623 $CurResource{TrgPath}=~s-^(.*[^\\])$-$1\\-o; # ensure path ends with a backslash |
|
624 $CurResource{TrgPath}="z\\$CurResource{TrgPath}"; |
|
625 if (@$Line) { |
|
626 push @MmpWarn, "$CurFile($LineNum) : Too many arguments for Resource keyword TARGETPATH\n"; |
|
627 } |
|
628 next LINE; |
|
629 } |
|
630 if (/^UID$/o) { |
|
631 if (@$Line) { |
|
632 if (scalar @$Line>2) { |
|
633 push @MmpWarn, "$CurFile($LineNum) : Can't specify more than 2 Uids\n"; |
|
634 next LINE; |
|
635 } |
|
636 foreach (@$Line) { |
|
637 $_=&Genutl_AnyToHex($_); |
|
638 if (defined $_) { |
|
639 push @{$CurResource{Uids}}, $_; |
|
640 next; |
|
641 } |
|
642 push @MmpDie, "$CurFile($LineNum) : Uid doesn't fit expected number format\n"; |
|
643 next LINE; |
|
644 } |
|
645 next LINE; |
|
646 } |
|
647 push @MmpWarn, "$CurFile($LineNum) : No Uids specified for Resource keyword UID\n"; |
|
648 next LINE; |
|
649 } |
|
650 if (/^DEPENDS$/o) { |
|
651 # Note that DEPENDS lines are tolerated, but ignored - these are only relevant to build systems |
|
652 # other than ABLD |
|
653 next LINE; |
|
654 } |
|
655 |
|
656 push @MmpWarn, "$CurFile($LineNum) : Unrecognised Resource Keyword \"$_\"\n"; |
|
657 } |
|
658 if (/^WCHARENTRYPOINT$/o) { |
|
659 if (@$Line) { |
|
660 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
661 } |
|
662 if ($TrgType=~/^STDEXE$/io) { |
|
663 $WideCharMain=1; |
|
664 } |
|
665 else{ |
|
666 push @MmpWarn, "$CurFile($LineNum) : WCHARENTRYPOINT is supported only for Target Type STDEXE\n"; |
|
667 } |
|
668 next LINE; |
|
669 } |
|
670 # ----------- handle body of START STRINGTABLE ... END ------------- |
|
671 if(%CurStringTable) |
|
672 { |
|
673 if (/^END$/o) { |
|
674 my %stringtable = %CurStringTable; |
|
675 push @StringTableStruct, \%stringtable; |
|
676 undef %CurStringTable; |
|
677 next LINE; |
|
678 } |
|
679 if (/^EXPORTPATH/o) { |
|
680 if (scalar @$Line != 1) { |
|
681 push @MmpDie, "$CurFile($LineNum) : Wrong number of arguments for EXPORTPATH\n"; |
|
682 } |
|
683 if(defined $CurStringTable{ExportPath}) { |
|
684 push @MmpDie, "$CurFile($LineNum) : Redefinition of EXPORTPATH\n"; |
|
685 } |
|
686 else { |
|
687 my $src=shift @$Line; |
|
688 $CurStringTable{ExportPath} = $src; |
|
689 |
|
690 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, "STRINGTABLE EXPORTPATH", $CurStringTable{ExportPath}, $LineNum); |
|
691 |
|
692 $CurStringTable{ExportPath} = &Path_Norm($CurStringTable{ExportPath}); |
|
693 |
|
694 $CurStringTable{ExportPath} =~ s/\\$//o; # ensure path doesn't end with a backslash (cl_generic.pm will add one) |
|
695 $CurStringTable{ExportPath} = &Path_MakeEAbs($EPOCPath,$CurFile,$CurStringTable{ExportPath}); |
|
696 |
|
697 } |
|
698 next LINE; |
|
699 } |
|
700 if (/^HEADERONLY$/o) { |
|
701 if ($CurStringTable{Hdronly}) { |
|
702 push @MmpWarn, "$CurFile($LineNum) : Stringtable HEADERONLY already specified\n"; |
|
703 next LINE; |
|
704 } |
|
705 $CurStringTable{Hdronly}="$CurFile($LineNum)"; |
|
706 if (@$Line) { |
|
707 push @MmpWarn, "$CurFile($LineNum) : Stringtable keyword HEADERONLY takes no arguments\n"; |
|
708 } |
|
709 next LINE; |
|
710 } |
|
711 } |
|
712 # ----------- handle top-level MMP file ------------------- |
|
713 if (/^START$/) { |
|
714 unless ($_=uc shift @$Line) { |
|
715 push @MmpWarn, "$CurFile($LineNum) : No Argument specified for START block\n"; |
|
716 next LINE; |
|
717 } |
|
718 foreach $MmpMacro (@{$$Plat_ref{MmpMacros}}) { |
|
719 if ($_ eq $MmpMacro) { |
|
720 $PlatTxtSwitch="$CurFile($LineNum)"; |
|
721 next LINE; |
|
722 } |
|
723 } |
|
724 if ($_ eq 'BITMAP') { |
|
725 unless ($CurBitMap{Trg}=shift @$Line) { |
|
726 push @MmpWarn, "$CurFile($LineNum) : No Bitmap Target specified\n"; |
|
727 $CurBitMap{Trg}='NoTargetSpecified'; |
|
728 } |
|
729 if (@$Line) { |
|
730 push @MmpWarn, "$CurFile($LineNum) : Too many arguments for START BITMAP clause\n"; |
|
731 } |
|
732 |
|
733 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, "START BITMAP", $CurBitMap{Trg}, $LineNum); |
|
734 $CurBitMap{Trg} = &Path_Norm($CurBitMap{Trg}); |
|
735 next LINE; |
|
736 } |
|
737 if ($_ eq 'RESOURCE') { |
|
738 if (scalar @$Line != 1) { |
|
739 push @MmpWarn, "$CurFile($LineNum) : Wrong number of arguments for START RESOURCE clause\n"; |
|
740 } |
|
741 else { |
|
742 my $src=shift @$Line; |
|
743 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, "START RESOURCE", $src, $LineNum, $CheckSource_PhysicalCheck, $CurSrcPath); |
|
744 $src = &Path_Norm($src); |
|
745 |
|
746 $CurResource{Source}="$CurSrcPath$src"; |
|
747 } |
|
748 |
|
749 |
|
750 next LINE; |
|
751 } |
|
752 if ($_ eq 'STRINGTABLE') { |
|
753 if (scalar @$Line != 1) { |
|
754 push @MmpWarn, "$CurFile($LineNum) : Wrong number of arguments for START STRINGTABLE clause\n"; |
|
755 } |
|
756 else { |
|
757 my $Candidate = shift @$Line; |
|
758 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, "START STRINGTABLE", $Candidate, $LineNum, $CheckSource_PhysicalCheck, $CurSrcPath); |
|
759 $Candidate = &Path_Norm($Candidate); |
|
760 |
|
761 $Candidate =~ s/^\\//; # remove leading \, if any |
|
762 $CurStringTable{BaseTrg}=&Path_Split('Base',$Candidate); |
|
763 my $path=&Path_Split('Path',$Candidate); |
|
764 if($path){ |
|
765 $CurStringTable{STPath}=&Path_MakeAbs($CurSrcPath,&Path_Split('Path',$Candidate)); |
|
766 } |
|
767 else { |
|
768 $CurStringTable{STPath}=$CurSrcPath; |
|
769 } |
|
770 $CurStringTable{STFile}=&Path_Split('File',$Candidate); |
|
771 |
|
772 } |
|
773 next LINE; |
|
774 } |
|
775 $OtherPlatSwitch="$CurFile($LineNum)"; |
|
776 next LINE; |
|
777 } |
|
778 |
|
779 if (/^AIF$/o) { |
|
780 my ($trg, $dir, $file, $clDepth, @bitmaps)=@$Line; |
|
781 unless ($file) { # bitmaps aren't essential |
|
782 push @MmpDie, "$CurFile($LineNum) : Not enough arguments for keyword AIF\n"; |
|
783 next LINE; |
|
784 } |
|
785 my %Data; |
|
786 $Data{Trg} = $trg; # Defect: may include directory |
|
787 $dir=~s-^(.*[^\\])$-$1\\-o; # ensure path ends with a backslash |
|
788 $Data{Source}=&Path_MakeAbs($CurFile, "$dir$file"); |
|
789 unless (-e "$Data{Source}") { |
|
790 push @MmpWarn, "$CurFile($LineNum) : AIF source \"$Data{Source}\" not found\n"; |
|
791 } |
|
792 if ($CheckAif{$Data{Trg}}) { |
|
793 push @MmpDie, "$CurFile($LineNum) : Duplicate Aif \"$Data{Trg}\" at line $CheckAif{$Data{Trg}}\n"; |
|
794 next LINE; |
|
795 } |
|
796 $CheckAif{$Data{Trg}}="$CurFile($LineNum)"; |
|
797 push @AifStruct, \%Data; |
|
798 next LINE unless (@bitmaps); |
|
799 # handle bitmaps |
|
800 my @ClDepths = split(/,/, $clDepth); |
|
801 foreach (@ClDepths) { |
|
802 $_ = lc $_; # bmconv can't handle upper-case 'C's |
|
803 unless (/^c?\d\d?$/o) { |
|
804 push @MmpDie, "$CurFile($LineNum) : AIF color depth \"$_\" - unexpected format\n"; |
|
805 } |
|
806 } |
|
807 @ClDepths = (@ClDepths) x @bitmaps; # make a sufficiently long list of color depths |
|
808 foreach $file (@bitmaps) { |
|
809 if ($file !~ /^\\/) { |
|
810 $file = &Path_MakeAbs($CurFile, "$dir$file"); |
|
811 } |
|
812 push @{$Data{BitMaps}}, { # sources must be kept in order |
|
813 Src=>$file, |
|
814 ClDepth=>shift @ClDepths # take next color depth from the list |
|
815 }; |
|
816 unless (-e $file) { |
|
817 push @MmpWarn, "$CurFile($LineNum) : AIF source \"$file\" not found\n"; |
|
818 } |
|
819 } |
|
820 next LINE; |
|
821 } |
|
822 if (/^ASSPABI$/o) { |
|
823 if (@$Line) { |
|
824 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
825 } |
|
826 $ASSPABISwitch=1; |
|
827 next LINE; |
|
828 } |
|
829 if (/^ASSPEXPORTS$/o) { |
|
830 if (@$Line) { |
|
831 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
832 } |
|
833 $ASSPExports=1; |
|
834 next LINE; |
|
835 } |
|
836 if (/^ASSPLIBRARY$/o) { |
|
837 if (@$Line) { |
|
838 my $Candidate; |
|
839 foreach $Candidate (@$Line) { |
|
840 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $Candidate, $LineNum); |
|
841 $Candidate = &Path_Norm($Candidate); |
|
842 |
|
843 unless ($emulator or &Genutl_ParseVersionedName(\$Candidate)) { |
|
844 push @MmpWarn, "$CurFile($LineNum) : Bad version in ASSPLIBRARY\n"; |
|
845 } |
|
846 if ($CheckASSPLib{$Candidate}) { |
|
847 push @MmpWarn, "$CurFile($LineNum) : Duplicate Library \"$Candidate\" at line $CheckASSPLib{$Candidate}\n"; |
|
848 next; |
|
849 } |
|
850 |
|
851 push @ASSPLibList, $Candidate; |
|
852 $CheckASSPLib{$Candidate}="$CurFile($LineNum)"; |
|
853 } |
|
854 next LINE; |
|
855 } |
|
856 push @MmpWarn, "$CurFile($LineNum) : No Libraries specified for keyword ASSPLIBRARY\n"; |
|
857 next LINE; |
|
858 } |
|
859 if (/^CAPABILITY$/o) { |
|
860 if (defined($Capability)) { |
|
861 push @MmpWarn, "$CurFile($LineNum) : Attempt to redefine CAPABILITY\n"; |
|
862 next LINE; |
|
863 } |
|
864 if (scalar @$Line == 0) { |
|
865 push @MmpWarn, "$CurFile($LineNum) : Wrong number of arguments for CAPABILITY\n"; |
|
866 next LINE; |
|
867 } |
|
868 foreach my $capname (@$Line) { |
|
869 my $invert = 0; |
|
870 if ($capname =~ /^-(\w*)/) { |
|
871 $invert = 0xffffffff; |
|
872 $capname = $1; |
|
873 } |
|
874 my $capFlag = 0; |
|
875 if (defined($CapabilityNames{uc $capname})) { |
|
876 $capFlag = $CapabilityNames{uc $capname}; |
|
877 if (not $capFlag) { |
|
878 push @MmpDiagnostic, "$CurFile($LineNum) : Use of old capability name, \"$capname\" ignored\n"; |
|
879 next; |
|
880 } |
|
881 if ("ALL" eq uc $capname and $invert) { |
|
882 push @MmpWarn, "Capability '-ALL' not allowed"; |
|
883 next; |
|
884 } |
|
885 } |
|
886 elsif ("NONE" eq uc $capname) { |
|
887 if($invert) { |
|
888 push @MmpWarn, "Capability '-NONE' not allowed"; |
|
889 next; |
|
890 } |
|
891 } |
|
892 else { |
|
893 push @MmpWarn, "$CurFile($LineNum) : Unknown capability \"$capname\" ignored\n"; |
|
894 next; |
|
895 } |
|
896 # append name to capability string |
|
897 if (defined($Capability) and not $invert) { $Capability .= "+"; } |
|
898 if($invert) { $Capability .= "-"; } |
|
899 $Capability .= $capname; |
|
900 |
|
901 # add capability mask to flags |
|
902 $CapabilityFlags[0] = $CapabilityFlags[0] ^ $invert; |
|
903 $CapabilityFlags[0] = $CapabilityFlags[0] | $capFlag; |
|
904 $CapabilityFlags[0] = $CapabilityFlags[0] ^ $invert; |
|
905 $CapabilityFlags[1] = 0; |
|
906 next; |
|
907 } |
|
908 next LINE; |
|
909 } |
|
910 if (/^DEBUGLIBRARY$/o) { |
|
911 if (@$Line) { |
|
912 my $Candidate; |
|
913 foreach $Candidate (@$Line) { |
|
914 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $Candidate, $LineNum); |
|
915 $Candidate = &Path_Norm($Candidate); |
|
916 |
|
917 unless ($emulator or &Genutl_ParseVersionedName(\$Candidate)) { |
|
918 push @MmpWarn, "$CurFile($LineNum) : Bad version in DEBUGLIBRARY\n"; |
|
919 } |
|
920 if ($CheckLib{$Candidate}) { |
|
921 push @MmpWarn, "$CurFile($LineNum) : Duplicate Library \"$Candidate\" at line $CheckLib{$Candidate}\n"; |
|
922 next; |
|
923 } |
|
924 |
|
925 push @DebugLibList, $Candidate; |
|
926 $CheckLib{$Candidate}="$CurFile($LineNum)"; |
|
927 } |
|
928 next LINE; |
|
929 } |
|
930 push @MmpWarn, "$CurFile($LineNum) : No Libraries specified for keyword DEBUGLIBRARY\n"; |
|
931 next LINE; |
|
932 } |
|
933 if (/^DEFFILE$/o) { |
|
934 if ($CheckDef) { |
|
935 push @MmpWarn, "$CurFile($LineNum) : Attempt to redefine DEFFILE\n"; |
|
936 next LINE; |
|
937 } |
|
938 $CheckDef=1; |
|
939 unless ($_=shift @$Line) { |
|
940 push @MmpWarn, "$CurFile($LineNum) : No file specified for keyword DEFFILE\n"; |
|
941 next LINE; |
|
942 } |
|
943 |
|
944 $Def{CheckSource_MMPEntry} = $_; |
|
945 $Def{CheckSource_LineNumber} = $LineNum; |
|
946 $Def{CheckSource_MMPFile} = $CurFile; |
|
947 |
|
948 $_ = &Path_Norm($_); |
|
949 |
|
950 $Def{Base}=&Path_Split('Base',$_); |
|
951 $Def{Ext}=&Path_Split('Ext',$_); |
|
952 $Def{Path}=&Path_Split('Path',$_); |
|
953 |
|
954 if ($Def{Path}) { |
|
955 $Def{Path}=&Path_MakeEAbs($EPOCPath,$CurFile,$Def{Path}); |
|
956 } |
|
957 |
|
958 if ($Def{Base} =~ /\{|\}/) { |
|
959 push @MmpDie, "$CurFile($LineNum) : Bad DEFFILE name\n"; |
|
960 } |
|
961 next LINE; |
|
962 } |
|
963 if (/^DOCUMENT$/o) { |
|
964 if (@$Line) { |
|
965 my $Candidate; |
|
966 foreach $Candidate (@$Line) { |
|
967 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $Candidate, $LineNum, $CheckSource_PhysicalCheck, $CurSrcPath); |
|
968 $Candidate = &Path_Norm($Candidate); |
|
969 |
|
970 if ($CheckDoc{"$CurSrcPath$Candidate"}) { |
|
971 push @MmpWarn, "$CurFile($LineNum) : Duplicate Document \"$CurSrcPath$Candidate\" at line ", $CheckDoc{"$CurSrcPath$Candidate"}, "\n"; |
|
972 next; |
|
973 } |
|
974 unless (-e "$CurSrcPath$Candidate") { |
|
975 push @MmpWarn, "$CurFile($LineNum) : DOCUMENT \"$CurSrcPath$Candidate\" not found\n"; |
|
976 } |
|
977 |
|
978 push @{$DocHash{$CurSrcPath}}, $Candidate; |
|
979 $CheckDoc{"$CurSrcPath$Candidate"}="$CurFile($LineNum)"; |
|
980 } |
|
981 next LINE; |
|
982 } |
|
983 push @MmpWarn, "$CurFile($LineNum) : No Files specified for keyword DOCUMENT\n"; |
|
984 next LINE; |
|
985 } |
|
986 if (/^EPOCALLOWDLLDATA$/o) { |
|
987 if (@$Line) { |
|
988 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
989 } |
|
990 $AllowDllData=1; |
|
991 next LINE; |
|
992 } |
|
993 if (/^ALWAYS_BUILD_AS_ARM$/o) { |
|
994 if (@$Line) { |
|
995 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
996 } |
|
997 $BuildAsARM=1; |
|
998 next LINE; |
|
999 } |
|
1000 if (/^EPOCCALLDLLENTRYPOINTS$/o) { |
|
1001 if (@$Line) { |
|
1002 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
1003 } |
|
1004 $CallDllEntryPoints=1; |
|
1005 next LINE; |
|
1006 } |
|
1007 if (/^EPOCDATALINKADDRESS$/o) { |
|
1008 if (@$Line) { |
|
1009 my $temp=&main::Genutl_AnyToHex(shift @$Line); |
|
1010 if (defined $temp) { |
|
1011 $DataLinkAddress=$temp; |
|
1012 next LINE; |
|
1013 } |
|
1014 push @MmpDie, "$CurFile($LineNum) : Data link address doesn't fit expected number format\n"; |
|
1015 } |
|
1016 push @MmpWarn, "$CurFile($LineNum) : No data link address specified for keyword $_\n"; |
|
1017 next LINE; |
|
1018 } |
|
1019 if (/^EPOCFIXEDPROCESS$/o) { |
|
1020 if (@$Line) { |
|
1021 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
1022 } |
|
1023 $FixedProcess=1; |
|
1024 next LINE; |
|
1025 } |
|
1026 if (/^EPOCHEAPSIZE$/o) { |
|
1027 if (@$Line) { |
|
1028 my $tempMin=&main::Genutl_AnyToHex(shift @$Line); |
|
1029 if (defined $tempMin) { |
|
1030 if (@$Line) { |
|
1031 my $tempMax=&main::Genutl_AnyToHex(shift @$Line); |
|
1032 if (defined $tempMax) { |
|
1033 $HeapSize{Min}=$tempMin; |
|
1034 $HeapSize{Max}=$tempMax; |
|
1035 next LINE; |
|
1036 } |
|
1037 push @MmpDie, "$CurFile($LineNum) : maximum heap size doesn't fit expected number format\n"; |
|
1038 next LINE; |
|
1039 } |
|
1040 push @MmpDie, "$CurFile($LineNum) : No maximum heap size specified for keyword $_\n"; |
|
1041 next LINE; |
|
1042 } |
|
1043 push @MmpDie, "$CurFile($LineNum) : minimum heap size doesn't fit expected number format\n"; |
|
1044 next LINE; |
|
1045 } |
|
1046 push @MmpWarn, "$CurFile($LineNum) : No minimum heap size specified for keyword $_\n"; |
|
1047 next LINE; |
|
1048 } |
|
1049 if (/^EPOCPROCESSPRIORITY$/o) { |
|
1050 if ($ProcessPriority) { |
|
1051 push @MmpWarn, "$CurFile($LineNum) : Attempt to redefine EPOCPROCESSPRIORITY\n"; |
|
1052 next LINE; |
|
1053 } |
|
1054 if ($ProcessPriority=shift @$Line) { |
|
1055 if (defined($ProcessPriorityNames{uc $ProcessPriority})) { |
|
1056 $ProcessPriority = $ProcessPriorityNames{uc $ProcessPriority}; # canonical form |
|
1057 next LINE; |
|
1058 } |
|
1059 push @MmpDie, "$CurFile($LineNum) : ProcessPriority \"$ProcessPriority\" not supported\n"; |
|
1060 next LINE; |
|
1061 } |
|
1062 push @MmpWarn, "$CurFile($LineNum) : No Priority specified for keyword EPOCPROCESSPRIORITY\n"; |
|
1063 next LINE; |
|
1064 } |
|
1065 if (/^EPOCSTACKSIZE$/o) { |
|
1066 if (@$Line) { |
|
1067 my $temp=&main::Genutl_AnyToHex(shift @$Line); |
|
1068 if (defined $temp) { |
|
1069 $StackSize=$temp; |
|
1070 next LINE; |
|
1071 } |
|
1072 push @MmpDie, "$CurFile($LineNum) : Stack size doesn't fit expected number format\n"; |
|
1073 next LINE; |
|
1074 } |
|
1075 push @MmpWarn, "$CurFile($LineNum) : No stack size specified for keyword STACKSIZE\n"; |
|
1076 next LINE; |
|
1077 } |
|
1078 if (/^COMPRESSTARGET$/o) { |
|
1079 if (@$Line) { |
|
1080 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
1081 } |
|
1082 $CompressTarget=COMPRESS; |
|
1083 $CompressTargetMethod=NOCOMPRESSIONMETHOD; # means 'use default' |
|
1084 next LINE; |
|
1085 } |
|
1086 if (/^NOCOMPRESSTARGET$/o) { |
|
1087 if (@$Line) { |
|
1088 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
1089 } |
|
1090 $CompressTarget=NOCOMPRESS; |
|
1091 $CompressTargetMethod=NOCOMPRESSIONMETHOD; |
|
1092 next LINE; |
|
1093 } |
|
1094 if (/^INFLATECOMPRESSTARGET$/o) { |
|
1095 if (@$Line) { |
|
1096 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
1097 } |
|
1098 $CompressTarget=COMPRESS; |
|
1099 $CompressTargetMethod=INFLATECOMPRESSIONMETHOD; |
|
1100 next LINE; |
|
1101 } |
|
1102 if (/^BYTEPAIRCOMPRESSTARGET$/o) { |
|
1103 if (@$Line) { |
|
1104 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
1105 } |
|
1106 $CompressTarget=COMPRESS; |
|
1107 $CompressTargetMethod=BYTEPAIRCOMPRESSIONMETHOD; |
|
1108 next LINE; |
|
1109 } |
|
1110 if (/^EXPORTUNFROZEN$/o) { |
|
1111 if (@$Line) { |
|
1112 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
1113 } |
|
1114 $ExportUnfrozen=1; |
|
1115 next LINE; |
|
1116 } |
|
1117 if (/^FIRSTLIB$/o) { |
|
1118 if ($FirstLib) { |
|
1119 push @MmpWarn, "$CurFile($LineNum) : Attempt to redefine FIRSTLIB\n"; |
|
1120 next LINE; |
|
1121 } |
|
1122 if ($FirstLib=shift @$Line) { |
|
1123 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $FirstLib, $LineNum); |
|
1124 $FirstLib = &Path_Norm($FirstLib); |
|
1125 next LINE; |
|
1126 } |
|
1127 |
|
1128 push @MmpWarn, "$CurFile($LineNum) : Nothing specified for keyword FIRSTLIB\n"; |
|
1129 next LINE; |
|
1130 } |
|
1131 if (/^LANG$/o) { |
|
1132 if (@$Line) { |
|
1133 my $Candidate; |
|
1134 foreach $Candidate (@$Line) { |
|
1135 if ($CheckLang{$Candidate}) { |
|
1136 push @MmpWarn, "$CurFile($LineNum) : Duplicate Language \"$Candidate\" at line $CheckLang{$Candidate}\n"; |
|
1137 next; |
|
1138 } |
|
1139 push @LangList, $Candidate; |
|
1140 $CheckLang{$Candidate}="$CurFile($LineNum)"; |
|
1141 } |
|
1142 next LINE; |
|
1143 } |
|
1144 push @MmpWarn, "$CurFile($LineNum) : No Languages specified for keyword LANG\n"; |
|
1145 next LINE; |
|
1146 } |
|
1147 if (/^LIBRARY$/o) { |
|
1148 if (@$Line) { |
|
1149 my $Candidate; |
|
1150 foreach $Candidate (@$Line) { |
|
1151 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $Candidate, $LineNum); |
|
1152 $Candidate = &Path_Norm($Candidate); |
|
1153 |
|
1154 unless ($emulator or &Genutl_ParseVersionedName(\$Candidate)) { |
|
1155 push @MmpWarn, "$CurFile($LineNum) : Bad version in LIBRARY\n"; |
|
1156 } |
|
1157 if ($CheckLib{$Candidate}) { |
|
1158 push @MmpWarn, "$CurFile($LineNum) : Duplicate Library \"$Candidate\" at line $CheckLib{$Candidate}\n"; |
|
1159 next; |
|
1160 } |
|
1161 |
|
1162 push @LibList, $Candidate; |
|
1163 push @DebugLibList, $Candidate; # appears in both |
|
1164 $CheckLib{$Candidate}="$CurFile($LineNum)"; |
|
1165 } |
|
1166 next LINE; |
|
1167 } |
|
1168 push @MmpWarn, "$CurFile($LineNum) : No Libraries specified for keyword LIBRARY\n"; |
|
1169 next LINE; |
|
1170 } |
|
1171 if (/^LINKAS$/o) { |
|
1172 if ($LinkAs) { |
|
1173 push @MmpWarn, "$CurFile($LineNum) : Attempt to redefine LINKAS\n"; |
|
1174 next LINE; |
|
1175 } |
|
1176 if ($LinkAs=shift @$Line) { |
|
1177 next LINE; |
|
1178 } |
|
1179 push @MmpWarn, "$CurFile($LineNum) : No name specified for keyword LINKAS\n"; |
|
1180 next LINE; |
|
1181 } |
|
1182 if (/^EXPORTLIBRARY$/o) { |
|
1183 if ($NoExportLibrary) { |
|
1184 push @MmpDie, "$CurFile($LineNum) : Can't specify both EXPORTLIBRARY and NOEXPORTLIBRARY\n"; |
|
1185 next LINE; |
|
1186 } |
|
1187 if ($ExportLibrary) { |
|
1188 push @MmpWarn, "$CurFile($LineNum) : Attempt to redefine EXPORTLIBRARY\n"; |
|
1189 next LINE; |
|
1190 } |
|
1191 if ($ExportLibrary=shift @$Line) { |
|
1192 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $ExportLibrary, $LineNum); |
|
1193 $ExportLibrary = &Path_Norm($ExportLibrary); |
|
1194 $ExportLibrary=&Path_Split('Base',$ExportLibrary); |
|
1195 next LINE; |
|
1196 } |
|
1197 push @MmpWarn, "$CurFile($LineNum) : No name specified for keyword EXPORTLIBRARY\n"; |
|
1198 next LINE; |
|
1199 } |
|
1200 if (/^NOEXPORTLIBRARY$/o) { |
|
1201 if ($ExportLibrary) { |
|
1202 push @MmpDie, "$CurFile($LineNum) : Can't specify both EXPORTLIBRARY and NOEXPORTLIBRARY\n"; |
|
1203 next LINE; |
|
1204 } |
|
1205 $NoExportLibrary = 1; |
|
1206 next LINE; |
|
1207 } |
|
1208 if (/^NEWLIB$/o) { |
|
1209 if ($NewLib) { |
|
1210 push @MmpWarn, "$CurFile($LineNum) : Attempt to redefine NEWLIB\n"; |
|
1211 next LINE; |
|
1212 } |
|
1213 if ($NewLib = shift @$Line) { |
|
1214 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $NewLib, $LineNum); |
|
1215 $NewLib = &Path_Norm($NewLib); |
|
1216 next LINE; |
|
1217 } |
|
1218 push @MmpWarn, "$CurFile($LineNum) : No library specified for keyword NEWLIB\n"; |
|
1219 next LINE; |
|
1220 } |
|
1221 if (/^MACRO$/o) { |
|
1222 if (@$Line) { |
|
1223 my $Candidate; |
|
1224 foreach $Candidate (@$Line) { |
|
1225 if ($CheckMacro{$Candidate}) { |
|
1226 push @MmpWarn, "$CurFile($LineNum) : Duplicate Macro \"$Candidate\" at line $CheckMacro{$Candidate}\n"; |
|
1227 next; |
|
1228 } |
|
1229 push @Macros, $Candidate; |
|
1230 $CheckMacro{$Candidate}="$CurFile($LineNum)"; |
|
1231 } |
|
1232 next LINE; |
|
1233 } |
|
1234 next LINE; |
|
1235 } |
|
1236 if (/^NOSTRICTDEF$/o) { |
|
1237 if ($NoStrictDef) { |
|
1238 push @MmpWarn, "$CurFile($LineNum) : NOSTRICTDEF already set\n"; |
|
1239 next LINE; |
|
1240 } |
|
1241 if (@$Line) { |
|
1242 push @MmpWarn, "$CurFile($LineNum) : Keyword NOSTRICTDEF takes no arguments\n"; |
|
1243 } |
|
1244 $NoStrictDef=1; |
|
1245 next LINE; |
|
1246 } |
|
1247 if (/^RAMTARGET$/o) { |
|
1248 if ($CheckRamTargets) { |
|
1249 push @MmpWarn, "$CurFile($LineNum) : RAM targets already specified at line $CheckRamTargets\n"; |
|
1250 next LINE; |
|
1251 } |
|
1252 $CheckRamTargets="$CurFile($LineNum)"; |
|
1253 unless (@$Line) { |
|
1254 push @MmpWarn, "$CurFile($LineNum) : No targets specified for keyword RAMTARGET\n"; |
|
1255 next LINE; |
|
1256 } |
|
1257 if ($$Line[0] eq '+') { |
|
1258 my %Data=(); |
|
1259 push @RamTargets, \%Data; # include default |
|
1260 shift @$Line; |
|
1261 } |
|
1262 my $Elem; |
|
1263 foreach $Elem (@$Line) { |
|
1264 my %Data=(); |
|
1265 $Data{File}=&Path_Split('File',$Elem); |
|
1266 $Data{Path}=&Path_Split('Path',$Elem); |
|
1267 push @RamTargets, \%Data; |
|
1268 } |
|
1269 next LINE; |
|
1270 } |
|
1271 if (/^RESOURCE$/o) { |
|
1272 if (@$Line) { |
|
1273 my $Candidate; |
|
1274 foreach $Candidate (@$Line) { |
|
1275 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $Candidate, $LineNum, $CheckSource_PhysicalCheck, $CurSrcPath); |
|
1276 $Candidate = &Path_Norm($Candidate); |
|
1277 |
|
1278 if ($CheckResrc{$Candidate}) { |
|
1279 push @MmpDie, "$CurFile($LineNum) : Duplicate Resource $Candidate at line $CheckResrc{$Candidate}\n"; |
|
1280 next; |
|
1281 } |
|
1282 |
|
1283 $CheckResrc{$Candidate}="$CurFile($LineNum)"; |
|
1284 my $source="$CurSrcPath$Candidate"; |
|
1285 unless (-e $source) { |
|
1286 push @MmpWarn, "$CurFile($LineNum) : RESOURCE source \"$source\" not found\n"; |
|
1287 } |
|
1288 |
|
1289 $CurResource{BaseTrg}=&Path_Split('Base',$Candidate); |
|
1290 $CurResource{Source}=$source; |
|
1291 $CurResource{Hdr}="$CurFile($LineNum)"; |
|
1292 # $CurResource{TrgPath} will be filled in at the end; |
|
1293 my %Resource=%CurResource; |
|
1294 undef %CurResource; |
|
1295 push @ResourceStruct, \%Resource; |
|
1296 } |
|
1297 next LINE; |
|
1298 } |
|
1299 push @MmpWarn, "$CurFile($LineNum) : No Resources specified for keyword RESOURCE\n"; |
|
1300 next LINE; |
|
1301 } |
|
1302 if (/^ROMTARGET$/o) { |
|
1303 if ($CheckRomTargets) { |
|
1304 push @MmpWarn, "$CurFile($LineNum) : ROM targets already specified at line $CheckRomTargets\n"; |
|
1305 next LINE; |
|
1306 } |
|
1307 $CheckRomTargets="$CurFile($LineNum)"; |
|
1308 unless (@$Line) { |
|
1309 @RomTargets=(); |
|
1310 next LINE; |
|
1311 } |
|
1312 if ($$Line[0] eq '+') { |
|
1313 shift @$Line; |
|
1314 } |
|
1315 else { |
|
1316 @RomTargets=(); # remove default |
|
1317 } |
|
1318 my $Elem; |
|
1319 foreach $Elem (@$Line) { |
|
1320 my %Data=(); |
|
1321 $Data{File}=&Path_Split('File',$Elem); |
|
1322 $Data{Path}=&Path_Split('Path',$Elem); |
|
1323 push @RomTargets, \%Data; |
|
1324 } |
|
1325 next LINE; |
|
1326 } |
|
1327 if (/^SMPSAFE$/o) { |
|
1328 if (@$Line) { |
|
1329 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
1330 } |
|
1331 $SmpSafe = 1; |
|
1332 next LINE; |
|
1333 } |
|
1334 if (/^SOURCE$/o) { |
|
1335 if (@$Line) { |
|
1336 my $Candidate; |
|
1337 foreach $Candidate (@$Line) { |
|
1338 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $Candidate, $LineNum, $CheckSource_PhysicalCheck, $CurSrcPath); |
|
1339 $Candidate = &Path_Norm($Candidate); |
|
1340 |
|
1341 $Candidate =~ s/^\\//; # remove leading \, if any |
|
1342 $CurSource{BaseTrg}=&Path_Split('Base',$Candidate); |
|
1343 my $path=&Path_Split('Path',$Candidate); |
|
1344 if($path){ |
|
1345 $CurSource{SrcPath}=&Path_MakeAbs($CurSrcPath,&Path_Split('Path',$Candidate)); |
|
1346 } |
|
1347 else { |
|
1348 $CurSource{SrcPath}=$CurSrcPath; |
|
1349 } |
|
1350 $CurSource{CurFile}=&Path_Split('File',$Candidate); |
|
1351 |
|
1352 my %Source=%CurSource; |
|
1353 undef %CurSource; |
|
1354 push @SourceStruct, \%Source; |
|
1355 |
|
1356 } |
|
1357 next LINE; |
|
1358 } |
|
1359 push @MmpWarn, "$CurFile($LineNum) : No Sources specified for keyword SOURCE\n"; |
|
1360 next LINE; |
|
1361 } |
|
1362 if (/^SOURCEPATH$/o) { |
|
1363 if ($CurSrcPath=shift @$Line) { |
|
1364 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $CurSrcPath, $LineNum, $CheckSource_PhysicalCheck); |
|
1365 $CurSrcPath = &Path_Norm($CurSrcPath); |
|
1366 |
|
1367 $CurSrcPath=~s-^(.*[^\\])$-$1\\-o; # in case no terminating backslash |
|
1368 $CurSrcPath=&Path_MakeEAbs($EPOCPath,$CurFile,$CurSrcPath); |
|
1369 if (-d &Path_Chop($CurSrcPath)) { |
|
1370 next LINE; |
|
1371 } |
|
1372 push @MmpWarn, "$CurFile($LineNum) : SOURCEPATH \"$CurSrcPath\" not found\n"; |
|
1373 next LINE; |
|
1374 } |
|
1375 push @MmpDie, "$CurFile($LineNum) : No Source Path specified for keyword SOURCEPATH\n"; |
|
1376 next LINE; |
|
1377 } |
|
1378 if (/^STATICLIBRARY$/o) { |
|
1379 if (@$Line) { |
|
1380 my $Candidate; |
|
1381 foreach $Candidate (@$Line) { |
|
1382 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $Candidate, $LineNum); |
|
1383 $Candidate = &Path_Norm($Candidate); |
|
1384 |
|
1385 if ($CheckStatLib{$Candidate}) { |
|
1386 push @MmpWarn, "$CurFile($LineNum) : Duplicate Library \"$Candidate\" at line $CheckStatLib{$Candidate}\n"; |
|
1387 next; |
|
1388 } |
|
1389 |
|
1390 push @StatLibList, $Candidate; |
|
1391 $CheckStatLib{$Candidate}="$CurFile($LineNum)"; |
|
1392 } |
|
1393 next LINE; |
|
1394 } |
|
1395 push @MmpWarn, "$CurFile($LineNum) : No Libraries specified for keyword STATICLIBRARY\n"; |
|
1396 next LINE; |
|
1397 } |
|
1398 if (/^STDCPP$/o) { |
|
1399 if (@$Line) { |
|
1400 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
1401 } |
|
1402 $StdCpp=1; |
|
1403 next LINE; |
|
1404 } |
|
1405 if (/^NOSTDCPP$/o) { |
|
1406 if (@$Line) { |
|
1407 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
1408 } |
|
1409 $NoStdCpp=1; |
|
1410 next LINE; |
|
1411 } |
|
1412 if (/^STRICTDEPEND$/o) { |
|
1413 if ($MmpFlag{StrictDepend}) { |
|
1414 push @MmpWarn, "$CurFile($LineNum) : STRICTDEPEND already set\n"; |
|
1415 next LINE; |
|
1416 } |
|
1417 if (@$Line) { |
|
1418 push @MmpWarn, "$CurFile($LineNum) : Keyword STRICTDEPEND takes no arguments\n"; |
|
1419 } |
|
1420 $MmpFlag{StrictDepend}=1; |
|
1421 next LINE; |
|
1422 } |
|
1423 if (/^SYSTEMINCLUDE$/o){ |
|
1424 if (@$Line) { |
|
1425 my $Candidate; |
|
1426 foreach $Candidate (@$Line) { |
|
1427 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $Candidate, $LineNum, $CheckSource_PhysicalCheck); |
|
1428 $Candidate = &Path_Norm($Candidate); |
|
1429 |
|
1430 $Candidate=~s-^(.*[^\\])$-$1\\-o; # ensure path ends with a backslash |
|
1431 $Candidate=&Path_MakeEAbs($EPOCPath,$CurFile,$Candidate); |
|
1432 if ($CheckSysInc{$Candidate}) { |
|
1433 next; |
|
1434 } |
|
1435 push @SysIncPaths,$Candidate; |
|
1436 $CheckSysInc{$Candidate}="$CurFile($LineNum)"; |
|
1437 if (-d &Path_Chop($Candidate)) { |
|
1438 next; |
|
1439 } |
|
1440 push @MmpWarn, "$CurFile($LineNum) : SYSTEMINCLUDE path \"$Candidate\" not found\n"; |
|
1441 } |
|
1442 next LINE; |
|
1443 } |
|
1444 push @MmpWarn, "$CurFile($LineNum) : No Paths specified for keyword SYSTEMINCLUDE\n"; |
|
1445 next LINE; |
|
1446 } |
|
1447 if (/^SYSTEMRESOURCE$/o) { |
|
1448 if (@$Line) { |
|
1449 my $Candidate; |
|
1450 foreach $Candidate (@$Line) { |
|
1451 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $Candidate, $LineNum, $CheckSource_PhysicalCheck, $CurSrcPath); |
|
1452 $Candidate = &Path_Norm($Candidate); |
|
1453 |
|
1454 if ($CheckSysResrc{$Candidate}) { |
|
1455 push @MmpDie, "$CurFile($LineNum) : Duplicate Resource \"$Candidate\" at line $CheckSysResrc{$Candidate}\n"; |
|
1456 next; |
|
1457 } |
|
1458 $CheckSysResrc{$Candidate}="$CurFile($LineNum)"; |
|
1459 my $source="$CurSrcPath$Candidate"; |
|
1460 unless (-e $source) { |
|
1461 push @MmpWarn, "$CurFile($LineNum) : SYSTEMRESOURCE source \"$source\" not found\n"; |
|
1462 } |
|
1463 $CurResource{BaseTrg}=&Path_Split('Base',$Candidate); |
|
1464 $CurResource{Source}=$source; |
|
1465 $CurResource{Hdr}="$CurFile($LineNum)"; |
|
1466 $CurResource{TrgPath}="z\\system\\data\\"; # needs to match e32env.pm |
|
1467 my %Resource=%CurResource; |
|
1468 undef %CurResource; |
|
1469 push @ResourceStruct, \%Resource; |
|
1470 } |
|
1471 if (&main::EPOCSecurePlatform()) { |
|
1472 push @MmpMigrationNote, "Obsolete SYSTEMRESOURCE keyword specified in \"$MMPFILE\""; |
|
1473 } |
|
1474 next LINE; |
|
1475 } |
|
1476 push @MmpWarn, "$CurFile($LineNum) : No Resources specified for keyword SYSTEMRESOURCE\n"; |
|
1477 next LINE; |
|
1478 } |
|
1479 if (/^TARGET$/o) { |
|
1480 if ($Trg) { |
|
1481 push @MmpWarn, "$CurFile($LineNum) : Attempt to redefine TARGET\n"; |
|
1482 next LINE; |
|
1483 } |
|
1484 if ($Trg=shift @$Line) { |
|
1485 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $Trg, $LineNum); |
|
1486 $Trg = &Path_Norm($Trg); |
|
1487 next LINE; |
|
1488 } |
|
1489 push @MmpWarn, "$CurFile($LineNum) : No Target specified for keyword TARGET\n"; |
|
1490 next LINE; |
|
1491 } |
|
1492 if (/^TARGETPATH$/o) { |
|
1493 if ($TrgPath) { |
|
1494 push @MmpWarn, "$CurFile($LineNum) : Attempt to redefine TARGETPATH\n"; |
|
1495 next LINE; |
|
1496 } |
|
1497 unless ($TrgPath=shift @$Line) { |
|
1498 push @MmpWarn, "$CurFile($LineNum) : No Path specified for keyword TARGETPATH\n"; |
|
1499 next LINE; |
|
1500 } |
|
1501 |
|
1502 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $TrgPath, $LineNum); |
|
1503 $TrgPath = &Path_Norm($TrgPath); |
|
1504 |
|
1505 $TrgPath=~s-^\\(.*)$-$1-o; |
|
1506 $TrgPath=~s-^(.*[^\\])$-$1\\-o; |
|
1507 $TrgPath="z\\$TrgPath"; |
|
1508 if (@$Line) { |
|
1509 push @MmpWarn, "$CurFile($LineNum) : Too many arguments for keyword TARGETPATH\n"; |
|
1510 } |
|
1511 next LINE; |
|
1512 } |
|
1513 if (/^TARGETTYPE$/o) { |
|
1514 if ($TrgType) { |
|
1515 push @MmpWarn, "$CurFile($LineNum) : Attempt to redefine TARGETTYPE\n"; |
|
1516 next LINE; |
|
1517 } |
|
1518 unless ($TrgType=shift @$Line) { |
|
1519 push @MmpWarn, "$CurFile($LineNum) : No Type specified for keyword TARGETTYPE\n"; |
|
1520 next LINE; |
|
1521 } |
|
1522 eval { &Trg_GetL($TrgType, \%TrgType); }; |
|
1523 if ($@) { |
|
1524 push @MmpDie, "$CurFile($LineNum) : $@"; |
|
1525 } |
|
1526 next LINE; |
|
1527 } |
|
1528 if (/^UID$/o) { |
|
1529 if (@$Line) { |
|
1530 foreach (@$Line) { |
|
1531 if ($#UidList>=1) { |
|
1532 push @MmpWarn, "$CurFile($LineNum) : Can't specify more than 2 Uids\n"; |
|
1533 next LINE; |
|
1534 } |
|
1535 $_=&Genutl_AnyToHex($_); |
|
1536 if (defined $_) { |
|
1537 push @UidList, $_; |
|
1538 next; |
|
1539 } |
|
1540 push @MmpDie, "$CurFile($LineNum) : Uid doesn't fit expected number format\n"; |
|
1541 next LINE; |
|
1542 } |
|
1543 next LINE; |
|
1544 } |
|
1545 push @MmpWarn, "$CurFile($LineNum) : No Uids specified for keyword UID\n"; |
|
1546 next LINE; |
|
1547 } |
|
1548 if (/^SECUREID$/o) { |
|
1549 if ($SecureId) { |
|
1550 push @MmpWarn, "$CurFile($LineNum) : Attempt to redefine SECUREID\n"; |
|
1551 next LINE; |
|
1552 } |
|
1553 if (@$Line) { |
|
1554 $SecureId = &Genutl_AnyToHex(shift @$Line); |
|
1555 if (!defined $SecureId) { |
|
1556 push @MmpDie, "$CurFile($LineNum) : SECUREID doesn't fit expected number format\n"; |
|
1557 next LINE; |
|
1558 } |
|
1559 if (@$Line) { |
|
1560 push @MmpWarn, "$CurFile($LineNum) : Too many arguments for keyword SECUREID\n"; |
|
1561 } |
|
1562 next LINE; |
|
1563 } |
|
1564 push @MmpWarn, "$CurFile($LineNum) : Missing argument for keyword SECUREID\n"; |
|
1565 next LINE; |
|
1566 } |
|
1567 if (/^VENDORID$/o) { |
|
1568 if (defined($VendorId)) { |
|
1569 push @MmpWarn, "$CurFile($LineNum) : Attempt to redefine VENDORID\n"; |
|
1570 next LINE; |
|
1571 } |
|
1572 if (@$Line) { |
|
1573 $VendorId = &Genutl_AnyToHex(shift @$Line); |
|
1574 if (!defined $VendorId) { |
|
1575 push @MmpDie, "$CurFile($LineNum) : VENDORID doesn't fit expected number format\n"; |
|
1576 next LINE; |
|
1577 } |
|
1578 if (@$Line) { |
|
1579 push @MmpWarn, "$CurFile($LineNum) : Too many arguments for keyword VENDORID\n"; |
|
1580 } |
|
1581 next LINE; |
|
1582 } |
|
1583 push @MmpWarn, "$CurFile($LineNum) : Missing argument for keyword VENDORID\n"; |
|
1584 next LINE; |
|
1585 } |
|
1586 if (/^USERINCLUDE$/o) { |
|
1587 if (@$Line) { |
|
1588 my $Candidate; |
|
1589 foreach $Candidate (@$Line) { |
|
1590 CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, $mainElement, $Candidate, $LineNum, $CheckSource_PhysicalCheck); |
|
1591 $Candidate = &Path_Norm($Candidate); |
|
1592 |
|
1593 $Candidate=~s-^(.*[^\\])$-$1\\-o; # ensure path ends with a backslash |
|
1594 $Candidate=&Path_MakeEAbs($EPOCPath,$CurFile,$Candidate); |
|
1595 if ($CheckUserInc{$Candidate}) { |
|
1596 next; |
|
1597 } |
|
1598 push @UserIncPaths,$Candidate; |
|
1599 $CheckUserInc{$Candidate}="$CurFile($LineNum)"; |
|
1600 if (-d &Path_Chop($Candidate)) { |
|
1601 next; |
|
1602 } |
|
1603 push @MmpWarn, "$CurFile($LineNum) : USERINCLUDE path \"$Candidate\" not found\n"; |
|
1604 } |
|
1605 next LINE; |
|
1606 } |
|
1607 push @MmpWarn, "$CurFile($LineNum) : No Paths specified for keyword USERINCLUDE\n"; |
|
1608 next LINE; |
|
1609 } |
|
1610 if (/^SRCDBG$/o) { |
|
1611 if (@$Line) { |
|
1612 push @MmpWarn, "$CurFile($LineNum) : Keyword $_ takes no arguments\n"; |
|
1613 } |
|
1614 $SrcDbg=1; |
|
1615 next LINE; |
|
1616 } |
|
1617 if (/^VERSION$/o) { |
|
1618 if (%Version) { |
|
1619 push @MmpDie, "$CurFile($LineNum) : Attempt to redefine VERSION\n"; |
|
1620 next LINE; |
|
1621 } |
|
1622 unless (@$Line) { |
|
1623 push @MmpDie, "$CurFile($LineNum) : Missing argument to VERSION\n"; |
|
1624 next LINE; |
|
1625 } |
|
1626 %Version = &Genutl_StringToVersion(shift @$Line); |
|
1627 if (!%Version) { |
|
1628 push @MmpDie, "$CurFile($LineNum) : Bad VERSION number\n"; |
|
1629 next LINE; |
|
1630 } |
|
1631 if (@$Line) { |
|
1632 if ((lc $$Line[0]) eq 'explicit') { |
|
1633 $Version{explicit} = 1; |
|
1634 shift @$Line; |
|
1635 } |
|
1636 if (scalar(@$Line)) { |
|
1637 push @MmpDie, "$CurFile($LineNum) : Garbage after VERSION number\n"; |
|
1638 } |
|
1639 } |
|
1640 next LINE; |
|
1641 } |
|
1642 |
|
1643 if (/^OPTION$/oi ) { |
|
1644 if (@$Line >= 2) { |
|
1645 my $compilerkey= uc shift @$Line; |
|
1646 if (!defined($Compiler{$compilerkey})) { |
|
1647 # first use of "OPTION xxx" |
|
1648 $Compiler{$compilerkey}=shift @$Line; |
|
1649 } |
|
1650 # concatenate extra stuff |
|
1651 while (@$Line) { |
|
1652 $Compiler{$compilerkey}.=" ".shift @$Line; |
|
1653 } |
|
1654 next LINE; |
|
1655 } |
|
1656 push @MmpWarn, "$CurFile($LineNum) : Keyword OPTION requires at least two arguments\n"; |
|
1657 next LINE; |
|
1658 } |
|
1659 if (/^LINKEROPTION$/oi ) { |
|
1660 if (@$Line >= 2) { |
|
1661 # first parameter is the compiler |
|
1662 my $compilerkey= uc shift @$Line; |
|
1663 if (!defined($Compiler{$compilerkey})) { |
|
1664 # first use of "LINKEROPTION xxx" |
|
1665 $LinkerOptions{$compilerkey}=shift @$Line; |
|
1666 } |
|
1667 # concatenate extra stuff |
|
1668 while (@$Line) { |
|
1669 $LinkerOptions{$compilerkey}.=" ".shift @$Line; |
|
1670 } |
|
1671 next LINE; |
|
1672 } |
|
1673 push @MmpWarn, "$CurFile($LineNum) : Keyword LINKEROPTION requires at least two arguments\n"; |
|
1674 next LINE; |
|
1675 } |
|
1676 if (/^OPTION_Replace$/oi ) { |
|
1677 if (@$Line >= 2) { |
|
1678 my $compilerkey= uc shift @$Line; |
|
1679 my $repOptions= shift @$Line; |
|
1680 while (@$Line) |
|
1681 { |
|
1682 $repOptions.= " ".shift @$Line; |
|
1683 } |
|
1684 $repOptions =~ s/=\s*/=/g; |
|
1685 push @{$Replace{$compilerkey}},$repOptions; |
|
1686 |
|
1687 next LINE; |
|
1688 } |
|
1689 push @MmpWarn, "$CurFile($LineNum) : Keyword OPTION_Replace requires at least two arguments\n"; |
|
1690 next LINE; |
|
1691 } |
|
1692 if (/^ARMFPU$/oi) { |
|
1693 if ($ARMFPU) { |
|
1694 push @MmpWarn, "$CurFile($LineNum) : Attempt to redefine ARMFPU\n"; |
|
1695 next LINE; |
|
1696 } |
|
1697 if ($ARMFPU=shift @$Line) { |
|
1698 if (($ARMFPU !~ /^SOFTVFP$/oi) && ($ARMFPU !~ /^VFPV2$/oi)) { |
|
1699 push @MmpWarn, "$CurFile($LineNum) : ARMFPU can only specify SOFTVFP or VFPV2 as an argument\n"; |
|
1700 undef $ARMFPU; |
|
1701 } |
|
1702 next LINE; |
|
1703 } |
|
1704 push @MmpWarn, "$CurFile($LineNum) : ARMFPU must specify either SOFTVFP or VFPV2 as an argument\n"; |
|
1705 next LINE; |
|
1706 } |
|
1707 if( /^PAGED$/o) { |
|
1708 #revert "PAGED" keyword from code and data paged to code paged only |
|
1709 #if ($CodePagingTargetMode == PAGED or $DataPagingTargetMode == PAGED) { |
|
1710 if ($CodePagingTargetMode == PAGED) { |
|
1711 push @MmpWarn, "$CurFile($LineNum) : duplicate paging setting\n"; |
|
1712 } |
|
1713 #revert "PAGED" keyword from code and data paged to code paged only |
|
1714 #if ($CodePagingTargetMode == UNPAGED or $DataPagingTargetMode == UNPAGED) { |
|
1715 if ($CodePagingTargetMode == UNPAGED) { |
|
1716 push @MmpWarn, "$CurFile($LineNum) : conflict paging setting\n"; |
|
1717 } |
|
1718 $CodePagingTargetMode = PAGED; |
|
1719 #revert "PAGED" keyword from code and data paged to code paged only |
|
1720 #$DataPagingTargetMode = PAGED; |
|
1721 next LINE; |
|
1722 } |
|
1723 if( /^UNPAGED$/o) { |
|
1724 if ($CodePagingTargetMode == UNPAGED or $DataPagingTargetMode == UNPAGED) { |
|
1725 push @MmpWarn, "$CurFile($LineNum) : duplicate paging setting\n"; |
|
1726 } |
|
1727 if ($CodePagingTargetMode == PAGED or $DataPagingTargetMode == PAGED) { |
|
1728 push @MmpWarn, "$CurFile($LineNum) : conflict paging setting\n"; |
|
1729 } |
|
1730 $CodePagingTargetMode = UNPAGED; |
|
1731 $DataPagingTargetMode = UNPAGED; |
|
1732 next LINE; |
|
1733 } |
|
1734 if( /^PAGEDCODE$/o) { |
|
1735 if ($CodePagingTargetMode == PAGED) { |
|
1736 push @MmpWarn, "$CurFile($LineNum) : duplicate paging setting\n"; |
|
1737 } |
|
1738 if ($CodePagingTargetMode == UNPAGED) { |
|
1739 push @MmpWarn, "$CurFile($LineNum) : conflict paging setting\n"; |
|
1740 } |
|
1741 $CodePagingTargetMode = PAGED; |
|
1742 next LINE; |
|
1743 } |
|
1744 if( /^UNPAGEDCODE$/o) { |
|
1745 if ($CodePagingTargetMode == UNPAGED) { |
|
1746 push @MmpWarn, "$CurFile($LineNum) : duplicate paging setting\n"; |
|
1747 } |
|
1748 if ($CodePagingTargetMode == PAGED) { |
|
1749 push @MmpWarn, "$CurFile($LineNum) : conflict paging setting\n"; |
|
1750 } |
|
1751 $CodePagingTargetMode = UNPAGED; |
|
1752 next LINE; |
|
1753 } |
|
1754 if( /^PAGEDDATA$/o) { |
|
1755 if ($DataPagingTargetMode == PAGED) { |
|
1756 push @MmpWarn, "$CurFile($LineNum) : duplicate paging setting\n"; |
|
1757 } |
|
1758 if ($DataPagingTargetMode == UNPAGED) { |
|
1759 push @MmpWarn, "$CurFile($LineNum) : conflict paging setting\n"; |
|
1760 } |
|
1761 $DataPagingTargetMode = PAGED; |
|
1762 next LINE; |
|
1763 } |
|
1764 if( /^UNPAGEDDATA$/o) { |
|
1765 if ($DataPagingTargetMode == UNPAGED) { |
|
1766 push @MmpWarn, "$CurFile($LineNum) : duplicate paging setting\n"; |
|
1767 } |
|
1768 if ($DataPagingTargetMode == PAGED) { |
|
1769 push @MmpWarn, "$CurFile($LineNum) : conflict paging setting\n"; |
|
1770 } |
|
1771 $DataPagingTargetMode = UNPAGED; |
|
1772 next LINE; |
|
1773 } |
|
1774 if( /^DEBUGGABLE_UDEBONLY$/o) { |
|
1775 $IsDebuggable = DEBUGGABLE_UDEBONLY; |
|
1776 next LINE; |
|
1777 } |
|
1778 if( /^DEBUGGABLE$/o) { |
|
1779 if ($IsDebuggable != DEBUGGABLE_UDEBONLY) |
|
1780 { |
|
1781 $IsDebuggable = DEBUGGABLE; |
|
1782 } |
|
1783 next LINE; |
|
1784 } |
|
1785 if( /^FEATUREVARIANT$/o) { |
|
1786 push @MmpDie, "$CurFile($LineNum) : FEATUREVARIANT specified multiple times" if ($FeatureVariant); |
|
1787 $FeatureVariant = 1; |
|
1788 next LINE; |
|
1789 } |
|
1790 |
|
1791 push @MmpWarn, "$CurFile($LineNum) : Unrecognised Keyword \"$_\"\n"; |
|
1792 } |
|
1793 |
|
1794 undef $Line; |
|
1795 undef $MmpMacro; |
|
1796 |
|
1797 |
|
1798 # test the mmp contents |
|
1799 #---------------------- |
|
1800 if ($PlatTxtSwitch || $OtherPlatSwitch) { |
|
1801 push @MmpDie, $PlatTxtSwitch ? $PlatTxtSwitch : $OtherPlatSwitch, ": Unterminated START ... END block\n"; |
|
1802 } |
|
1803 undef $PlatTxtSwitch; |
|
1804 undef $OtherPlatSwitch; |
|
1805 |
|
1806 # Check the consistency of the mmp file contents |
|
1807 unless ($Trg) { |
|
1808 unless($TrgType=~/^NONE$/io){ |
|
1809 push @MmpDie, "ERROR: No Target specified\n"; |
|
1810 } |
|
1811 } |
|
1812 unless ($TrgType) { |
|
1813 push @MmpDie, "ERROR: No TargetType specified\n"; |
|
1814 } |
|
1815 if( $StdCpp && $NoStdCpp ) { |
|
1816 push @MmpWarn, "WARNING: Keyword statement STDCPP not permitted with keyword NOSTDCPP.\n"; |
|
1817 push @MmpWarn, "WARNING: Keyword statements STDCPP and NOSTDCPP ignored.\n"; |
|
1818 $StdCpp = 0; |
|
1819 $NoStdCpp = 0; |
|
1820 } |
|
1821 |
|
1822 if (($TrgType =~ /^LIB$/io) && (scalar(@DebugLibList) || scalar(@LibList) || scalar(@StatLibList))) { |
|
1823 push @MmpWarn, "WARNING: Library statements (DEBUGLIBRARY, LIBRARY or STATICLIBRARY) not permitted with TARGETTYPE LIB."; |
|
1824 push @MmpWarn, "WARNING: Library statements (DEBUGLIBRARY, LIBRARY or STATICLIBRARY) ignored.\n"; |
|
1825 undef @DebugLibList; |
|
1826 undef @LibList; |
|
1827 undef @StatLibList; |
|
1828 } |
|
1829 |
|
1830 if ($TrgType =~ /^LIB$/io && $NewLib) { |
|
1831 push @MmpWarn, "WARNING: Library statement NEWLIB not permitted with TARGETTYPE LIB."; |
|
1832 push @MmpWarn, "WARNING: Library statement NEWLIB ignored.\n"; |
|
1833 undef @DebugLibList; |
|
1834 undef @LibList; |
|
1835 undef @StatLibList; |
|
1836 } |
|
1837 |
|
1838 if ($TrgType =~ /^STD(EXE|DLL)$/io && $NewLib) { |
|
1839 push @MmpWarn, "WARNING: Library statement NEWLIB not permitted with TARGETTYPE STD*."; |
|
1840 push @MmpWarn, "WARNING: Library statement NEWLIB ignored.\n"; |
|
1841 undef @DebugLibList; |
|
1842 undef @LibList; |
|
1843 undef @StatLibList; |
|
1844 } |
|
1845 |
|
1846 if (($TrgType=~/^IMPLIB$/io) || ($TrgType=~/^NONE$/io)) { |
|
1847 push @MmpDie, "ERROR: SOURCE not permitted with TARGETTYPE $TrgType\n" if (@SourceStruct); |
|
1848 } elsif (!@SourceStruct) { |
|
1849 push @MmpDie, "ERROR: No Sources specified\n"; |
|
1850 } |
|
1851 if ($TrgType{NeedUID3} && $#UidList<1) { |
|
1852 push @MmpWarn, "WARNING: No Uid3 specified in \"$MMPFILE\" for TargetType \"$TrgType\"\n"; |
|
1853 } |
|
1854 if ($Trg && $Trg=~/\{|\}/) { |
|
1855 push @MmpDie, "ERROR: Bad TARGET name specified\n"; |
|
1856 } |
|
1857 if ($ExportLibrary and $ExportLibrary=~/\{|\}/) { |
|
1858 push @MmpDie, "ERROR: Bad EXPORTLIBRARY name specified\n"; |
|
1859 } |
|
1860 if ($LinkAs and $LinkAs=~/\{|\}/) { |
|
1861 push @MmpDie, "ERROR: Bad LINKAS name specified\n"; |
|
1862 } |
|
1863 # Make sure a valid compression method has been chosen if target is going to be paged |
|
1864 if ($CodePagingTargetMode == PAGED && $CompressTarget == COMPRESS) { |
|
1865 if ($CompressTargetMethod == INFLATECOMPRESSIONMETHOD) { |
|
1866 push @MmpWarn, "Incompatible keywords! The INFLATECOMPRESSTARGET is not allowed with PAGED!\n"; |
|
1867 push @MmpWarn, "Changing compression method to BYTEPAIRCOMPRESSTARGET\n"; |
|
1868 } |
|
1869 $CompressTargetMethod = BYTEPAIRCOMPRESSIONMETHOD; |
|
1870 } |
|
1871 |
|
1872 # Ensure 2nd UID is not deprecated |
|
1873 if (&main::EPOCSecurePlatform() && $TrgType{Basic} eq "DLL") |
|
1874 { |
|
1875 $deprecatedUIDs{"0x100039ce"} = "Unmigrated dll style application detected from use of UID 0x100039ce"; |
|
1876 } |
|
1877 |
|
1878 # Do not need UIDs for a resource only (i.e. TARGETTYPE is "none") mmp file |
|
1879 if ((!$TrgType=~/^NONE$/io) && &main::EPOCSecurePlatform() && defined($deprecatedUIDs{$UidList[0]})) |
|
1880 { |
|
1881 push @MmpMigrationNote, "$deprecatedUIDs{$UidList[0]}\n"; |
|
1882 } |
|
1883 |
|
1884 # PUT IN SOME DEFAULTS |
|
1885 |
|
1886 if ($TrgPath eq '') { |
|
1887 # set up default path from $TrgType |
|
1888 $TrgPath = $TrgType{Path}; |
|
1889 } |
|
1890 my $ResourceTrgPath = $TrgType{ResourcePath}; |
|
1891 if ($ResourceTrgPath eq '') { |
|
1892 $ResourceTrgPath = $TrgPath; # default to TrgPath, as before |
|
1893 } |
|
1894 unless (%Version) { |
|
1895 if ($$Plat_ref{DefFile} =~ /^\s*EABI\s*/i ) { |
|
1896 $Version{major} = 10; # Start major versions at 10 for EABI to allow coexistence with GCC98r2 ABI |
|
1897 } else { |
|
1898 $Version{major} = 1; |
|
1899 } |
|
1900 $Version{minor} = 0; |
|
1901 } |
|
1902 |
|
1903 # check for languages |
|
1904 @LangList=('SC') unless @LangList; |
|
1905 |
|
1906 if (&main::EPOCSecurePlatform() && !defined($Capability) && |
|
1907 (($TrgType{Basic} eq "DLL") || (uc($TrgType) eq "EXEXP"))) |
|
1908 { |
|
1909 push @MmpMigrationNote, "No Capabilities set in \"$MMPFILE\" for TargetType: $TrgType\n"; |
|
1910 } |
|
1911 |
|
1912 # Supply default capability mask if not set explicitly, and convert to hex string |
|
1913 $Capability = "none" unless (defined($Capability)); |
|
1914 $CapabilityFlags[0] = 0 unless (defined($CapabilityFlags[0])); |
|
1915 $CapabilityFlags[1] = 0 unless (defined($CapabilityFlags[1])); |
|
1916 |
|
1917 $CapabilityFlags[0] = sprintf("0x%08x", $CapabilityFlags[0]); |
|
1918 $CapabilityFlags[1] = sprintf("0x%08x", $CapabilityFlags[1]); |
|
1919 |
|
1920 # ensure all bitmaps have targetpaths and check for duplicate bitmaps |
|
1921 my %BitMapCheck; |
|
1922 my $BitMapRef; |
|
1923 foreach $BitMapRef (@BitMapStruct) { |
|
1924 unless ($$BitMapRef{TrgPath}) { |
|
1925 $$BitMapRef{TrgPath}=$ResourceTrgPath; |
|
1926 } |
|
1927 if ($BitMapCheck{"$$BitMapRef{TrgPath}$$BitMapRef{Trg}"}) { |
|
1928 push @MmpDie, "ERROR: Duplicate bitmap target \"$$BitMapRef{TrgPath}$$BitMapRef{Trg}\"\n"; |
|
1929 next; |
|
1930 } |
|
1931 $BitMapCheck{"$$BitMapRef{TrgPath}$$BitMapRef{Trg}"}=1; |
|
1932 } |
|
1933 |
|
1934 # ensure all resources have targetpaths, expand language list and check for duplicates |
|
1935 my %ResourceCheck; |
|
1936 my $ResourceRef; |
|
1937 my @PerLanguageResourceStruct; |
|
1938 foreach $ResourceRef (@ResourceStruct) { |
|
1939 |
|
1940 unless ($$ResourceRef{BaseTrg}) { |
|
1941 $$ResourceRef{BaseTrg}=&Path_Split('Base',$$ResourceRef{Source}); |
|
1942 } |
|
1943 unless ($$ResourceRef{TrgPath}) { |
|
1944 $$ResourceRef{TrgPath}=$ResourceTrgPath; |
|
1945 } |
|
1946 unless ($$ResourceRef{Lang}) { |
|
1947 @{$$ResourceRef{Lang}}=@LangList; |
|
1948 } |
|
1949 # generate one instance per language. |
|
1950 my @list = @{$$ResourceRef{Lang}}; |
|
1951 my $base = "$$ResourceRef{TrgPath}$$ResourceRef{BaseTrg}"; |
|
1952 foreach my $lang (@list) { |
|
1953 my %newResourceRef = %{$ResourceRef}; |
|
1954 $newResourceRef{Lang} = $lang; |
|
1955 $newResourceRef{Trg} = $base.lc("\.R$lang"); |
|
1956 push @PerLanguageResourceStruct, \%newResourceRef; |
|
1957 } |
|
1958 } |
|
1959 @ResourceStruct = @PerLanguageResourceStruct; |
|
1960 undef @PerLanguageResourceStruct; |
|
1961 |
|
1962 foreach $ResourceRef (@ResourceStruct) { |
|
1963 if ($ResourceCheck{"$$ResourceRef{TrgPath}$$ResourceRef{Trg}"}) { |
|
1964 push @MmpDie, "ERROR: Duplicate Resource target \"$$ResourceRef{TrgPath}$$ResourceRef{Trg}\"\n"; |
|
1965 next; |
|
1966 } |
|
1967 $ResourceCheck{"$$ResourceRef{TrgPath}$$ResourceRef{Trg}"}=1; |
|
1968 } |
|
1969 |
|
1970 my $Plat=&main::Plat; |
|
1971 |
|
1972 if (@MmpDie || @MmpWarn || @MmpDiagnostic || @MmpMigrationNote) { |
|
1973 warn "\nMMPFILE \"$MMPFILE\"\n"; |
|
1974 if (@MmpDiagnostic) { |
|
1975 warn |
|
1976 "DIAGNOSTIC MESSAGE(S)\n", |
|
1977 @MmpDiagnostic, |
|
1978 "\n" |
|
1979 ; |
|
1980 } |
|
1981 |
|
1982 foreach my $printedWarning (@MmpWarn) |
|
1983 { |
|
1984 print "WARNING: $printedWarning\n"; |
|
1985 } |
|
1986 foreach my $printedError (@MmpDie) |
|
1987 { |
|
1988 print "FATAL ERROR: $printedError\n"; |
|
1989 } |
|
1990 |
|
1991 foreach my $printedMigrationNote (@MmpMigrationNote) |
|
1992 { |
|
1993 print "MIGRATION_NOTE: $printedMigrationNote\n"; |
|
1994 } |
|
1995 |
|
1996 if (@MmpDie) |
|
1997 { |
|
1998 die; |
|
1999 } |
|
2000 } |
|
2001 |
|
2002 |
|
2003 # COMPLETE THE UID LIST |
|
2004 |
|
2005 while ($#UidList<1) { |
|
2006 push @UidList, '0x00000000'; |
|
2007 } |
|
2008 |
|
2009 # check the second UID, or set it |
|
2010 if ($TrgType{UID2}) { |
|
2011 if ($UidList[0]=~/^0x00000000$/o) { |
|
2012 # put in second uid for known targetypes without them |
|
2013 $UidList[0]=$TrgType{UID2}; |
|
2014 } |
|
2015 elsif ($UidList[0] ne $TrgType{UID2}) { |
|
2016 # text comparison is OK here because UIDs have both been through AnyToHex function |
|
2017 if ($UidList[0] ne '0x01111111') { |
|
2018 # issue warning (but not if UID == 0x01111111 (to allow test code to deliberately set incorrect UID) |
|
2019 warn( |
|
2020 "WARNING: Second Uid is $UidList[0], but\n", |
|
2021 " expected value for Target Type $TrgType is $TrgType{UID2}\n" |
|
2022 ); |
|
2023 } |
|
2024 } |
|
2025 } |
|
2026 |
|
2027 # Put in the first UID in the list |
|
2028 if ($TrgType{Basic}=~/^DLL$/o) { |
|
2029 unshift @UidList, '0x10000079'; |
|
2030 } |
|
2031 elsif ($TrgType{Basic}=~/^(EXE)$/o) { |
|
2032 unshift @UidList, '0x1000007a'; |
|
2033 } |
|
2034 elsif ($TrgType{Basic}=~/^(EXEDLL)$/o) { |
|
2035 # EXE on EPOC32, DLL on Emulator |
|
2036 # NOTE: On EKA1 EXEDLL used EXE UID1 on emulator |
|
2037 # On EKA2 this is unacceptable |
|
2038 if (!$emulator) { |
|
2039 unshift @UidList, '0x1000007a'; |
|
2040 } else { |
|
2041 unshift @UidList, '0x10000079'; |
|
2042 } |
|
2043 } |
|
2044 else { |
|
2045 unshift @UidList, '0x00000000'; |
|
2046 } |
|
2047 |
|
2048 # If no SID specified use UID3 |
|
2049 $SecureId = $UidList[2] unless(defined $SecureId); |
|
2050 |
|
2051 # SORT OUT TARGET TYPE DATA STRUCTURE |
|
2052 |
|
2053 # set the target path |
|
2054 if ($TrgPath) { |
|
2055 $TrgType{Path}=$TrgPath; |
|
2056 } |
|
2057 |
|
2058 # put in the $Linkas default |
|
2059 if (!$LinkAs and $TrgType=~/^IMPLIB$/io) { |
|
2060 $LinkAs = $Trg; |
|
2061 $LinkAs =~ s/\.lib$/\.dll/i; |
|
2062 } else { |
|
2063 $LinkAs = $Trg unless $LinkAs; |
|
2064 } |
|
2065 $LinkAsBase = $LinkAs; |
|
2066 unless ($emulator) { |
|
2067 $LinkAs = &DecorateWithVersion($LinkAs, %Version); |
|
2068 } |
|
2069 |
|
2070 # If explicit version add to target |
|
2071 if ($Version{explicit} && !$emulator) { |
|
2072 $Trg = &DecorateWithVersion($Trg, %Version); |
|
2073 } |
|
2074 |
|
2075 |
|
2076 # Reconcile any EXEDLL targettypes - must be done after first UIDs put in the list |
|
2077 # and after the $LinkAs keyword has been defined/defaulted |
|
2078 if ($TrgType{Basic} eq 'EXEDLL') { |
|
2079 $TrgType{Basic} = $emulator ? 'DLL' : 'EXE'; |
|
2080 $Trg=&Path_Split('Base',$Trg).'.EXE'; |
|
2081 $LinkAsBase=&Path_Split('Base',$LinkAsBase).'.EXE'; |
|
2082 $LinkAs=&Path_Split('Base',$LinkAs).'.EXE'; |
|
2083 } |
|
2084 |
|
2085 # put in the $ExportLibrary default |
|
2086 $ExportLibrary=&Path_Split('Base',$Trg) unless $ExportLibrary; |
|
2087 unless ($emulator) { |
|
2088 $ExportLibrary = &DecorateWithVersion($ExportLibrary, %Version); |
|
2089 } |
|
2090 |
|
2091 # Get the EPOC entrypoint static library |
|
2092 unless ($FirstLib) { |
|
2093 unless ($TrgType{FirstLib}) { |
|
2094 $FirstLib="E$TrgType{Basic}.LIB"; |
|
2095 } |
|
2096 else { |
|
2097 $FirstLib=$TrgType{FirstLib}; |
|
2098 } |
|
2099 } |
|
2100 |
|
2101 |
|
2102 # WORK OUT THE ASSP IMPLICATIONS |
|
2103 |
|
2104 # Nullify ASSP-specific API things for WINS/WINC since the API should always be |
|
2105 # the same for WINC as for WINS, |
|
2106 if ($emulator) { |
|
2107 $ASSPABISwitch=0; |
|
2108 $ASSPExports=0; |
|
2109 unshift @LibList, @ASSPLibList; |
|
2110 unshift @DebugLibList, @ASSPLibList; # keep DebugLibList in sync with LibList |
|
2111 @ASSPLibList=(); |
|
2112 } |
|
2113 else { |
|
2114 # Force ASSPABISwitch for known kernel components or if ASSPEXPORTS or ASSPLIBRARY specified in .MMP file |
|
2115 if ($TrgType{Kernel} or $ASSPExports or @ASSPLibList) { |
|
2116 $ASSPABISwitch=1; |
|
2117 } |
|
2118 } |
|
2119 |
|
2120 # Switch the ABI if necessary |
|
2121 unless ($ASSPABISwitch) { |
|
2122 # apply the standard ABI |
|
2123 $ABI=$$Plat_ref{ABI}; |
|
2124 } |
|
2125 else { |
|
2126 # kernel-specific stuff |
|
2127 # check that the platform is not generic |
|
2128 if ($$Plat_ref{Generic}) { |
|
2129 die "ERROR: Can't apply ASSPABI, ASSPEXPORTS or ASSPLIBRARY for generic platform \"$$Plat_ref{Name}\n"; |
|
2130 } |
|
2131 |
|
2132 # apply the ASSP-specific ABI |
|
2133 $ABI=$$Plat_ref{ASSPABI}; |
|
2134 } |
|
2135 |
|
2136 # COMPLETE THE .DEF FILE STRUCTURE |
|
2137 |
|
2138 # apply the default .DEF filename, and |
|
2139 # check as far as possible that the project is frozen |
|
2140 if (($TrgType{NeedDeffile} or $CheckDef)) { |
|
2141 unless ($Def{Path} and $Def{Path} !~ /\\\~\\$/) { |
|
2142 my $augment; |
|
2143 if ($ASSPExports) { |
|
2144 if ($$Plat_ref{DefFile} =~ /^\s*EABI\s*/i ) { |
|
2145 $augment = $$Plat_ref{ASSP}; |
|
2146 } else { |
|
2147 $augment = "B$$Plat_ref{ASSP}"; |
|
2148 } |
|
2149 } else { |
|
2150 if ($$Plat_ref{DefFile} =~ /^\s*EABI\s*/i ) { |
|
2151 $augment = lc($$Plat_ref{DefFile}); |
|
2152 } else { |
|
2153 $augment = lc("B$$Plat_ref{DefFile}"); |
|
2154 } |
|
2155 } |
|
2156 if ($Def{Path} =~ /\\\~\\$/) { |
|
2157 $Def{Path} =~ s/\\\~\\$/\\$augment\\/; |
|
2158 } else { |
|
2159 $Def{Path}=&Path_Strip(&Path_Split('Path',$MMPFILE)."..\\$augment\\"); |
|
2160 } |
|
2161 } |
|
2162 unless ($Def{Base}) { |
|
2163 $Def{Base} = &Path_Split('Base',$LinkAsBase); |
|
2164 } |
|
2165 unless ($Def{Ext}) { |
|
2166 $Def{Ext}='.def'; |
|
2167 } |
|
2168 # now that we've dumped narrow, treat the 'u' basename suffix as part of the frozen |
|
2169 # .DEF file basename. Once we've dumped the suffix we won't have to store the extension |
|
2170 # separately either |
|
2171 if (!$emulator && $Version{explicit}) { |
|
2172 $Def{Base} .= &Genutl_VersionToFileAugment(%Version); |
|
2173 } elsif (!$NoStrictDef) { |
|
2174 $Def{Base}.='u'; |
|
2175 } |
|
2176 |
|
2177 if ($Def{CheckSource_MMPEntry}) |
|
2178 { |
|
2179 my $type = "DEFFILE"; |
|
2180 $type .= " (NOSTRICTDEF)" if ($NoStrictDef); |
|
2181 |
|
2182 # for GCCXML and X86GCC, ignore check source errors for missing .def file |
|
2183 my $checkdef = (($IgnoreMissingDef) && ($Def{Path} =~ /[\\\/]bmarm[\\\/]/ || $$Plat_ref{Name} eq "X86GCC" || $$Plat_ref{Name} eq "X86GMP")) ? 0 : 1; |
|
2184 |
|
2185 if( $checkdef ) { |
|
2186 CheckSource_MetaData(%CheckSourceMMPMetaData, $Def{CheckSource_MMPFile}, $type, $Def{CheckSource_MMPEntry}, $Def{CheckSource_LineNumber}, $CheckSource_PhysicalCheck, $Def{Path}); |
|
2187 } |
|
2188 } |
|
2189 |
|
2190 # check deffile exists, |
|
2191 unless (-e "$Def{Path}$Def{Base}$Def{Ext}") { |
|
2192 if($IgnoreMissingDef == 0) { |
|
2193 warn "WARNING: Frozen .def file $Def{Path}$Def{Base}$Def{Ext} not found - project not frozen\n"; |
|
2194 } |
|
2195 } |
|
2196 } |
|
2197 } |
|
2198 |
|
2199 sub Mmp_ABI () { |
|
2200 $ABI; |
|
2201 } |
|
2202 sub Mmp_AifStruct () { |
|
2203 \@AifStruct; |
|
2204 } |
|
2205 sub Mmp_AllowDllData () { |
|
2206 $AllowDllData; |
|
2207 } |
|
2208 sub Mmp_CompressTarget () { |
|
2209 $CompressTarget; |
|
2210 } |
|
2211 sub Mmp_CompressTargetMode () { |
|
2212 $CompressTargetMethod; |
|
2213 } |
|
2214 sub Mmp_ASSPExports () { |
|
2215 $ASSPExports; |
|
2216 } |
|
2217 sub Mmp_ASSPLibList () { |
|
2218 @ASSPLibList; |
|
2219 } |
|
2220 sub Mmp_BitMapStruct () { |
|
2221 \@BitMapStruct; |
|
2222 } |
|
2223 sub Mmp_BuildAsARM () { |
|
2224 $BuildAsARM; |
|
2225 } |
|
2226 sub Mmp_CallDllEntryPoints () { |
|
2227 $CallDllEntryPoints; |
|
2228 } |
|
2229 sub Mmp_Capability () { |
|
2230 $Capability; |
|
2231 } |
|
2232 sub Mmp_CapabilityFlags () { |
|
2233 @CapabilityFlags; |
|
2234 } |
|
2235 sub Mmp_DataLinkAddress () { |
|
2236 $DataLinkAddress; |
|
2237 } |
|
2238 sub Mmp_DebugLibList () { |
|
2239 \@DebugLibList; |
|
2240 } |
|
2241 sub Mmp_Def () { |
|
2242 \%Def; |
|
2243 } |
|
2244 sub Mmp_DocHash () { |
|
2245 \%DocHash; |
|
2246 } |
|
2247 sub Mmp_ExportUnfrozen () { |
|
2248 $ExportUnfrozen; |
|
2249 } |
|
2250 sub Mmp_FirstLib () { |
|
2251 $FirstLib; |
|
2252 } |
|
2253 sub Mmp_FixedProcess () { |
|
2254 $FixedProcess; |
|
2255 } |
|
2256 sub Mmp_HeapSize () { |
|
2257 \%HeapSize; |
|
2258 } |
|
2259 sub Mmp_LibList () { |
|
2260 \@LibList; |
|
2261 } |
|
2262 sub Mmp_LinkAs () { |
|
2263 $LinkAs; |
|
2264 } |
|
2265 sub Mmp_LinkAsBase () { |
|
2266 $LinkAsBase; |
|
2267 } |
|
2268 sub Mmp_ExportLibrary () { |
|
2269 $ExportLibrary; |
|
2270 } |
|
2271 sub Mmp_NoExportLibrary () { |
|
2272 $NoExportLibrary; |
|
2273 } |
|
2274 sub Mmp_NewLib () { |
|
2275 $NewLib; |
|
2276 } |
|
2277 sub Mmp_Macros () { |
|
2278 @Macros; |
|
2279 } |
|
2280 sub Mmp_MmpFlag () { |
|
2281 \%MmpFlag; |
|
2282 } |
|
2283 sub Mmp_PlatTxt2D () { |
|
2284 @PlatTxt2D; |
|
2285 } |
|
2286 sub Mmp_ProcessPriority () { |
|
2287 $ProcessPriority; |
|
2288 } |
|
2289 sub Mmp_RamTargets () { |
|
2290 @RamTargets; |
|
2291 } |
|
2292 sub Mmp_ResourceStruct () { |
|
2293 \@ResourceStruct; |
|
2294 } |
|
2295 sub Mmp_RomTargets () { |
|
2296 @RomTargets; |
|
2297 } |
|
2298 sub Mmp_SourceStruct () { |
|
2299 \@SourceStruct; |
|
2300 } |
|
2301 sub Mmp_StackSize () { |
|
2302 $StackSize; |
|
2303 } |
|
2304 sub Mmp_StatLibList () { |
|
2305 @StatLibList; |
|
2306 } |
|
2307 sub Mmp_StdCpp () { |
|
2308 $StdCpp; |
|
2309 } |
|
2310 sub Mmp_NoStdCpp () { |
|
2311 $NoStdCpp; |
|
2312 } |
|
2313 sub Mmp_SysIncPaths () { |
|
2314 @SysIncPaths; |
|
2315 } |
|
2316 sub Mmp_Trg () { |
|
2317 $Trg; |
|
2318 } |
|
2319 sub Mmp_TrgType () { |
|
2320 \%TrgType; |
|
2321 } |
|
2322 sub Mmp_UidList () { |
|
2323 @UidList; |
|
2324 } |
|
2325 sub Mmp_UserIncPaths () { |
|
2326 @UserIncPaths; |
|
2327 } |
|
2328 sub Mmp_SrcDbg () { |
|
2329 $SrcDbg; |
|
2330 } |
|
2331 |
|
2332 sub Mmp_WarningLevel() { |
|
2333 %Compiler; |
|
2334 } |
|
2335 |
|
2336 sub Mmp_LinkerOptions() { |
|
2337 %LinkerOptions |
|
2338 } |
|
2339 |
|
2340 sub Mmp_Version() { |
|
2341 %Version; |
|
2342 } |
|
2343 |
|
2344 sub Mmp_SecureId() { |
|
2345 $SecureId; |
|
2346 } |
|
2347 |
|
2348 sub Mmp_VendorId () { |
|
2349 $VendorId; |
|
2350 } |
|
2351 |
|
2352 sub DecorateWithVersion($$) { |
|
2353 my ($name, %ver) = @_; |
|
2354 my $base = &Path_Split('Base', $name); |
|
2355 my $ext = &Path_Split('Ext', $name); |
|
2356 unless ($base =~ /\{(\d|a|b|c|d|e|f){8}\}$/i) { |
|
2357 $base .= &Genutl_VersionToFileAugment(%Version); |
|
2358 } |
|
2359 return "$base$ext"; |
|
2360 } |
|
2361 |
|
2362 sub Mmp_Replace() { |
|
2363 %Replace; |
|
2364 } |
|
2365 |
|
2366 sub Mmp_SmpSafe() { |
|
2367 $SmpSafe; |
|
2368 } |
|
2369 |
|
2370 sub Mmp_StringTable() { |
|
2371 \@StringTableStruct; |
|
2372 } |
|
2373 sub Mmp_ARMFPU() { |
|
2374 $ARMFPU; |
|
2375 } |
|
2376 |
|
2377 sub Mmp_CheckSourceMMPMetaData() { |
|
2378 %CheckSourceMMPMetaData; |
|
2379 } |
|
2380 |
|
2381 sub Mmp_CheckSourceMMPIncludes() { |
|
2382 %CheckSourceMMPIncludes; |
|
2383 } |
|
2384 |
|
2385 sub Mmp_CodePagingTargetMode() { |
|
2386 $CodePagingTargetMode; |
|
2387 } |
|
2388 |
|
2389 sub Mmp_DataPagingTargetMode() { |
|
2390 $DataPagingTargetMode; |
|
2391 } |
|
2392 |
|
2393 sub Mmp_IsWideCharMain() { |
|
2394 $WideCharMain; |
|
2395 } |
|
2396 |
|
2397 sub Mmp_IsDebuggable() { |
|
2398 $IsDebuggable; |
|
2399 } |
|
2400 |
|
2401 sub Mmp_IsFeatureVariant() { |
|
2402 $FeatureVariant; |
|
2403 } |
|
2404 |
|
2405 # Return the macros tested in the MMP file |
|
2406 sub Mmp_TestedMacros() { |
|
2407 return \%mmptestedMacrosHash; |
|
2408 } |
|
2409 |
|
2410 1; |