|
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 |
|
17 package Cl_gcc; |
|
18 |
|
19 my $GccPrefix=''; |
|
20 my $ToolPrefix=''; |
|
21 my $HelperLib=''; |
|
22 my %PlatOpt=( |
|
23 'Dlltool'=>'', |
|
24 'Entry'=>'-e', |
|
25 'Gcc'=>'', |
|
26 'Ld'=>'', |
|
27 'Petran'=>'', |
|
28 'Optimize'=>'-O' |
|
29 ); |
|
30 my $Dlltool; |
|
31 my $Archive; |
|
32 my $Link; |
|
33 my $Objcopy; |
|
34 |
|
35 require Exporter; |
|
36 @ISA=qw(Exporter); |
|
37 @EXPORT=qw( |
|
38 PMHelp_Mmp |
|
39 |
|
40 PMPlatProcessMmp |
|
41 |
|
42 PMUnderlyingABI |
|
43 |
|
44 PMStartBldList |
|
45 PMBld |
|
46 PMStartSrcList |
|
47 PMBitMapBld |
|
48 PMResrcBld |
|
49 PMAifBld |
|
50 PMStartSrc |
|
51 PMSrcDepend |
|
52 PMSrcBldDepend |
|
53 PMEndSrcBld |
|
54 PMEndSrc |
|
55 PMEndSrcList |
|
56 ); |
|
57 |
|
58 use cl_generic; |
|
59 use Genutl; |
|
60 |
|
61 use constant NOCOMPRESSIONMETHOD => 0; |
|
62 use constant INFLATECOMPRESSIONMETHOD => 1; |
|
63 use constant BYTEPAIRCOMPRESSIONMETHOD => 2; |
|
64 |
|
65 use constant NOTPAGED => 0; |
|
66 use constant UNPAGED => 1; |
|
67 use constant PAGED => 2; |
|
68 sub PMHelp_Mmp { |
|
69 print "// No additional keywords for this platform\n"; |
|
70 } |
|
71 |
|
72 sub PMPlatProcessMmp (@) { |
|
73 my $MMPFILE=&main::MmpFile; |
|
74 |
|
75 # set up START MARM ... END block module variables |
|
76 my @MmpWarn=(); |
|
77 my $Line; |
|
78 LINE: foreach $Line (@_) { |
|
79 my $LineInfo=shift @$Line; |
|
80 $_=shift @$Line; |
|
81 push @MmpWarn, "$LineInfo : Unrecognised Keyword \"$_\"\n"; |
|
82 } |
|
83 |
|
84 undef $Line; |
|
85 if (@MmpWarn) { |
|
86 warn |
|
87 "\nMMPFILE \"$MMPFILE\"\n", |
|
88 "START .. END BLOCK WARNINGS(S)\n", |
|
89 @MmpWarn, |
|
90 "\n" |
|
91 ; |
|
92 } |
|
93 undef @MmpWarn; |
|
94 } |
|
95 |
|
96 sub SystemTarget() { |
|
97 return 1 if &main::SystemTrg; |
|
98 my $ExportLibrary=&main::ExportLibrary; |
|
99 # N.B. should get better way to detect kernel probably!! |
|
100 return 1 if ($ExportLibrary =~ /EKERN/i); |
|
101 |
|
102 return 0; |
|
103 } |
|
104 |
|
105 my %CompatibleABIs=( |
|
106 ARMI=>['ARM4', 'THUMB'], |
|
107 ARM4=>['ARMI'], |
|
108 THUMB=>['ARMI'] |
|
109 ); |
|
110 my @CompatibleABIs; |
|
111 sub PMUnderlyingABI($) { |
|
112 my ($ABI) = @_; |
|
113 if ($ABI eq 'ARM4T') { |
|
114 if (&main::BuildAsARM) { |
|
115 return 'ARMI'; |
|
116 } |
|
117 elsif (SystemTarget()) { |
|
118 return 'ARM4'; |
|
119 } |
|
120 else { |
|
121 return 'THUMB'; |
|
122 } |
|
123 } |
|
124 return $ABI; |
|
125 } |
|
126 |
|
127 my $Makecmd; |
|
128 my %ABILibPath=(); |
|
129 sub PMStartBldList($) { |
|
130 ($Makecmd) = @_; |
|
131 my $ABI=&main::ABI; |
|
132 my $UnderlyingABI=PMUnderlyingABI($ABI); |
|
133 my $BaseTrg=&main::BaseTrg; |
|
134 my $BasicTrgType=&main::BasicTrgType; |
|
135 my @BldList=&main::BldList; |
|
136 my @ChopRTWSysIncPaths=&main::Path_Chop(&main::Path_RltToWork(&main::SysIncPaths)); |
|
137 my @ChopRTWUserIncPaths=&main::Path_Chop(&main::Path_RltToWork(&main::UserIncPaths)); |
|
138 my $DefFile=&main::DefFile; |
|
139 my $EPOCPath=&main::EPOCPath; |
|
140 my $LinkAs=&main::LinkAs; |
|
141 my $LibPath=&main::LibPath; |
|
142 my @MacroList=&main::MacroList(); |
|
143 my $VariantFile=&main::VariantFile(); |
|
144 my $Plat=&main::Plat; |
|
145 my $Trg=&main::Trg; |
|
146 my $TrgType=&main::TrgType; |
|
147 my @UidList=&main::UidList; |
|
148 my $WarningLevel=&main::CompilerOption("GCC"); |
|
149 my $ExportLibrary=&main::ExportLibrary; |
|
150 my $NoExportLibrary=&main::NoExportLibrary; |
|
151 my $SystemTrg = SystemTarget(); |
|
152 my %Version = &main::Version(); |
|
153 my $ExtraExportLibrary; |
|
154 my $PrimaryExportLibrary = $ExportLibrary; |
|
155 unless ($Version{explicit}) { |
|
156 $ExtraExportLibrary = $ExportLibrary; |
|
157 $ExtraExportLibrary =~ s/\{(\d|a|b|c|d|e|f){8}\}//i; |
|
158 $PrimaryExportLibrary = $ExtraExportLibrary; |
|
159 } |
|
160 |
|
161 # set up LinkAs |
|
162 $UidList[2]=~/^0x(.*)$/o; |
|
163 if ($1 ne '00000000') { # have to make sure than series of noughts in brackets doesn't appear in name for null uids |
|
164 $LinkAs=join '', &main::Path_Split('Base',$LinkAs),"[$1]",&main::Path_Split('Ext',$LinkAs); |
|
165 } |
|
166 |
|
167 # set up dlltool flag hash |
|
168 my %ABIDlltool=( |
|
169 ARMI=>'-m arm_interwork', |
|
170 ARM4=>'-m arm', |
|
171 THUMB=>'-m thumb' |
|
172 ); |
|
173 |
|
174 # work out the flags for various platforms |
|
175 if ($ABI eq 'ARMI') { |
|
176 $PlatOpt{Gcc}='-march=armv4t -mthumb-interwork'; |
|
177 $PlatOpt{Dlltool}=$ABIDlltool{ARMI}; |
|
178 } |
|
179 elsif ($ABI eq 'ARM4T') { |
|
180 if (&main::BuildAsARM) { |
|
181 $PlatOpt{Gcc}='-march=armv4t -mthumb-interwork'; |
|
182 $PlatOpt{Dlltool}=$ABIDlltool{ARMI}; |
|
183 } |
|
184 elsif ($SystemTrg) { |
|
185 $PlatOpt{Gcc}='-march=armv4'; |
|
186 # allow thumb for ARM4 ABI where necessary |
|
187 unless (&main::PlatABI eq 'ARM4') { |
|
188 $PlatOpt{Gcc}.='t'; |
|
189 } |
|
190 $PlatOpt{Dlltool}=$ABIDlltool{ARM4}; |
|
191 } |
|
192 else { |
|
193 $GccPrefix='thumb-epoc-pe-'; |
|
194 $PlatOpt{Gcc}='-mthumb-interwork -D__MARM_THUMB__'; |
|
195 $PlatOpt{Dlltool}=$ABIDlltool{THUMB}; |
|
196 } |
|
197 } |
|
198 elsif ($ABI eq 'ARM4') { |
|
199 $PlatOpt{Gcc}='-march=armv4'; |
|
200 # allow thumb for ARM4 ABI where necessary |
|
201 unless (&main::PlatABI eq 'ARM4') { |
|
202 $PlatOpt{Gcc}.='t'; |
|
203 } |
|
204 $PlatOpt{Dlltool}=$ABIDlltool{ARM4}; |
|
205 } |
|
206 elsif ($ABI eq 'THUMB') { |
|
207 $GccPrefix='thumb-epoc-pe-'; |
|
208 $PlatOpt{Gcc}='-mthumb-interwork'; |
|
209 $PlatOpt{Dlltool}=$ABIDlltool{THUMB}; |
|
210 } |
|
211 else { |
|
212 &main::FatalError("Platform module - ABI \"$ABI\" unrecognised"); |
|
213 } |
|
214 |
|
215 @CompatibleABIs=@{$CompatibleABIs{$UnderlyingABI}}; |
|
216 |
|
217 # set up CompatibleABI lib path hash |
|
218 foreach (@CompatibleABIs) { |
|
219 $ABILibPath{$_}=&main::Path_Strip("$LibPath..\\$_\\"); |
|
220 } |
|
221 my %ABIRTWLibPath=(); |
|
222 foreach (@CompatibleABIs) { |
|
223 $ABIRTWLibPath{$_}=&main::Path_RltToWork($ABILibPath{$_}); |
|
224 } |
|
225 |
|
226 $Dlltool=$ToolPrefix.'dlltool'; |
|
227 $Archive=$ToolPrefix.'ar'; |
|
228 $Link=$ToolPrefix.'ld'; |
|
229 $Objcopy=$ToolPrefix.'objcopy'; |
|
230 |
|
231 &Generic_Header(1,$Makecmd); # define standard things using relative paths |
|
232 |
|
233 # GCC needs a fully-qualified path |
|
234 if ($ENV{'PATH'} !~ m/[a-zA-z]{1}:{1}.[^;]*epoc32\\gcc\\bin/i) { |
|
235 if ($Makecmd eq "nmake") { |
|
236 &main::Output( |
|
237 "\n", |
|
238 "PATH=",&main::Path_Drive,$EPOCPath,"gcc\\bin;\$(PATH)\n", |
|
239 "\n" |
|
240 ); |
|
241 } |
|
242 else { |
|
243 &main::Output( |
|
244 "\n", |
|
245 "# must set both PATH and Path to make it work correctly\n", |
|
246 "Path:=",&main::Path_Drive,$EPOCPath,"gcc\\bin;\$(Path)\n", |
|
247 "PATH:=\$(Path)\n", |
|
248 "\n" |
|
249 ); |
|
250 } |
|
251 } |
|
252 |
|
253 &main::Output( |
|
254 "INCDIR =" |
|
255 ); |
|
256 |
|
257 foreach (@ChopRTWUserIncPaths) { |
|
258 &main::Output( |
|
259 " -I \"$_\"" |
|
260 ); |
|
261 } |
|
262 foreach (@ChopRTWSysIncPaths) { |
|
263 &main::Output( |
|
264 " -I \"$_\"" |
|
265 ); |
|
266 } |
|
267 if($VariantFile){ |
|
268 # gcc needs a relativ path |
|
269 $VariantFile = &main::Path_RltToWork($VariantFile); |
|
270 &main::Output("\\\n -include \"$VariantFile\""); |
|
271 } |
|
272 &main::Output( |
|
273 "\n", |
|
274 "\n" |
|
275 ); |
|
276 |
|
277 &main::Output( |
|
278 "GCCFLAGS=$PlatOpt{Gcc} \\\n", |
|
279 "\t\t-pipe -c -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas $WarningLevel\n", |
|
280 "\n" |
|
281 ); |
|
282 |
|
283 &main::Output( |
|
284 "GCCDEFS =" |
|
285 ); |
|
286 foreach(@MacroList) { |
|
287 &main::Output( |
|
288 " -D$_" |
|
289 ); |
|
290 } |
|
291 &main::Output( |
|
292 " \$(USERDEFS)\n", |
|
293 "\n" |
|
294 ); |
|
295 |
|
296 foreach (@BldList) { |
|
297 &main::Output( |
|
298 "GCC$_ = ${GccPrefix}gcc" |
|
299 ); |
|
300 if (/REL$/o) { |
|
301 &main::Output( |
|
302 ' -s -fomit-frame-pointer ', |
|
303 $PlatOpt{Optimize} |
|
304 ); |
|
305 } |
|
306 elsif (/DEB$/o) { |
|
307 &main::Output( |
|
308 ' -g' |
|
309 ); |
|
310 unless (&main::SrcDbg) { |
|
311 &main::Output( |
|
312 ' ', $PlatOpt{Optimize} |
|
313 ); |
|
314 } |
|
315 } |
|
316 &main::Output( |
|
317 ' $(GCCFLAGS)' |
|
318 ); |
|
319 foreach (&main::MacroList($_)) { |
|
320 &main::Output( |
|
321 " -D$_" |
|
322 ); |
|
323 } |
|
324 &main::Output( |
|
325 " \$(GCCDEFS)\n" |
|
326 ); |
|
327 } |
|
328 &main::Output( |
|
329 "\n", |
|
330 "\n" |
|
331 ); |
|
332 |
|
333 foreach (@BldList) { |
|
334 &main::Output( |
|
335 "$_ :" |
|
336 ); |
|
337 |
|
338 if ($BasicTrgType !~ /IMPLIB/io) { |
|
339 &main::Output ( |
|
340 " \\\n\t", |
|
341 &Generic_Quote("\$(EPOCTRG$_)\\$Trg") |
|
342 ); |
|
343 } |
|
344 |
|
345 # lib has to come after the main target so that a .DEF file will be generated if the project is not frozen |
|
346 if ($DefFile and not &main::ExportUnfrozen) { |
|
347 &main::Output( |
|
348 " \\\n", |
|
349 "\tLIBRARY\n" |
|
350 ); |
|
351 } |
|
352 &main::Output( |
|
353 "\n", |
|
354 "\n" |
|
355 ); |
|
356 } |
|
357 |
|
358 # Resource building is done entirely via cl_generic.pm |
|
359 |
|
360 foreach (@BldList) { |
|
361 &main::Output( |
|
362 "\n", |
|
363 "RESOURCE$_ : MAKEWORK$_" |
|
364 ); |
|
365 } |
|
366 &main::Output( |
|
367 "\n", |
|
368 "\n", |
|
369 ); |
|
370 |
|
371 &main::Output( |
|
372 "LIBRARY : MAKEWORK" |
|
373 ); |
|
374 if ($BasicTrgType=~/^LIB$/o) { |
|
375 # code to ensure that the static libraries for all builds are built at the library stage |
|
376 foreach (@BldList) { |
|
377 &main::Output( |
|
378 " $_" |
|
379 ); |
|
380 } |
|
381 } |
|
382 elsif ($DefFile and !$NoExportLibrary) { |
|
383 unless (&main::ExportUnfrozen) { |
|
384 if (-e $DefFile) { # effectively "if project frozen ..." |
|
385 &main::Output( |
|
386 " ", &Generic_Quote("\$(EPOCLIB)\\UREL\\$PrimaryExportLibrary.lib") |
|
387 ); |
|
388 foreach (@CompatibleABIs) { |
|
389 &main::Output( |
|
390 " ", &Generic_Quote("$ABILibPath{$_}UREL\\$PrimaryExportLibrary.lib") |
|
391 ); |
|
392 &Generic_MakeWorkDir('MAKEWORKLIBRARY',"$ABILibPath{$_}UREL"); |
|
393 } |
|
394 &main::Output( |
|
395 "\n" |
|
396 ); |
|
397 } else { |
|
398 &main::Output( |
|
399 "\n", |
|
400 "\t\@echo WARNING: Not attempting to create any import libraries.\n", |
|
401 "\t\@echo When exports are frozen in \"$DefFile\", regenerate Makefile.\n" |
|
402 ); |
|
403 } |
|
404 } |
|
405 else { |
|
406 &main::Output( |
|
407 "\n", |
|
408 "\t\@echo Not attempting to create \"\$(EPOCLIB)\\UREL\\$PrimaryExportLibrary.lib\"\n", |
|
409 "\t\@echo from frozen .DEF file, since EXPORTUNFROZEN specified.\n" |
|
410 ); |
|
411 } |
|
412 &main::Output( |
|
413 "\n", |
|
414 "\n", |
|
415 "# REAL TARGET - LIBRARY\n", |
|
416 "# EPOCBLDP = ", &Generic_Definition('EPOCBLDP'), "\n", |
|
417 "# EPOCLIB = ", &Generic_Definition('EPOCLIB'), "\n", |
|
418 ); |
|
419 &main::Output( |
|
420 "\n", |
|
421 &Generic_Quote("\$(EPOCBLDP)\\$ExportLibrary.prep.def"), " : ", |
|
422 &Generic_Quote($DefFile), "\n", |
|
423 "\tperl -S prepdef.pl \$< \$@\n", |
|
424 "\n", |
|
425 &Generic_Quote("\$(EPOCLIB)\\UREL\\$ExportLibrary.lib"), " : ", |
|
426 &Generic_Quote("\$(EPOCBLDP)\\$ExportLibrary.prep.def"), "\n", |
|
427 "\tpushd ".&Generic_Quote("\$(EPOCBLDP)")." && \\\n", |
|
428 "\t$Dlltool $PlatOpt{Dlltool} --output-lib \"$ExportLibrary.tmp.lib\" --def \"$ExportLibrary.prep.def\" --dllname \"$LinkAs\" && popd && move ", &Generic_Quote("\$(EPOCBLDP)\\$ExportLibrary.tmp.lib"), " \$@\n" |
|
429 ); |
|
430 if ($ExtraExportLibrary) { |
|
431 &main::Output( |
|
432 "\n", |
|
433 &Generic_Quote("\$(EPOCLIB)\\UREL\\$ExtraExportLibrary.lib"), " : ", |
|
434 &Generic_Quote("\$(EPOCLIB)\\UREL\\$ExportLibrary.lib"), "\n", |
|
435 "\tcopy \$< \$@\n" |
|
436 ); |
|
437 } |
|
438 foreach (@CompatibleABIs) { |
|
439 &main::Output( |
|
440 "\n", |
|
441 &Generic_Quote("$ABILibPath{$_}UREL\\$ExportLibrary.lib"), " : ", |
|
442 &Generic_Quote("\$(EPOCBLDP)\\$ExportLibrary.prep.def"), "\n", |
|
443 "\tpushd ".&Generic_Quote("\$(EPOCBLDP)")." && \\\n", |
|
444 "\t$Dlltool $ABIDlltool{$_} --output-lib \"$ExportLibrary.tmp.lib\" \\\n", |
|
445 "\t\t--def \"$ExportLibrary.prep.def\" \\\n", |
|
446 "\t\t--dllname \"$LinkAs\" && popd && move ", &Generic_Quote("\$(EPOCBLDP)\\$ExportLibrary.tmp.lib"), " \$@\n" |
|
447 ); |
|
448 if ($ExtraExportLibrary) { |
|
449 &main::Output( |
|
450 "\n", |
|
451 &Generic_Quote("$ABILibPath{$_}UREL\\$ExtraExportLibrary.lib"), " : ", |
|
452 &Generic_Quote("$ABILibPath{$_}UREL\\$ExportLibrary.lib"), "\n", |
|
453 "\tcopy \$< \$@\n" |
|
454 ); |
|
455 } |
|
456 } |
|
457 } |
|
458 &main::Output( |
|
459 "\n", |
|
460 "\n", |
|
461 "FREEZE :\n" |
|
462 ); |
|
463 if ($DefFile and $BasicTrgType!~/^IMPLIB$/io) { |
|
464 &main::Output( |
|
465 # call perl on the script here so nmake will die if there are errors - this doesn't happen if calling perl in a batch file |
|
466 "\tperl -S efreeze.pl \$(EFREEZE_ALLOW_REMOVE) \"$DefFile\" \"\$(EPOCBLDP)\\$ExportLibrary.def\" \n" |
|
467 ); |
|
468 } |
|
469 &main::Output( |
|
470 "\n", |
|
471 "CLEANLIBRARY :\n" |
|
472 ); |
|
473 if ($DefFile and !$NoExportLibrary) { |
|
474 &main::Output( |
|
475 "\t-\$(ERASE) \"\$(EPOCLIB)\\UREL\\$ExportLibrary.lib\"\n", |
|
476 "\t-\$(ERASE) \"\$(EPOCBLDP)\\$ExportLibrary.prep.def\"\n" |
|
477 ); |
|
478 if ($ExtraExportLibrary) { |
|
479 &main::Output( |
|
480 "\t-\$(ERASE) \"\$(EPOCLIB)\\UREL\\$ExtraExportLibrary.lib\"\n" |
|
481 ); |
|
482 } |
|
483 foreach (@CompatibleABIs) { |
|
484 &main::Output( |
|
485 "\t-\$(ERASE) \"$ABILibPath{$_}UREL\\$ExportLibrary.lib\"\n" |
|
486 ); |
|
487 if ($ExtraExportLibrary) { |
|
488 &main::Output( |
|
489 "\t-\$(ERASE) \"$ABILibPath{$_}UREL\\$ExtraExportLibrary.lib\"\n" |
|
490 ); |
|
491 } |
|
492 } |
|
493 } |
|
494 &main::Output( |
|
495 "\n", |
|
496 "\n" |
|
497 ); |
|
498 &Generic_MakeWorkDir('MAKEWORKLIBRARY',"${LibPath}UREL"); |
|
499 |
|
500 &Generic_Releaseables; |
|
501 } |
|
502 |
|
503 |
|
504 sub PMBld { |
|
505 |
|
506 my @ASSPLibList=&main::ASSPLibList; |
|
507 my @SrcList=&main::SrcList; |
|
508 my $BaseTrg=&main::BaseTrg; |
|
509 my $Bld=&main::Bld; |
|
510 my $ChopBldPath=&main::Path_Chop(&main::BldPath); |
|
511 my $DefFile=&main::DefFile; |
|
512 my $EPOCIncPath=&main::EPOCIncPath; |
|
513 my $FirstLib=&main::FirstLib; |
|
514 my $BasicTrgType=&main::BasicTrgType; |
|
515 my @LibList; |
|
516 my $LibPath=&main::LibPath; |
|
517 my $LinkAs=&main::LinkAs; |
|
518 my $ChopRelPath=&main::Path_Chop(&main::RelPath); |
|
519 my $RelPath=&main::RelPath; |
|
520 my @StatLibList=&main::StatLibList; |
|
521 my $StatLinkPath=&main::StatLinkPath; |
|
522 my $Trg=&main::Trg; |
|
523 my $TrgType=&main::TrgType; |
|
524 my @UidList=&main::UidList; |
|
525 my $ExportLibrary=&main::ExportLibrary; |
|
526 my $NoExportLibrary=&main::NoExportLibrary; |
|
527 my $SystemTrg = SystemTarget(); |
|
528 my %Version = &main::Version(); |
|
529 my $ExtraExportLibrary; |
|
530 unless ($Version{explicit}) { |
|
531 $ExtraExportLibrary = $ExportLibrary; |
|
532 $ExtraExportLibrary =~ s/\{(\d|a|b|c|d|e|f){8}\}//i; |
|
533 } |
|
534 |
|
535 if ($Bld =~ /DEB/) { |
|
536 @LibList = &main::DebugLibList; |
|
537 } else { |
|
538 @LibList = &main::LibList; |
|
539 } |
|
540 |
|
541 # set up $LinkAs |
|
542 $UidList[2]=~/^0x(.*)$/o; |
|
543 if ($1 ne '00000000') { # have to make sure than series of noughts in brackets doesn't appear in name for null uids |
|
544 $LinkAs=join '', &main::Path_Split('Base',$LinkAs),"[$1]",&main::Path_Split('Ext',$LinkAs); |
|
545 } |
|
546 |
|
547 |
|
548 # REAL TARGETS |
|
549 #------------- |
|
550 &main::Output( |
|
551 "# REAL TARGET - BUILD VARIANT $Bld\n", |
|
552 "\n" |
|
553 ); |
|
554 |
|
555 # releasables |
|
556 my @releaseables; |
|
557 |
|
558 |
|
559 push @releaseables, "$RelPath$Trg" if ($BasicTrgType!~/^IMPLIB$/io); |
|
560 if ($BasicTrgType=~/^(DLL|EXE)$/o) { |
|
561 push @releaseables, "$RelPath$Trg.MAP"; |
|
562 } |
|
563 if (-e $DefFile and !$NoExportLibrary) { # effectively "if project frozen ..." |
|
564 push @releaseables, "$LibPath$ExportLibrary.lib"; |
|
565 push @releaseables, "$LibPath$ExtraExportLibrary.lib" if ($ExtraExportLibrary); |
|
566 foreach (@CompatibleABIs) { |
|
567 push @releaseables, "$ABILibPath{$_}UREL\\$ExportLibrary.lib"; |
|
568 push @releaseables, "$ABILibPath{$_}UREL\\$ExtraExportLibrary.lib" if ($ExtraExportLibrary); |
|
569 } |
|
570 } |
|
571 |
|
572 &main::Output( |
|
573 "WHAT$Bld : WHATGENERIC\n", |
|
574 "\n", |
|
575 "CLEAN$Bld : CLEANBUILD$Bld CLEANRELEASE$Bld\n", |
|
576 "\n", |
|
577 "CLEANBUILD$Bld : \n", |
|
578 "\t\@perl -S ermdir.pl \"\$(EPOCBLDP$Bld)\"\n", |
|
579 "\n", |
|
580 "CLEANRELEASE$Bld : CLEANGENERIC\n", |
|
581 "\n" |
|
582 ); |
|
583 &Generic_WhatCleanTargets($Bld, "WHAT$Bld", "CLEANRELEASE$Bld", @releaseables); |
|
584 |
|
585 &Generic_MakeWorkDir("MAKEWORK$Bld",$ChopBldPath); |
|
586 if (defined $ENV{PBUILDPID}) { |
|
587 my $ChopBldPPath = $ChopBldPath; |
|
588 $ChopBldPPath =~ s/(.*)\\(\w+)\\$Bld$/$1\\$2\$\(PBUILDPID\)\\$Bld/i; |
|
589 &Generic_MakeWorkDir("MAKEWORK$Bld",$ChopBldPPath); |
|
590 } |
|
591 &Generic_MakeWorkDir("MAKEWORK$Bld",$ChopRelPath); |
|
592 |
|
593 return if ($BasicTrgType=~/^IMPLIB$/io); |
|
594 |
|
595 &main::Output( |
|
596 "LISTING$Bld : MAKEWORK$Bld" |
|
597 ); |
|
598 foreach (@SrcList) { |
|
599 my $BaseSrc = &main::Path_Split('Base', $_); |
|
600 my $Ext = &main::Path_Split('Ext', $_); |
|
601 $BaseSrc.='_' if (lc($Ext) eq '.cia'); |
|
602 &main::Output( |
|
603 " \\\n\tLISTING$Bld$BaseSrc" |
|
604 ); |
|
605 } |
|
606 &main::Output( |
|
607 "\n", |
|
608 "\n" |
|
609 ); |
|
610 |
|
611 &main::Output( |
|
612 "LIBS$Bld=" |
|
613 ); |
|
614 if ($BasicTrgType=~/^DLL$/o) { # Add the DLL stub library |
|
615 &main::Output( |
|
616 " \\\n\t", |
|
617 &Generic_Quote("\$(EPOCSTATLINK$Bld)\\EDLLSTUB.LIB") |
|
618 ); |
|
619 } |
|
620 if ($HelperLib) { |
|
621 &main::Output( |
|
622 " \\\n\t", |
|
623 &Generic_Quote("\$(EPOCSTATLINK$Bld)\\$HelperLib") |
|
624 ); |
|
625 } |
|
626 foreach (@StatLibList) { |
|
627 &main::Output( |
|
628 " \\\n\t", |
|
629 &Generic_Quote("\$(EPOCSTATLINK$Bld)\\$_") |
|
630 ); |
|
631 } |
|
632 if ($BasicTrgType=~/^(DLL|EXE)/o) { # Add the GCC helper fns |
|
633 &main::Output( |
|
634 " \\\n\t", |
|
635 &Generic_Quote("\$(EPOCSTATLINK$Bld)\\EGCC.LIB") |
|
636 ); |
|
637 } |
|
638 foreach (@ASSPLibList) { |
|
639 &main::Output( |
|
640 " \\\n\t", |
|
641 &Generic_Quote("\$(EPOCASSPLINK$Bld)\\$_") |
|
642 ); |
|
643 } |
|
644 foreach (@LibList) { |
|
645 &main::Output( |
|
646 " \\\n\t", |
|
647 &Generic_Quote("\$(EPOCLINK$Bld)\\$_") |
|
648 ); |
|
649 } |
|
650 &main::Output( |
|
651 "\n", |
|
652 "\n" |
|
653 ); |
|
654 |
|
655 &main::Output( |
|
656 "# EPOCBLDP$Bld = ", &main::Path_AbsToWork(&Generic_Definition("EPOCBLDP$Bld")), "\n", |
|
657 "# EPOCSTATLINK$Bld = ", &main::Path_AbsToWork(&Generic_Definition("EPOCSTATLINK$Bld")), "\n", |
|
658 "# EPOCLIB = ", &main::Path_AbsToWork(&Generic_Definition("EPOCLIB")), "\n", |
|
659 ); |
|
660 |
|
661 &main::Output( |
|
662 &Generic_Quote("\$(EPOCTRG$Bld)\\$Trg"), " : ", |
|
663 &Generic_Quote("\$(EPOCBLDP$Bld)\\$BaseTrg.in") |
|
664 ); |
|
665 if (-e $DefFile) { # effectively "if project frozen ..." |
|
666 &main::Output( |
|
667 " ", &Generic_Quote($DefFile) |
|
668 ); |
|
669 } |
|
670 if ($BasicTrgType=~/^(EXE|DLL)$/o) { |
|
671 &main::Output( |
|
672 " ", &Generic_Quote("\$(EPOCSTATLINK$Bld)\\$FirstLib") |
|
673 ); |
|
674 } |
|
675 &main::Output( |
|
676 " \$(LIBS$Bld)\n" |
|
677 ); |
|
678 |
|
679 |
|
680 # Establish the entry point symbol |
|
681 my $EntrySymbol; |
|
682 if ($BasicTrgType=~/^DLL$/o) { |
|
683 $EntrySymbol = '_E32Dll'; |
|
684 } |
|
685 elsif ($BasicTrgType=~/^EXE$/o) { |
|
686 $EntrySymbol = '_E32Startup'; |
|
687 } |
|
688 my $AbsentSubst = ''; |
|
689 if ($EntrySymbol) { |
|
690 $AbsentSubst = " -absent $EntrySymbol"; |
|
691 } |
|
692 |
|
693 if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) { |
|
694 |
|
695 # generate a .DEF file from the objects and static libraries |
|
696 &main::Output( |
|
697 "\tpushd ".&Generic_Quote("\$(EPOCBLDP$Bld)")." && \\\n", |
|
698 "\t$Dlltool $PlatOpt{Dlltool} --output-def \"$ExportLibrary.inf\" \"$BaseTrg.in\"" |
|
699 ); |
|
700 foreach (@StatLibList) { |
|
701 &main::Output( |
|
702 " \"", &main::Path_MakeRltToBase(&main::Path_AbsToWork(&Generic_Definition("EPOCBLDP$Bld")."\\"), &main::Path_AbsToWork(&Generic_Definition("EPOCSTATLINK$Bld")."\\"))."$_\"" |
|
703 ); |
|
704 } |
|
705 &main::Output( |
|
706 " && popd\n" |
|
707 ); |
|
708 |
|
709 # reorder the .DEF file taking frozen exports into account if there are any |
|
710 &main::Output( |
|
711 # call perl on the script here so nmake will die if there are errors - this doesn't happen if calling perl in a batch file |
|
712 "\tperl -S makedef.pl -Deffile \"\$(EPOCBLDP$Bld)\\$ExportLibrary.inf\"$AbsentSubst" |
|
713 ); |
|
714 if (SystemTarget()) { |
|
715 &main::Output( "\t\t-SystemTargetType \\\n" ); |
|
716 } |
|
717 if (-e $DefFile) { # effectively "if project frozen ..." |
|
718 &main::Output( |
|
719 " -Frzfile \"$DefFile\"" |
|
720 ); |
|
721 } |
|
722 # freeze ordinals, a maximum of 2, for polymorphic dlls |
|
723 my $Ordinal; |
|
724 my $Num=1; |
|
725 foreach $Ordinal (&main::Exports) { |
|
726 &main::Output( |
|
727 " -$Num $Ordinal" |
|
728 ); |
|
729 $Num++; |
|
730 } |
|
731 &main::Output( |
|
732 " \"\$(EPOCBLDP)\\$ExportLibrary.def\"\n" |
|
733 ); |
|
734 |
|
735 # delete the unordered definition file |
|
736 &main::Output( |
|
737 "\t-\$(ERASE) \"\$(EPOCBLDP$Bld)\\$ExportLibrary.inf\"\n" |
|
738 ); |
|
739 |
|
740 # generate an export object from the ordered .DEF file |
|
741 &main::Output( |
|
742 "\tpushd ".&Generic_Quote("\$(EPOCBLDP$Bld)")." && \\\n", |
|
743 "\t$Dlltool $PlatOpt{Dlltool} --def \"..\\$ExportLibrary.def\" \\\n", |
|
744 "\t\t--output-exp \"$ExportLibrary.exp\" \\\n", |
|
745 "\t\t--dllname \"$LinkAs\"" |
|
746 ); |
|
747 if (&main::ExportUnfrozen) { |
|
748 &main::Output( |
|
749 "\\\n", |
|
750 "\t\t--output-lib \"", &main::Path_MakeRltToBase(&main::Path_AbsToWork(&Generic_Definition("EPOCBLDP$Bld")."\\"), &main::Path_AbsToWork(&Generic_Definition("EPOCLIB")."\\"))."UREL\\$ExportLibrary.lib\"", |
|
751 " && popd\n" |
|
752 ); |
|
753 if ($ExtraExportLibrary) { |
|
754 &main::Output( |
|
755 "\n", |
|
756 "\tcopy \$(EPOCLIB)\\UREL\\$ExportLibrary.lib ", |
|
757 "\$(EPOCLIB)\\UREL\\$ExtraExportLibrary.lib", |
|
758 "\n" |
|
759 ); |
|
760 } |
|
761 } |
|
762 else { |
|
763 &main::Output( |
|
764 " && popd\n" |
|
765 ); |
|
766 } |
|
767 } |
|
768 |
|
769 # call ld to do base relocations (and dll exports) |
|
770 if ($BasicTrgType=~/^(DLL|EXE)/o) { |
|
771 &main::Output( |
|
772 "\t$Link $PlatOpt{Ld} -s" |
|
773 ); |
|
774 if ($BasicTrgType=~/^DLL$/o) { |
|
775 &main::Output( |
|
776 " $PlatOpt{Entry} $EntrySymbol -u $EntrySymbol \"\$(EPOCBLDP$Bld)\\$ExportLibrary.exp\" --dll \\\n" |
|
777 ); |
|
778 } |
|
779 elsif ($BasicTrgType=~/^EXE$/o) { |
|
780 &main::Output( |
|
781 " $PlatOpt{Entry} $EntrySymbol -u $EntrySymbol \\\n" |
|
782 ); |
|
783 } |
|
784 # --whole-archive is required here apparently because of a defect in the gcc toolchain |
|
785 # the flag can probably be removed with a later version of gcc |
|
786 &main::Output( |
|
787 "\t\t--base-file \"\$(EPOCBLDP$Bld)\\$BaseTrg.bas\" -o \"\$(EPOCBLDP$Bld)\\$Trg\" \\\n", |
|
788 "\t\t\"\$(EPOCSTATLINK$Bld)\\$FirstLib\" --whole-archive \"\$(EPOCBLDP$Bld)\\$BaseTrg.in\" \\\n", |
|
789 "\t\t--no-whole-archive" |
|
790 ); |
|
791 &main::Output( |
|
792 " \$(LIBS$Bld) \$(USERLDFLAGS)\n" |
|
793 ); |
|
794 |
|
795 # delete temporary files |
|
796 if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) { |
|
797 &main::Output( |
|
798 "\t-\$(ERASE) \"\$(EPOCBLDP$Bld)\\$ExportLibrary.exp\"\n" |
|
799 ); |
|
800 } |
|
801 &main::Output( |
|
802 "\t-\$(ERASE) \"\$(EPOCBLDP$Bld)\\$Trg\"\n" |
|
803 ); |
|
804 |
|
805 # call dlltool to do base relocations (and dll exports) |
|
806 &main::Output( |
|
807 "\tpushd ".&Generic_Quote("\$(EPOCBLDP$Bld)")." && \\\n", |
|
808 "\t$Dlltool $PlatOpt{Dlltool} \\\n" |
|
809 ); |
|
810 if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) { |
|
811 &main::Output( |
|
812 "\t\t--def \"..\\$ExportLibrary.def\" \\\n", |
|
813 "\t\t--dllname \"$LinkAs\" \\\n" |
|
814 ); |
|
815 } |
|
816 &main::Output( |
|
817 "\t\t--base-file \"$BaseTrg.bas\" \\\n", |
|
818 "\t\t--output-exp \"$ExportLibrary.exp\" && popd\n" |
|
819 ); |
|
820 |
|
821 # delete temporary files |
|
822 &main::Output( |
|
823 "\t-\$(ERASE) \"\$(EPOCBLDP$Bld)\\$BaseTrg.bas\"\n" |
|
824 ); |
|
825 |
|
826 # call ld to link the target |
|
827 &main::Output( |
|
828 "\t$Link $PlatOpt{Ld}" |
|
829 ); |
|
830 if ($Bld=~/^U?REL$/o) { |
|
831 &main::Output( |
|
832 " -s" |
|
833 ); |
|
834 } |
|
835 if ($BasicTrgType=~/^DLL$/o) { |
|
836 &main::Output( |
|
837 " $PlatOpt{Entry} $EntrySymbol -u $EntrySymbol --dll \\\n" |
|
838 ); |
|
839 } |
|
840 elsif ($BasicTrgType=~/^EXE$/o) { |
|
841 &main::Output( |
|
842 " $PlatOpt{Entry} $EntrySymbol -u $EntrySymbol \\\n" |
|
843 ); |
|
844 } |
|
845 # --whole-archive is required here apparently because of a defect in the gcc toolchain |
|
846 # the flag can probably be removed with a later version of gcc |
|
847 &main::Output( |
|
848 "\t\t\"\$(EPOCBLDP$Bld)\\$ExportLibrary.exp\" \\\n", |
|
849 "\t\t-Map \"\$(EPOCTRG$Bld)\\$Trg.map\" -o \"\$(EPOCBLDP$Bld)\\$Trg\" \\\n", |
|
850 "\t\t\"\$(EPOCSTATLINK$Bld)\\$FirstLib\" --whole-archive \"\$(EPOCBLDP$Bld)\\$BaseTrg.in\" \\\n", |
|
851 "\t\t--no-whole-archive" |
|
852 ); |
|
853 &main::Output( |
|
854 " \$(LIBS$Bld) \$(USERLDFLAGS)\n" |
|
855 ); |
|
856 |
|
857 # delete temporary files |
|
858 &main::Output( |
|
859 "\t-\$(ERASE) \"\$(EPOCBLDP$Bld)\\$ExportLibrary.exp\"\n" |
|
860 ); |
|
861 |
|
862 if ($Bld=~/DEB$/o) { |
|
863 &main::Output( |
|
864 "\t$Objcopy -X \"\$(EPOCBLDP$Bld)\\$Trg\" \"\$(EPOCTRG$Bld)\\$BaseTrg.sym\"\n" |
|
865 ); |
|
866 } |
|
867 |
|
868 if (&main::CompressTarget) { |
|
869 &main::Output( |
|
870 "\tpetran $PlatOpt{Petran} -version ", &Genutl_VersionToUserString(%Version), " -sid ", &main::SecureId(), " -nocompress " , " \"\$(EPOCBLDP$Bld)\\$Trg\" \"\$\@\" \\\n", |
|
871 "\t\t" |
|
872 ); |
|
873 } |
|
874 else { |
|
875 if(&main::CompressTargetMode==NOCOMPRESSIONMETHOD){ |
|
876 &main::Output( |
|
877 "\tpetran $PlatOpt{Petran} -version ", &Genutl_VersionToUserString(%Version), " -sid ", &main::SecureId(), " \"\$(EPOCBLDP$Bld)\\$Trg\" \"\$\@\" \\\n", |
|
878 "\t\t" |
|
879 ); |
|
880 } |
|
881 elsif(&main::CompressTargetMode==INFLATECOMPRESSIONMETHOD){ |
|
882 &main::Output( |
|
883 "\tpetran $PlatOpt{Petran} -version ", &Genutl_VersionToUserString(%Version), " -sid ", &main::SecureId(), " ", " -compressionmethod deflate", " \"\$(EPOCBLDP$Bld)\\$Trg\" \"\$\@\" \\\n", |
|
884 "\t\t" |
|
885 ); |
|
886 } |
|
887 elsif(&main::CompressTargetMode==BYTEPAIRCOMPRESSIONMETHOD){ |
|
888 &main::Output( |
|
889 "\tpetran $PlatOpt{Petran} -version ", &Genutl_VersionToUserString(%Version), " -sid ", &main::SecureId(), " ", " -compressionmethod bytepair", " \"\$(EPOCBLDP$Bld)\\$Trg\" \"\$\@\" \\\n", |
|
890 "\t\t" |
|
891 ); |
|
892 } |
|
893 } |
|
894 |
|
895 if (&main::AllowDllData) { |
|
896 &main::Output( |
|
897 ' -allow' |
|
898 ); |
|
899 } |
|
900 if (not &main::CallDllEntryPoints) { |
|
901 &main::Output( |
|
902 ' -nocall' |
|
903 ); |
|
904 } |
|
905 if (&main::DataLinkAddress) { |
|
906 &main::Output( |
|
907 ' -datalinkaddress ',&main::DataLinkAddress |
|
908 ); |
|
909 } |
|
910 if (&main::FixedProcess) { |
|
911 &main::Output( |
|
912 ' -fixed' |
|
913 ); |
|
914 } |
|
915 if (&main::HeapSize) { |
|
916 my %HeapSize=&main::HeapSize; |
|
917 &main::Output( |
|
918 ' -heap ',$HeapSize{Min},' ',$HeapSize{Max} |
|
919 ); |
|
920 } |
|
921 if (&main::ProcessPriority) { |
|
922 &main::Output( |
|
923 ' -priority ',&main::ProcessPriority |
|
924 ); |
|
925 } |
|
926 if (&main::SmpSafe) { |
|
927 &main::Output( |
|
928 ' -smpsafe' |
|
929 ); |
|
930 } |
|
931 if (&main::StackSize) { |
|
932 &main::Output( |
|
933 ' -stack ',&main::StackSize |
|
934 ); |
|
935 } |
|
936 |
|
937 if (&main::CodePagingTargetMode == UNPAGED) { |
|
938 &main::Output( |
|
939 ' -codepaging unpaged' |
|
940 ); |
|
941 } |
|
942 elsif (&main::CodePagingTargetMode == PAGED) { |
|
943 &main::Output( |
|
944 ' -codepaging paged' |
|
945 ); |
|
946 } |
|
947 |
|
948 if (&main::DataPagingTargetMode == UNPAGED) { |
|
949 &main::Output( |
|
950 ' -datapaging unpaged' |
|
951 ); |
|
952 } |
|
953 elsif (&main::DataPagingTargetMode == PAGED) { |
|
954 &main::Output( |
|
955 ' -datapaging paged' |
|
956 ); |
|
957 } |
|
958 |
|
959 my $i=1; |
|
960 foreach (@UidList) { |
|
961 &main::Output( |
|
962 " -uid$i $_" |
|
963 ); |
|
964 $i++; |
|
965 } |
|
966 if(&main::VendorId) { |
|
967 &main::Output( |
|
968 ' -vid ',&main::VendorId |
|
969 ); |
|
970 } |
|
971 &main::Output( |
|
972 ' -capability ',&main::Capability, |
|
973 ); |
|
974 &main::Output("\n"); |
|
975 &main::Output( |
|
976 "\t-\$(ERASE) \"\$(EPOCBLDP$Bld)\\$Trg\"\n" |
|
977 ); |
|
978 } |
|
979 elsif ($BasicTrgType=~/^LIB$/o) { |
|
980 &main::Output( |
|
981 "\tcopy \"\$(EPOCBLDP$Bld)\\$BaseTrg.in\" \"\$(EPOCSTATLINK$Bld)\\$Trg\"\n" |
|
982 ); |
|
983 } |
|
984 |
|
985 &main::Output( |
|
986 "\n" |
|
987 ); |
|
988 |
|
989 |
|
990 # TARGET *.IN |
|
991 #------------ |
|
992 if (scalar @SrcList >150) { |
|
993 # deal with very long lists by splitting them into 150 file pieces, which allows |
|
994 # about 200 bytes per filename if the underlying max size is 32K |
|
995 # |
|
996 my $counter1=150; # i.e. trigger new variable immediately |
|
997 my $counter2=0; |
|
998 my @objvarlist=(); |
|
999 foreach (@SrcList) { |
|
1000 if ($counter1==150) { |
|
1001 $counter1=0; |
|
1002 $counter2++; |
|
1003 my $objvar = "OBJECTS$Bld$counter2"; |
|
1004 push @objvarlist, " \$($objvar)"; |
|
1005 &main::Output( |
|
1006 "\n", |
|
1007 "$objvar=" |
|
1008 ); |
|
1009 } |
|
1010 my $BaseSrc = &main::Path_Split('Base', $_); |
|
1011 my $Ext = &main::Path_Split('Ext', $_); |
|
1012 $BaseSrc.='_' if (lc($Ext) eq '.cia'); |
|
1013 &main::Output( |
|
1014 " \\\n\t", &Generic_Quote("\$(EPOCBLDP$Bld)\\$BaseSrc.o") |
|
1015 ); |
|
1016 $counter1++; |
|
1017 } |
|
1018 &main::Output( |
|
1019 "\n", |
|
1020 "\n", |
|
1021 &Generic_Quote("\$(EPOCBLDP$Bld)\\$BaseTrg.in"), " : ", @objvarlist,"\n", |
|
1022 "\tif exist \"\$\@\" del \"\$\@\"\n" |
|
1023 ); |
|
1024 foreach (@objvarlist) { |
|
1025 # Add the files to the list in groups |
|
1026 &main::Output( |
|
1027 "\t$Archive cr \$\@$_\n" |
|
1028 ); |
|
1029 } |
|
1030 &main::Output( |
|
1031 "\n\n" |
|
1032 ); |
|
1033 } else { |
|
1034 # shorter lists remain unchanged |
|
1035 # |
|
1036 &main::Output( |
|
1037 "OBJECTS$Bld=" |
|
1038 ); |
|
1039 foreach (@SrcList) { |
|
1040 my $BaseSrc = &main::Path_Split('Base', $_); |
|
1041 my $Ext = &main::Path_Split('Ext', $_); |
|
1042 $BaseSrc.='_' if (lc($Ext) eq '.cia'); |
|
1043 &main::Output( |
|
1044 " \\\n\t", &Generic_Quote("\$(EPOCBLDP$Bld)\\$BaseSrc.o") |
|
1045 ); |
|
1046 } |
|
1047 &main::Output( |
|
1048 "\n", |
|
1049 "\n" |
|
1050 ); |
|
1051 &main::Output( |
|
1052 &Generic_Quote("\$(EPOCBLDP$Bld)\\$BaseTrg.in"), " : \$(OBJECTS$Bld)\n", |
|
1053 "\tif exist \"\$\@\" del \"\$\@\"\n", |
|
1054 "\t$Archive cr \$\@ \$^\n", |
|
1055 "\n\n" |
|
1056 ); |
|
1057 } |
|
1058 } |
|
1059 |
|
1060 |
|
1061 sub PMStartSrcList { |
|
1062 |
|
1063 &main::Output( |
|
1064 "# SOURCES\n", |
|
1065 "\n" |
|
1066 ); |
|
1067 } |
|
1068 |
|
1069 sub PMBitMapBld { |
|
1070 |
|
1071 &Generic_BitMapBld; |
|
1072 |
|
1073 } |
|
1074 |
|
1075 sub PMResrcBld { |
|
1076 |
|
1077 &Generic_ResrcBld; |
|
1078 |
|
1079 } |
|
1080 |
|
1081 sub PMAifBld { |
|
1082 |
|
1083 &Generic_AifBld; |
|
1084 |
|
1085 } |
|
1086 |
|
1087 sub PMStartSrc { |
|
1088 my $Src=&main::Src; |
|
1089 |
|
1090 &main::Output( |
|
1091 "# Source $Src\n", |
|
1092 "\n" |
|
1093 ); |
|
1094 } |
|
1095 |
|
1096 sub PMSrcDepend { |
|
1097 my @BldList=&main::BldList; |
|
1098 my @DepList=&main::DepList; |
|
1099 my $BaseSrc=&main::BaseSrc; |
|
1100 my $ExtSrc=&main::ExtSrc; |
|
1101 my $cia = (lc($ExtSrc) eq '.cia') ? "_" : ""; |
|
1102 |
|
1103 return if (@DepList == 0); |
|
1104 |
|
1105 foreach (@BldList) { |
|
1106 &main::Output( |
|
1107 &Generic_Quote("\$(EPOCBLDP$_)\\$BaseSrc$cia.lis"), " ", |
|
1108 &Generic_Quote("\$(EPOCBLDP$_)\\$BaseSrc$cia.o"), " \\\n", |
|
1109 ); |
|
1110 } |
|
1111 &main::Output( |
|
1112 ":" |
|
1113 ); |
|
1114 foreach (@DepList) { |
|
1115 &main::Output( |
|
1116 " \\\n\t", &Generic_Quote($_) |
|
1117 ); |
|
1118 } |
|
1119 &main::Output( |
|
1120 "\n", |
|
1121 "\n" |
|
1122 ); |
|
1123 } |
|
1124 |
|
1125 sub PMSrcBldDepend { |
|
1126 my $Bld=&main::Bld; |
|
1127 my @DepList=&main::DepList; |
|
1128 my $BaseSrc=&main::BaseSrc; |
|
1129 my $ExtSrc=&main::ExtSrc; |
|
1130 my $cia = (lc($ExtSrc) eq '.cia') ? "_" : ""; |
|
1131 |
|
1132 return if (@DepList == 0); |
|
1133 |
|
1134 &main::Output( |
|
1135 &Generic_Quote("\$(EPOCBLDP$Bld)\\$BaseSrc$cia.lis"), " ", |
|
1136 &Generic_Quote("\$(EPOCBLDP$Bld)\\$BaseSrc$cia.o"), " :", |
|
1137 ); |
|
1138 foreach (@DepList) { |
|
1139 &main::Output( |
|
1140 " \\\n\t", &Generic_Quote($_) |
|
1141 ); |
|
1142 } |
|
1143 &main::Output( |
|
1144 "\n", |
|
1145 "\n" |
|
1146 ); |
|
1147 } |
|
1148 |
|
1149 sub PMEndSrcBld { |
|
1150 my $ABI=&main::ABI; |
|
1151 my $BaseSrc=&main::BaseSrc; |
|
1152 my $Bld=&main::Bld; |
|
1153 my $Src=ucfirst lc &main::Src; |
|
1154 my $SrcPath=&main::SrcPath; |
|
1155 my $Ext = &main::Path_Split('Ext', $Src); |
|
1156 my $Cia = (lc($Ext) eq '.cia') ? 1 : 0; |
|
1157 |
|
1158 my $RTWSrcPath=&main::Path_Chop(&main::Path_RltToWork($SrcPath)); |
|
1159 |
|
1160 # Use GCC trick to get assembler source files preprocessed with CPP |
|
1161 $Src =~ s/\.s$/.S/i; |
|
1162 |
|
1163 if ($Cia) { |
|
1164 &main::Output( |
|
1165 &Generic_Quote("\$(EPOCBLDP$Bld)\\$BaseSrc\_.o"), " : ", |
|
1166 &Generic_Quote("$SrcPath$Src"), "\n", |
|
1167 "\techo $Src\n", |
|
1168 "\t\$(GCC$Bld) -x c++ -D__CIA__ -I \"$RTWSrcPath\" \$(INCDIR) -o \$\@ \"$RTWSrcPath\\$Src\"\n", |
|
1169 "\n", |
|
1170 # generate an assembly listing target too |
|
1171 "LISTING$Bld$BaseSrc\_ : ", &Generic_Quote("\$(EPOCBLDP$Bld)\\$BaseSrc\_.lis"), "\n", |
|
1172 "\t", &Generic_CopyAction("$SrcPath$BaseSrc\_.$ABI.lst"), |
|
1173 "\n", |
|
1174 &Generic_Quote("\$(EPOCBLDP$Bld)\\$BaseSrc\_.lis"), " : ", |
|
1175 &Generic_Quote("$SrcPath$Src"), "\n", |
|
1176 "\t\$(GCC$Bld) -x c++ -D__CIA__ -Wa,-adln -I \"$RTWSrcPath\" \$(INCDIR) -o nul: \"$RTWSrcPath\\$Src\" > \$\@\n", |
|
1177 "\n" |
|
1178 ); |
|
1179 } else { |
|
1180 &main::Output( |
|
1181 &Generic_Quote("\$(EPOCBLDP$Bld)\\$BaseSrc.o"), " : ", |
|
1182 &Generic_Quote("$SrcPath$Src"), "\n", |
|
1183 "\techo $Src\n", |
|
1184 "\t\$(GCC$Bld) -I \"$RTWSrcPath\" \$(INCDIR) -o \$\@ \"$RTWSrcPath\\$Src\"\n", |
|
1185 "\n", |
|
1186 # generate an assembly listing target too |
|
1187 "LISTING$Bld$BaseSrc : ", &Generic_Quote("\$(EPOCBLDP$Bld)\\$BaseSrc.lis"), "\n", |
|
1188 "\t", &Generic_CopyAction("$SrcPath$BaseSrc.$ABI.lst"), |
|
1189 "\n", |
|
1190 &Generic_Quote("\$(EPOCBLDP$Bld)\\$BaseSrc.lis"), " : ", |
|
1191 &Generic_Quote("$SrcPath$Src"), "\n", |
|
1192 "\t\$(GCC$Bld) -Wa,-adln -I \"$RTWSrcPath\" \$(INCDIR) -o nul: \"$RTWSrcPath\\$Src\" > \$\@\n", |
|
1193 "\n" |
|
1194 ); |
|
1195 } |
|
1196 } |
|
1197 |
|
1198 sub PMEndSrc { |
|
1199 |
|
1200 &main::Output( |
|
1201 "\n", |
|
1202 "\n" |
|
1203 ); |
|
1204 } |
|
1205 |
|
1206 sub PMEndSrcList { |
|
1207 |
|
1208 # Deal with accumulated MAKEDIRS etc. |
|
1209 |
|
1210 &Generic_End; |
|
1211 } |
|
1212 |
|
1213 1; |