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