|
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 # |
|
15 |
|
16 # This package contains routines to handle Base Platform ABI (BPABI) Platforms. |
|
17 package Cl_bpabi; |
|
18 |
|
19 my @commonOptions; |
|
20 my @thumbOptions; |
|
21 my @armOptions; |
|
22 my @kernelOptions; |
|
23 my @invariantOptions; |
|
24 my @linkerOptions; |
|
25 my @archiverOptions; |
|
26 my @debugFormat; |
|
27 my $ArmIncDir; |
|
28 my @ArmLibList; |
|
29 |
|
30 my %configVariables; |
|
31 |
|
32 #Check if Function call Logger is enabled |
|
33 my $Function_Call_Logger=&main::IsFunctionCallLogging(); |
|
34 |
|
35 # Get the information regarding supporting Compiler Wrapper Option |
|
36 my $IsCompilerWrapperOption=&main::CompilerWrapperOption(); |
|
37 my $IsProxyWrapperOption=&main::ProxyWrapperOption(); |
|
38 |
|
39 # takes an 'expression' to evaluate with $_ bound to each of the |
|
40 # remaining args |
|
41 sub PrintList |
|
42 { |
|
43 my $expr = shift @_; |
|
44 foreach (@_) { |
|
45 my $str = eval($expr); |
|
46 &main::Output($str); |
|
47 } |
|
48 } |
|
49 |
|
50 sub DepLinkList |
|
51 { |
|
52 my $expr = shift @_; |
|
53 my @arr; |
|
54 foreach (@_) { |
|
55 my $str = eval($expr); |
|
56 push @arr, $str; |
|
57 } |
|
58 return @arr; |
|
59 } |
|
60 |
|
61 require Exporter; |
|
62 @ISA=qw(Exporter); |
|
63 @EXPORT=qw( |
|
64 PMHelp_Mmp |
|
65 PMPlatProcessMmp |
|
66 PMStartBldList |
|
67 PMBld |
|
68 PMStartSrcList |
|
69 PMBitMapBld |
|
70 PMResrcBld |
|
71 PMStartSrc |
|
72 PMAifBld |
|
73 PMSrcDepend |
|
74 PMSrcBldDepend |
|
75 PMEndSrcBld |
|
76 PMEndSrc |
|
77 PMEndSrcList |
|
78 PMPrefixFile |
|
79 PMToolChainIncDir |
|
80 PMSupportsFeatureVariants |
|
81 ); |
|
82 |
|
83 use Cwd; |
|
84 |
|
85 # Armutl package does various ancillary things for armedg modules |
|
86 use Armutl; |
|
87 use BPABIutl; |
|
88 use E32Plat; |
|
89 use RVCT_plat2set; |
|
90 use gcce_plat2set; |
|
91 |
|
92 # This is the RVCT Version information required by Armutl package |
|
93 my $RVCTMajorVersion; |
|
94 my $RVCTMinorVersion; |
|
95 my $RVCTVersion; |
|
96 |
|
97 my $GCCEMajorVersion; |
|
98 my $GCCEMinorVersion; |
|
99 my $GCCEVersion; |
|
100 |
|
101 # The name of the build platform, e.g. ARMV6. |
|
102 my $PlatName = main::Plat(); |
|
103 |
|
104 # The name of the root platform. This is useful if the plaform is derived using a |
|
105 # BSF file. If the current platform is not derived, $RootName will be the same as |
|
106 # $PlatName. |
|
107 my $RootName = E32Plat::Plat_Root($PlatName); |
|
108 |
|
109 |
|
110 # cl_generic package contains generic routines to handle bits of makefiles which are |
|
111 # common to all of the platforms. Currently it deals with AIF, MBM amd RSC files. |
|
112 use cl_generic; |
|
113 |
|
114 # E32env package contains information for makmake and associated e32tools perl programs |
|
115 # within the Epoc32 Environment |
|
116 use E32env; |
|
117 |
|
118 # Genutl package contains utility subroutines for MAKMAKE and associated scripts |
|
119 use Genutl; |
|
120 |
|
121 # Modload package is the runtime module-loading routine for loading e32tools modules into |
|
122 # 'main' module |
|
123 use Modload; |
|
124 |
|
125 use constant NOCOMPRESSIONMETHOD => 0; |
|
126 use constant INFLATECOMPRESSIONMETHOD => 1; |
|
127 use constant BYTEPAIRCOMPRESSIONMETHOD => 2; |
|
128 |
|
129 use constant NOTPAGED => 0; |
|
130 use constant UNPAGED => 1; |
|
131 use constant PAGED => 2; |
|
132 |
|
133 use constant NON_DEBUGGABLE => 0; |
|
134 use constant DEBUGGABLE => 1; |
|
135 use constant DEBUGGABLE_UDEBONLY => 2; |
|
136 |
|
137 my %plat = &main::PlatRec(); |
|
138 my $CustomizedARMV5Plat = 0; |
|
139 |
|
140 if (($plat{'CUSTOMIZES'}) && (($plat{'ROOTPLATNAME'} eq "ARMV5") || ($plat{'ROOTPLATNAME'} eq "ARMV5_ABIV2"))) { |
|
141 # The following flag is set to handle the exceptions related to ARMV5 toolchain. |
|
142 $CustomizedARMV5Plat = 1; |
|
143 } |
|
144 |
|
145 #this fucntion will be used for cw_ide platform to update the PlatName and reinitialize the hashtable |
|
146 sub getVariableForNewPlat |
|
147 { |
|
148 $PlatName = main::Plat(); |
|
149 undef(%configVariables); |
|
150 } |
|
151 sub PMHelp_Mmp { |
|
152 |
|
153 # Help Text for ARM Platform, lists out the MMP keywords used incase of ARM Compiler |
|
154 if($PlatName eq "ARMV5" || $PlatName eq "ARMV5_ABIV2" || $CustomizedARMV5Plat) |
|
155 { |
|
156 return &Armutl_Help_Mmp; |
|
157 } |
|
158 else |
|
159 { |
|
160 return ""; |
|
161 } |
|
162 } |
|
163 |
|
164 my $ToolChainIncDir; |
|
165 my @ToolChainLibList; |
|
166 my $ArmRT = 0; |
|
167 my %AsmFiles = (); |
|
168 my %AsmDirs = (); |
|
169 my $NamedSymLkup = 0; |
|
170 my $InterWorking = ''; |
|
171 |
|
172 sub PMPlatProcessMmp (@) { |
|
173 &InitToolChain(@_); |
|
174 $ToolChainIncDir = &GetToolChainIncDir; |
|
175 &main::SetStdIncPaths($ToolChainIncDir); |
|
176 @ToolChainLibList = &GetLibList; |
|
177 # Variable to check if the target forms part of the run time libraries, if it is so |
|
178 # shouldn't be linked against itself or other runtime libs |
|
179 $ArmRT = &IsTargetRT; |
|
180 my @AsmFileList = &GetToolChainAsmFileList; |
|
181 foreach (@AsmFileList) { $AsmFiles{ucfirst lc $_} = 1; } |
|
182 } |
|
183 |
|
184 my $preinclude; |
|
185 |
|
186 my $Makecmd; |
|
187 |
|
188 sub PMStartBldList($) { |
|
189 ($Makecmd) = @_; |
|
190 my $ABI=&main::ABI; |
|
191 my $BaseTrg=&main::BaseTrg; |
|
192 my $BasicTrgType=&main::BasicTrgType; |
|
193 my @BldList=&main::BldList; |
|
194 my @ChopSysIncPaths=&main::Path_Chop(&main::SysIncPaths); |
|
195 my @ChopUserIncPaths=&main::Path_Chop(&main::UserIncPaths); |
|
196 my $DefFile=&main::DefFile; |
|
197 my $EPOCPath=&main::EPOCPath; |
|
198 my $LinkAs=&main::LinkAs; |
|
199 my $LibPath=&main::LibPath.'LIB\\'; |
|
200 my @MacroList=&main::MacroList(); |
|
201 push @MacroList, "__SUPPORT_CPP_EXCEPTIONS__"; |
|
202 push @MacroList, "__SYMBIAN_STDCPP_SUPPORT__" if ( StdCppTarget() ); |
|
203 |
|
204 my $Plat=&main::Plat; |
|
205 my $Trg=&main::Trg; |
|
206 my $TrgType=&main::TrgType; |
|
207 |
|
208 # This horrible change (presumably to allow GCCE to work with edll.lib etc. |
|
209 # produced by RVCT breaks SMP (and also breaks any optimized platform |
|
210 # builds such as ARMV6, and also Thumb2 builds). |
|
211 # Work round for now by conditioning the horrible change on the absence of |
|
212 # SMP in the platform definition. |
|
213 my %PlatHash = &main::PlatRec(); |
|
214 unless ($PlatHash{SMP}) { |
|
215 my $myStatLinkPath; |
|
216 $myStatLinkPath = "$E32env::Data{LinkPath}"; |
|
217 $myStatLinkPath .= "ARMV5"; |
|
218 &main::SetStatLinkPath($myStatLinkPath); |
|
219 } |
|
220 |
|
221 my $VariantFile=&ChangeSlash(&main::VariantFile); |
|
222 |
|
223 my @UidList=&main::UidList; |
|
224 my $SystemTrg = &main::SystemTrg; |
|
225 my $ExportLibrary=&main::ExportLibrary; |
|
226 my $NoExportLibrary=&main::NoExportLibrary; |
|
227 # N.B. should get better way to detect kernel probably!! |
|
228 $SystemTrg = 1 if ($ExportLibrary =~ /EKERN/i); |
|
229 |
|
230 # N.B. should get better way to detect this |
|
231 $SystemTrg = 1 if ($Trg =~ /KSRT/i); |
|
232 |
|
233 my %Version = &main::Version(); |
|
234 my $ExtraExportLibrary; |
|
235 my $PrimaryExportLibrary = $ExportLibrary; |
|
236 unless ($Version{explicit}) { |
|
237 $ExtraExportLibrary = $ExportLibrary; |
|
238 $ExtraExportLibrary =~ s/\{(\d|a|b|c|d|e|f){8}\}//i; |
|
239 $PrimaryExportLibrary = $ExtraExportLibrary; |
|
240 } |
|
241 |
|
242 # set up LinkAs |
|
243 $UidList[2]=~/^0x(.*)$/o; |
|
244 if ($1 ne '00000000') { # have to make sure than series of noughts in brackets doesn't appear in name for null uids |
|
245 $LinkAs=join '', &main::Path_Split('Base',$LinkAs),"[$1]",&main::Path_Split('Ext',$LinkAs); |
|
246 } |
|
247 |
|
248 # Required for .lib generation |
|
249 $InterWorking = ($ABI eq 'ARMV4') ? "" : "--inter"; |
|
250 |
|
251 # need to add config file for makmake invocation |
|
252 my $config_file = BPABIutl_Config_Path($PlatName); |
|
253 |
|
254 &main::Output("\n", "include $config_file\n", "\n"); |
|
255 &Generic_Header(0,$Makecmd, 1); # define standard things using absolute paths and request that a make function |
|
256 # is provided to provide optional conversion of absolute paths to Unix slashes |
|
257 |
|
258 # modified start: makefile improvement |
|
259 &main::Output( |
|
260 "CHECKVMAP : CHECKVMAPUDEB CHECKVMAPUREL", |
|
261 "\n" |
|
262 ); |
|
263 # modified end: makefile improvement |
|
264 if ($Makecmd eq "nmake") { |
|
265 &main::Output( |
|
266 "\n", |
|
267 "PATH=",&main::Path_Drive,$EPOCPath,"gcc\$(PBUILDPID)\\bin;\$(PATH)\n", |
|
268 "\n" |
|
269 ); |
|
270 } |
|
271 else { |
|
272 &main::Output( |
|
273 "\n", |
|
274 "# must set both PATH and Path to make it work correctly\n", |
|
275 "Path:=",&main::Path_Drive,$EPOCPath,"gcc\$(PBUILDPID)\\bin;\$(Path)\n", |
|
276 "PATH:=\$(Path)\n", |
|
277 "\n" |
|
278 ); |
|
279 } |
|
280 |
|
281 if ($BasicTrgType=~/^(DLL|EXE)/o) |
|
282 { |
|
283 |
|
284 my $OtherLinkerOpts; |
|
285 my $toolchain = getConfigVariable('COMPILER_PLAT'); |
|
286 |
|
287 # In case of GCCE releases, '--map' option was supported only from build 3.4.3 Q1C release |
|
288 # Hence this is a special case, where GCCE platform is checked to ensure that the --map option |
|
289 # is accepted in the correct relase. Even if the option is provided in the config file, it will be |
|
290 # ignored for versions before 3.4.3 Q1C 2005 release. |
|
291 |
|
292 # Check to be included in the Makefile, so that the map filename is provided as input only |
|
293 # when the MAP option is supplied |
|
294 |
|
295 &main::Output("ifdef LINKER_SYMBOLS_MAP_OPTION\n"); |
|
296 foreach (@BldList) |
|
297 { |
|
298 &main::Output("\t$_"."_MAP_FILE=\"\$(EPOCTRG$_)\\".&main::Trg($_).".map\"\n"); |
|
299 } |
|
300 &main::Output("else\n"); |
|
301 foreach (@BldList) |
|
302 { |
|
303 &main::Output("\t$_"."_MAP_FILE=\n"); |
|
304 } |
|
305 &main::Output("endif\n"); |
|
306 |
|
307 # In some compiler toolchains, the start address may be required to be provided using the appropriate option. |
|
308 # Incase if the option is provided by the toolchain, then pass we need to pass in the start address. |
|
309 &main::Output( |
|
310 "\nifdef CODE_SEGMENT_START\n", |
|
311 "\tCODE_SEGMENT_START += 0x8000 \n", |
|
312 "endif\n", |
|
313 ); |
|
314 |
|
315 |
|
316 # In some compiler toolchain, the symboled archives may have to be listed |
|
317 &main::Output( |
|
318 "ifdef START_GROUP_SYMBOL\n", |
|
319 "\tEEXE_OBJECT=\$(START_GROUP_SYMBOL)UC_EXE_.o\$(END_GROUP_SYMBOL)\n", |
|
320 "\tEDLL_OBJECT=\$(START_GROUP_SYMBOL)UC_DLL_.o\$(END_GROUP_SYMBOL)\n", |
|
321 "\tDENTRY_OBJECT=\$(START_GROUP_SYMBOL)D_ENTRY_.o\$(END_GROUP_SYMBOL)\n", |
|
322 "\tLENTRY_OBJECT=\$(START_GROUP_SYMBOL)L_ENTRY_.o\$(END_GROUP_SYMBOL)\n", |
|
323 "\tXENTRY_OBJECT=\$(START_GROUP_SYMBOL)X_ENTRY_.o\$(END_GROUP_SYMBOL)\n", |
|
324 "\tVENTRY_OBJECT=\$(START_GROUP_SYMBOL)V_ENTRY_.o\$(END_GROUP_SYMBOL)\n", |
|
325 "\tKENTRY_OBJECT=\$(START_GROUP_SYMBOL)K_ENTRY_.o\$(END_GROUP_SYMBOL)\n", |
|
326 "endif\n\n" |
|
327 ); |
|
328 |
|
329 # put the extra linker options from MMP file into the linker flags |
|
330 $OtherLinkerOpts=&main::LinkerOption($toolchain); |
|
331 |
|
332 if($OtherLinkerOpts) { |
|
333 &main::Output( |
|
334 "\n# ADDITIONAL LINKER OPTIONS\n", |
|
335 "ifdef SYMBIAN_UREL_LINK_FLAGS\n", |
|
336 "\tSYMBIAN_UREL_LINK_FLAGS += $OtherLinkerOpts \n", |
|
337 "else\n", |
|
338 "\tSYMBIAN_UREL_LINK_FLAGS = $OtherLinkerOpts \n", |
|
339 "endif\n", |
|
340 "ifdef SYMBIAN_UDEB_LINK_FLAGS\n", |
|
341 "\tSYMBIAN_UDEB_LINK_FLAGS += $OtherLinkerOpts \n", |
|
342 "else\n", |
|
343 "\tSYMBIAN_UDEB_LINK_FLAGS = $OtherLinkerOpts \n", |
|
344 "endif\n\n" |
|
345 ); |
|
346 } |
|
347 } |
|
348 |
|
349 &main::Output( |
|
350 "INCDIR =" |
|
351 ); |
|
352 |
|
353 PrintList("\" \\\$(INCLUDE_OPTION) \$_\"", @ChopUserIncPaths); |
|
354 PrintList("\" \\\$(INCLUDE_OPTION) \$_\"", @ChopSysIncPaths); |
|
355 |
|
356 $ToolchainIncDir = &GetToolChainIncDir; |
|
357 |
|
358 if($ToolchainIncDir ne '') |
|
359 { |
|
360 &main::Output( |
|
361 " \$(INCLUDE_OPTION) ","\"$ToolchainIncDir\""); |
|
362 } |
|
363 |
|
364 &main::Output( |
|
365 "\n", |
|
366 "\n" |
|
367 ); |
|
368 |
|
369 #Function call logger takes -I as include option |
|
370 my $FCLogger_inc_option = getConfigVariable('FC_LOGGER_INCLUDE_OPTION'); |
|
371 if ($Function_Call_Logger) { |
|
372 &main::Output( |
|
373 "INCDIR_FCLOGGER =" |
|
374 ); |
|
375 PrintList("\" $FCLogger_inc_option \$_\"", @ChopUserIncPaths); |
|
376 PrintList("\" $FCLogger_inc_option \$_\"", @ChopSysIncPaths); |
|
377 $ToolchainIncDir = &GetToolChainIncDir; |
|
378 if($ToolchainIncDir ne '') { |
|
379 &main::Output( |
|
380 " $FCLogger_inc_option \"$ToolchainIncDir\"" |
|
381 ); |
|
382 } |
|
383 &main::Output( |
|
384 "\n", |
|
385 "\n" |
|
386 ); |
|
387 } |
|
388 |
|
389 # Set control warnings and errors options for building Standard C++ application |
|
390 if( StdCppTarget() ) { |
|
391 &main::Output("CC_WARNINGS_CONTROL_OPTION=\$(CC_STDCPP_WARNINGS_CONTROL_OPTION)","\n"); |
|
392 &main::Output("CC_ERRORS_CONTROL_OPTION=\$(CC_STDCPP_ERRORS_CONTROL_OPTION)","\n"); |
|
393 &main::Output("\n", "\n"); |
|
394 } |
|
395 |
|
396 Read_BSF_Options() if ($plat{'CUSTOMIZES'}); |
|
397 |
|
398 my $kernelOption=0; |
|
399 my $buildAsArmOption=0; |
|
400 my $thumbOption=0; |
|
401 |
|
402 if (SysTrg()) |
|
403 { |
|
404 $kernelOption=1; |
|
405 } |
|
406 elsif (main::BuildAsARM() or ($ABI eq 'ARMV4')) |
|
407 { |
|
408 $buildAsArmOption=1; |
|
409 } |
|
410 else |
|
411 { |
|
412 $thumbOption=1; |
|
413 } |
|
414 |
|
415 my $OtherOpts = undef; |
|
416 |
|
417 my $toolchain = getConfigVariable('COMPILER_PLAT'); |
|
418 |
|
419 $OtherOpts = &main::CompilerOption($toolchain); |
|
420 |
|
421 |
|
422 if($kernelOption==1) |
|
423 { |
|
424 if(@kernelOptions) { |
|
425 # Kernel options as read from BSF file (KERNEL_OPTIONS keyword) |
|
426 Set_BSF_Options('KERNEL_OPTIONS',\@kernelOptions); |
|
427 } |
|
428 $OtherOpts .= " \$(KERNEL_OPTIONS) "; |
|
429 } |
|
430 elsif($buildAsArmOption==1) |
|
431 { |
|
432 if(@armOptions) { |
|
433 # Arm options as read from BSF file (ARM_OPTIONS keyword) |
|
434 Set_BSF_Options('ARM_OPTIONS',\@armOptions); |
|
435 } |
|
436 $OtherOpts .= " \$(ARM_OPTIONS) "; |
|
437 } |
|
438 elsif($thumbOption==1) |
|
439 { |
|
440 if(@thumbOptions) { |
|
441 # Thumb options as read from BSF file (THUMB_OPTIONS keyword) |
|
442 Set_BSF_Options('THUMB_OPTIONS',\@thumbOptions); |
|
443 } |
|
444 $OtherOpts .= " \$(THUMB_OPTIONS) "; |
|
445 } |
|
446 |
|
447 if($thumbOption==1 || $buildAsArmOption==1 || $kernelOption ==1 ) |
|
448 { |
|
449 if (&main::ARMFPU && (&main::ARMFPU =~ /^VFPV2$/i)) |
|
450 { |
|
451 $OtherOpts .= " \$(VFP2MODE_OPTION) "; |
|
452 } |
|
453 else |
|
454 { |
|
455 $OtherOpts .= " \$(SOFTVFPMODE_OPTION) "; |
|
456 } |
|
457 } |
|
458 |
|
459 if ($thumbOption==1) |
|
460 { |
|
461 $OtherOpts .= " \$(COMPILER_THUMB_DEFINES) "; |
|
462 } |
|
463 |
|
464 $OtherOpts .= " \$(COMPILER_INTERWORK_DEFINES) "; |
|
465 |
|
466 # Options to export symbols by default, for OE |
|
467 if($TrgType=~/^STDDLL$/o || $TrgType=~/^STDEXE$/o || $TrgType=~/^STDLIB$/o) { |
|
468 $OtherOpts .= " \$(OE_OPTIONS) "; |
|
469 } |
|
470 |
|
471 if($OtherOpts) |
|
472 { |
|
473 &main::Output( |
|
474 "OTHEROPTIONS=$OtherOpts", |
|
475 "\n", |
|
476 "CCFLAGS += \$(OTHEROPTIONS)", |
|
477 "\n" |
|
478 ); |
|
479 } |
|
480 |
|
481 if(@invariantOptions) { |
|
482 # Invariant options as read from BSF file (INVARIANT_OPTIONS keyword) |
|
483 Set_BSF_Options('INVARIANT_OPTIONS',\@invariantOptions); |
|
484 } |
|
485 |
|
486 if(@commonOptions) { |
|
487 # Common options as read from BSF file (COMMON_OPTIONS keyword) |
|
488 Set_BSF_Options('COMMON_OPTIONS',\@commonOptions); |
|
489 } |
|
490 |
|
491 if(@linkerOptions) { |
|
492 # Linker options as read from BSF file (LD_OPTIONS keyword) |
|
493 Set_BSF_Options('LD_OPTIONS',\@linkerOptions); |
|
494 } |
|
495 |
|
496 if ($BasicTrgType=~/^LIB$/o) { |
|
497 if(@archiverOptions) { |
|
498 # Archiver options as read from BSF file (AR_OPTIONS keyword) |
|
499 Set_BSF_Options('AR_OPTIONS',\@archiverOptions); |
|
500 } |
|
501 } |
|
502 |
|
503 if(@debugFormat) { |
|
504 Set_BSF_Options('DEBUG_FORMAT',\@debugFormat); |
|
505 } |
|
506 |
|
507 &main::Output( |
|
508 "CCDEFS = \$(COMPILER_DEFINES) " |
|
509 ); |
|
510 |
|
511 PrintList("\" -D\$_\"", @MacroList); |
|
512 |
|
513 &main::Output( |
|
514 " \$(PLATFORM_DEFINES) " |
|
515 ); |
|
516 |
|
517 &main::Output( |
|
518 |
|
519 ); |
|
520 |
|
521 if($kernelOption==1) |
|
522 { |
|
523 &main::Output( |
|
524 "-D__KERNEL_MODE__ " |
|
525 ); |
|
526 } |
|
527 |
|
528 if($VariantFile){ |
|
529 #Function Call Logger |
|
530 if ($Function_Call_Logger) { |
|
531 #FC Logger accepts product include file without path |
|
532 my $file=&main::Path_Split('File', &main::VariantFile); |
|
533 &main::Output( |
|
534 " -D\"__PRODUCT_INCLUDE__=\\\"${file}\\\"\"" |
|
535 ); |
|
536 } |
|
537 else { |
|
538 &main::Output( |
|
539 " -D__PRODUCT_INCLUDE__=\\\"${VariantFile}\\\"" |
|
540 ); |
|
541 } |
|
542 } |
|
543 |
|
544 &main::Output( |
|
545 " \$(USERDEFS)\n", |
|
546 "\n" |
|
547 ); |
|
548 |
|
549 if ( $RootName =~ /^ARMV5$/ ) { |
|
550 # Now we know that the platform is either ARMV5 or a platform derived from |
|
551 # ARMV5 (BSF). |
|
552 |
|
553 # See if an environment variable overrides the default DWARF version for |
|
554 # this platform. |
|
555 |
|
556 my $env_dwarf_key = "ABLD_${PlatName}_DWARF"; |
|
557 my $env_dwarf_val = $ENV{$env_dwarf_key}; |
|
558 |
|
559 if ($env_dwarf_val) { |
|
560 main::FatalError("The value of $env_dwarf_key is invalid.") unless ($env_dwarf_val =~ /^[23]$/); |
|
561 main::FatalError("We don't support DWARF-2 on ARMV7.") if ($PlatName =~ /^ARMV7/ && $env_dwarf_val == 2); |
|
562 |
|
563 &main::Output( "DEBUG_FORMAT=\$(DEBUG_FORMAT_DWARF$env_dwarf_val)\n\n"); |
|
564 } |
|
565 } |
|
566 |
|
567 |
|
568 foreach (@BldList) { |
|
569 &main::Output( |
|
570 "CC$_ = ", $IsProxyWrapperOption ? "$ENV{ABLD_COMPWRAP} ":"", "\$(CC) " |
|
571 ); |
|
572 |
|
573 # SYMBIAN_UDEB/UREL_CCFLAGS don't have the optimisation levels. |
|
574 if(&main::DebugSwitchUsed() ){ |
|
575 if(&main::SymbolicDebugEnabled() ) { |
|
576 &main::Output( |
|
577 " \$(SYMBIAN_UDEB_CCFLAGS) " |
|
578 ); |
|
579 } |
|
580 else { |
|
581 &main::Output( |
|
582 " \$(SYMBIAN_UREL_CCFLAGS) " |
|
583 ); |
|
584 } |
|
585 } |
|
586 elsif (/DEB$/o) { |
|
587 &main::Output( |
|
588 " \$(SYMBIAN_UDEB_CCFLAGS) " |
|
589 ); |
|
590 } |
|
591 else { |
|
592 &main::Output( |
|
593 " \$(SYMBIAN_UREL_CCFLAGS) " |
|
594 ); |
|
595 |
|
596 } |
|
597 #Set the optimisation levels depending on whether it is a UREL or a UDEB build |
|
598 if (/DEB$/o) { |
|
599 &main::Output( |
|
600 " \$(DEBUG_OPTIMISATION) " |
|
601 ); |
|
602 } |
|
603 else { |
|
604 &main::Output( |
|
605 " \$(REL_OPTIMISATION) " |
|
606 ); |
|
607 } |
|
608 |
|
609 &main::Output( |
|
610 "\$(RUNTIME_SYMBOL_VISIBILITY_OPTION) " |
|
611 ); |
|
612 |
|
613 if($kernelOption == 0) |
|
614 { |
|
615 &main::Output( |
|
616 "\$(EXCEPTIONS) " |
|
617 ); |
|
618 } |
|
619 &main::Output( |
|
620 '$(CCFLAGS) ' |
|
621 ); |
|
622 |
|
623 my @ml = &main::MacroList($_); |
|
624 PrintList("\" -D\$_\"", @ml); |
|
625 |
|
626 &main::Output( |
|
627 " \$(CCDEFS)\n" |
|
628 ); |
|
629 my @mmpReplaceOptions = &main::ReplaceOptions($toolchain); |
|
630 |
|
631 if (@mmpReplaceOptions) |
|
632 { |
|
633 my $OptionPrefix = getConfigVariable('OPTION_PREFIX'); |
|
634 my $Pattern; |
|
635 |
|
636 # Set the value of '$Pattern' which is required to segregate one option from another based on the option prefix. |
|
637 if($OptionPrefix) |
|
638 { |
|
639 $Pattern = $OptionPrefix.'\S+\s*(?!'.$OptionPrefix.')\S*'; |
|
640 } |
|
641 else |
|
642 { |
|
643 # If option prefix is not set in the configuration make file, then set default |
|
644 # option prefix as '-' or '--'. |
|
645 $Pattern = '-{1,2}\S+\s*(?!-)\S*'; |
|
646 } |
|
647 |
|
648 foreach my $options (@mmpReplaceOptions) |
|
649 { |
|
650 my @opts = $options =~ /$Pattern/g; |
|
651 my $count = 0; |
|
652 |
|
653 while ($count <= $#opts) |
|
654 { |
|
655 my $opt; |
|
656 my $rep; |
|
657 if ($opts[$count] =~ /^(\S+)\s+(\S+)$/) |
|
658 { |
|
659 $opt = $1; |
|
660 $rep = $2; |
|
661 &main::Output( |
|
662 "CC$_ := \$(subst $opt ,@@,\$(CC$_))\n", |
|
663 "CC$_ := \$(CC$_:@@%=$opt $rep)", |
|
664 "\n" |
|
665 ); |
|
666 $count++; |
|
667 } |
|
668 else |
|
669 { |
|
670 $opt = $opts[$count]; |
|
671 $rep = $opts[$count+1]; |
|
672 |
|
673 # Substitute '=' with '%' which is a wild card character in makefile. |
|
674 $opt =~ s/=/%/; |
|
675 |
|
676 &main::Output( |
|
677 "CC$_ := \$(CC$_:$opt=$rep)", |
|
678 "\n" |
|
679 ); |
|
680 $count+=2; |
|
681 } |
|
682 } |
|
683 } |
|
684 } |
|
685 &main::Output( |
|
686 "\n" |
|
687 ); |
|
688 } |
|
689 |
|
690 &main::Output( |
|
691 "\n" |
|
692 ); |
|
693 |
|
694 #Function call logger |
|
695 if ($Function_Call_Logger) { |
|
696 #Send all the debug macros to logger |
|
697 foreach (@BldList) { |
|
698 &main::Output |
|
699 ( |
|
700 "FCLOGGER$_ = ", |
|
701 $EPOCPath, |
|
702 "tools\\fc_logger\\edgcpfe" |
|
703 ); |
|
704 |
|
705 my @ml = &main::MacroList($_); |
|
706 PrintList("\" -D\$_\"", @ml); |
|
707 if ($thumbOption==1) { |
|
708 &main::Output( |
|
709 " \$(COMPILER_THUMB_DEFINES)" |
|
710 ); |
|
711 } |
|
712 &main::Output(" \$(COMPILER_INTERWORK_DEFINES)", |
|
713 " \$(CCDEFS)", |
|
714 " \$(FC_LOGGER_DEFINES)", |
|
715 " \$(FC_LOGGER_OPTION)"); |
|
716 &main::Output( |
|
717 "\n", |
|
718 "\n" |
|
719 ); |
|
720 } |
|
721 } |
|
722 |
|
723 foreach (@BldList) { |
|
724 &main::Output( |
|
725 "$_ :" |
|
726 ); |
|
727 |
|
728 if ($BasicTrgType !~ /IMPLIB/io) { |
|
729 &main::Output ( |
|
730 " \\\n\t", |
|
731 &Generic_Quote("\$(EPOCTRG$_)\\".&main::Trg($_)) |
|
732 ); |
|
733 } |
|
734 |
|
735 # lib has to come after the main target so that a .DEF file will be generated if the project is not frozen |
|
736 if ($DefFile and not &main::ExportUnfrozen) { |
|
737 &main::Output( |
|
738 " \\\n", |
|
739 "\tLIBRARY\n" |
|
740 ); |
|
741 } |
|
742 &main::Output( |
|
743 "\n", |
|
744 "\n" |
|
745 ); |
|
746 } |
|
747 |
|
748 # Resource building is done entirely via cl_generic.pm |
|
749 PrintList("\"\nRESOURCE\$_ : MAKEWORK\$_\"", @BldList); |
|
750 &main::Output( |
|
751 "\n", |
|
752 "\n", |
|
753 ); |
|
754 |
|
755 &main::Output( |
|
756 "LIBRARY : MAKEWORKLIBRARY" |
|
757 ); |
|
758 if ($BasicTrgType=~/^LIB$/o) { |
|
759 # code to ensure that the static libraries for all builds are built at the library stage |
|
760 PrintList("\" \$_\"", @BldList); |
|
761 } |
|
762 elsif ($DefFile and !$NoExportLibrary) { |
|
763 unless (&main::ExportUnfrozen) { |
|
764 if (-e $DefFile) { # effectively "if project frozen ..." |
|
765 if ($PlatName =~ /^ARMV5$/) { |
|
766 &main::Output( |
|
767 " ", &Generic_Quote("\$(EPOCLIB)\\LIB\\$PrimaryExportLibrary.dso"), |
|
768 " ", &Generic_Quote("\$(EPOCLIB)\\LIB\\$PrimaryExportLibrary.lib"), "\n" |
|
769 ); |
|
770 } |
|
771 else { |
|
772 &main::Output( |
|
773 " ", &Generic_Quote("\$(EPOCLIB)\\LIB\\$PrimaryExportLibrary.dso"), "\n" |
|
774 ); |
|
775 } |
|
776 } |
|
777 else { |
|
778 &main::Output( |
|
779 "\n", |
|
780 "\t\@echo WARNING: Not attempting to create any import libraries.\n", |
|
781 "\t\@echo When exports are frozen in \"$DefFile\", regenerate Makefile.\n" |
|
782 ); |
|
783 } |
|
784 } else { |
|
785 &main::Output( |
|
786 "\n", |
|
787 "\t\@echo Not attempting to create \"\$(EPOCLIB)\\LIB\\$PrimaryExportLibrary.dso\"\n", |
|
788 "\t\@echo from frozen .DEF file, since EXPORTUNFROZEN specified.\n" |
|
789 ); |
|
790 } |
|
791 |
|
792 my $theDefFile = $DefFile; |
|
793 $theDefFile = "\$(EPOCBLD)\\$BaseTrg.def" unless (-e $DefFile); |
|
794 &main::Output( |
|
795 "\n", |
|
796 "\n", |
|
797 "# REAL TARGET - LIBRARY (.dso) \n", |
|
798 "\n", |
|
799 &Generic_Quote("\$(EPOCLIB)\\LIB\\$ExportLibrary.dso"), " : ", |
|
800 &Generic_Quote($DefFile), "\n", |
|
801 "\tperl -S prepdef.pl ", &Generic_Quote($DefFile), " \"\$(EPOCBLD)\\$ExportLibrary.prep.def\"\n", |
|
802 "\telf2e32 --definput=\"\$(EPOCBLD)\\$ExportLibrary.prep.def\" --dso=", |
|
803 &Generic_Quote("\$(EPOCLIB)\\LIB\\$ExportLibrary.dso"), |
|
804 " --linkas=$LinkAs\n", |
|
805 "\n" |
|
806 ); |
|
807 if ($ExtraExportLibrary) { |
|
808 &main::Output( |
|
809 "\n", |
|
810 &Generic_Quote("\$(EPOCLIB)\\LIB\\$ExtraExportLibrary.dso"), " : ", |
|
811 &Generic_Quote("\$(EPOCLIB)\\LIB\\$ExportLibrary.dso"), "\n", |
|
812 "\tcopy \"\$<\" \"\$@\"\n" |
|
813 ); |
|
814 } |
|
815 |
|
816 # Generate .lib files which will be used for ARMV5_ABIV1 platform (ABIV1 mode toolchain) |
|
817 # Only for ARMV5 platform |
|
818 if ($PlatName =~ /^ARMV5$/) |
|
819 { |
|
820 &main::Output( |
|
821 "\n", |
|
822 "\n", |
|
823 "# REAL TARGET - LIBRARY (.lib) \n", |
|
824 "\n", |
|
825 &Generic_Quote("\$(EPOCLIB)\\LIB\\$ExportLibrary.lib"), " : ", |
|
826 &Generic_Quote($DefFile), "\n", |
|
827 "\tperl -S prepdef.pl ", &Generic_Quote($DefFile), " \"\$(EPOCBLD)\\$ExportLibrary.prep.def\"\n", |
|
828 "\tdef2dll.bat --path=\$(EPOCLIB)\\LIB \\\n\t\t--bldpath=\$(EPOCBLD) \\\n\t\t--import=$ExportLibrary \\\n", |
|
829 "\t\t--deffile=\"\$(EPOCBLD)\\$ExportLibrary.prep.def\" \\\n\t\t--linkAs=$LinkAs \\\n\t\t$InterWorking\n", |
|
830 "\n", |
|
831 ); |
|
832 if ($ExtraExportLibrary) { |
|
833 &main::Output( |
|
834 "\n", |
|
835 &Generic_Quote("\$(EPOCLIB)\\LIB\\$ExtraExportLibrary.lib"), " : ", |
|
836 &Generic_Quote("\$(EPOCLIB)\\LIB\\$ExportLibrary.lib"), "\n", |
|
837 "\tcopy \"\$<\" \"\$@\"\n" |
|
838 ); |
|
839 } |
|
840 } |
|
841 } |
|
842 |
|
843 my $freezeDir = &main::Path_Split('Path', $DefFile); |
|
844 chop($freezeDir); |
|
845 |
|
846 # dummy rule for def files to cope with filename case differences |
|
847 unless (&main::ExportUnfrozen) { |
|
848 if (-e $DefFile) { # effectively "if project frozen ..." |
|
849 &main::Output( |
|
850 "\n", |
|
851 "\n", |
|
852 &Generic_Quote($DefFile), " : ", "\n", |
|
853 "\t\@rem Do nothing\n", |
|
854 ); |
|
855 } |
|
856 } |
|
857 |
|
858 &main::Output( |
|
859 "\n", |
|
860 "\n", |
|
861 &Generic_Quote($freezeDir), " : ", "\n", |
|
862 "\tperl -S emkdir.pl \$\@\n", |
|
863 ); |
|
864 |
|
865 &main::Output( |
|
866 "\n", |
|
867 "\n", |
|
868 "FREEZE : ", |
|
869 &Generic_Quote($freezeDir), "\n", |
|
870 ); |
|
871 if ($DefFile and $BasicTrgType!~/^IMPLIB$/io) { |
|
872 # call perl on the script here so make will die if there are errors |
|
873 # - this doesn't happen if calling perl in a batch file |
|
874 &main::Output( "\tperl -S efreeze.pl \$(EFREEZE_ALLOW_REMOVE) \"$DefFile\" \"\$(EPOCBLD)\\$ExportLibrary.def\" \n" ); |
|
875 } |
|
876 else { |
|
877 &main::Output( "\tperl -e \"print \\\"warning: freeze could not be supported or \\ |
|
878 you need to declare an explicitly specified def file using the keyword \\ |
|
879 DEFFILE in the MMP file!\\n\\\"\""); |
|
880 } |
|
881 &main::Output( |
|
882 "\n", |
|
883 "CLEANLIBRARY :\n" |
|
884 ); |
|
885 if ($DefFile and !$NoExportLibrary) { |
|
886 &main::Output( |
|
887 "\t-\$(ERASE) \"\$(EPOCLIB)\\LIB\\$ExportLibrary.dso\"\n" |
|
888 ); |
|
889 if ($ExtraExportLibrary) { |
|
890 &main::Output( |
|
891 "\t-\$(ERASE) \"\$(EPOCLIB)\\LIB\\$ExtraExportLibrary.dso\"\n" |
|
892 ); |
|
893 } |
|
894 } |
|
895 &main::Output( |
|
896 "\n", |
|
897 "\n" |
|
898 ); |
|
899 &Generic_MakeWorkDir('MAKEWORKLIBRARY',"${LibPath}"); |
|
900 |
|
901 &Generic_Releaseables; |
|
902 } |
|
903 |
|
904 |
|
905 sub PMBld { |
|
906 |
|
907 my $ABI=&main::ABI; |
|
908 my @ASSPLibList=&main::ASSPLibList; |
|
909 my @SrcList=&main::SrcList; |
|
910 my $FeatureVariantBaseTrg=&main::FeatureVariantBaseTrg; |
|
911 my $Bld=&main::Bld; |
|
912 my $ChopBldPath=&main::Path_Chop(&main::BldPath); |
|
913 my $DefFile=&main::DefFile; |
|
914 my $EPOCIncPath=&main::EPOCIncPath; |
|
915 my $FirstLib=&main::FirstLib; |
|
916 my $BasicTrgType=&main::BasicTrgType; |
|
917 my @LibList; |
|
918 my @RTLibList = &GetRTLibList(); |
|
919 my $SystemTrg = &main::SystemTrg; |
|
920 my $LibPath= &main::LibPath; |
|
921 my $LinkAs=&main::LinkAs; |
|
922 my $ExportLibrary=&main::ExportLibrary; |
|
923 my $NoExportLibrary=&main::NoExportLibrary; |
|
924 # N.B. should get better way to detect kernel probably!! |
|
925 $SystemTrg = 1 if ($ExportLibrary =~ /EKERN/i); |
|
926 my $ChopRelPath=&main::Path_Chop(&main::RelPath); |
|
927 my $RelPath=&main::RelPath; |
|
928 my @StatLibList=&main::StatLibList; |
|
929 my $StatLinkPath=&main::StatLinkPath; |
|
930 my $Trg=&main::Trg; |
|
931 my $TrgType=&main::TrgType; |
|
932 my @UidList=&main::UidList; |
|
933 my %Version = &main::Version(); |
|
934 my $ExtraExportLibrary; |
|
935 unless ($Version{explicit}) { |
|
936 $ExtraExportLibrary = $ExportLibrary; |
|
937 $ExtraExportLibrary =~ s/\{(\d|a|b|c|d|e|f){8}\}//i; |
|
938 } |
|
939 my $objectFiles; |
|
940 |
|
941 if ($Bld =~ /DEB/) { |
|
942 @LibList = &main::DebugLibList; |
|
943 } else { |
|
944 @LibList = &main::LibList; |
|
945 } |
|
946 |
|
947 # set up $LinkAs |
|
948 $UidList[2]=~/^0x(.*)$/o; |
|
949 if ($1 ne '00000000') { # have to make sure than series of noughts in brackets doesn't appear in name for null uids |
|
950 $LinkAs=join '', &main::Path_Split('Base',$LinkAs),"[$1]",&main::Path_Split('Ext',$LinkAs); |
|
951 } |
|
952 |
|
953 |
|
954 # REAL TARGETS |
|
955 #------------- |
|
956 &main::Output( |
|
957 "# REAL TARGET - BUILD VARIANT $Bld\n", |
|
958 "\n" |
|
959 ); |
|
960 |
|
961 # releasables |
|
962 my @releaseables; |
|
963 |
|
964 push @releaseables, "$RelPath$Trg" if ($BasicTrgType!~/^IMPLIB$/io); |
|
965 if ($BasicTrgType=~/^(DLL|EXE)$/o) { |
|
966 push @releaseables, "$RelPath$Trg.map"; |
|
967 } |
|
968 if (-e $DefFile and !$NoExportLibrary) { # effectively "if project frozen ..." |
|
969 push @releaseables, "$LibPath$ExportLibrary.dso"; |
|
970 push @releaseables, "$LibPath$ExtraExportLibrary.dso" if ($ExtraExportLibrary); |
|
971 if ($PlatName =~ /^ARMV5$/) { |
|
972 push @releaseables, "$LibPath$ExportLibrary.lib"; |
|
973 push @releaseables, "$LibPath$ExtraExportLibrary.lib" if ($ExtraExportLibrary); |
|
974 } |
|
975 } |
|
976 |
|
977 push @releaseables, &main::FeatureVariantVMapFile() if &main::FeatureVariantVMapFile(); |
|
978 |
|
979 &main::Output( |
|
980 "WHAT$Bld : WHATGENERIC\n", |
|
981 "\n", |
|
982 "CLEAN$Bld : CLEANBUILD$Bld CLEANRELEASE$Bld\n", |
|
983 "\n", |
|
984 "CLEANBUILD$Bld : \n", |
|
985 "\t\@perl -S ermdir.pl \"\$(EPOCBLD$Bld)\"\n", |
|
986 "\n", |
|
987 "CLEANRELEASE$Bld : CLEANGENERIC\n", |
|
988 "\n" |
|
989 ); |
|
990 |
|
991 &Generic_WhatTargets($Bld, "WHAT$Bld", @releaseables); |
|
992 my @cleantargets = (@releaseables, "$RelPath$ExtraExportLibrary.sym"); |
|
993 |
|
994 if (-e $DefFile and !$NoExportLibrary) { # effectively "if project frozen ..." |
|
995 &Generic_CleanTargets($Bld, "CLEANRELEASE$Bld", @cleantargets); |
|
996 } |
|
997 else { |
|
998 push @cleantargets, "$LibPath$ExportLibrary.dso"; |
|
999 push @cleantargets, "$LibPath$ExtraExportLibrary.dso" if ($ExtraExportLibrary); |
|
1000 if ($PlatName =~ /^ARMV5$/) { |
|
1001 push @cleantargets, "$LibPath$ExportLibrary.lib"; |
|
1002 push @cleantargets, "$LibPath$ExtraExportLibrary.lib" if ($ExtraExportLibrary); |
|
1003 } |
|
1004 &Generic_CleanTargets($Bld, "CLEANRELEASE$Bld", @cleantargets); |
|
1005 } |
|
1006 |
|
1007 &Generic_MakeWorkDir("MAKEWORK$Bld",$ChopBldPath); |
|
1008 &Generic_MakeWorkDir("MAKEWORK$Bld",$ChopRelPath); |
|
1009 |
|
1010 return if ($BasicTrgType=~/^IMPLIB$/io); |
|
1011 |
|
1012 &main::Output( |
|
1013 "LISTING$Bld : MAKEWORK$Bld" |
|
1014 ); |
|
1015 foreach (@SrcList) { |
|
1016 my $BaseSrc = &main::Path_Split('Base', $_); |
|
1017 my $Ext = &main::Path_Split('Ext', $_); |
|
1018 if ($Ext =~ /cia/i && ($PlatName ne "GCCE")) { |
|
1019 $BaseSrc = "$BaseSrc\_"; |
|
1020 } |
|
1021 &main::Output( |
|
1022 " \\\n\tLISTING$Bld$BaseSrc" |
|
1023 ); |
|
1024 } |
|
1025 &main::Output( |
|
1026 "\n", |
|
1027 "\n" |
|
1028 ); |
|
1029 #Compiler wrapper support starts |
|
1030 if($IsCompilerWrapperOption) |
|
1031 { |
|
1032 my $Platcmpwrap=&main::Plat; |
|
1033 |
|
1034 &main::Output( |
|
1035 "COMPWRAP$Bld : OUTPUT_NAME = ", |
|
1036 "$Platcmpwrap\_$Bld", |
|
1037 "\n" |
|
1038 ); |
|
1039 |
|
1040 &main::Output( |
|
1041 "COMPWRAP$Bld : MAKEWORK$Bld" |
|
1042 ); |
|
1043 |
|
1044 foreach (@SrcList) { |
|
1045 my $BaseSrc = &main::Path_Split('Base', $_); |
|
1046 &main::Output( |
|
1047 " \\\n\tCOMPWRAP$Bld$BaseSrc" |
|
1048 ); |
|
1049 } |
|
1050 |
|
1051 &main::Output( |
|
1052 "\n", |
|
1053 "\n" |
|
1054 ); |
|
1055 } |
|
1056 #--Compiler wrapper support ends |
|
1057 |
|
1058 # Flag that tells us wheter to run checklib.exe on user-added static libraries. |
|
1059 my $run_checklib = 0; |
|
1060 |
|
1061 if (@StatLibList && $BasicTrgType =~ /^(EXE|DLL)$/o && !$SystemTrg && main::StdCppSupport()) { |
|
1062 # There are user-added static libraries. They should be checked for |
|
1063 # consistent use of operator new. |
|
1064 $run_checklib = 1; |
|
1065 |
|
1066 #Create a make variable for the libraries. |
|
1067 main::Output("\nUSER_ADDED_ARCHIVES_$Bld="); |
|
1068 PrintList("\' \\\n\t\'\.\&Generic_Quote\(\"\\\$\(EPOCSTATLINK$Bld\)\\\\\$_\"\)", @StatLibList); |
|
1069 main::Output("\n\n"); |
|
1070 } |
|
1071 |
|
1072 &main::Output( |
|
1073 "LIBS$Bld=" |
|
1074 ); |
|
1075 |
|
1076 my @depLibs; |
|
1077 if ($BasicTrgType=~/^DLL$/o) { # Add the DLL stub library |
|
1078 &main::Output( |
|
1079 " \\\n\t", |
|
1080 &Generic_Quote("\$(EPOCSTATLINK$Bld)\\EDLLSTUB.lib") |
|
1081 ); |
|
1082 push @depLibs, &Generic_Quote("\$(EPOCSTATLINK$Bld)\\EDLLSTUB.lib"); |
|
1083 } |
|
1084 |
|
1085 my $StaticRTLib = ""; |
|
1086 |
|
1087 |
|
1088 if ($SystemTrg) { |
|
1089 $StaticRTLib = "ksrt"; |
|
1090 } |
|
1091 else { |
|
1092 $StaticRTLib = "usrt"; |
|
1093 } |
|
1094 |
|
1095 if ($RVCTVersion) { |
|
1096 $StaticRTLib .= $RVCTVersion; |
|
1097 } |
|
1098 elsif ($GCCEVersion) { |
|
1099 if ($GCCEMajorVersion < 4) { |
|
1100 $StaticRTLib .= "2_2"; |
|
1101 } |
|
1102 else { |
|
1103 $StaticRTLib .= "3_1"; |
|
1104 } |
|
1105 } |
|
1106 else { |
|
1107 $StaticRTLib .= "2_2"; |
|
1108 } |
|
1109 |
|
1110 &main::Output(" \\\n\$(EPOCSTATLINK$Bld)\\$StaticRTLib\.lib"); |
|
1111 |
|
1112 &main::Output(" \\\n\t",getConfigVariable('VIA_FILE_PREFIX')); |
|
1113 PrintList("\' \\\n\t\'\.\&Generic_Quote\(\"\\\$\(EPOCBSFSTATLINK$Bld\)\\\\\$_\"\)", @StatLibList); |
|
1114 &main::Output(" \\\n\t",getConfigVariable('VIA_FILE_SUFFIX')); |
|
1115 |
|
1116 @depLibs = (@depLibs, DepLinkList("\&Generic_Quote\(\"\\\$\(EPOCBSFSTATLINK$Bld\)\\\\\$_\"\)", @StatLibList)); |
|
1117 |
|
1118 |
|
1119 my @ImportLibList = ImportLibraryList(@LibList); |
|
1120 PrintList("\' \\\n\t\'\.\&Generic_Quote\(\"\\\$\(EPOCLIB\)\\\\LIB\\\\\$_\"\)", @ImportLibList); |
|
1121 @depLibs = (@depLibs, DepLinkList("\&Generic_Quote\(\"\\\$\(EPOCLIB\)\\\\LIB\\\\\$_\"\)", @ImportLibList)); |
|
1122 |
|
1123 if ($TrgType=~/^STDEXE$/o || $TrgType=~/^STDDLL$/o) { |
|
1124 $NamedSymLkup = 1; |
|
1125 my @OEImportLibraryList = &GetOEImportLibList(); |
|
1126 @OEImportLibraryList = ImportLibraryList(@OEImportLibraryList); |
|
1127 if(not (grep /^libc.dso$/i, @LibList)) { |
|
1128 push @OEImportLibraryList, "libc.dso"; |
|
1129 } |
|
1130 PrintList("\' \\\n\t\'\.\&Generic_Quote\(\"\\\$\(EPOCLIB\)\\\\LIB\\\\\$_\"\)", @OEImportLibraryList); |
|
1131 @depLibs = (@depLibs, DepLinkList("\&Generic_Quote\(\"\\\$\(EPOCLIB\)\\\\LIB\\\\\$_\"\)", @OEImportLibraryList)); |
|
1132 } |
|
1133 |
|
1134 unless ($ArmRT || ($BasicTrgType=~/^LIB$/o)) { |
|
1135 my $TargLib = "$ExportLibrary.dso"; |
|
1136 $TargLib =~ s/\{(\d|a|b|c|d|e|f){8}\}//i; |
|
1137 unless ($SystemTrg) { |
|
1138 foreach (@RTLibList) { |
|
1139 # Ignore the empty file name Modified by Kun Xu for DEF126030 on 06/08/2008 |
|
1140 if(!$_) |
|
1141 { |
|
1142 next; |
|
1143 } |
|
1144 &main::Output( |
|
1145 " \\\n\t", |
|
1146 &Generic_Quote("\$(EPOCLIB)\\LIB\\$_") |
|
1147 ) unless ($_ =~ /$TargLib/i); |
|
1148 push @depLibs, &Generic_Quote("\$(EPOCLIB)\\LIB\\$_") unless ($_ =~ /$TargLib/i); |
|
1149 } |
|
1150 } |
|
1151 } |
|
1152 #OE Glue Code |
|
1153 if ($TrgType=~/^STDEXE$/o) { |
|
1154 my @OELibList = &GetOELibList(); |
|
1155 foreach (@OELibList) { |
|
1156 &main::Output( |
|
1157 " \\\n\t", |
|
1158 &Generic_Quote("\$(EPOCSTATLINK$Bld)\\$_"), |
|
1159 ); |
|
1160 push @depLibs, &Generic_Quote("\$(EPOCSTATLINK$Bld)\\$_"); |
|
1161 } |
|
1162 } |
|
1163 PrintList("\' \\\n\t\'\.\&Generic_Quote\(\"\$_\"\)", @ToolChainLibList); |
|
1164 |
|
1165 &main::Output( |
|
1166 "\n", |
|
1167 "\n" |
|
1168 ); |
|
1169 |
|
1170 main::Output( |
|
1171 "LIBS$Bld" . "DEPS=" |
|
1172 ); |
|
1173 |
|
1174 my @tmp; |
|
1175 for my $lib (@depLibs) |
|
1176 { |
|
1177 $lib =~ s/\(.*\.o\)//; |
|
1178 $lib =~ s/\\$//; |
|
1179 push @tmp, $lib unless ($lib =~ /-\(/ || $lib =~ /-\)/); |
|
1180 } |
|
1181 |
|
1182 PrintList("\' \\\n\t\'\.\&Generic_Quote\(\"\$_\"\)", @tmp); |
|
1183 |
|
1184 &main::Output( |
|
1185 "\n", |
|
1186 "\n" |
|
1187 ); |
|
1188 |
|
1189 &main::Output( |
|
1190 "VTBLEXPORTS$Bld=" |
|
1191 ); |
|
1192 my $vtobj = quotemeta("(VtblExports.o)"); |
|
1193 &main::Output( |
|
1194 "\n", |
|
1195 "\n" |
|
1196 ); |
|
1197 |
|
1198 &main::Output( |
|
1199 "OBJECTS$Bld=" |
|
1200 ); |
|
1201 foreach (@SrcList) { |
|
1202 my $BaseSrc = &main::Path_Split('Base', $_); |
|
1203 my $Ext = &main::Path_Split('Ext', $_); |
|
1204 if ($Ext =~ /cia/i && ($PlatName ne "GCCE")) { |
|
1205 $BaseSrc = "$BaseSrc\_"; |
|
1206 } |
|
1207 |
|
1208 &main::Output( |
|
1209 " \\\n\t", |
|
1210 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.o") |
|
1211 ); |
|
1212 |
|
1213 $objectFiles .= &main::BldPath.$BaseSrc.".o "; |
|
1214 } |
|
1215 &main::Output( |
|
1216 "\n", |
|
1217 "\n" |
|
1218 ); |
|
1219 |
|
1220 # IsCustomDllUseCase() subroutine is called to check if the given executable |
|
1221 # is a custom dll or not. |
|
1222 my $IsCustomDll = IsCustomDllUseCase(); |
|
1223 |
|
1224 if ($IsCustomDll) |
|
1225 { |
|
1226 # Generate ".bin" file(assembly listing file) only if frozen deffile is present and EXPORTUNFROZEN is not specified |
|
1227 # in the Mmp file. |
|
1228 if((-e $DefFile) && (!&main::ExportUnfrozen)) |
|
1229 { |
|
1230 &main::Output( |
|
1231 "EXPFILE$Bld = \$(EPOCBLD$Bld)\\$ExportLibrary.bin \n", |
|
1232 "\n" |
|
1233 ); |
|
1234 } |
|
1235 else |
|
1236 { |
|
1237 &main::Output( |
|
1238 "EXPFILE$Bld = \n", |
|
1239 "\n" |
|
1240 ); |
|
1241 } |
|
1242 } |
|
1243 |
|
1244 # Create "via" file containing all object files in order to reduce |
|
1245 # command line lengths in pertinent calls |
|
1246 my $objectsViaFile = &main::CommandFile(); |
|
1247 my $viaoption = getConfigVariable('COMMANDFILE_OPTION'); |
|
1248 |
|
1249 if ($BasicTrgType=~/^LIB$/o && StdCppTarget() ) { |
|
1250 |
|
1251 # Add the magic object that identifies the library as a STDLIB. |
|
1252 $objectFiles .= "$ENV{EPOCROOT}epoc32/tools/tag/tag_elf"; |
|
1253 } |
|
1254 |
|
1255 $objectFiles =~ s/\\/\//g ; |
|
1256 |
|
1257 &main::CreateExtraFile($objectsViaFile, $objectFiles); |
|
1258 |
|
1259 &main::Output( |
|
1260 &Generic_Quote("\$(EPOCTRG$Bld)\\$Trg"), |
|
1261 " : \$(OBJECTS$Bld) \$(LIBS". $Bld . "DEPS)" |
|
1262 ); |
|
1263 |
|
1264 if (-e $DefFile) { # effectively "if project frozen ..." |
|
1265 &main::Output( |
|
1266 " ", &Generic_Quote($DefFile) |
|
1267 ); |
|
1268 } |
|
1269 |
|
1270 if($IsCustomDll eq 1) |
|
1271 { |
|
1272 &main::Output( " \$(EXPFILE$Bld) " ); |
|
1273 } |
|
1274 |
|
1275 &main::Output("\n"); |
|
1276 |
|
1277 |
|
1278 # get rid of any -symbols produced .map file |
|
1279 if ($BasicTrgType=~/^(DLL|EXE)/o) { |
|
1280 &main::Output( |
|
1281 "\t-\$(ERASE) \"\$(EPOCTRG$Bld)\\$Trg.map\" \n" |
|
1282 ); |
|
1283 } |
|
1284 |
|
1285 my $AbsentSubst = ''; |
|
1286 if ($BasicTrgType=~/^(DLL|EXE)/o) { |
|
1287 |
|
1288 if ($run_checklib) { |
|
1289 my $checklib = "checklib"; |
|
1290 |
|
1291 if ( StdCppTarget() ) { |
|
1292 $checklib .= " stdc++ --elf"; |
|
1293 } |
|
1294 else { |
|
1295 $checklib .= " symc++ --elf"; |
|
1296 } |
|
1297 |
|
1298 &main::Output( "\t$checklib ","\$(USER_ADDED_ARCHIVES_$Bld)\n" ); |
|
1299 } |
|
1300 |
|
1301 my $WrapLD = $IsProxyWrapperOption ? "$ENV{ABLD_COMPWRAP} " : ""; |
|
1302 if ($Bld =~ /DEB/) |
|
1303 { |
|
1304 if($PlatName ne "GCCE"){ |
|
1305 # if the compiler is RVCT then append SYMBIAN_UDEB_LINK_FLAGS to option string |
|
1306 # in order to override the default ones. |
|
1307 &main::Output( |
|
1308 "\t", $WrapLD, "\$(LD) ","\$(STATIC_LIBS) ", "\$(SHARED_OBJECT_OPTION) ", |
|
1309 "\$(CODE_SEGMENT_START) ", "\$(DATA_SEGMENT_START) 0x400000 ", "\$(SYMVER_OPTION) ", "\$(SYMBIAN_UDEB_LINK_FLAGS) ", "\$(SO_NAME_OPTION) ","$LinkAs" |
|
1310 ); |
|
1311 } else { |
|
1312 &main::Output( |
|
1313 "\t", $WrapLD, "\$(LD) ","\$(STATIC_LIBS) ","\$(SYMBIAN_UDEB_LINK_FLAGS) ", "\$(SHARED_OBJECT_OPTION) ", |
|
1314 "\$(CODE_SEGMENT_START) ", "\$(DATA_SEGMENT_START) 0x400000 ", "\$(SYMVER_OPTION) ","\$(SO_NAME_OPTION) ","$LinkAs" |
|
1315 ); |
|
1316 } |
|
1317 } |
|
1318 else |
|
1319 { |
|
1320 if($PlatName ne "GCCE"){ |
|
1321 # if the compiler is RVCT then append SYMBIAN_UREL_LINK_FLAGS to option string |
|
1322 # in order to override the default ones. |
|
1323 &main::Output( |
|
1324 "\t", $WrapLD, "\$(LD) ","\$(STATIC_LIBS) ","\$(SHARED_OBJECT_OPTION) ", |
|
1325 "\$(CODE_SEGMENT_START) ", "\$(DATA_SEGMENT_START) 0x400000 ", "\$(SYMVER_OPTION) ", "\$(SYMBIAN_UREL_LINK_FLAGS) ", "\$(SO_NAME_OPTION) ", "$LinkAs" |
|
1326 ); |
|
1327 } else { |
|
1328 &main::Output( |
|
1329 "\t", $WrapLD, "\$(LD) ","\$(STATIC_LIBS) ","\$(SYMBIAN_UREL_LINK_FLAGS) ","\$(SHARED_OBJECT_OPTION) ", |
|
1330 "\$(CODE_SEGMENT_START) ", "\$(DATA_SEGMENT_START) 0x400000 ", "\$(SYMVER_OPTION) ","\$(SO_NAME_OPTION) ","$LinkAs" |
|
1331 ); |
|
1332 } |
|
1333 } |
|
1334 |
|
1335 if(&main::DebugSwitchUsed()){ |
|
1336 if(&main::SymbolicDebugEnabled() ) { |
|
1337 &main::Output( |
|
1338 " \$(LINKER_DEBUG_OPTION) " |
|
1339 ); |
|
1340 } |
|
1341 else { |
|
1342 &main::Output( |
|
1343 " \$(LINKER_NODEBUG_OPTION) " |
|
1344 ); |
|
1345 } |
|
1346 } |
|
1347 elsif($Bld =~/DEB/){ |
|
1348 &main::Output( |
|
1349 " \$(LINKER_DEBUG_OPTION) " |
|
1350 ); |
|
1351 } |
|
1352 else { |
|
1353 &main::Output( |
|
1354 " \$(LINKER_NODEBUG_OPTION) " |
|
1355 ); |
|
1356 } |
|
1357 |
|
1358 my $EntrySymbol; |
|
1359 if ($BasicTrgType=~/^DLL$/o) { |
|
1360 $EntrySymbol = '_E32Dll'; |
|
1361 } |
|
1362 elsif ($BasicTrgType=~/^EXE$/o) { |
|
1363 $EntrySymbol = '_E32Startup'; |
|
1364 } |
|
1365 if ($EntrySymbol) { |
|
1366 $AbsentSubst = " --absent $EntrySymbol"; |
|
1367 } |
|
1368 |
|
1369 if (($BasicTrgType=~/^DLL$/o) || ($BasicTrgType=~/^EXE$/o)) { |
|
1370 &main::Output( |
|
1371 " \$(LINKER_ENTRY_OPTION)", |
|
1372 " $EntrySymbol " |
|
1373 ); |
|
1374 my $undefined_option = getConfigVariable('UNDEFINED_SYMBOL_REF_OPTION'); |
|
1375 if ($undefined_option) |
|
1376 { |
|
1377 &main::Output( |
|
1378 " \$(UNDEFINED_SYMBOL_REF_OPTION)", |
|
1379 " $EntrySymbol " |
|
1380 ); |
|
1381 } |
|
1382 } |
|
1383 |
|
1384 if ($BasicTrgType=~/^DLL$/o) { |
|
1385 # get the right object file for the entry point |
|
1386 my $ObjFile="\$(EDLL_OBJECT)"; |
|
1387 if ($FirstLib =~ /EDEV/i) { |
|
1388 $ObjFile="\$(DENTRY_OBJECT)"; |
|
1389 } |
|
1390 if ($FirstLib =~ /EKLL/i) { |
|
1391 $ObjFile="\$(LENTRY_OBJECT)"; |
|
1392 } |
|
1393 if ($FirstLib =~ /EEXT/i) { |
|
1394 $ObjFile="\$(XENTRY_OBJECT)"; |
|
1395 } |
|
1396 if ($FirstLib =~ /EVAR/i) { |
|
1397 $ObjFile="\$(VENTRY_OBJECT)"; |
|
1398 } |
|
1399 |
|
1400 &main::Output( |
|
1401 " \$(EPOCSTATLINK$Bld)\\$FirstLib", "$ObjFile", |
|
1402 " \$(EPOCSTATLINK$Bld)\\$FirstLib", " \\", "\n" |
|
1403 ); |
|
1404 } elsif ($BasicTrgType=~/^EXE$/o || $TrgType=~/^EXEXP$/o) { |
|
1405 # get the right object file for the entry point |
|
1406 my $ObjFile="\$(EEXE_OBJECT)"; |
|
1407 if ($FirstLib =~ /KC_EXE/i) { |
|
1408 $ObjFile="\$(KENTRY_OBJECT)"; |
|
1409 } |
|
1410 |
|
1411 &main::Output( |
|
1412 " \$(EPOCSTATLINK$Bld)\\$FirstLib", "$ObjFile", |
|
1413 " \$(EPOCSTATLINK$Bld)\\$FirstLib", " \\", "\n" |
|
1414 ); |
|
1415 } |
|
1416 |
|
1417 &main::Output( |
|
1418 "\t\t\$(LINKER_OUTPUT_OPTION) \"\$(EPOCBLD$Bld)\\$Trg\" \\\n", |
|
1419 # "\t\t\$(OBJECTS$Bld) \\\n" |
|
1420 ); |
|
1421 |
|
1422 &main::Output( |
|
1423 "\t\t\$(LINKER_SYMBOLS_MAP_OPTION) ", |
|
1424 "\$(","$Bld","_MAP_FILE) \\\n" |
|
1425 ); |
|
1426 |
|
1427 # Pass in the command file if the command file option is passed in |
|
1428 if($viaoption) { |
|
1429 #'@' is for GCCE whos version is not 3.4.3 |
|
1430 if($viaoption eq '@'){ |
|
1431 main::Output( |
|
1432 "\t\t$viaoption$objectsViaFile \\\n" |
|
1433 ); |
|
1434 } |
|
1435 #'-via' is for RVCT |
|
1436 else{ |
|
1437 main::Output( |
|
1438 "\t\t$viaoption $objectsViaFile \\\n" |
|
1439 ); |
|
1440 } |
|
1441 } |
|
1442 else { |
|
1443 &main::Output( |
|
1444 "\t\t\$(OBJECTS$Bld) \\\n" |
|
1445 ); |
|
1446 } |
|
1447 |
|
1448 if($IsCustomDll eq 1) { |
|
1449 &main::Output( "\t\t\$(EXPFILE$Bld) \\\n" ); |
|
1450 } |
|
1451 |
|
1452 &main::Output( |
|
1453 "\t\t\$(LIBS$Bld) \\\n", |
|
1454 "\t\t\$(VTBLEXPORTS$Bld) \$(USERLDFLAGS) \n" |
|
1455 ); |
|
1456 |
|
1457 if(&main::DebugSwitchUsed() ){ |
|
1458 if(&main::SymbolicDebugEnabled() ) { |
|
1459 &main::Output( |
|
1460 "\tcopy \"\$(EPOCBLD$Bld)\\$Trg\" \"\$(EPOCTRG$Bld)\\$FeatureVariantBaseTrg.sym\"\n" |
|
1461 ); |
|
1462 } |
|
1463 } |
|
1464 elsif ($Bld=~/^U?DEB$/o) { |
|
1465 &main::Output( |
|
1466 "\tcopy \"\$(EPOCBLD$Bld)\\$Trg\" \"\$(EPOCTRG$Bld)\\$FeatureVariantBaseTrg.sym\"\n" |
|
1467 ); |
|
1468 } |
|
1469 if (-e $DefFile) { |
|
1470 &main::Output( |
|
1471 "\tcopy ", &Generic_Quote(("\"$DefFile\"")), " \"\$(EPOCBLD)\\$ExportLibrary.prep.def\"\n", |
|
1472 ); |
|
1473 } |
|
1474 |
|
1475 &main::Output( |
|
1476 "\telf2e32 --sid=", &main::SecureId(), " " |
|
1477 ); |
|
1478 |
|
1479 if (&main::IsDebuggable eq DEBUGGABLE) { |
|
1480 &main::Output( |
|
1481 ' --debuggable ' |
|
1482 ); |
|
1483 } |
|
1484 |
|
1485 if (&main::IsDebuggable eq DEBUGGABLE_UDEBONLY) { |
|
1486 if ($Bld=~/^UDEB$/o) { |
|
1487 &main::Output( |
|
1488 ' --debuggable ' |
|
1489 ); |
|
1490 } |
|
1491 } |
|
1492 |
|
1493 # Do not export Arm Static Library Symbols |
|
1494 if (&Armutl_ArmLibList) { |
|
1495 &main::Output( |
|
1496 ' --excludeunwantedexports' |
|
1497 ); |
|
1498 } |
|
1499 |
|
1500 if ($IsCustomDll eq 1) { |
|
1501 &main::Output( |
|
1502 ' --customdlltarget' |
|
1503 ); |
|
1504 } |
|
1505 if (keys(%Version)) { |
|
1506 &main::Output( |
|
1507 ' --version=', &Genutl_VersionToUserString(%Version) |
|
1508 ); |
|
1509 } |
|
1510 # exexps are allowed data, but they look like dlls to elftran.... |
|
1511 if (&main::AllowDllData || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) { |
|
1512 &main::Output( |
|
1513 ' --dlldata' |
|
1514 ); |
|
1515 } |
|
1516 if (&main::DataLinkAddress) { |
|
1517 &main::Output( |
|
1518 ' --datalinkaddress=',&main::DataLinkAddress |
|
1519 ); |
|
1520 } |
|
1521 if (&main::FixedProcess) { |
|
1522 &main::Output( |
|
1523 ' --fixedaddress' |
|
1524 ); |
|
1525 } |
|
1526 if (&main::HeapSize) { |
|
1527 my %HeapSize=&main::HeapSize; |
|
1528 &main::Output( |
|
1529 ' --heap=',$HeapSize{Min},',',$HeapSize{Max} |
|
1530 ); |
|
1531 } |
|
1532 if (&main::ProcessPriority) { |
|
1533 &main::Output( |
|
1534 ' --priority=',&main::ProcessPriority |
|
1535 ); |
|
1536 } |
|
1537 if (&main::StackSize) { |
|
1538 &main::Output( |
|
1539 ' --stack=',&main::StackSize |
|
1540 ); |
|
1541 } |
|
1542 &main::Output( |
|
1543 "\\\n\t\t" |
|
1544 ); |
|
1545 |
|
1546 my $i=1; |
|
1547 foreach (@UidList) { |
|
1548 &main::Output( |
|
1549 " --uid$i=$_" |
|
1550 ); |
|
1551 $i++; |
|
1552 } |
|
1553 if(&main::VendorId) { |
|
1554 &main::Output( |
|
1555 ' --vid=',&main::VendorId |
|
1556 ); |
|
1557 } |
|
1558 &main::Output( |
|
1559 "\\\n\t\t" |
|
1560 ); |
|
1561 |
|
1562 &main::Output( |
|
1563 ' --capability=',&main::Capability |
|
1564 ); |
|
1565 |
|
1566 my $vfpv2_support = getConfigVariable('VFP2MODE_OPTION'); |
|
1567 if ($vfpv2_support && &main::ARMFPU && (&main::ARMFPU =~ /^VFPV2$/i)) |
|
1568 { |
|
1569 &main::Output( |
|
1570 ' --fpu=vfpv2' |
|
1571 ); |
|
1572 } |
|
1573 else |
|
1574 { |
|
1575 &main::Output( |
|
1576 ' --fpu=softvfp' |
|
1577 ); |
|
1578 } |
|
1579 |
|
1580 if (&main::SmpSafe) |
|
1581 { |
|
1582 &main::Output( |
|
1583 ' --smpsafe' |
|
1584 ); |
|
1585 } |
|
1586 |
|
1587 |
|
1588 if(($BasicTrgType=~/^DLL/ && $TrgType!~/^DLL/ ) || $TrgType=~/^EXEXP/ || $TrgType=~/^STDEXE/){ |
|
1589 &main::Output( |
|
1590 ' --targettype=',$TrgType |
|
1591 ); |
|
1592 } |
|
1593 else{ |
|
1594 &main::Output( |
|
1595 ' --targettype=',$BasicTrgType |
|
1596 ); |
|
1597 } |
|
1598 |
|
1599 &main::Output( |
|
1600 ' --output=',"\"\$\@\"" |
|
1601 ); |
|
1602 if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) { |
|
1603 if (-e $DefFile) { |
|
1604 &main::Output( |
|
1605 ' --definput=',"\"\$(EPOCBLD)\\$ExportLibrary.prep.def\"" |
|
1606 ); |
|
1607 } |
|
1608 # Non-callable exports will be ignored if the MMP file does not contain the DEFFILE keyword or contains the NOEXPORTLIBRARY keyword |
|
1609 if (!($DefFile) || $NoExportLibrary) { |
|
1610 &main::Output( " --ignorenoncallable" ); |
|
1611 } |
|
1612 &main::Output( |
|
1613 ' --dso=', |
|
1614 &Generic_Quote("\$(EPOCBLD$Bld)\\$ExportLibrary.dso") |
|
1615 ); |
|
1616 &main::Output( |
|
1617 ' --defoutput=', |
|
1618 &Generic_Quote("\$(EPOCBLD$Bld)\\$ExportLibrary.def") |
|
1619 ); |
|
1620 if(&main::ExportUnfrozen) { |
|
1621 &main::Output( ' --unfrozen '); |
|
1622 } |
|
1623 } |
|
1624 #the input elf file - as the last arg |
|
1625 &main::Output( |
|
1626 " --elfinput=","\"\$(EPOCBLD$Bld)\\$Trg\"", |
|
1627 " --linkas=$LinkAs" |
|
1628 ); |
|
1629 if (&main::CompressTarget) |
|
1630 { |
|
1631 &main::Output( |
|
1632 " --uncompressed" |
|
1633 ); |
|
1634 } |
|
1635 else |
|
1636 { |
|
1637 if(&main::CompressTargetMode == NOCOMPRESSIONMETHOD) |
|
1638 { |
|
1639 # Do nothing |
|
1640 } |
|
1641 elsif(&main::CompressTargetMode == INFLATECOMPRESSIONMETHOD) |
|
1642 { |
|
1643 &main::Output( |
|
1644 " --compressionmethod inflate" |
|
1645 ); |
|
1646 } |
|
1647 elsif(&main::CompressTargetMode == BYTEPAIRCOMPRESSIONMETHOD) |
|
1648 { |
|
1649 &main::Output( |
|
1650 " --compressionmethod bytepair" |
|
1651 ); |
|
1652 } |
|
1653 |
|
1654 } |
|
1655 |
|
1656 if($NamedSymLkup){ |
|
1657 &main::Output(" --namedlookup" |
|
1658 ); |
|
1659 } |
|
1660 |
|
1661 &main::Output( |
|
1662 " --libpath=", "\"\$(EPOCLIB)\\LIB\"" |
|
1663 ); |
|
1664 |
|
1665 if($BasicTrgType=~/^DLL/ && $TrgType!~/^DLL/){ |
|
1666 my $Export; |
|
1667 my $Ordinal=1; |
|
1668 foreach $Export (&main::Exports) { |
|
1669 if($Ordinal == 1) { |
|
1670 &main::Output(" --sysdef="); |
|
1671 } |
|
1672 &main::Output( |
|
1673 "$Export,$Ordinal; " |
|
1674 ); |
|
1675 $Ordinal++; |
|
1676 } |
|
1677 } |
|
1678 |
|
1679 if (&main::CodePagingTargetMode == UNPAGED) { |
|
1680 &main::Output( |
|
1681 ' --codepaging=unpaged' |
|
1682 ); |
|
1683 } |
|
1684 elsif (&main::CodePagingTargetMode == PAGED) { |
|
1685 &main::Output( |
|
1686 ' --codepaging=paged' |
|
1687 ); |
|
1688 } |
|
1689 |
|
1690 if (&main::DataPagingTargetMode == UNPAGED) { |
|
1691 &main::Output( |
|
1692 ' --datapaging=unpaged' |
|
1693 ); |
|
1694 } |
|
1695 elsif (&main::DataPagingTargetMode == PAGED) { |
|
1696 &main::Output( |
|
1697 ' --datapaging=paged' |
|
1698 ); |
|
1699 } |
|
1700 |
|
1701 &main::Output( |
|
1702 "\n" |
|
1703 ); |
|
1704 |
|
1705 } |
|
1706 elsif ($BasicTrgType=~/^LIB$/o) { |
|
1707 &main::Output( |
|
1708 "\t\$(AR) ", |
|
1709 " \$(ARCHIVER_CREATE_OPTION) ", |
|
1710 " \$(EPOCBSFSTATLINK$Bld)\\$Trg \\\n" |
|
1711 ); |
|
1712 # Pass in the command file if the command file option is passed in |
|
1713 if($viaoption) { |
|
1714 #'@' is for GCCE whos version is not 3.4.3 |
|
1715 if($viaoption eq '@'){ |
|
1716 &main::Output( |
|
1717 "\t\t$viaoption$objectsViaFile\n" |
|
1718 ); |
|
1719 } |
|
1720 #'-via' is for RVCT |
|
1721 else{ |
|
1722 &main::Output( |
|
1723 "\t\t$viaoption $objectsViaFile\n" |
|
1724 ); |
|
1725 } |
|
1726 } |
|
1727 else { |
|
1728 &main::Output( |
|
1729 "\t\t\$(OBJECTS$Bld) \n" |
|
1730 ); |
|
1731 } |
|
1732 # Pass the archiver options which can be customized form BSF file |
|
1733 &main::Output( |
|
1734 "\t\t\$(AR_OPTIONS) \n" |
|
1735 ); |
|
1736 } |
|
1737 |
|
1738 &main::Output( |
|
1739 "\n" |
|
1740 ); |
|
1741 |
|
1742 if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) { |
|
1743 &main::Output( |
|
1744 "\tcopy ", " \"\$(EPOCBLD$Bld)\\$ExportLibrary.def\" ", "\"\$(EPOCBLD)\\$ExportLibrary.def\"\n" |
|
1745 ); |
|
1746 if (&main::ExportUnfrozen) { |
|
1747 if ($PlatName =~ /^ARMV5$/) |
|
1748 { |
|
1749 &main::Output( |
|
1750 "\tdef2dll.bat --path=\$(EPOCBLD$Bld) \\\n\t\t--bldpath=\$(EPOCBLD$Bld) \\\n\t\t--export=$ExportLibrary \\\n\t\t--import=$ExportLibrary \\\n", |
|
1751 "\t\t--deffile=\$(EPOCBLD)\\$ExportLibrary.def \\\n\t\t--linkAs=$LinkAs \\\n\t\t$InterWorking \\\n\t\t--absent=undef \n" |
|
1752 ); |
|
1753 &main::Output( |
|
1754 "\n", |
|
1755 "\tcopy ", " \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\" ", |
|
1756 "\"\$(EPOCLIB)\\LIB\\$ExportLibrary.lib\"", |
|
1757 "\n" |
|
1758 ); |
|
1759 if ($ExtraExportLibrary) { |
|
1760 &main::Output( |
|
1761 "\n", |
|
1762 "\tcopy ", " \"\$(EPOCLIB)\\LIB\\$ExportLibrary.lib\" ", |
|
1763 "\"\$(EPOCLIB)\\LIB\\$ExtraExportLibrary.lib\"", |
|
1764 "\n" |
|
1765 ); |
|
1766 } |
|
1767 } |
|
1768 |
|
1769 &main::Output( |
|
1770 "\n", |
|
1771 "\tcopy ", " \"\$(EPOCBLD$Bld)\\$ExportLibrary.dso\" ", |
|
1772 "\"\$(EPOCLIB)\\LIB\\$ExportLibrary.dso\"", |
|
1773 "\n" |
|
1774 ); |
|
1775 |
|
1776 &main::Output( |
|
1777 "\n", |
|
1778 "\tcopy ", " \"\$(EPOCBLD$Bld)\\$ExportLibrary.dso\" ", |
|
1779 "\"\$(EPOCLIB)\\LIB\\$ExtraExportLibrary.dso\"", |
|
1780 "\n" |
|
1781 ) if ($ExtraExportLibrary); |
|
1782 |
|
1783 } |
|
1784 } |
|
1785 |
|
1786 if($IsCustomDll eq 1) |
|
1787 { |
|
1788 &main::Output( |
|
1789 &Generic_Quote("\$(EPOCBLD$Bld)\\$ExportLibrary.bin"), ": $DefFile\n"); |
|
1790 |
|
1791 my $theDefFile = "\$(EPOCBLD)\\$ExportLibrary.def"; |
|
1792 $theDefFile = $DefFile if (-e $DefFile && !&main::ExportUnfrozen); |
|
1793 my $theAssembler = " \$(ASM) "; |
|
1794 &main::Output( |
|
1795 "\telf2e32 \\\n\t\t--definput=$theDefFile \\\n\t\t--dump=a \\\n\t\t--output=\$(EPOCBLD$Bld)\\$ExportLibrary.s \n", |
|
1796 "\t$theAssembler \$(AAPCS_OPTION) \\\n\t\t \$(ASM_OUTPUT_OPTION) \$(EPOCBLD$Bld)\\$ExportLibrary.bin \$(EPOCBLD$Bld)\\$ExportLibrary.s\n\n" |
|
1797 ); |
|
1798 &main::Output( |
|
1799 "\t-\$(ERASE) \"\$(EPOCBLD$Bld)\\$ExportLibrary.s\"\n\n" |
|
1800 ); |
|
1801 } |
|
1802 |
|
1803 &main::Output( "\n" ); |
|
1804 } |
|
1805 |
|
1806 # Set to 1 if multifile compilation wanted |
|
1807 my $domultifile = 0; |
|
1808 |
|
1809 sub DoMultiFile () { |
|
1810 return $ENV{RVCTMultiFile} if (defined $ENV{RVCTMultiFile}); |
|
1811 return $domultifile; |
|
1812 } |
|
1813 |
|
1814 my %CompilationGroups = (); |
|
1815 |
|
1816 sub InitMultiFileCompilation() { |
|
1817 # Do preparatory work for multifile compilation |
|
1818 my $SourceStructRef=&main::SourceStructRef; |
|
1819 |
|
1820 # We sort the source files by path and extension. These form natural groups to compile together. |
|
1821 my %PathToSourceMap = (); |
|
1822 foreach my $SourceRef (@$SourceStructRef) { |
|
1823 my $SrcFile = $$SourceRef{CurFile}; |
|
1824 my $Ext = &main::Path_Split('Ext', $SrcFile); |
|
1825 push @{$PathToSourceMap{$$SourceRef{SrcPath}}{$Ext}}, $SrcFile; |
|
1826 } |
|
1827 |
|
1828 # Now we split each group into sets of 10. |
|
1829 foreach my $SrcPath (keys %PathToSourceMap) { |
|
1830 foreach my $Ext (keys %{$PathToSourceMap{$SrcPath}}) { |
|
1831 my @FileList; |
|
1832 my @ObjectList; |
|
1833 my @SourceList; |
|
1834 my $NumToGo = 10; |
|
1835 foreach my $File (@{$PathToSourceMap{$SrcPath}{$Ext}}) { |
|
1836 my $base = &main::Path_Split('Base', $File); |
|
1837 my $cia = ($Ext =~ /cia/i); |
|
1838 $base .= "_" if $cia && ($PlatName ne "GCCE"); |
|
1839 push @FileList, $File; |
|
1840 push @ObjectList, "$base.o"; |
|
1841 # this gives us our source files xxx |
|
1842 push @SourceList, ($cia && ($PlatName ne "GCCE")) ? "$base.cpp" : "$SrcPath$base$Ext"; |
|
1843 $NumToGo--; |
|
1844 unless ($NumToGo) { |
|
1845 # Use the last file as the key. This means e.g that all the dependency |
|
1846 # info will have been generated for the earlier files in the list |
|
1847 push @{$CompilationGroups{$FileList[$#FileList]}{Sources}}, @SourceList; |
|
1848 push @{$CompilationGroups{$FileList[$#FileList]}{Objects}}, @ObjectList; |
|
1849 $NumToGo = 10; |
|
1850 undef @FileList; |
|
1851 undef @ObjectList; |
|
1852 undef @SourceList; |
|
1853 } |
|
1854 } |
|
1855 push @{$CompilationGroups{$FileList[$#FileList]}{Sources}}, @SourceList; |
|
1856 push @{$CompilationGroups{$FileList[$#FileList]}{Objects}}, @ObjectList; |
|
1857 } |
|
1858 } |
|
1859 |
|
1860 # debug print out |
|
1861 if (0) { |
|
1862 foreach my $keyfile (keys %CompilationGroups) { |
|
1863 print "$keyfile :\n"; |
|
1864 foreach my $class (keys %{$CompilationGroups{$keyfile}}) { |
|
1865 print "\t$class:\n\t\t"; |
|
1866 print join " ", @{$CompilationGroups{$keyfile}{$class}}, "\n"; |
|
1867 } |
|
1868 } |
|
1869 } |
|
1870 |
|
1871 } |
|
1872 |
|
1873 sub PMStartSrcList { |
|
1874 |
|
1875 &main::Output( |
|
1876 "# SOURCES\n", |
|
1877 "\n" |
|
1878 ); |
|
1879 |
|
1880 InitMultiFileCompilation() if DoMultiFile(); |
|
1881 |
|
1882 } |
|
1883 |
|
1884 sub PMBitMapBld { |
|
1885 |
|
1886 &Generic_BitMapBld; |
|
1887 |
|
1888 } |
|
1889 |
|
1890 sub PMResrcBld { |
|
1891 |
|
1892 &Generic_ResrcBld; |
|
1893 |
|
1894 } |
|
1895 |
|
1896 sub PMAifBld { |
|
1897 &Generic_AifBld; |
|
1898 } |
|
1899 |
|
1900 |
|
1901 sub PMStartSrc { |
|
1902 my $Src=&main::Src; |
|
1903 |
|
1904 &main::Output( |
|
1905 "# Source $Src\n", |
|
1906 "\n" |
|
1907 ); |
|
1908 } |
|
1909 |
|
1910 sub PMSrcDepend { |
|
1911 my @DepList=&main::DepList; |
|
1912 return if (@DepList == 0); |
|
1913 |
|
1914 my @BldList=&main::BldList; |
|
1915 my $BaseSrc=&main::BaseSrc; |
|
1916 my $ExtSrc=&main::ExtSrc; |
|
1917 |
|
1918 my $BaseObj=$BaseSrc; |
|
1919 my $cia = 0; |
|
1920 if ($ExtSrc =~ /cia/i ) { |
|
1921 $cia = 1; |
|
1922 $BaseObj .= '_' if ($PlatName ne "GCCE"); |
|
1923 } |
|
1924 |
|
1925 foreach my $Bld (@BldList) { |
|
1926 my $tranasm = getConfigVariable('TRANASM'); |
|
1927 if ($tranasm) |
|
1928 { |
|
1929 &main::Output( |
|
1930 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.pre"), " ", |
|
1931 ) if $cia && ($PlatName ne "GCCE"); |
|
1932 } |
|
1933 |
|
1934 &main::Output( |
|
1935 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseObj.cpp"), " ", |
|
1936 ) if $cia && ($PlatName ne "GCCE"); |
|
1937 &main::Output( |
|
1938 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), " ", |
|
1939 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseObj.o"), " \\\n", |
|
1940 ); |
|
1941 } |
|
1942 &main::Output( |
|
1943 ":" |
|
1944 ); |
|
1945 |
|
1946 my $prefix_file=getConfigVariable('PREFIXFILE'); |
|
1947 |
|
1948 my @tempdeplist = &main::DepList; |
|
1949 |
|
1950 my $totalcount = $#tempdeplist; |
|
1951 my $count = 0; |
|
1952 while( $totalcount >= $count ) |
|
1953 { |
|
1954 my $dependencyfile = shift(@tempdeplist); |
|
1955 if($dependencyfile eq $prefix_file ) |
|
1956 { |
|
1957 $DepList[$count]="\$(PREFIXFILE)"; |
|
1958 } |
|
1959 $count += 1; |
|
1960 } |
|
1961 |
|
1962 PrintList("\' \\\n\t\'\.\&Generic_Quote\(\$_\)", @DepList); |
|
1963 &main::Output( |
|
1964 "\n", |
|
1965 "\n" |
|
1966 ); |
|
1967 } |
|
1968 |
|
1969 sub PMSrcBldDepend { |
|
1970 my @DepList=&main::DepList; |
|
1971 return if (@DepList == 0); |
|
1972 |
|
1973 my $Bld=&main::Bld; |
|
1974 my $BaseSrc=&main::BaseSrc; |
|
1975 my $ExtSrc=&main::ExtSrc; |
|
1976 |
|
1977 my $BaseObj=$BaseSrc; |
|
1978 my $cia = 0; |
|
1979 if ($ExtSrc =~ /cia/i ) { |
|
1980 $cia = 1; |
|
1981 $BaseObj .= '_' if ($PlatName ne "GCCE"); |
|
1982 } |
|
1983 |
|
1984 my $tranasm = getConfigVariable('TRANASM'); |
|
1985 if ($tranasm) |
|
1986 { |
|
1987 &main::Output( |
|
1988 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.pre"), " ", |
|
1989 ) if $cia && ($PlatName ne "GCCE"); |
|
1990 } |
|
1991 |
|
1992 &main::Output( |
|
1993 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseObj.cpp"), " ", |
|
1994 ) if $cia && ($PlatName ne "GCCE"); |
|
1995 |
|
1996 &main::Output( |
|
1997 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), " ", |
|
1998 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseObj.o"), " :", |
|
1999 ); |
|
2000 |
|
2001 my $prefix_file=getConfigVariable('PREFIXFILE'); |
|
2002 |
|
2003 my @tempdeplist = &main::DepList; |
|
2004 |
|
2005 my $totalcount = $#tempdeplist; |
|
2006 my $count = 0; |
|
2007 while( $totalcount >= $count ) |
|
2008 { |
|
2009 my $dependencyfile = shift(@tempdeplist); |
|
2010 if($dependencyfile eq $prefix_file ) |
|
2011 { |
|
2012 $DepList[$count]="\$(PREFIXFILE)"; |
|
2013 } |
|
2014 $count += 1; |
|
2015 } |
|
2016 |
|
2017 PrintList("\' \\\n\t\'\.\&Generic_Quote\(\$_\)", @DepList); |
|
2018 &main::Output( |
|
2019 "\n", |
|
2020 "\n" |
|
2021 ); |
|
2022 } |
|
2023 |
|
2024 sub quoted_path |
|
2025 { |
|
2026 my $curdrive=""; |
|
2027 my ($arg) = @_; |
|
2028 return "\"$arg\"" if ($arg !~ /^\\[^\\]/); # not an absolute path |
|
2029 |
|
2030 $curdrive=$1 if (cwd =~ /^(.:)/); |
|
2031 return "\"$curdrive$arg\""; |
|
2032 } |
|
2033 |
|
2034 sub PMPrefixFile |
|
2035 { |
|
2036 # Prefix Header File passed to the preprocessor |
|
2037 |
|
2038 my $prefix_file=getConfigVariable('PREFIXFILE'); |
|
2039 return quoted_path($prefix_file) if defined $prefix_file; |
|
2040 } |
|
2041 |
|
2042 sub PMToolChainIncDir |
|
2043 { |
|
2044 # Extra system include directories dictated by the toolchain |
|
2045 return $ToolChainIncDir; |
|
2046 } |
|
2047 |
|
2048 sub PMEndSrcBld { |
|
2049 # Generate multifile compilation stuff if needed. |
|
2050 if (DoMultiFile()) { |
|
2051 MultiFileEndSrcBld(); |
|
2052 return; |
|
2053 } |
|
2054 |
|
2055 my $ABI=&main::ABI; |
|
2056 my $Plat=&main::Plat; |
|
2057 my $BaseSrc=&main::BaseSrc; |
|
2058 my $Bld=&main::Bld; |
|
2059 my $Src=lc &main::Src; |
|
2060 my $SrcPath=&main::SrcPath; |
|
2061 my $BaseTrg=&main::BaseTrg; |
|
2062 my $BldPath = &main::BldPath; |
|
2063 my $Ext = &main::Path_Split('Ext', $Src); |
|
2064 $Src = ucfirst $Src if ($Ext !~ /\.(cpp|c)$/); |
|
2065 my $LangOptions = &SelectLangOptions($Ext); |
|
2066 # support for auto 'translated' ASM |
|
2067 my $AsmFilep = $AsmFiles{$Src}; |
|
2068 |
|
2069 $preinclude = &GetToolChainPreInclude(); |
|
2070 |
|
2071 #Function call logger takes -I as include option |
|
2072 my $FCLogger_inc_option = getConfigVariable('FC_LOGGER_INCLUDE_OPTION'); |
|
2073 my $logger_preinclude = getConfigVariable('PREINCLUDE_OPTION_FCLOGGER'); |
|
2074 my $Dictionary_File_Name = getConfigVariable('FC_LOGGER_DICTIONARY_FILE_NAME'); |
|
2075 my $Generated_C_File_Name = getConfigVariable('FC_LOGGER_GENERATED_C_FILE_NAME'); |
|
2076 |
|
2077 my $ChopSrcPath=&main::Path_Chop($SrcPath); |
|
2078 my $lfboption = LinkerFeedBackOption(); |
|
2079 my $LstExt ; |
|
2080 if($Plat =~ /^(ARMV[6-9])/i){ |
|
2081 $LstExt = $1 ; |
|
2082 } |
|
2083 else{ |
|
2084 $LstExt = $ABI; |
|
2085 } |
|
2086 if ($AsmFilep || ($Ext =~ /cia/i && ($PlatName ne "GCCE"))) { |
|
2087 &main::Output( |
|
2088 # compile the translated, preprocessed source |
|
2089 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.o"), " : ", |
|
2090 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.cpp"), "\n", |
|
2091 "\t\@echo $Src\n", |
|
2092 "\t\$(CC$Bld) $lfboption $LangOptions ", "\$(INCLUDE_OPTION)"," \$(call absolutePaths,$ChopSrcPath \$(INCDIR) \$(OUTPUT_OPTION) \$\@ \$(EPOCBLD$Bld)\\$BaseSrc\_.cpp)\n", |
|
2093 "\n" |
|
2094 ); |
|
2095 # rule to translate the preprocessed source |
|
2096 my $tranasm = getConfigVariable('TRANASM'); |
|
2097 if ($tranasm) |
|
2098 { |
|
2099 &main::Output( |
|
2100 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.cpp"), " : ", |
|
2101 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.pre"), "\n", |
|
2102 |
|
2103 "\t\$(TRANASM) \$(TRANASM_FLAGS) \$(TRANASM_OUTPUT_OPTION)\$\@ \$(TRANASM_INPUT_OPTION)\$(EPOCBLD$Bld)\\$BaseSrc.pre\n", |
|
2104 "\n" |
|
2105 ); |
|
2106 # rule to preprocess the source |
|
2107 &main::Output( |
|
2108 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.pre"), " : ", |
|
2109 &Generic_Quote("$SrcPath$Src"), "\n", |
|
2110 "\t\$(CC$Bld) \$(PREPROCESSOR_OPTION) $preinclude $LangOptions ","\$(INCLUDE_OPTION)"," \$(call absolutePaths,$ChopSrcPath \$(INCDIR) $ChopSrcPath\\$Src \$(OUTPUT_OPTION) \$\@) \n", |
|
2111 # generate an assembly listing target too |
|
2112 "LISTING$Bld$BaseSrc\_ : ", &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.lis"), "\n", |
|
2113 "\t", &Generic_CopyAction("$SrcPath$BaseSrc\_.$LstExt.lst"), |
|
2114 "\n", |
|
2115 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.lis"), " : ", |
|
2116 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.cpp"), "\n", |
|
2117 "\t\$(CC$Bld) $LangOptions ", "\$(ASSEMBLER_LISTING_OPTION) ","\$(INCLUDE_OPTION)"," \$(call absolutePaths,$ChopSrcPath \$(INCDIR) \$(OUTPUT_OPTION) \$\@ \$(EPOCBLD$Bld)\\$BaseSrc\_.cpp)\n", |
|
2118 "\n" |
|
2119 ); |
|
2120 } |
|
2121 else |
|
2122 { |
|
2123 &main::Output( |
|
2124 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.cpp"), " : ", |
|
2125 &Generic_Quote("$SrcPath$Src"), "\n", |
|
2126 "\t\$(CC$Bld) \$(PREPROCESSOR_OPTION) $preinclude $LangOptions ","\$(INCLUDE_OPTION)"," \$(call absolutePaths,$ChopSrcPath \$(INCDIR) $ChopSrcPath\\$Src \$(OUTPUT_OPTION) \$\@) \n", |
|
2127 # generate an assembly listing target too |
|
2128 "LISTING$Bld$BaseSrc\_ : ", &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.lis"), "\n", |
|
2129 "\t", &Generic_CopyAction("$SrcPath$BaseSrc\_.$LstExt.lst"), |
|
2130 "\n", |
|
2131 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.lis"), " : ", |
|
2132 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.cpp"), "\n", |
|
2133 "\t\$(CC$Bld) $LangOptions ", "\$(ASSEMBLER_LISTING_OPTION) ","\$(INCLUDE_OPTION)"," \$(call absolutePaths,$ChopSrcPath \$(INCDIR) \$(OUTPUT_OPTION) \$\@ \$(EPOCBLD$Bld)\\$BaseSrc\_.cpp)\n", |
|
2134 "\n" |
|
2135 ); |
|
2136 } |
|
2137 } |
|
2138 else { |
|
2139 #If Function call logging is enabled, add call to function call logger |
|
2140 if ($Function_Call_Logger) { |
|
2141 &main::Output( |
|
2142 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.o"), |
|
2143 " : ", |
|
2144 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.int.cpp"), |
|
2145 "\n", |
|
2146 "\t\@echo $BaseSrc.int.cpp\n", |
|
2147 "\t\$(CC$Bld) $lfboption$LangOptions ", |
|
2148 " \$(INCLUDE_OPTION) ", |
|
2149 "\$(call absolutePaths, $ChopSrcPath \$(INCDIR) \$(OUTPUT_OPTION) \$\@ \$(EPOCBLD$Bld)\\$BaseSrc.int.cpp)\n", |
|
2150 "\n", |
|
2151 # generate an assembly listing target too |
|
2152 "LISTING$Bld$BaseSrc : ", |
|
2153 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), |
|
2154 "\n", |
|
2155 "\t", |
|
2156 &Generic_CopyAction("$SrcPath$BaseSrc.$LstExt.lst"), |
|
2157 "\n", |
|
2158 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), |
|
2159 " : ", |
|
2160 &Generic_Quote("$SrcPath$Src"), |
|
2161 "\n", |
|
2162 "\t\$(CC$Bld) $LangOptions ", |
|
2163 "\$(ASSEMBLER_LISTING_OPTION) ", |
|
2164 "\$(INCLUDE_OPTION)", |
|
2165 " \$(call absolutePaths,$ChopSrcPath \$(INCDIR) \$(OUTPUT_OPTION) \$\@ $ChopSrcPath\\$Src) \n", |
|
2166 "\n" |
|
2167 ); |
|
2168 |
|
2169 #Call to Function Call Logger |
|
2170 &main::Output( |
|
2171 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.int.cpp"), |
|
2172 " : ", |
|
2173 &Generic_Quote("$SrcPath\\$Src"), |
|
2174 "\n", |
|
2175 "\t\@echo $BaseSrc.int.cpp\n", |
|
2176 "\t\$(FCLOGGER$Bld) $lfboption \\\n" , |
|
2177 "\t$FCLogger_inc_option $ChopSrcPath \\\n", |
|
2178 "\t$logger_preinclude \\\n ", |
|
2179 "\t\$(INCDIR_FCLOGGER) \\\n" , |
|
2180 "\t$Dictionary_File_Name $BldPath$BaseTrg.txt \\\n" , |
|
2181 "\t$Generated_C_File_Name \$\@ $ChopSrcPath\\$Src \n", |
|
2182 "\n\n" |
|
2183 ); |
|
2184 } |
|
2185 else { |
|
2186 &main::Output( |
|
2187 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.o"), " : ", |
|
2188 &Generic_Quote("$SrcPath$Src"), "\n", |
|
2189 "\t\@echo $Src\n", |
|
2190 "\t\$(CC$Bld) $lfboption $LangOptions ", "\$(INCLUDE_OPTION)"," \$(call absolutePaths,$ChopSrcPath \$(INCDIR) \$(OUTPUT_OPTION) \$\@ $ChopSrcPath\\$Src)\n", |
|
2191 "\n", |
|
2192 # generate an assembly listing target too |
|
2193 "LISTING$Bld$BaseSrc : ", &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), "\n", |
|
2194 "\t", &Generic_CopyAction("$SrcPath$BaseSrc.$LstExt.lst"), |
|
2195 "\n", |
|
2196 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), " : ", |
|
2197 &Generic_Quote("$SrcPath$Src"), "\n", |
|
2198 "\t\$(CC$Bld) $LangOptions ","\$(ASSEMBLER_LISTING_OPTION) ","\$(INCLUDE_OPTION)"," \$(call absolutePaths,$ChopSrcPath \$(INCDIR) \$(OUTPUT_OPTION) \$\@ $ChopSrcPath\\$Src) \n", |
|
2199 "\n" |
|
2200 ); |
|
2201 # Compiler wrapper support starts... |
|
2202 if($IsCompilerWrapperOption) |
|
2203 { |
|
2204 &main::Output( |
|
2205 "COMPWRAP$Bld$BaseSrc : ", |
|
2206 &Generic_Quote("$SrcPath$Src"), "\n", |
|
2207 "\t\@echo Analysing $Src\n", |
|
2208 "\t\$(COMPWRAP) \$(CC$Bld) $lfboption $LangOptions ", "\$(INCLUDE_OPTION)"," \$(call absolutePaths,$ChopSrcPath \$(INCDIR) \$(OUTPUT_OPTION) \$\@ $ChopSrcPath\\$Src)\n", |
|
2209 "\n" |
|
2210 ); |
|
2211 } |
|
2212 # Compiler wrapper support ends... |
|
2213 } |
|
2214 } |
|
2215 } |
|
2216 |
|
2217 my $MFVarN = 0; |
|
2218 sub MultiFileEndSrcBld { |
|
2219 my $ABI=&main::ABI; |
|
2220 my $BaseSrc=&main::BaseSrc; |
|
2221 my $Bld=&main::Bld; |
|
2222 my $KeyFile = &main::Src; |
|
2223 my $Src=ucfirst lc $KeyFile; |
|
2224 my $SrcPath=&main::SrcPath; |
|
2225 my $Ext = &main::Path_Split('Ext', $Src); |
|
2226 my $LangOptions = &SelectLangOptions($Ext); |
|
2227 # support for auto 'translated' ASM |
|
2228 my $AsmFilep = $AsmFiles{$Src}; |
|
2229 |
|
2230 my $ChopSrcPath=&main::Path_Chop($SrcPath); |
|
2231 my $lfboption = LinkerFeedBackOption(); |
|
2232 |
|
2233 if ($AsmFilep || ($Ext =~ /cia/i && ($PlatName ne "GCCE"))) { |
|
2234 if ($CompilationGroups{$KeyFile}) { |
|
2235 # compile the translated, preprocessed source |
|
2236 &main::Output( "OBJECTS$MFVarN = "); |
|
2237 foreach my $obj (@{$CompilationGroups{$KeyFile}{Objects}}) { |
|
2238 &main::Output( &Generic_Quote("\\\n\t\$(EPOCBLD$Bld)\\$obj"), " "); |
|
2239 } |
|
2240 &main::Output( "\n\n"); |
|
2241 &main::Output( "SOURCES$MFVarN = "); |
|
2242 foreach my $src (@{$CompilationGroups{$KeyFile}{Sources}}) { |
|
2243 &main::Output( &Generic_Quote("\\\n\t\$(EPOCBLD$Bld)\\$src", " ")); |
|
2244 } |
|
2245 &main::Output( "\n\n"); |
|
2246 &main::Output( "\$(OBJECTS$MFVarN) : \$(SOURCES$MFVarN) \n"); |
|
2247 |
|
2248 &main::Output( |
|
2249 "\t\@echo Compiling \$(SOURCES$MFVarN)\n", |
|
2250 "\t\$(CC$Bld) ","\$(INCLUDE_OPTION)"," \$(call absolutePaths,$ChopSrcPath \$(INCDIR)) $lfboption\\\n", |
|
2251 "\t\t$LangOptions \$(OUTPUT_OPTION) \$\@ --multifile \$(SOURCES$MFVarN)" |
|
2252 ); |
|
2253 &main::Output( "\n\n"); |
|
2254 $MFVarN++; |
|
2255 } |
|
2256 &main::Output( |
|
2257 # rule to translate the preprocessed source |
|
2258 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.cpp"), " : ", |
|
2259 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.pre"), "\n", |
|
2260 "\ttranasm -n -s -o=\$\@ \$(EPOCBLD$Bld)\\$BaseSrc.pre\n", |
|
2261 "\n", |
|
2262 # rule to preprocess the source |
|
2263 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.pre"), " : ", |
|
2264 &Generic_Quote("$SrcPath$Src"), "\n", |
|
2265 "\t\$(CC$Bld) \$(PREPROCESSOR_OPTION) $preinclude $LangOptions ","\$(INCLUDE_OPTION)"," \$(call absolutePaths,$ChopSrcPath \$(INCDIR)) $ChopSrcPath\\$Src \$(OUTPUT_OPTION) \$\@ \n", |
|
2266 # generate an assembly listing target too |
|
2267 "LISTING$Bld$BaseSrc\_ : ", &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.lis"), "\n", |
|
2268 "\t", &Generic_CopyAction("$SrcPath$BaseSrc\_.$LstExt.lst"), |
|
2269 "\n", |
|
2270 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.lis"), " : ", |
|
2271 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.cpp"), "\n", |
|
2272 "\t\$(CC$Bld) $LangOptions ", "\$(ASSEMBLER_LISTING_OPTION) ","\$(INCLUDE_OPTION)"," \$(call absolutePaths,$ChopSrcPath \$(INCDIR)) \$(OUTPUT_OPTION) \$\@ \$(EPOCBLD$Bld)\\$BaseSrc\_.cpp\n", |
|
2273 "\n" |
|
2274 ); |
|
2275 } else { |
|
2276 |
|
2277 if ($CompilationGroups{$KeyFile}) { |
|
2278 # compile the source |
|
2279 &main::Output( "OBJECTS$MFVarN = "); |
|
2280 foreach my $obj (@{$CompilationGroups{$KeyFile}{Objects}}) { |
|
2281 &main::Output( &Generic_Quote("\\\n\t\$(EPOCBLD$Bld)\\$obj"), " "); |
|
2282 } |
|
2283 &main::Output( "\n\n"); |
|
2284 &main::Output( "SOURCES$MFVarN = "); |
|
2285 foreach my $src (@{$CompilationGroups{$KeyFile}{Sources}}) { |
|
2286 &main::Output( &Generic_Quote("\\\n\t$src"), " "); |
|
2287 } |
|
2288 &main::Output( "\n\n"); |
|
2289 &main::Output( "\$(OBJECTS$MFVarN) : \$(SOURCES$MFVarN) \n"); |
|
2290 |
|
2291 &main::Output( |
|
2292 "\t\@echo Compiling \$(SOURCES$MFVarN)\n", |
|
2293 "\t\$(CC$Bld) ", "\$(INCLUDE_OPTION)"," \$(call absolutePaths,$ChopSrcPath \$(INCDIR)) $lfboption\\\n", |
|
2294 "\t\t$LangOptions \$(OUTPUT_OPTION) \$\@ --multifile \$(SOURCES$MFVarN)" |
|
2295 ); |
|
2296 &main::Output( "\n\n"); |
|
2297 $MFVarN++; |
|
2298 } |
|
2299 # generate an assembly listing target too |
|
2300 &main::Output( |
|
2301 "LISTING$Bld$BaseSrc : ", &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), "\n", |
|
2302 "\t", &Generic_CopyAction("$SrcPath$BaseSrc.$LstExt.lst"), |
|
2303 "\n", |
|
2304 &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), " : ", |
|
2305 &Generic_Quote("$SrcPath$Src"), "\n", |
|
2306 "\t\$(CC$Bld) $LangOptions ","\$(ASSEMBLER_LISTING_OPTION) ","\$(INCLUDE_OPTION)"," \$(call absolutePaths,$ChopSrcPath \$(INCDIR)) \$(OUTPUT_OPTION) \$\@ $ChopSrcPath\\$Src \n", |
|
2307 "\n" |
|
2308 ); |
|
2309 } |
|
2310 } |
|
2311 |
|
2312 |
|
2313 sub PMEndSrc { |
|
2314 |
|
2315 &main::Output( |
|
2316 "\n", |
|
2317 "\n" |
|
2318 ); |
|
2319 } |
|
2320 |
|
2321 sub PMEndSrcList { |
|
2322 |
|
2323 # Deal with accumulated MAKEDIRS etc. |
|
2324 |
|
2325 &Generic_End; |
|
2326 # modified start: makefile improvement |
|
2327 &checkVMAPFiles; |
|
2328 # modified end: makefile improvement |
|
2329 } |
|
2330 |
|
2331 sub ImportLibraryList { |
|
2332 my $dso; |
|
2333 my $base; |
|
2334 my @ImportLibList; |
|
2335 foreach $dso (@_) { |
|
2336 $base = &main::Path_Split('Base', $dso); |
|
2337 $dso = $base.".dso"; |
|
2338 push @ImportLibList, $dso; |
|
2339 } |
|
2340 return @ImportLibList; |
|
2341 } |
|
2342 |
|
2343 sub ChangeSlash($) { |
|
2344 my $abspath = $_[0]; |
|
2345 $abspath =~ s/\\/\//g ; |
|
2346 return $abspath; |
|
2347 } |
|
2348 |
|
2349 # System libraries such as the standard C++ libraries or floating point libraries or any other |
|
2350 # static libraries are made into DLLs by linking its export table against them. Such DLLs that are |
|
2351 # created from a static library is known as a Custom DLL. The ARM libraries can be supplied using |
|
2352 # the ARMLIBS mmp keyword A DLL is considered to be a customdll based on the presence of ARMLIBS |
|
2353 # keyword and also the presence of DEFFILE keyword. |
|
2354 |
|
2355 sub IsCustomDllUseCase() |
|
2356 { |
|
2357 # To check if ARMLIBS keyword is passed in the MMP file. |
|
2358 # Armutl_ArmLibList() gets the list of static arm libraries, if used by an executable. |
|
2359 my $armliblist = &Armutl_ArmLibList; |
|
2360 |
|
2361 # To check if DEFFILE keyword is used in the MMP file to supply the def file. |
|
2362 my $deffile = &main::DefFile; |
|
2363 |
|
2364 if ($armliblist && $deffile) |
|
2365 { |
|
2366 return 1; |
|
2367 } |
|
2368 return 0; |
|
2369 |
|
2370 } |
|
2371 |
|
2372 sub GetToolChainPreInclude { |
|
2373 my $preinclude_file = getConfigVariable('PREINCLUDE_OPTION'); |
|
2374 |
|
2375 $preinclude_file =~ s/\\/\//g; |
|
2376 return "$preinclude_file"; |
|
2377 } |
|
2378 |
|
2379 sub SelectLangOptions { |
|
2380 my ($Ext) = @_; |
|
2381 $preinclude = &GetToolChainPreInclude; |
|
2382 if ($Ext=~/^.cpp$/ || ($Ext=~/^.cia$/ && ($PlatName eq "GCCE"))) { |
|
2383 #Function Call Logger |
|
2384 return " \$(CPP_LANG_OPTION) " if ($Function_Call_Logger); |
|
2385 return " \$(CPP_LANG_OPTION) $preinclude "; |
|
2386 } |
|
2387 if ($Ext=~/^.cia$/) { |
|
2388 return " \$(CIA_LANG_OPTION) "; |
|
2389 } |
|
2390 if ($Ext=~/^.c$/) { |
|
2391 my $CompilerOption = &main::CompilerOption("ARMCC"); |
|
2392 if($CompilerOption =~ /--cpp/){ |
|
2393 #Function Call Logger |
|
2394 return " \$(CPP_LANG_OPTION) " if ($Function_Call_Logger); |
|
2395 return " \$(CPP_LANG_OPTION) $preinclude "; |
|
2396 } |
|
2397 else { |
|
2398 #Function Call Logger |
|
2399 return " \$(C_LANG_OPTION) " if ($Function_Call_Logger); |
|
2400 return " \$(C_LANG_OPTION) $preinclude "; |
|
2401 } |
|
2402 } |
|
2403 # To support .cc, .cxx, .c++ file extensions for Open Environment |
|
2404 elsif ($Ext=~/^(.cc|.cxx|.c\+\+)$/) { |
|
2405 #Function Call Logger |
|
2406 return " \$(CPP_LANG_OPTION) " if ($Function_Call_Logger); |
|
2407 return " \$(CPP_LANG_OPTION) $preinclude "; |
|
2408 } |
|
2409 return ''; |
|
2410 } |
|
2411 |
|
2412 sub IsMapOptAvail() { |
|
2413 open PIPE, "arm-none-symbianelf-g++ -v 2>&1 | "; |
|
2414 while(<PIPE>){ |
|
2415 |
|
2416 if($_ =~ /gcc version (.*) \(release\).*/i) |
|
2417 { |
|
2418 if($1 lt "3.4.3") |
|
2419 { |
|
2420 return 0; |
|
2421 } |
|
2422 elsif($_ =~ /gcc version (.*) \(release\) \(CodeSourcery ARM (.*) (\d*)\)/i) |
|
2423 { |
|
2424 if($1 eq "3.4.3" && uc $2 ne "Q1B" && $3 ge 2005) |
|
2425 { |
|
2426 return 1; |
|
2427 } |
|
2428 elsif($1 gt "3.4.3") |
|
2429 { |
|
2430 return 1; |
|
2431 } |
|
2432 else |
|
2433 { |
|
2434 return 0; |
|
2435 } |
|
2436 } |
|
2437 |
|
2438 } |
|
2439 |
|
2440 } |
|
2441 close PIPE; |
|
2442 } |
|
2443 |
|
2444 sub StdCppTarget() { |
|
2445 |
|
2446 # STDCPP is supported |
|
2447 return 0 if (! main::StdCppSupport()); |
|
2448 |
|
2449 if ( main::NoStdCpp() ) { #MMP keyword NOSTDCPP set |
|
2450 return 0; |
|
2451 } |
|
2452 |
|
2453 if ( main::StdCpp() ) { # MMP keyword STDCPP set. |
|
2454 return 1; |
|
2455 } |
|
2456 else { |
|
2457 return ( main::TrgType() =~ /^(STDEXE|STDDLL|STDLIB)$/io ); |
|
2458 } |
|
2459 } |
|
2460 |
|
2461 sub GetRTLibList() { |
|
2462 |
|
2463 my $newlib = main::NewLib(); # Could have been set in the MMP file. |
|
2464 |
|
2465 unless ($newlib) { |
|
2466 if ( StdCppTarget() ) { |
|
2467 $newlib = getConfigVariable('OE_NEW_LIB'); |
|
2468 } |
|
2469 else { |
|
2470 $newlib = getConfigVariable('SYM_NEW_LIB'); |
|
2471 } |
|
2472 } |
|
2473 |
|
2474 my @RtLib; |
|
2475 my $list = "$newlib " . getConfigVariable('RUNTIME_LIBS_LIST') ; |
|
2476 if (length($list) >0) |
|
2477 { |
|
2478 @RtLib = split(/\s+/, $list); |
|
2479 } |
|
2480 return @RtLib; |
|
2481 } |
|
2482 |
|
2483 sub GetOELibList() { |
|
2484 my @OELib; |
|
2485 my $list; |
|
2486 if (&main::IsWideCharMain()) { |
|
2487 $list = getConfigVariable('OE_EXE_LIBS_WCHAR'); |
|
2488 } |
|
2489 else { |
|
2490 $list = getConfigVariable('OE_EXE_LIBS'); |
|
2491 } |
|
2492 |
|
2493 if (length($list) >0) |
|
2494 { |
|
2495 @OELib = split(/\s+/, $list); |
|
2496 } |
|
2497 return @OELib; |
|
2498 } |
|
2499 |
|
2500 sub GetOEImportLibList() { |
|
2501 my @OEImportLib; |
|
2502 my $list; |
|
2503 $list = getConfigVariable('OE_IMPORT_LIBS'); |
|
2504 |
|
2505 if (length($list) >0) |
|
2506 { |
|
2507 @OEImportLib = split(/\s+/, $list); |
|
2508 } |
|
2509 return @OEImportLib; |
|
2510 } |
|
2511 |
|
2512 sub InitToolChain(@) { |
|
2513 |
|
2514 if($PlatName eq "ARMV5" || $PlatName eq "ARMV5_ABIV2" || $CustomizedARMV5Plat) |
|
2515 { |
|
2516 my $RVCTBuildNumber; |
|
2517 |
|
2518 ($RVCTMajorVersion, $RVCTMinorVersion, $RVCTBuildNumber) = RVCT_plat2set::get_version_list($PlatName); |
|
2519 |
|
2520 $RVCTVersion = "${RVCTMajorVersion}_${RVCTMinorVersion}"; |
|
2521 |
|
2522 my $aRVCTVersion = "${RVCTMajorVersion}.${RVCTMinorVersion}"; |
|
2523 if (($aRVCTVersion == 2.2) && ($RVCTBuildNumber < 559)) |
|
2524 { |
|
2525 warn "WARNING: When building using ABIV2 mode toolchain Compiler RVCT2.2 Build 559 or later is required.\n"; |
|
2526 } |
|
2527 &Armutl_DoMmp(@_); |
|
2528 } |
|
2529 elsif ($RootName eq "GCCE") |
|
2530 { |
|
2531 ($GCCEMajorVersion, $GCCEMinorVersion) = gcce_plat2set::get_version_list($Platname); |
|
2532 |
|
2533 $GCCEVersion = "${GCCEMajorVersion}_${GCCEMinorVersion}"; |
|
2534 } |
|
2535 |
|
2536 } |
|
2537 |
|
2538 my %BSF_keywords = ( |
|
2539 COMMON_OPTIONS => 1, |
|
2540 THUMB_OPTIONS => 1, |
|
2541 ARM_OPTIONS => 1, |
|
2542 KERNEL_OPTIONS => 1, |
|
2543 INVARIANT_OPTIONS => 1, |
|
2544 LD_OPTIONS => 1, |
|
2545 AR_OPTIONS => 1, |
|
2546 DEBUG_FORMAT => 1 |
|
2547 ); |
|
2548 |
|
2549 |
|
2550 sub Read_BSF_Options() { |
|
2551 my %plat = (main::PlatRec()); |
|
2552 my @Customization_Data = split(/\n/,$plat{'CUSTOMIZATION_DATA'}); |
|
2553 foreach my $option (@Customization_Data) { |
|
2554 next if ($option =~ /^$/); |
|
2555 warn "Unrecognized BSF syntax: $option.\n" |
|
2556 unless ($option =~ /\s*(\S+)\s+(.+)$/); |
|
2557 my $key = uc $1; |
|
2558 my $val = $2; |
|
2559 warn "Unrecognized BSF keyword: $key.\n" |
|
2560 unless ($BSF_keywords{$key}); |
|
2561 if ($key =~ /COMMON_OPTIONS/) { |
|
2562 push @commonOptions, $val; |
|
2563 next; |
|
2564 } |
|
2565 if ($key =~ /THUMB_OPTIONS/) { |
|
2566 push @thumbOptions, $val; |
|
2567 next; |
|
2568 } |
|
2569 if ($key =~ /ARM_OPTIONS/) { |
|
2570 push @armOptions, $val; |
|
2571 next; |
|
2572 } |
|
2573 if ($key =~ /KERNEL_OPTIONS/) { |
|
2574 push @kernelOptions, $val; |
|
2575 next; |
|
2576 } |
|
2577 if ($key =~ /INVARIANT_OPTIONS/) { |
|
2578 push @invariantOptions, $val; |
|
2579 next; |
|
2580 } |
|
2581 if ($key =~ /LD_OPTIONS/) { |
|
2582 push @linkerOptions, $val; |
|
2583 next; |
|
2584 } |
|
2585 if ($key =~ /AR_OPTIONS/) { |
|
2586 push @archiverOptions, $val; |
|
2587 next; |
|
2588 } |
|
2589 if ($key =~ /DEBUG_FORMAT/) { |
|
2590 push @debugFormat, $val; |
|
2591 next; |
|
2592 } |
|
2593 |
|
2594 } |
|
2595 } |
|
2596 |
|
2597 # Set the options passed from BSF file |
|
2598 # @param OptionName - BSF Keyword using which the options would be overridden in the BSF file |
|
2599 # @param Options - List of options read from the BSF keyword |
|
2600 sub Set_BSF_Options($$) |
|
2601 { |
|
2602 my ($OptionName,$Options) = @_; |
|
2603 my @Fragments=(); |
|
2604 foreach my $val (@{$Options}) |
|
2605 { |
|
2606 # Check if the value of BSF option is to be set or added/removed. |
|
2607 if($val =~ /\+\[.*\]\+|\-\[.*\]\-/) |
|
2608 { |
|
2609 if (@Fragments = Split_BSF_Options($val,'RemoveOptions')) |
|
2610 { |
|
2611 foreach my $Opt (@Fragments) |
|
2612 { |
|
2613 # Remove trailing white spaces |
|
2614 $Opt =~ s/\s+$//; |
|
2615 # Substitute '=' with '%' which is a wild card character in makefile. |
|
2616 # This is required for cases where option to be removed contains '=' (e.g.'-march=armv5t'). |
|
2617 # When such options are to be removed, "$(INVARIANT_OPTIONS:-march=armv5t=)" is written in the makefile. |
|
2618 # However, because of the occurence of '=', pattern match fails in the makefile and such options are not removed. |
|
2619 # To resolve this, '=' is replaced with '%' in the makefile so that the substitution pattern looks like |
|
2620 # "$(INVARIANT_OPTIONS:-march%armv5t=)" in makefile (e.g."$(INVARIANT_OPTIONS:-march%armv5t=)"). |
|
2621 $Opt =~ s/=/%/; |
|
2622 &main::Output( |
|
2623 "$OptionName := \$($OptionName:$Opt=)", |
|
2624 "\n" |
|
2625 ); |
|
2626 } |
|
2627 @Fragments=(); |
|
2628 } |
|
2629 if (@Fragments = Split_BSF_Options($val,'AddOptions')) |
|
2630 { |
|
2631 &main::Output( |
|
2632 "$OptionName += @Fragments ", |
|
2633 "\n" |
|
2634 ); |
|
2635 @Fragments=(); |
|
2636 } |
|
2637 |
|
2638 # Warn if options are not present in the form '+[...]+' or '-[...]-' |
|
2639 $val =~ s/\+\[.*?\]\+|\-\[.*?\]\-//g; |
|
2640 if($val !~ /^\s*$/) |
|
2641 { |
|
2642 print "Warning: Ignoring option(s) \"$val\" for $OptionName as option(s) should be in the form '+[...]+' or '-[...]-.\n"; |
|
2643 } |
|
2644 } |
|
2645 else |
|
2646 { |
|
2647 &main::Output( |
|
2648 "$OptionName = $val ", |
|
2649 "\n" |
|
2650 ); |
|
2651 } |
|
2652 } |
|
2653 &main::Output( |
|
2654 "\n" |
|
2655 ); |
|
2656 } |
|
2657 |
|
2658 # Split BSF options to find options which are to be added/removed |
|
2659 # @param String - List of options present in form '+[...]+' or '-[....]-' |
|
2660 # @param $Task - Variable to decide whether to return options to be addded or options to be removed |
|
2661 sub Split_BSF_Options($$) |
|
2662 { |
|
2663 my ($String,$Task) = @_; |
|
2664 my @Result = (); |
|
2665 my @Fragments = (); |
|
2666 my $Pattern = ''; |
|
2667 # Get the toolchain specific option prefix to segregate the options. |
|
2668 my $OptionPrefix = getConfigVariable('OPTION_PREFIX'); |
|
2669 |
|
2670 if ($Task eq 'AddOptions') |
|
2671 { |
|
2672 # Get the options which are to be added (present in the form '+[...]+') |
|
2673 @Fragments = $String =~ /\+\[(.*?)\]\+/g; |
|
2674 } |
|
2675 elsif ($Task eq 'RemoveOptions') |
|
2676 { |
|
2677 # Get the options which are to be removed (present in the form '-[...]-') |
|
2678 @Fragments = $String =~ /\-\[(.*?)\]\-/g; |
|
2679 } |
|
2680 |
|
2681 # Set the value of '$Pattern' which is required to segregate one option from another based on the option prefix. |
|
2682 if($OptionPrefix) |
|
2683 { |
|
2684 $Pattern = $OptionPrefix.'\S+\s*(?!'.$OptionPrefix.')\S*'; |
|
2685 } |
|
2686 else |
|
2687 { |
|
2688 # If option prefix is not set in the configuration make file, then set default |
|
2689 # option prefix as '-' or '--'. |
|
2690 $Pattern = '-{1,2}\S+\s*(?!-)\S*'; |
|
2691 } |
|
2692 |
|
2693 foreach my $Val (@Fragments) |
|
2694 { |
|
2695 my @Opt = $Val =~ /$Pattern/g; |
|
2696 push @Result,@Opt; |
|
2697 } |
|
2698 return @Result; |
|
2699 } |
|
2700 |
|
2701 sub SysTrg () { |
|
2702 return 1 if &main::SystemTrg; |
|
2703 my $ExportLibrary=&main::ExportLibrary; |
|
2704 return 1 if ($ExportLibrary =~ /EKERN/i); |
|
2705 my $Trg=&main::Trg; |
|
2706 return 1 if ($Trg =~ /KSRT/i); |
|
2707 return 0; |
|
2708 } |
|
2709 |
|
2710 sub GetLibList() { |
|
2711 my @LibList; |
|
2712 my @StaticLibList; |
|
2713 my $list = getConfigVariable('STATIC_LIBS_LIST') ; |
|
2714 |
|
2715 if (length($list) >0) |
|
2716 { |
|
2717 @StaticLibList = split(/\s+/, $list); |
|
2718 } |
|
2719 if($PlatName eq "ARMV5" || $PlatName eq "ARMV5_ABIV2" || $CustomizedARMV5Plat) { |
|
2720 @LibList=&Armutl_ArmLibList; |
|
2721 if(@LibList==0) { |
|
2722 my $LibDir = Armutl_ArmLibDir(); |
|
2723 # convert '/' to '\' if there are some '/' |
|
2724 $LibDir =~ s#/#\\#g; |
|
2725 if (@StaticLibList) { |
|
2726 foreach my $lib (@StaticLibList) { |
|
2727 push @LibList, ("$LibDir\\$lib"); |
|
2728 } |
|
2729 } |
|
2730 } |
|
2731 } |
|
2732 else |
|
2733 { |
|
2734 @LibList = ('$(STATIC_LIBS_LIST)'); |
|
2735 } |
|
2736 return @LibList; |
|
2737 } |
|
2738 |
|
2739 sub GetToolChainAsmFileList() { |
|
2740 my @FileList; |
|
2741 @FileList=&Armutl_AsmFileList; |
|
2742 if(@FileList) |
|
2743 { |
|
2744 return @FileList; |
|
2745 } |
|
2746 return; |
|
2747 } |
|
2748 |
|
2749 sub IsTargetRT() { |
|
2750 my $RTtarget=&Armutl_ArmRT; |
|
2751 if($RTtarget) |
|
2752 { |
|
2753 return $RTtarget; |
|
2754 } |
|
2755 return; |
|
2756 } |
|
2757 |
|
2758 sub GetToolChainIncDir { |
|
2759 if($PlatName eq "ARMV5" || $PlatName eq "ARMV5_ABIV2" || $CustomizedARMV5Plat) |
|
2760 { |
|
2761 #the ToolChainIncDir's value depends on the key word ARMINC in mmp file |
|
2762 return &Armutl_ArmIncDir; |
|
2763 } |
|
2764 else |
|
2765 { |
|
2766 my $compiler_inc_path = getConfigVariable('COMPILER_INCLUDE_PATH'); |
|
2767 $compiler_inc_path =~ s/^\s+//g; |
|
2768 return ($compiler_inc_path); |
|
2769 } |
|
2770 } |
|
2771 |
|
2772 my $useLinkerFeedBack = 0; |
|
2773 |
|
2774 sub LinkerFeedBackFile() { |
|
2775 return unless $useLinkerFeedBack; |
|
2776 my $Trg = &main::Trg; |
|
2777 return "$Trg.lfb"; |
|
2778 } |
|
2779 |
|
2780 sub LinkerFeedBackOption() { |
|
2781 return "" unless $useLinkerFeedBack; |
|
2782 my $BasicTrgType=&main::BasicTrgType; |
|
2783 return "" unless ($BasicTrgType=~/^(DLL|EXE)/o); |
|
2784 my $file = LinkerFeedBackFile(); |
|
2785 return "/$(FEEDBACK_FILE_OPTION) $file "; |
|
2786 |
|
2787 } |
|
2788 |
|
2789 sub getConfigVariable |
|
2790 { |
|
2791 my ($variable) = @_; |
|
2792 initialiseConfigVariables(); |
|
2793 return $configVariables{$variable}; |
|
2794 } |
|
2795 |
|
2796 sub initialiseConfigVariables() |
|
2797 { |
|
2798 if (!keys(%configVariables)) |
|
2799 { |
|
2800 %configVariables = BPABIutl_Get_Config_Variables($PlatName); |
|
2801 |
|
2802 if (!keys(%configVariables)) |
|
2803 { |
|
2804 # no variables were extracted from configuration file. |
|
2805 &main::FatalError("Cannot extract configuration variables for $PlatName"); |
|
2806 } |
|
2807 } |
|
2808 } |
|
2809 |
|
2810 sub PMSupportsFeatureVariants |
|
2811 { |
|
2812 return 1; |
|
2813 } |
|
2814 # modified start: makefile improvement |
|
2815 sub checkVMAPFiles |
|
2816 { |
|
2817 my %srcSet = %{&main::getSrcSet}; |
|
2818 my %featureVariantInfo = &main::FeatureVariantInfo(); |
|
2819 my $vmapfile = &main::Trg.".".$featureVariantInfo{NAME}.".vmap"; |
|
2820 my $mmpFile = &main::MmpFile; |
|
2821 if ( $vmapfile ){ |
|
2822 &main::Output( |
|
2823 "\n", |
|
2824 "\n", |
|
2825 "# Rules to check out the VMAP files", |
|
2826 "\n", |
|
2827 "\n", |
|
2828 ); |
|
2829 &main::Output( |
|
2830 "CHECKVMAPUREL : ", |
|
2831 "\$(EPOCTRG)\\urel\\", |
|
2832 $vmapfile, |
|
2833 " \n", |
|
2834 "\$(EPOCTRG)\\urel\\", |
|
2835 $vmapfile, |
|
2836 " : \\\n", |
|
2837 "\t", |
|
2838 $mmpFile, |
|
2839 ); |
|
2840 foreach my $srcfile (sort keys(%srcSet)) |
|
2841 { |
|
2842 &main::Output( |
|
2843 " \\\n \t", |
|
2844 $srcfile, |
|
2845 ); |
|
2846 } |
|
2847 &main::Output( |
|
2848 "\n", |
|
2849 "\t-\$(ERASE) \$(EPOCTRG)\\urel\\", |
|
2850 $vmapfile, |
|
2851 "\n", |
|
2852 "\n", |
|
2853 ); |
|
2854 &main::Output( |
|
2855 "CHECKVMAPUDEB : ", |
|
2856 "\$(EPOCTRG)\\udeb\\", |
|
2857 $vmapfile, |
|
2858 " \n", |
|
2859 "\$(EPOCTRG)\\udeb\\", |
|
2860 $vmapfile, |
|
2861 " : \\\n", |
|
2862 "\t", |
|
2863 $mmpFile, |
|
2864 ); |
|
2865 foreach my $srcfile (sort keys(%srcSet)) |
|
2866 { |
|
2867 &main::Output( |
|
2868 " \\\n \t", |
|
2869 $srcfile, |
|
2870 ); |
|
2871 } |
|
2872 &main::Output( |
|
2873 "\n", |
|
2874 "\t-\$(ERASE) \$(EPOCTRG)\\udeb\\", |
|
2875 $vmapfile, |
|
2876 "\n", |
|
2877 "\n", |
|
2878 ); |
|
2879 } |
|
2880 } |
|
2881 # modified by SV end: makefile improvement |
|
2882 # modified end: makefile improvement |
|
2883 |
|
2884 |
|
2885 1; |