599
|
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_x86;
|
|
18 |
|
|
19 |
# declare variables global for module
|
|
20 |
|
|
21 |
|
|
22 |
require Exporter;
|
|
23 |
@ISA=qw(Exporter);
|
|
24 |
@EXPORT=qw(
|
|
25 |
PMHelp_Mmp
|
|
26 |
|
|
27 |
PMCheckPlatformL
|
|
28 |
|
|
29 |
PMPlatProcessMmp
|
|
30 |
|
|
31 |
PMStartBldList
|
|
32 |
PMBld
|
|
33 |
PMStartSrcList
|
|
34 |
PMBitMapBld
|
|
35 |
PMResrcBld
|
|
36 |
PMAifBld
|
|
37 |
PMStartSrc
|
|
38 |
PMSrcDepend
|
|
39 |
PMSrcBldDepend
|
|
40 |
PMEndSrcBld
|
|
41 |
PMEndSrc
|
|
42 |
PMEndSrcList
|
|
43 |
);
|
|
44 |
|
|
45 |
use Winutl;
|
|
46 |
use cl_generic;
|
|
47 |
use Genutl;
|
|
48 |
use Pathutl;
|
|
49 |
|
|
50 |
use constant NOCOMPRESSIONMETHOD => 0;
|
|
51 |
use constant INFLATECOMPRESSIONMETHOD => 1;
|
|
52 |
use constant BYTEPAIRCOMPRESSIONMETHOD => 2;
|
|
53 |
|
|
54 |
use constant NOTPAGED => 0;
|
|
55 |
use constant UNPAGED => 1;
|
|
56 |
use constant PAGED => 2;
|
|
57 |
sub PMHelp_Mmp {
|
|
58 |
&Winutl_Help_Mmp;
|
|
59 |
}
|
|
60 |
|
|
61 |
sub PMCheckPlatformL {
|
|
62 |
}
|
|
63 |
|
|
64 |
sub PMPlatProcessMmp (@) {
|
|
65 |
|
|
66 |
}
|
|
67 |
|
|
68 |
sub PMStartBldList($) {
|
|
69 |
my ($makecmd) = @_;
|
|
70 |
die "Cannot generate $makecmd makefiles\n" if ($makecmd ne "nmake");
|
|
71 |
my $BaseTrg=&main::BaseTrg;
|
|
72 |
my @BldList=&main::BldList;
|
|
73 |
my @ChopSysIncPaths=&main::Path_Chop(&main::SysIncPaths);
|
|
74 |
my @ChopUserIncPaths=&main::Path_Chop(&main::UserIncPaths);
|
|
75 |
my $DefFile=&main::DefFile;
|
|
76 |
my $BasicTrgType=&main::BasicTrgType;
|
|
77 |
my $LinkAs=&main::LinkAs;
|
|
78 |
my $ExportLibrary=&main::ExportLibrary;
|
|
79 |
my $NoExportLibrary=&main::NoExportLibrary;
|
|
80 |
my $LibPath=&main::LibPath;
|
|
81 |
my @MacroList=&main::MacroList();
|
|
82 |
my $VariantFile=&main::VariantFile();
|
|
83 |
my $Plat=&main::Plat;
|
|
84 |
my $Trg=&main::Trg;
|
|
85 |
my $TrgType=&main::TrgType;
|
|
86 |
my @UidList=&main::UidList;
|
|
87 |
my $WarningLevel=&main::CompilerOption("MSVC");
|
|
88 |
my %Version = &main::Version();
|
|
89 |
my $ExtraExportLibrary;
|
|
90 |
my $PrimaryExportLibrary = $ExportLibrary;
|
|
91 |
unless ($Version{explicit}) {
|
|
92 |
$ExtraExportLibrary = $ExportLibrary;
|
|
93 |
$ExtraExportLibrary =~ s/\{(\d|a|b|c|d|e|f){8}\}//i;
|
|
94 |
$PrimaryExportLibrary = $ExtraExportLibrary;
|
|
95 |
}
|
|
96 |
|
|
97 |
&Generic_Header(0,$makecmd); # define standard things using absolute paths
|
|
98 |
|
|
99 |
# set up LinkAs
|
|
100 |
$UidList[2]=~/^0x(.*)$/o;
|
|
101 |
if ($1 ne '00000000') { # have to make sure than series of noughts in brackets doesn't appear in name for null uids
|
|
102 |
$LinkAs=join '', &main::Path_Split('Base',$LinkAs),"[$1]",&main::Path_Split('Ext',$LinkAs);
|
|
103 |
}
|
|
104 |
|
|
105 |
my $TrgDir="";
|
|
106 |
|
|
107 |
&main::Output(
|
|
108 |
"INCDIR ="
|
|
109 |
);
|
|
110 |
if($VariantFile){
|
|
111 |
my $VariantFileFileName = Path_Split('FILE',$VariantFile);
|
|
112 |
&main::Output(
|
|
113 |
" /FI \"$VariantFileFileName\"",
|
|
114 |
);
|
|
115 |
|
|
116 |
}
|
|
117 |
|
|
118 |
foreach (@ChopUserIncPaths,@ChopSysIncPaths) {
|
|
119 |
&main::Output(
|
|
120 |
" /I \"$_\""
|
|
121 |
);
|
|
122 |
}
|
|
123 |
&main::Output(
|
|
124 |
"\n",
|
|
125 |
"\n"
|
|
126 |
);
|
|
127 |
|
|
128 |
&main::Output(
|
|
129 |
"CLFLAGS = /nologo /Zp4 $WarningLevel /Zm256"
|
|
130 |
);
|
|
131 |
&main::Output(
|
|
132 |
" /X"
|
|
133 |
);
|
|
134 |
&main::Output(
|
|
135 |
"\n",
|
|
136 |
"\n"
|
|
137 |
);
|
|
138 |
|
|
139 |
&main::Output(
|
|
140 |
"CLDEFS ="
|
|
141 |
);
|
|
142 |
foreach(@MacroList) {
|
|
143 |
&main::Output(
|
|
144 |
" /D \"$_\""
|
|
145 |
);
|
|
146 |
}
|
|
147 |
&main::Output(
|
|
148 |
" \$(USERDEFS)\n",
|
|
149 |
"\n"
|
|
150 |
);
|
|
151 |
|
|
152 |
foreach (@BldList) {
|
|
153 |
&main::Output(
|
|
154 |
"CL$_ = cl.exe"
|
|
155 |
);
|
|
156 |
if (/DEB$/o) {
|
|
157 |
&main::Output(
|
|
158 |
' /Od /Gs0x10000 /Gy /GR- /GX-'
|
|
159 |
);
|
|
160 |
# euser change to apply inlining on the _NAKED functions
|
|
161 |
if ($BaseTrg=~/^EUSER$/oi) {
|
|
162 |
&main::Output(
|
|
163 |
' /Ob1'
|
|
164 |
);
|
|
165 |
}
|
|
166 |
}
|
|
167 |
elsif (/REL$/o) {
|
|
168 |
# euser change to prevent minimum size optimisation from disrupting the maths functions
|
|
169 |
&main::Output(
|
|
170 |
' /O1 /Op /Gs0x10000 /Gy /GF /GR- /GX-'
|
|
171 |
);
|
|
172 |
}
|
|
173 |
&main::Output(
|
|
174 |
' $(CLFLAGS)'
|
|
175 |
);
|
|
176 |
foreach (&main::MacroList($_)) {
|
|
177 |
&main::Output(
|
|
178 |
" /D $_"
|
|
179 |
);
|
|
180 |
}
|
|
181 |
&main::Output(
|
|
182 |
" \$(CLDEFS) \$(INCDIR)\n"
|
|
183 |
);
|
|
184 |
}
|
|
185 |
&main::Output(
|
|
186 |
"\n",
|
|
187 |
"\n"
|
|
188 |
);
|
|
189 |
|
|
190 |
foreach (@BldList) {
|
|
191 |
&main::Output(
|
|
192 |
"$_ :"
|
|
193 |
);
|
|
194 |
if ($BasicTrgType !~ /^IMPLIB$/io) {
|
|
195 |
&main::Output (
|
|
196 |
" \\\n",
|
|
197 |
"\t\"\$(EPOCTRG$_)\\$TrgDir$Trg\""
|
|
198 |
);
|
|
199 |
}
|
|
200 |
|
|
201 |
# lib has to come after the main target so that a .DEF file will be generated if the project is not frozen
|
|
202 |
if ($DefFile and not &main::ExportUnfrozen) {
|
|
203 |
&main::Output(
|
|
204 |
" \\\n",
|
|
205 |
"\tLIBRARY\n"
|
|
206 |
);
|
|
207 |
}
|
|
208 |
&main::Output(
|
|
209 |
"\n",
|
|
210 |
"\n"
|
|
211 |
);
|
|
212 |
}
|
|
213 |
|
|
214 |
|
|
215 |
# Resource building is done entirely via cl_generic.pm
|
|
216 |
|
|
217 |
foreach (@BldList) {
|
|
218 |
my $makework="MAKEWORK$_";
|
|
219 |
&main::Output(
|
|
220 |
"\n",
|
|
221 |
"RESOURCE$_ : $makework"
|
|
222 |
);
|
|
223 |
}
|
|
224 |
&main::Output(
|
|
225 |
"\n",
|
|
226 |
"\n",
|
|
227 |
);
|
|
228 |
|
|
229 |
&main::Output(
|
|
230 |
"LIBRARY : MAKEWORKLIBRARY"
|
|
231 |
);
|
|
232 |
if ($BasicTrgType=~/^LIB$/o) {
|
|
233 |
# code to ensure that the static libraries for all builds are built at the library stage
|
|
234 |
foreach (@BldList) {
|
|
235 |
&main::Output(
|
|
236 |
" $_"
|
|
237 |
);
|
|
238 |
}
|
|
239 |
}
|
|
240 |
elsif ($DefFile and !$NoExportLibrary) {
|
|
241 |
unless (&main::ExportUnfrozen) {
|
|
242 |
if (-e $DefFile) { # effectively "if project frozen ..."
|
|
243 |
&main::Output(
|
|
244 |
" \"\$(EPOCLIB)\\UREL\\$PrimaryExportLibrary.LIB\"\n"
|
|
245 |
);
|
|
246 |
}
|
|
247 |
else {
|
|
248 |
&main::Output(
|
|
249 |
"\n",
|
|
250 |
"\t\@echo WARNING: Not attempting to create \"\$(EPOCLIB)\\UREL\\$PrimaryExportLibrary.LIB\".\n",
|
|
251 |
"\t\@echo When exports are frozen in \"$DefFile\", regenerate Makefile.\n"
|
|
252 |
);
|
|
253 |
}
|
|
254 |
}
|
|
255 |
else {
|
|
256 |
&main::Output(
|
|
257 |
"\n",
|
|
258 |
"\t\@echo Not attempting to create \"\$(EPOCLIB)UREL\\$PrimaryExportLibrary.LIB\"\n",
|
|
259 |
"\t\@echo from frozen .DEF file, since EXPORTUNFROZEN specified.\n"
|
|
260 |
);
|
|
261 |
}
|
|
262 |
&main::Output(
|
|
263 |
"\n",
|
|
264 |
"\n",
|
|
265 |
"# REAL TARGET - LIBRARY\n",
|
|
266 |
"\n",
|
|
267 |
"\"\$(EPOCLIB)\\UREL\\$ExportLibrary.LIB\" : \"$DefFile\"\n",
|
|
268 |
"\tperl -S prepdef.pl \"$DefFile\" \"\$(EPOCBLD)\\$ExportLibrary.prep.def\"\n",
|
|
269 |
"\tlib.exe /nologo /machine:i386 /nodefaultlib /subsystem:native /name:\"$LinkAs\" /def:\"\$(EPOCBLD)\\$ExportLibrary.prep.def\" /out:\"\$(EPOCLIB)\\UREL\\$ExportLibrary.LIB\"\n",
|
|
270 |
"\tdel \"\$(EPOCLIB)\\UREL\\$ExportLibrary.exp\"\n"
|
|
271 |
);
|
|
272 |
if ($ExtraExportLibrary) {
|
|
273 |
&main::Output(
|
|
274 |
"\n",
|
|
275 |
&Generic_Quote("\$(EPOCLIB)\\UREL\\$ExtraExportLibrary.lib"), " : ",
|
|
276 |
&Generic_Quote("\$(EPOCLIB)\\UREL\\$ExportLibrary.lib"), "\n",
|
|
277 |
"\tcopy ", &Generic_Quote("\$(EPOCLIB)\\UREL\\$ExportLibrary.lib"), " \$@\n"
|
|
278 |
);
|
|
279 |
}
|
|
280 |
}
|
|
281 |
&main::Output(
|
|
282 |
"\n",
|
|
283 |
"\n",
|
|
284 |
"FREEZE :\n"
|
|
285 |
);
|
|
286 |
if ($DefFile and $BasicTrgType !~ /^IMPLIB$/io) {
|
|
287 |
&main::Output(
|
|
288 |
# 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
|
|
289 |
"\tperl -S efreeze.pl \$(EFREEZE_ALLOW_REMOVE) \"$DefFile\" \"\$(EPOCBLD)\\$ExportLibrary.def\" \n"
|
|
290 |
);
|
|
291 |
}
|
|
292 |
&main::Output(
|
|
293 |
"\n",
|
|
294 |
"CLEANLIBRARY :\n"
|
|
295 |
);
|
|
296 |
if ($DefFile and !$NoExportLibrary) {
|
|
297 |
&main::Output(
|
|
298 |
"\t-\$(ERASE) \"\$(EPOCLIB)\\UREL\\$ExportLibrary.LIB\"\n"
|
|
299 |
);
|
|
300 |
if ($ExtraExportLibrary) {
|
|
301 |
&main::Output(
|
|
302 |
"\t-\$(ERASE) \"\$(EPOCLIB)\\UREL\\$ExtraExportLibrary.LIB\"\n"
|
|
303 |
);
|
|
304 |
}
|
|
305 |
}
|
|
306 |
&Generic_MakeWorkDir('MAKEWORKLIBRARY',"${LibPath}UREL");
|
|
307 |
|
|
308 |
&Generic_Releaseables;
|
|
309 |
}
|
|
310 |
|
|
311 |
sub PMBld {
|
|
312 |
|
|
313 |
my @ASSPLibList=&main::ASSPLibList;
|
|
314 |
my @SrcList=&main::SrcList;
|
|
315 |
my $BaseTrg=&main::BaseTrg;
|
|
316 |
my $Bld=&main::Bld;
|
|
317 |
my $DefFile=&main::DefFile;
|
|
318 |
my $EPOCIncPath=&main::EPOCIncPath;
|
|
319 |
my $FirstLib=&main::FirstLib;
|
|
320 |
my $BasicTrgType=&main::BasicTrgType;
|
|
321 |
my @LibList;
|
|
322 |
my $LinkAs=&main::LinkAs;
|
|
323 |
my $ExportLibrary=&main::ExportLibrary;
|
|
324 |
my $NoExportLibrary=&main::NoExportLibrary;
|
|
325 |
my $LibPath=&main::LibPath;
|
|
326 |
my $RelPath=&main::RelPath;
|
|
327 |
my @StatLibList=&main::StatLibList;
|
|
328 |
my $Trg=&main::Trg;
|
|
329 |
my $TrgPath=&main::TrgPath;
|
|
330 |
my $TrgType=&main::TrgType;
|
|
331 |
my @UidList=&main::UidList;
|
|
332 |
my $HasExports=0;
|
|
333 |
if (-e $DefFile or scalar(&main::Exports)!=0) {
|
|
334 |
$HasExports=1;
|
|
335 |
}
|
|
336 |
my %Version = &main::Version();
|
|
337 |
my $ExtraExportLibrary;
|
|
338 |
unless ($Version{explicit}) {
|
|
339 |
$ExtraExportLibrary = $ExportLibrary;
|
|
340 |
$ExtraExportLibrary =~ s/\{(\d|a|b|c|d|e|f){8}\}//i;
|
|
341 |
}
|
|
342 |
|
|
343 |
my $WarningLevel='/WARN:3';
|
|
344 |
$WarningLevel='/WARN:1'; # avoid LNK4005 warnings about unused libraries
|
|
345 |
|
|
346 |
if ($Bld =~ /DEB/) {
|
|
347 |
@LibList=&main::DebugLibList;
|
|
348 |
} else {
|
|
349 |
@LibList=&main::LibList;
|
|
350 |
}
|
|
351 |
|
|
352 |
# set up $LinkAs
|
|
353 |
$UidList[2]=~/^0x(.*)$/o;
|
|
354 |
if ($1 ne '00000000') { # have to make sure than series of noughts in brackets doesn't appear in name for null uids
|
|
355 |
$LinkAs=join '', &main::Path_Split('Base',$LinkAs),"[$1]",&main::Path_Split('Ext',$LinkAs);
|
|
356 |
}
|
|
357 |
|
|
358 |
my $BLDTRGPATH = "\$(EPOCTRG$Bld)\\";
|
|
359 |
my $BLDDATAPATH = "\$(EPOCTRG$Bld)\\";
|
|
360 |
my $Entry="";
|
|
361 |
my $Include="";
|
|
362 |
my $EntrySymbol='';
|
|
363 |
if ($BasicTrgType=~/^DLL$/o) {
|
|
364 |
$Entry="_E32Dll";
|
|
365 |
$Include="/include:\"__E32Dll\"";
|
|
366 |
$EntrySymbol='_E32Dll';
|
|
367 |
}
|
|
368 |
elsif ($BasicTrgType=~/^EXE$/o) {
|
|
369 |
$Entry="_E32Startup";
|
|
370 |
$Include="/include:\"__E32Startup\"";
|
|
371 |
$EntrySymbol='_E32Startup';
|
|
372 |
}
|
|
373 |
my $AbsentSubst = '';
|
|
374 |
if ($EntrySymbol) {
|
|
375 |
$AbsentSubst = " -absent $EntrySymbol";
|
|
376 |
}
|
|
377 |
|
|
378 |
# REAL TARGETS
|
|
379 |
#-------------
|
|
380 |
&main::Output(
|
|
381 |
"# REAL TARGET - BUILD VARIANT $Bld\n",
|
|
382 |
"\n"
|
|
383 |
);
|
|
384 |
|
|
385 |
# releasables
|
|
386 |
my @releasables;
|
|
387 |
push @releasables, "$RelPath$Trg" if ($BasicTrgType !~ /^IMPLIB$/io);
|
|
388 |
if ($BasicTrgType=~/^(DLL|EXE)$/o) {
|
|
389 |
push @releasables, "$RelPath$Trg.MAP";
|
|
390 |
}
|
|
391 |
if (-e $DefFile and !$NoExportLibrary) { # effectively "if project frozen ..."
|
|
392 |
push @releasables, "$LibPath$ExportLibrary.LIB";
|
|
393 |
push @releasables, "$LibPath$ExtraExportLibrary.LIB" if ($ExtraExportLibrary);
|
|
394 |
}
|
|
395 |
|
|
396 |
&main::Output(
|
|
397 |
"WHAT$Bld : WHATGENERIC\n",
|
|
398 |
"\n",
|
|
399 |
"CLEAN$Bld : CLEANBUILD$Bld CLEANRELEASE$Bld\n",
|
|
400 |
"\n",
|
|
401 |
"CLEANBUILD$Bld : \n",
|
|
402 |
"\t\@perl -S ermdir.pl \"\$(EPOCBLD$Bld)\"\n",
|
|
403 |
"\t-\$(ERASE) \"$BLDTRGPATH$BaseTrg.ILK\"\n",
|
|
404 |
"\n",
|
|
405 |
"CLEANRELEASE$Bld : CLEANGENERIC\n",
|
|
406 |
"\n"
|
|
407 |
);
|
|
408 |
&Generic_WhatCleanTargets($Bld, "WHAT$Bld", "CLEANRELEASE$Bld", @releasables);
|
|
409 |
|
|
410 |
&Generic_MakeWorkDir("MAKEWORK$Bld", &main::BldPath);
|
|
411 |
&Generic_MakeWorkDir("MAKEWORK$Bld", $BLDTRGPATH);
|
|
412 |
|
|
413 |
return if ($BasicTrgType =~ /^IMPLIB$/io);
|
|
414 |
|
|
415 |
&main::Output(
|
|
416 |
"LISTING$Bld : MAKEWORK$Bld"
|
|
417 |
);
|
|
418 |
foreach (@SrcList) {
|
|
419 |
my $BaseSrc = &main::Path_Split('Base', $_);
|
|
420 |
my $Ext = &main::Path_Split('Ext', $_);
|
|
421 |
$BaseSrc.='_' if (lc($Ext) eq '.cia');
|
|
422 |
&main::Output(
|
|
423 |
" \\\n\tLISTING$Bld$BaseSrc"
|
|
424 |
);
|
|
425 |
}
|
|
426 |
&main::Output(
|
|
427 |
"\n",
|
|
428 |
"\n"
|
|
429 |
);
|
|
430 |
|
|
431 |
&main::Output(
|
|
432 |
"LIBS="
|
|
433 |
);
|
|
434 |
foreach (@StatLibList) {
|
|
435 |
&main::Output(
|
|
436 |
" \\\n\t\"\$(EPOCSTATLINK$Bld)\\$_\""
|
|
437 |
);
|
|
438 |
}
|
|
439 |
foreach (@ASSPLibList) {
|
|
440 |
&main::Output(
|
|
441 |
" \\\n\t\"\$(EPOCASSPLINK$Bld)\\$_\""
|
|
442 |
);
|
|
443 |
}
|
|
444 |
foreach (@LibList) {
|
|
445 |
&main::Output(
|
|
446 |
" \\\n\t\"\$(EPOCLINK$Bld)\\$_\""
|
|
447 |
);
|
|
448 |
}
|
|
449 |
&main::Output(
|
|
450 |
"\n",
|
|
451 |
"\n"
|
|
452 |
);
|
|
453 |
|
|
454 |
&main::Output(
|
|
455 |
"LINK_OBJS="
|
|
456 |
);
|
|
457 |
foreach (@SrcList) {
|
|
458 |
my $BaseSrc = &main::Path_Split('Base', $_);
|
|
459 |
my $Ext = &main::Path_Split('Ext', $_);
|
|
460 |
$BaseSrc.='_' if (lc($Ext) eq '.cia');
|
|
461 |
&main::Output(
|
|
462 |
" \\\n",
|
|
463 |
"\t\"\$(EPOCBLD$Bld)\\$BaseSrc.obj\""
|
|
464 |
);
|
|
465 |
}
|
|
466 |
&main::Output(
|
|
467 |
"\n",
|
|
468 |
"\n"
|
|
469 |
);
|
|
470 |
|
|
471 |
if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
|
|
472 |
&main::OutFormat(
|
|
473 |
"STAGE1_LINK_FLAGS="
|
|
474 |
);
|
|
475 |
&main::OutFormat(
|
|
476 |
"\"\$(EPOCSTATLINK$Bld)\\$FirstLib\" /PDB:NONE"
|
|
477 |
);
|
|
478 |
if ($BasicTrgType=~/^(DLL)$/o) { # Add the DLL stub
|
|
479 |
&main::OutFormat(
|
|
480 |
" \"\$(EPOCSTATLINK$Bld)\\EDLLSTUB.LIB\""
|
|
481 |
);
|
|
482 |
}
|
|
483 |
&main::OutFormat(
|
|
484 |
" \$(LIBS) /nologo /entry:$Entry /subsystem:native"
|
|
485 |
);
|
|
486 |
if ($BasicTrgType=~/^DLL$/o) {
|
|
487 |
&main::OutFormat(
|
|
488 |
" /dll"
|
|
489 |
);
|
|
490 |
}
|
|
491 |
if ($Bld=~/DEB$/o) {
|
|
492 |
&main::OutFormat(
|
|
493 |
' /debug'
|
|
494 |
);
|
|
495 |
}
|
|
496 |
&main::OutFormat(
|
|
497 |
" /incremental:no /machine:IX86 /nodefaultlib $Include /out:\"\$(EPOCBLD$Bld)\\$Trg\" $WarningLevel",
|
|
498 |
" /implib:\"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"",
|
|
499 |
' /ignore:4089', # LNK4089: all references to "dynamic-link library" discarded by /OPT:REF
|
|
500 |
' /ignore:4005' # LNK4005: no objects used from XXX
|
|
501 |
);
|
|
502 |
&main::Output(
|
|
503 |
"\n",
|
|
504 |
"\n"
|
|
505 |
);
|
|
506 |
}
|
|
507 |
|
|
508 |
&main::OutFormat(
|
|
509 |
'LINK_FLAGS='
|
|
510 |
);
|
|
511 |
if ($BasicTrgType=~/^(EXE|DLL)$/o) {
|
|
512 |
&main::OutFormat(
|
|
513 |
" \"\$(EPOCSTATLINK$Bld)\\$FirstLib\" /PDB:NONE "
|
|
514 |
);
|
|
515 |
if ($BasicTrgType=~/^(DLL)$/o) { # Add the DLL stub
|
|
516 |
&main::OutFormat(
|
|
517 |
" \"\$(EPOCSTATLINK$Bld)\\EDLLSTUB.LIB\""
|
|
518 |
);
|
|
519 |
}
|
|
520 |
}
|
|
521 |
&main::OutFormat(
|
|
522 |
' $(LIBS) /nologo'
|
|
523 |
);
|
|
524 |
if ($BasicTrgType=~/^(EXE|DLL)$/o) {
|
|
525 |
&main::OutFormat(
|
|
526 |
" /fixed:no "
|
|
527 |
);
|
|
528 |
&main::OutFormat(
|
|
529 |
" /entry:$Entry"
|
|
530 |
);
|
|
531 |
}
|
|
532 |
&main::OutFormat(
|
|
533 |
' /subsystem:native'
|
|
534 |
);
|
|
535 |
if ($BasicTrgType=~/^DLL$/o) {
|
|
536 |
if ($HasExports) {
|
|
537 |
&main::OutFormat(
|
|
538 |
" /dll \"\$(EPOCBLD$Bld)\\$ExportLibrary.exp\""
|
|
539 |
);
|
|
540 |
} else {
|
|
541 |
&main::OutFormat(
|
|
542 |
" /dll"
|
|
543 |
);
|
|
544 |
}
|
|
545 |
} elsif ($TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
|
|
546 |
&main::OutFormat(
|
|
547 |
" \"\$(EPOCBLD$Bld)\\$ExportLibrary.exp\""
|
|
548 |
);
|
|
549 |
}
|
|
550 |
if (&main::HeapSize) {
|
|
551 |
my %HeapSize=&main::HeapSize;
|
|
552 |
&main::OutFormat(
|
|
553 |
' /heap:',$HeapSize{Max},',',$HeapSize{Min}
|
|
554 |
);
|
|
555 |
}
|
|
556 |
if ($BasicTrgType=~/^(DLL|EXE)$/o) {
|
|
557 |
if ($Bld=~/DEB$/o) {
|
|
558 |
&main::OutFormat(
|
|
559 |
' /debug'
|
|
560 |
);
|
|
561 |
}
|
|
562 |
elsif ($Bld=~/REL$/o) {
|
|
563 |
&main::OutFormat(
|
|
564 |
' /incremental:no'
|
|
565 |
);
|
|
566 |
}
|
|
567 |
}
|
|
568 |
&main::OutFormat(
|
|
569 |
' /machine:IX86',
|
|
570 |
' /ignore:4089', # LNK4089: all references to "dynamic-link library" discarded by /OPT:REF
|
|
571 |
' /ignore:4005' # LNK4005: no objects used from XXX
|
|
572 |
);
|
|
573 |
&main::OutFormat(
|
|
574 |
" /nodefaultlib $Include"
|
|
575 |
);
|
|
576 |
if ($BasicTrgType=~/^(DLL|EXE)$/o) {
|
|
577 |
&main::OutFormat(
|
|
578 |
" /out:\"\$(EPOCBLD$Bld)\\$Trg\"",
|
|
579 |
" /implib:\"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\""
|
|
580 |
);
|
|
581 |
&main::OutFormat(
|
|
582 |
" $WarningLevel"
|
|
583 |
);
|
|
584 |
} else {
|
|
585 |
&main::OutFormat(
|
|
586 |
" /out:\"$BLDTRGPATH$Trg\""
|
|
587 |
);
|
|
588 |
}
|
|
589 |
&main::Output(
|
|
590 |
"\n",
|
|
591 |
"\n"
|
|
592 |
);
|
|
593 |
|
|
594 |
&main::Output(
|
|
595 |
"\"$BLDTRGPATH$Trg\" : \$(LINK_OBJS)"
|
|
596 |
);
|
|
597 |
if (-e $DefFile) { # effectively "if project frozen ..."
|
|
598 |
&main::Output(
|
|
599 |
" \"$DefFile\""
|
|
600 |
);
|
|
601 |
}
|
|
602 |
if ($BasicTrgType=~/^(DLL|EXE)$/o) {
|
|
603 |
&main::Output(
|
|
604 |
" \"\$(EPOCSTATLINK$Bld)\\$FirstLib\""
|
|
605 |
);
|
|
606 |
}
|
|
607 |
&main::Output(
|
|
608 |
" \$(LIBS)\n"
|
|
609 |
);
|
|
610 |
|
|
611 |
|
|
612 |
# Link by name first time round for dlls
|
|
613 |
if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
|
|
614 |
&main::Output(
|
|
615 |
"\techo $Entry>\"\$(EPOCBLD$Bld)\\$ExportLibrary.ord\"\n",
|
|
616 |
"\tlink.exe \@<<\n",
|
|
617 |
"\t\t\$(STAGE1_LINK_FLAGS) /order:@\"\$(EPOCBLD$Bld)\\$ExportLibrary.ord\" \$(LINK_OBJS)\n",
|
|
618 |
"<<\n",
|
|
619 |
"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.ord\"\n",
|
|
620 |
"\tdel \"\$(EPOCBLD$Bld)\\$Trg\"\n",
|
|
621 |
# "\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.exp\"\n"
|
|
622 |
);
|
|
623 |
|
|
624 |
if ($HasExports) {
|
|
625 |
# Generate an export info file
|
|
626 |
&main::Output(
|
|
627 |
"\tdumpbin /exports /out:\"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\" \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n",
|
|
628 |
"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n"
|
|
629 |
);
|
|
630 |
|
|
631 |
# call makedef to reorder the export information
|
|
632 |
&main::Output(
|
|
633 |
# 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
|
|
634 |
"\tperl -S makedef.pl $AbsentSubst -Inffile \"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\""
|
|
635 |
);
|
|
636 |
if (-e $DefFile) { # effectively "if project frozen ..."
|
|
637 |
&main::Output(
|
|
638 |
" -Frzfile \"$DefFile\""
|
|
639 |
);
|
|
640 |
}
|
|
641 |
# freeze ordinals, a maximum of 2, for polymorphic dlls
|
|
642 |
my $Ordinal;
|
|
643 |
my $Num=1;
|
|
644 |
foreach $Ordinal (&main::Exports) {
|
|
645 |
# replace "$" with "$$" so that NMAKE doesn't think there's a macro in the function name
|
|
646 |
$Ordinal=~s-\$-\$\$-go;
|
|
647 |
&main::Output(
|
|
648 |
" -$Num $Ordinal"
|
|
649 |
);
|
|
650 |
$Num++;
|
|
651 |
}
|
|
652 |
&main::Output(
|
|
653 |
" \"\$(EPOCBLD)\\$ExportLibrary.def\" \n",
|
|
654 |
"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\"\n"
|
|
655 |
);
|
|
656 |
|
|
657 |
# create the export object from the .DEF file
|
|
658 |
&main::Output(
|
|
659 |
"\tlib.exe /nologo /machine:i386 /nodefaultlib /subsystem:native /name:\"$LinkAs\" /def:\"\$(EPOCBLD)\\$ExportLibrary.def\" /out:\"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n"
|
|
660 |
);
|
|
661 |
if (&main::ExportUnfrozen) {
|
|
662 |
&main::Output(
|
|
663 |
"\tcopy \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\" \"\$(EPOCLIB)\\UREL\\$ExportLibrary.lib\"\n"
|
|
664 |
);
|
|
665 |
if ($ExtraExportLibrary) {
|
|
666 |
&main::Output(
|
|
667 |
"\n",
|
|
668 |
"\tcopy \"\$(EPOCLIB)\\UREL\\$ExportLibrary.lib\" ",
|
|
669 |
"\"\$(EPOCLIB)\\UREL\\$ExtraExportLibrary.lib\"",
|
|
670 |
"\n"
|
|
671 |
);
|
|
672 |
}
|
|
673 |
}
|
|
674 |
&main::Output(
|
|
675 |
"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n"
|
|
676 |
);
|
|
677 |
}
|
|
678 |
}
|
|
679 |
|
|
680 |
if ($BasicTrgType=~/^(DLL|EXE)$/o) {
|
|
681 |
&main::Output(
|
|
682 |
"\techo $Entry>\"\$(EPOCBLD$Bld)\\$ExportLibrary.ord\"\n",
|
|
683 |
"\tlink.exe /order:@\"\$(EPOCBLD$Bld)\\$ExportLibrary.ord\" /MAPINFO:EXPORTS /MAP:\"$RelPath$Trg.MAP\" \@<<\n"
|
|
684 |
);
|
|
685 |
}
|
|
686 |
elsif ($BasicTrgType=~/^LIB$/o) {
|
|
687 |
&main::Output(
|
|
688 |
"\tlib.exe \@<<\n"
|
|
689 |
);
|
|
690 |
}
|
|
691 |
&main::Output(
|
|
692 |
"\t\t\$(LINK_FLAGS) \$(LINK_OBJS)\n",
|
|
693 |
"<<\n"
|
|
694 |
);
|
|
695 |
|
|
696 |
if ($BasicTrgType=~/^(DLL|EXE)$/o) {
|
|
697 |
&main::Output(
|
|
698 |
"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.ord\"\n"
|
|
699 |
);
|
|
700 |
if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
|
|
701 |
if ($HasExports) {
|
|
702 |
&main::Output(
|
|
703 |
"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.exp\"\n"
|
|
704 |
);
|
|
705 |
}
|
|
706 |
}
|
|
707 |
&main::Output(
|
|
708 |
"\tperl -S findimp.pl \"$RelPath$Trg.MAP\" \"\$(EPOCBLD$Bld)\\$ExportLibrary.imp\"\n"
|
|
709 |
);
|
|
710 |
&main::Output(
|
|
711 |
"\tpetran -x86imp=\"\$(EPOCBLD$Bld)\\$ExportLibrary.imp\" -version ", &Genutl_VersionToUserString(%Version), " -sid ", &main::SecureId(), " \"\$(EPOCBLD$Bld)\\$Trg\" \$\@ \\\n",
|
|
712 |
"\t\t"
|
|
713 |
);
|
|
714 |
if (&main::AllowDllData) {
|
|
715 |
&main::Output(
|
|
716 |
' -allow'
|
|
717 |
);
|
|
718 |
}
|
|
719 |
if (not &main::CallDllEntryPoints) {
|
|
720 |
&main::Output(
|
|
721 |
' -nocall'
|
|
722 |
);
|
|
723 |
}
|
|
724 |
if (&main::DataLinkAddress) {
|
|
725 |
&main::Output(
|
|
726 |
' -datalinkaddress ',&main::DataLinkAddress
|
|
727 |
);
|
|
728 |
}
|
|
729 |
if (&main::FixedProcess) {
|
|
730 |
&main::Output(
|
|
731 |
' -fixed'
|
|
732 |
);
|
|
733 |
}
|
|
734 |
if (&main::HeapSize) {
|
|
735 |
my %HeapSize=&main::HeapSize;
|
|
736 |
&main::Output(
|
|
737 |
' -heap ',$HeapSize{Min},' ',$HeapSize{Max}
|
|
738 |
);
|
|
739 |
}
|
|
740 |
if (&main::ProcessPriority) {
|
|
741 |
&main::Output(
|
|
742 |
' -priority ',&main::ProcessPriority
|
|
743 |
);
|
|
744 |
}
|
|
745 |
if (&main::SmpSafe) {
|
|
746 |
&main::Output(
|
|
747 |
' -smpsafe'
|
|
748 |
);
|
|
749 |
}
|
|
750 |
if (&main::StackSize) {
|
|
751 |
&main::Output(
|
|
752 |
' -stack ',&main::StackSize
|
|
753 |
);
|
|
754 |
}
|
|
755 |
my $i=1;
|
|
756 |
foreach (@UidList) {
|
|
757 |
&main::Output(
|
|
758 |
" -uid$i $_"
|
|
759 |
);
|
|
760 |
$i++;
|
|
761 |
}
|
|
762 |
if(&main::VendorId) {
|
|
763 |
&main::Output(
|
|
764 |
' -vid ',&main::VendorId
|
|
765 |
);
|
|
766 |
}
|
|
767 |
&main::Output(
|
|
768 |
' -capability ',&main::Capability,
|
|
769 |
);
|
|
770 |
if (&main::CompressTarget)
|
|
771 |
{
|
|
772 |
&main::Output(
|
|
773 |
" -nocompress"
|
|
774 |
);
|
|
775 |
}
|
|
776 |
else
|
|
777 |
{
|
|
778 |
if(&main::CompressTargetMode == NOCOMPRESSIONMETHOD)
|
|
779 |
{
|
|
780 |
# Do nothing
|
|
781 |
}
|
|
782 |
elsif(&main::CompressTargetMode == INFLATECOMPRESSIONMETHOD)
|
|
783 |
{
|
|
784 |
&main::Output(
|
|
785 |
" -compressionmethod deflate"
|
|
786 |
);
|
|
787 |
}
|
|
788 |
elsif(&main::CompressTargetMode == BYTEPAIRCOMPRESSIONMETHOD)
|
|
789 |
{
|
|
790 |
&main::Output(
|
|
791 |
" -compressionmethod bytepair"
|
|
792 |
);
|
|
793 |
}
|
|
794 |
|
|
795 |
}
|
|
796 |
if (&main::CodePagingTargetMode == UNPAGED) {
|
|
797 |
&main::Output(
|
|
798 |
' -codepaging unpaged'
|
|
799 |
);
|
|
800 |
}
|
|
801 |
elsif (&main::CodePagingTargetMode == PAGED) {
|
|
802 |
&main::Output(
|
|
803 |
' -codepaging paged'
|
|
804 |
);
|
|
805 |
}
|
|
806 |
|
|
807 |
if (&main::DataPagingTargetMode == UNPAGED) {
|
|
808 |
&main::Output(
|
|
809 |
' -datapaging unpaged'
|
|
810 |
);
|
|
811 |
}
|
|
812 |
elsif (&main::DataPagingTargetMode == PAGED) {
|
|
813 |
&main::Output(
|
|
814 |
' -datapaging paged'
|
|
815 |
);
|
|
816 |
}
|
|
817 |
&main::Output("\n");
|
|
818 |
&main::Output(
|
|
819 |
"\tdel \"\$(EPOCBLD$Bld)\\$Trg\"\n"
|
|
820 |
);
|
|
821 |
}
|
|
822 |
|
|
823 |
&main::Output(
|
|
824 |
"\n",
|
|
825 |
"\n"
|
|
826 |
);
|
|
827 |
}
|
|
828 |
|
|
829 |
sub PMStartSrcList {
|
|
830 |
|
|
831 |
&main::Output(
|
|
832 |
"# SOURCES\n",
|
|
833 |
"\n"
|
|
834 |
);
|
|
835 |
}
|
|
836 |
|
|
837 |
sub PMBitMapBld {
|
|
838 |
|
|
839 |
&Generic_BitMapBld;
|
|
840 |
|
|
841 |
}
|
|
842 |
|
|
843 |
sub PMResrcBld {
|
|
844 |
|
|
845 |
&Generic_ResrcBld;
|
|
846 |
|
|
847 |
}
|
|
848 |
|
|
849 |
sub PMAifBld {
|
|
850 |
|
|
851 |
&Generic_AifBld;
|
|
852 |
|
|
853 |
}
|
|
854 |
|
|
855 |
sub PMStartSrc {
|
|
856 |
my $Src=&main::Src;
|
|
857 |
|
|
858 |
&main::Output(
|
|
859 |
"# Source $Src\n",
|
|
860 |
"\n"
|
|
861 |
);
|
|
862 |
}
|
|
863 |
|
|
864 |
sub PMSrcDepend {
|
|
865 |
my @BldList=&main::BldList;
|
|
866 |
my @DepList=&main::DepList;
|
|
867 |
|
|
868 |
&main::Output(
|
|
869 |
"DEPEND="
|
|
870 |
);
|
|
871 |
foreach (@DepList) {
|
|
872 |
&main::Output(
|
|
873 |
" \\\n\t\"$_\""
|
|
874 |
);
|
|
875 |
}
|
|
876 |
&main::Output(
|
|
877 |
"\n",
|
|
878 |
"\n"
|
|
879 |
);
|
|
880 |
foreach (@BldList) {
|
|
881 |
&main::Output(
|
|
882 |
"DEPEND$_=\$(DEPEND)\n",
|
|
883 |
"\n"
|
|
884 |
);
|
|
885 |
}
|
|
886 |
&main::Output(
|
|
887 |
"\n"
|
|
888 |
);
|
|
889 |
}
|
|
890 |
|
|
891 |
sub PMSrcBldDepend {
|
|
892 |
my $Bld=&main::Bld;
|
|
893 |
my @DepList=&main::DepList;
|
|
894 |
|
|
895 |
&main::Output(
|
|
896 |
"DEPEND$Bld="
|
|
897 |
);
|
|
898 |
foreach (@DepList) {
|
|
899 |
&main::Output(
|
|
900 |
" \\\n\t\"$_\""
|
|
901 |
);
|
|
902 |
}
|
|
903 |
&main::Output(
|
|
904 |
"\n",
|
|
905 |
"\n"
|
|
906 |
);
|
|
907 |
}
|
|
908 |
|
|
909 |
sub PMEndSrcBld {
|
|
910 |
my $BaseSrc=&main::BaseSrc;
|
|
911 |
my $Bld=&main::Bld;
|
|
912 |
my $Plat=&main::Plat;
|
|
913 |
my $Src=ucfirst lc &main::Src;
|
|
914 |
my $SrcPath=&main::SrcPath;
|
|
915 |
my $Ext=&main::ExtSrc;
|
|
916 |
my $Cia = (lc($Ext) eq '.cia') ? 1 : 0;
|
|
917 |
|
|
918 |
if ($Cia) {
|
|
919 |
&main::Output(
|
|
920 |
"\"\$(EPOCBLD$Bld)\\$BaseSrc\_.obj\" \"\$(EPOCBLD$Bld)\\$BaseSrc\_.sbr\" : \"$SrcPath$Src\" \$(DEPEND$Bld)\n",
|
|
921 |
"\tperl -S tranasm_x86.pl \"$SrcPath$Src\" \"\$(EPOCBLD$Bld)\\$BaseSrc\_.transd.cia\"\n",
|
|
922 |
"\t\$(CL$Bld) /I \"$SrcPath\.\" /TP /Fo\"\$(EPOCBLD$Bld)\\$BaseSrc\_.obj\" /GF /c \"\$(EPOCBLD$Bld)\\$BaseSrc\_.transd.cia\"\n",
|
|
923 |
"\n",
|
|
924 |
# assembler listing target
|
|
925 |
"LISTING$Bld$BaseSrc\_ : \"\$(EPOCBLD$Bld)\\$BaseSrc\_.lis\"\n",
|
|
926 |
"\tcopy \$? \"$SrcPath$BaseSrc\_.$Plat.lst\"\n",
|
|
927 |
"\n",
|
|
928 |
"\"\$(EPOCBLD$Bld)\\$BaseSrc\_.lis\": \"$SrcPath$Src\" \$(DEPEND$Bld)\n",
|
|
929 |
"\t\$(CL$Bld) /TP /FAsc /Fa\"\$\@\" /Fo\"\$(EPOCBLD$Bld)\\$BaseSrc\_.obj\" /GF /c \"$SrcPath$Src\"\n",
|
|
930 |
"\n"
|
|
931 |
);
|
|
932 |
} else {
|
|
933 |
&main::Output(
|
|
934 |
"\"\$(EPOCBLD$Bld)\\$BaseSrc.obj\" \"\$(EPOCBLD$Bld)\\$BaseSrc.sbr\" : \"$SrcPath$Src\" \$(DEPEND$Bld)\n",
|
|
935 |
"\t\$(CL$Bld) /Fo\"\$(EPOCBLD$Bld)/\" /GF /c \"$SrcPath$Src\"\n",
|
|
936 |
"\n",
|
|
937 |
# assembler listing target
|
|
938 |
"LISTING$Bld$BaseSrc : \"\$(EPOCBLD$Bld)\\$BaseSrc.lis\"\n",
|
|
939 |
"\tcopy \$? \"$SrcPath$BaseSrc.$Plat.lst\"\n",
|
|
940 |
"\n",
|
|
941 |
"\"\$(EPOCBLD$Bld)\\$BaseSrc.lis\": \"$SrcPath$Src\" \$(DEPEND$Bld)\n",
|
|
942 |
"\t\$(CL$Bld) /FAsc /Fa\"\$\@\" /Fo\"\$(EPOCBLD$Bld)/\" /GF /c \"$SrcPath$Src\"\n",
|
|
943 |
"\n"
|
|
944 |
);
|
|
945 |
}
|
|
946 |
}
|
|
947 |
|
|
948 |
sub PMEndSrc {
|
|
949 |
|
|
950 |
&main::Output(
|
|
951 |
"\n",
|
|
952 |
"\n"
|
|
953 |
);
|
|
954 |
}
|
|
955 |
|
|
956 |
sub PMEndSrcList {
|
|
957 |
|
|
958 |
# Deal with accumulated MAKEDIRS etc.
|
|
959 |
|
|
960 |
&Generic_End;
|
|
961 |
}
|
|
962 |
|
|
963 |
1;
|