599
|
1 |
# Copyright (c) 1999-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 |
# Makmake-module for creating MAKMAKE MSVC6 IDE makefiles shared by windows platform modules
|
|
15 |
#
|
|
16 |
#
|
|
17 |
|
|
18 |
package Ide_vc6;
|
|
19 |
|
|
20 |
# declare variables global for module
|
|
21 |
my $BaseAddressFlag;
|
|
22 |
my @CppCall;
|
|
23 |
my %IdeBlds=();
|
|
24 |
my %PrjHdrs=();
|
|
25 |
my @Win32LibList=();
|
|
26 |
my $Win32Resrc;
|
|
27 |
my $Win32StdHeaders;
|
|
28 |
my $MSVCVer;
|
|
29 |
|
|
30 |
my $SupText='';
|
|
31 |
|
|
32 |
|
|
33 |
require Exporter;
|
|
34 |
@ISA=qw(Exporter);
|
|
35 |
|
|
36 |
@EXPORT=qw(
|
|
37 |
PMHelp_Mmp
|
|
38 |
|
|
39 |
PMCheckPlatformL
|
|
40 |
|
|
41 |
PMPlatProcessMmp
|
|
42 |
|
|
43 |
PMStartBldList
|
|
44 |
PMBld
|
|
45 |
PMEndBldList
|
|
46 |
PMStartSrcList
|
|
47 |
PMResrcBld
|
|
48 |
PMDoc
|
|
49 |
PMStartSrc
|
|
50 |
PMSrcDepend
|
|
51 |
PMEndSrcList
|
|
52 |
);
|
|
53 |
|
|
54 |
use Winutl;
|
|
55 |
use Pathutl;
|
|
56 |
|
|
57 |
sub PMHelp_Mmp {
|
|
58 |
# get the windows help from WINUTL
|
|
59 |
&Winutl_Help_Mmp;
|
|
60 |
}
|
|
61 |
|
|
62 |
sub PMCheckPlatformL {
|
|
63 |
if ((&main::Plat eq 'TOOLS') and (&main::BasicTrgType ne 'EXE') and (&main::BasicTrgType ne 'LIB')) {
|
|
64 |
die "Can't specify anything but EXE or LIB targettypes for this platform\n";
|
|
65 |
}
|
|
66 |
}
|
|
67 |
|
|
68 |
sub PMPlatProcessMmp (@) {
|
|
69 |
|
|
70 |
# get WINUTL to do the windows mmp file processing
|
|
71 |
&Winutl_DoMmp(\@_, $ENV{INCLUDE});
|
|
72 |
$BaseAddressFlag=&Winutl_BaseAddress;
|
|
73 |
$BaseAddressFlag=~s/^(.+$)$/ \/base:\"$1\"/o;
|
|
74 |
@Win32LibList=&Winutl_Win32LibList;
|
|
75 |
my $MSVCVer = &Winutl_MSVCVer;
|
|
76 |
push @Win32LibList, "kernel32.lib";
|
|
77 |
$Win32Resrc=&Winutl_Win32Resrc;
|
|
78 |
$Win32StdHeaders=&Winutl_Win32StdHeaders;
|
|
79 |
}
|
|
80 |
|
|
81 |
sub PMStartBldList($) {
|
|
82 |
my ($makecmd) = @_;
|
|
83 |
die "Cannot generate $makecmd makefiles\n" if ($makecmd ne "nmake");
|
|
84 |
my $BaseTrg=&main::BaseTrg;
|
|
85 |
my @BldList=&main::BldList;
|
|
86 |
my $BldPath=&main::BldPath;
|
|
87 |
my $ChopDataPath=&main::Path_Chop(&main::DataPath);
|
|
88 |
my $ChopTrgPath=&main::Path_Chop(&main::TrgPath);
|
|
89 |
my $DefFile=&main::DefFile;
|
|
90 |
my $BasicTrgType=&main::BasicTrgType;
|
|
91 |
my $ExportLibrary=&main::ExportLibrary;
|
|
92 |
my $LibPath=&main::LibPath;
|
|
93 |
|
|
94 |
my $MSVCVer = &Winutl_MSVCVer;
|
|
95 |
|
|
96 |
my $LinkPath=&main::LinkPath;
|
|
97 |
my $Plat=&main::Plat;
|
|
98 |
my $RelPath=&main::RelPath;
|
|
99 |
my $Trg=&main::Trg;
|
|
100 |
my $StatLinkPath=&main::StatLinkPath;
|
|
101 |
my $TrgType=&main::TrgType;
|
|
102 |
|
|
103 |
|
|
104 |
# set up global IDE builds variable
|
|
105 |
%IdeBlds= (
|
|
106 |
UREL=> "$BaseTrg - Win32 Uni Release",
|
|
107 |
UDEB=> "$BaseTrg - Win32 Uni Debug",
|
|
108 |
);
|
|
109 |
if (&main::Plat eq 'TOOLS') {
|
|
110 |
%IdeBlds= (
|
|
111 |
REL=> "$BaseTrg - Win32 Release",
|
|
112 |
DEB=> "$BaseTrg - Win32 Debug",
|
|
113 |
);
|
|
114 |
}
|
|
115 |
|
|
116 |
|
|
117 |
# Start the supplementary makefile
|
|
118 |
|
|
119 |
$SupText.=join('',
|
|
120 |
"\n",
|
|
121 |
# need to set path here because MSDEV might be set up so that
|
|
122 |
# it does not take account of the PATH environment variable
|
|
123 |
"PATH=$ENV{PATH}\n",
|
|
124 |
"\n",
|
|
125 |
"# EPOC DEFINITIONS\n",
|
|
126 |
"\n",
|
|
127 |
"EPOCBLD = $BldPath #\n",
|
|
128 |
"EPOCTRG = $RelPath #\n",
|
|
129 |
"EPOCLIB = $LibPath #\n",
|
|
130 |
"EPOCLINK = $LinkPath #\n",
|
|
131 |
"EPOCSTATLINK = $StatLinkPath #\n",
|
|
132 |
"\n"
|
|
133 |
);
|
|
134 |
|
|
135 |
if ($BasicTrgType eq 'DLL' || $TrgType eq 'EXEXP') {
|
|
136 |
foreach (@BldList) {
|
|
137 |
$SupText.=join('',
|
|
138 |
"EPOCBLD$_ = \$(EPOCBLD)$_\n",
|
|
139 |
"EPOCTRG$_ = \$(EPOCTRG)$_\n",
|
|
140 |
"EPOCLIB$_ = \$(EPOCLIB)UDEB\n",
|
|
141 |
"EPOCLINK$_ = \$(EPOCLINK)UDEB\n",
|
|
142 |
"EPOCSTATLINK$_ = \$(EPOCSTATLINK)$_\n",
|
|
143 |
"\n"
|
|
144 |
);
|
|
145 |
}
|
|
146 |
$SupText.="\nTRGDIR = ";
|
|
147 |
if ($Plat!~/^WINC$/o && $ChopTrgPath) { # target path not allowed under WINC
|
|
148 |
$SupText.=$ChopTrgPath;
|
|
149 |
}
|
|
150 |
else {
|
|
151 |
$SupText.=".\\";
|
|
152 |
}
|
|
153 |
$SupText.="\n\nDATADIR = $ChopDataPath\n\n";
|
|
154 |
|
|
155 |
|
|
156 |
# commands for creating the import library
|
|
157 |
$SupText.="LIBRARY :";
|
|
158 |
if ($DefFile) {
|
|
159 |
unless (&main::ExportUnfrozen) {
|
|
160 |
if (-e $DefFile) { # effectively "if project frozen ..."
|
|
161 |
$SupText.=" \"\$(EPOCLIB)UDEB\\$ExportLibrary.lib\"\n";
|
|
162 |
}
|
|
163 |
else {
|
|
164 |
$SupText.=join('',
|
|
165 |
"\n",
|
|
166 |
"\t\@echo WARNING: Not attempting to create \"\$(EPOCLIB)UDEB\\$ExportLibrary.lib\".\n",
|
|
167 |
"\t\@echo When exports are frozen in \"$DefFile\", regenerate Makefile.\n"
|
|
168 |
);
|
|
169 |
}
|
|
170 |
}
|
|
171 |
else {
|
|
172 |
$SupText.=join('',
|
|
173 |
"\n",
|
|
174 |
"\t\@echo Not attempting to create \"\$(EPOCLIB)UDEB\\$ExportLibrary.lib\"\n",
|
|
175 |
"\t\@echo from frozen .DEF file, since EXPORTUNFROZEN specified.\n"
|
|
176 |
);
|
|
177 |
}
|
|
178 |
$SupText.=join('',
|
|
179 |
"\n",
|
|
180 |
"\n",
|
|
181 |
"# REAL TARGET - IMPORT LIBRARY\n",
|
|
182 |
"\n",
|
|
183 |
"\"\$(EPOCLIB)UDEB\\$ExportLibrary.lib\" : \"$DefFile\" MAKEWORKLIBRARY\n",
|
|
184 |
"\tperl -S prepdef.pl \"$DefFile\" \"\$(EPOCBLD)\\$ExportLibrary.prep.def\"\n",
|
|
185 |
"\tlib.exe /nologo /machine:i386 /nodefaultlib /name:\"$Trg\" /def:\"\$(EPOCBLD)\\$ExportLibrary.prep.def\" /out:\"\$(EPOCLIB)UDEB\\$ExportLibrary.lib\"\n",
|
|
186 |
"\tdel \"\$(EPOCLIB)UDEB\\$ExportLibrary.exp\"\n"
|
|
187 |
);
|
|
188 |
}
|
|
189 |
$SupText.=join('',
|
|
190 |
"\n",
|
|
191 |
"\n",
|
|
192 |
"MAKEWORKLIBRARY : \"${LibPath}UDEB\"\n",
|
|
193 |
"\n",
|
|
194 |
"\"${LibPath}UDEB\" :\n"
|
|
195 |
);
|
|
196 |
$SupText.="\t\@perl -S emkdir.pl \"${LibPath}UDEB\"\n\n\n";
|
|
197 |
}
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
&main::Output(
|
|
202 |
"# Microsoft Developer Studio Project File - Name=\"$BaseTrg\" - Package Owner=<4>\n",
|
|
203 |
"# Microsoft Developer Studio Generated Build File, Format Version 6.00\n",
|
|
204 |
"# ** DO NOT EDIT **\n",
|
|
205 |
"\n"
|
|
206 |
);
|
|
207 |
|
|
208 |
if ($BasicTrgType=~/^DLL$/o) {
|
|
209 |
&main::Output(
|
|
210 |
"# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102\n"
|
|
211 |
);
|
|
212 |
}
|
|
213 |
elsif ($BasicTrgType=~/^EXE$/o) {
|
|
214 |
if (not &main::Plat=~/^(WINC|TOOLS)$/o) {
|
|
215 |
&main::Output(
|
|
216 |
"# TARGTYPE \"Win32 (x86) Application\" 0x0101\n"
|
|
217 |
);
|
|
218 |
}
|
|
219 |
else {
|
|
220 |
&main::Output(
|
|
221 |
"# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\n"
|
|
222 |
);
|
|
223 |
}
|
|
224 |
}
|
|
225 |
elsif ($BasicTrgType=~/^(LIB)$/o) {
|
|
226 |
&main::Output(
|
|
227 |
"# TARGTYPE \"Win32 (x86) Static Library\" 0x0104\n"
|
|
228 |
);
|
|
229 |
}
|
|
230 |
|
|
231 |
&main::Output(
|
|
232 |
"\n",
|
|
233 |
"CFG=",$IdeBlds{$BldList[0]},"\n",
|
|
234 |
"!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n",
|
|
235 |
"!MESSAGE use the Export Makefile command and run\n",
|
|
236 |
"!MESSAGE \n",
|
|
237 |
"!MESSAGE NMAKE /f \"",$BaseTrg,".mak\".\n",
|
|
238 |
"!MESSAGE \n",
|
|
239 |
"!MESSAGE You can specify a configuration when running NMAKE\n",
|
|
240 |
"!MESSAGE by defining the macro CFG on the command line. For example:\n",
|
|
241 |
"!MESSAGE \n",
|
|
242 |
"!MESSAGE NMAKE /f \"",$BaseTrg,".mak\" CFG=\"".$IdeBlds{$BldList[0]}."\"\n",
|
|
243 |
"!MESSAGE \n",
|
|
244 |
"!MESSAGE Possible choices for configuration are:\n",
|
|
245 |
"!MESSAGE \n"
|
|
246 |
);
|
|
247 |
&main::OutSetLength(79);
|
|
248 |
if ($BasicTrgType=~/^DLL$/o) {
|
|
249 |
foreach (reverse @BldList) { # reverse because VC6 takes last as the default
|
|
250 |
&main::OutFormat(
|
|
251 |
"!MESSAGE \"",$IdeBlds{$_},"\" (based on \"Win32 (x86) Dynamic-Link Library\")"
|
|
252 |
);
|
|
253 |
&main::Output();
|
|
254 |
}
|
|
255 |
}
|
|
256 |
elsif ($BasicTrgType=~/^EXE$/o) {
|
|
257 |
if (not &main::Plat=~/^(WINC|TOOLS)$/o) {
|
|
258 |
foreach (reverse @BldList) {
|
|
259 |
&main::OutFormat(
|
|
260 |
"!MESSAGE \"",$IdeBlds{$_},"\" (based on \"Win32 (x86) Application\")"
|
|
261 |
);
|
|
262 |
&main::Output();
|
|
263 |
}
|
|
264 |
}
|
|
265 |
else {
|
|
266 |
foreach (reverse @BldList) {
|
|
267 |
&main::OutFormat(
|
|
268 |
"!MESSAGE \"",$IdeBlds{$_},"\" (based on \"Win32 (x86) Console Application\")"
|
|
269 |
);
|
|
270 |
&main::Output();
|
|
271 |
}
|
|
272 |
}
|
|
273 |
}
|
|
274 |
elsif ($BasicTrgType=~/^(LIB)$/o) {
|
|
275 |
foreach (@BldList) {
|
|
276 |
&main::OutFormat(
|
|
277 |
"!MESSAGE \"",$IdeBlds{$_},"\" (based on \"Win32 (x86) Static Library\")"
|
|
278 |
);
|
|
279 |
&main::Output();
|
|
280 |
}
|
|
281 |
}
|
|
282 |
&main::OutSetLength();
|
|
283 |
&main::Output(
|
|
284 |
"!MESSAGE \n",
|
|
285 |
"\n"
|
|
286 |
);
|
|
287 |
|
|
288 |
# BEGIN THE PROJECT
|
|
289 |
#------------------
|
|
290 |
&main::Output(
|
|
291 |
"# Begin Project\n",
|
|
292 |
"# PROP Scc_ProjName \"\"\n",
|
|
293 |
"# PROP Scc_LocalPath \"\"\n",
|
|
294 |
"CPP=cl.exe\n",
|
|
295 |
"MTL=midl.exe\n",
|
|
296 |
"RSC=rc.exe\n",
|
|
297 |
"\n"
|
|
298 |
);
|
|
299 |
}
|
|
300 |
|
|
301 |
sub PMBld {
|
|
302 |
|
|
303 |
my @BaseSrcList=&main::BaseSrcList;
|
|
304 |
my $BaseTrg=&main::BaseTrg;
|
|
305 |
my $Bld=&main::Bld;
|
|
306 |
my @BldList=&main::BldList;
|
|
307 |
my $ChopBldPath=&main::Path_Chop(&main::BldPath);
|
|
308 |
my $ChopLinkPath=&main::Path_Chop(&main::LinkPath);
|
|
309 |
my $ChopRelPath=&main::Path_Chop(&main::RelPath);
|
|
310 |
my $ChopStatLinkPath=&main::Path_Chop(&main::StatLinkPath);
|
|
311 |
my @ChopSysIncPaths=&main::Path_Chop(&main::SysIncPaths);
|
|
312 |
my @ChopUserIncPaths=&main::Path_Chop(&main::UserIncPaths);
|
|
313 |
my $ExportLibrary=&main::ExportLibrary;
|
|
314 |
my $DefFile=&main::DefFile;
|
|
315 |
my $FirstLib=&main::FirstLib;
|
|
316 |
my $BasicTrgType=&main::BasicTrgType;
|
|
317 |
my @MacroList=&main::MacroList();
|
|
318 |
push @MacroList, "__SUPPORT_CPP_EXCEPTIONS__";
|
|
319 |
my $VariantFile=&main::VariantFile();
|
|
320 |
|
|
321 |
|
|
322 |
my @LibList;
|
|
323 |
my $PathBaseDsp=&main::MakeFilePath.&main::BaseMak;
|
|
324 |
my @StatLibList=&main::StatLibList;
|
|
325 |
my $Trg=&main::Trg;
|
|
326 |
my $TrgPath=&main::TrgPath;
|
|
327 |
my $TrgType=&main::TrgType;
|
|
328 |
|
|
329 |
my $newlib = main::NewLib(); # Check if newlib has been set in the MMP file.
|
|
330 |
my $NewLib = 'scppnwdl.lib'; # This is where operator new and operator delete
|
|
331 |
# are defined for user side targets.
|
|
332 |
my $NewKernLib = 'scppnwdl_kern.lib'; # This is where operator new and operator delete
|
|
333 |
# are defined for kernel side targets.
|
|
334 |
|
|
335 |
|
|
336 |
if ($Bld =~ /DEB/) {
|
|
337 |
@LibList=&main::DebugLibList;
|
|
338 |
} else {
|
|
339 |
@LibList=&main::LibList;
|
|
340 |
}
|
|
341 |
|
|
342 |
my $NotUseWin32LibsFlag="";
|
|
343 |
unless ($Win32StdHeaders or &main::Plat eq 'TOOLS') {
|
|
344 |
$NotUseWin32LibsFlag=" /X"; # this flag suppresses searching of the standard directories for header files
|
|
345 |
}
|
|
346 |
|
|
347 |
|
|
348 |
if ($Bld eq $BldList[0]) {
|
|
349 |
&main::Output(
|
|
350 |
"!IF \"\$(CFG)\" == \"$IdeBlds{$Bld}\"\n",
|
|
351 |
"\n"
|
|
352 |
);
|
|
353 |
}
|
|
354 |
else {
|
|
355 |
&main::Output(
|
|
356 |
"!ELSEIF \"\$(CFG)\" == \"$IdeBlds{$Bld}\"\n",
|
|
357 |
"\n"
|
|
358 |
);
|
|
359 |
}
|
|
360 |
&main::Output(
|
|
361 |
"# PROP BASE Use_MFC 0\n"
|
|
362 |
);
|
|
363 |
if ($Bld=~/REL$/o) {
|
|
364 |
&main::Output(
|
|
365 |
"# PROP BASE Use_Debug_Libraries 0\n",
|
|
366 |
"# PROP BASE Output_Dir \".\\Win32_Un\"\n",
|
|
367 |
"# PROP BASE Intermediate_Dir \".\\Win32_Un\"\n"
|
|
368 |
);
|
|
369 |
}
|
|
370 |
elsif ($Bld=~/DEB$/o) {
|
|
371 |
&main::Output(
|
|
372 |
"# PROP BASE Use_Debug_Libraries 1\n",
|
|
373 |
"# PROP BASE Output_Dir \".\\Win32_U0\"\n",
|
|
374 |
"# PROP BASE Intermediate_Dir \".\\Win32_U0\"\n"
|
|
375 |
);
|
|
376 |
}
|
|
377 |
&main::Output(
|
|
378 |
"# PROP Use_MFC 0\n"
|
|
379 |
);
|
|
380 |
if ($Bld=~/REL$/o) {
|
|
381 |
&main::Output(
|
|
382 |
"# PROP Use_Debug_Libraries 0\n"
|
|
383 |
);
|
|
384 |
}
|
|
385 |
elsif ($Bld=~/DEB$/o) {
|
|
386 |
&main::Output(
|
|
387 |
"# PROP Use_Debug_Libraries 1\n"
|
|
388 |
);
|
|
389 |
}
|
|
390 |
&main::Output(
|
|
391 |
"# PROP Output_Dir \"$ChopRelPath\"\n",
|
|
392 |
"# PROP Intermediate_Dir \"$ChopBldPath\"\n",
|
|
393 |
);
|
|
394 |
|
|
395 |
&main::Output(
|
|
396 |
"# ADD CPP",
|
|
397 |
" /nologo", # suppress "sign-on" banner message
|
|
398 |
" /Zp4" , # packs structures on 4 byte boundaries
|
|
399 |
" /GF" # Pools strings and places them in read-only memory
|
|
400 |
);
|
|
401 |
|
|
402 |
$MSVCVer = &Winutl_MSVCVer;
|
|
403 |
|
|
404 |
if ($MSVCVer >= 7) {
|
|
405 |
&main::Output(
|
|
406 |
" /wd4996", # C4996: 'xxxx' was declared deprecated
|
|
407 |
" /wd4571" # C4571: catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions
|
|
408 |
);
|
|
409 |
|
|
410 |
if (&main::Plat ne 'TOOLS') {
|
|
411 |
&main::Output(
|
|
412 |
" /EHsc", # Exceptions on
|
|
413 |
" /GR" # RTTI on
|
|
414 |
);
|
|
415 |
if ($MSVCVer >= 8) {
|
|
416 |
&main::Output(
|
|
417 |
" /GS-" # Buffer checking off
|
|
418 |
);
|
|
419 |
}
|
|
420 |
} else {
|
|
421 |
&main::Output(
|
|
422 |
" /EHsc", # Exceptions on
|
|
423 |
" /GR", # RTTI on
|
|
424 |
" /GS" # Buffer checking on
|
|
425 |
);
|
|
426 |
}
|
|
427 |
} else {
|
|
428 |
if (&main::Plat ne 'TOOLS') {
|
|
429 |
&main::Output(
|
|
430 |
" /GX", # Exceptions on
|
|
431 |
" /GR" # RTTI on
|
|
432 |
);
|
|
433 |
}
|
|
434 |
}
|
|
435 |
|
|
436 |
if ($BasicTrgType=~/^EXE$/o) {
|
|
437 |
&main::Output(
|
|
438 |
' /MT' # Creates a multi-threaded executable file, using libcmt.lib
|
|
439 |
);
|
|
440 |
if ($Bld=~/DEB$/o) {
|
|
441 |
&main::Output(
|
|
442 |
"d" # i.e. /MTd, debug executable using debug version of libcmt
|
|
443 |
);
|
|
444 |
}
|
|
445 |
}
|
|
446 |
elsif (($BasicTrgType=~/^(DLL|LIB)$/o) and (&main::Plat ne 'TOOLS')) {
|
|
447 |
&main::Output(
|
|
448 |
" /MD" # Creates a multithreaded DLL, using MSVCRT.LIB
|
|
449 |
);
|
|
450 |
if ($Bld=~/DEB$/o) {
|
|
451 |
&main::Output(
|
|
452 |
"d" # i.e. /MDd, debug executable using debug version of msvcrt
|
|
453 |
);
|
|
454 |
}
|
|
455 |
}
|
|
456 |
|
|
457 |
if ($MSVCVer >= 8) {
|
|
458 |
&main::Output(
|
|
459 |
" /Zc:wchar_t-" # Don't make wchar_t a built-in; breaks mangled names
|
|
460 |
);
|
|
461 |
}
|
|
462 |
|
|
463 |
if (($MSVCVer >= 7) || (&main::Plat ne 'TOOLS')) {
|
|
464 |
&main::Output(
|
|
465 |
" /W4"
|
|
466 |
);
|
|
467 |
}
|
|
468 |
|
|
469 |
if ($Bld=~/DEB$/o) {
|
|
470 |
&main::Output(
|
|
471 |
" /Zi", # Generates complete debugging information
|
|
472 |
" /Od" # Disables optimization
|
|
473 |
);
|
|
474 |
# euser change to apply inlining on the _NAKED functions
|
|
475 |
if ($BaseTrg=~/^EUSER$/oi) {
|
|
476 |
&main::Output(
|
|
477 |
' /Ob1' # Specific control of expension of inline functions
|
|
478 |
);
|
|
479 |
}
|
|
480 |
}
|
|
481 |
elsif ($Bld=~/REL$/o) {
|
|
482 |
&main::Output(
|
|
483 |
' /O1' # Creates small code
|
|
484 |
);
|
|
485 |
if ($MSVCVer >= 8) {
|
|
486 |
&main::Output(
|
|
487 |
' /fp:strict' # Improves floating-point consistency
|
|
488 |
);
|
|
489 |
} else {
|
|
490 |
&main::Output(
|
|
491 |
' /Op' # Improves floating-point consistency
|
|
492 |
);
|
|
493 |
}
|
|
494 |
|
|
495 |
}
|
|
496 |
&main::Output(
|
|
497 |
"$NotUseWin32LibsFlag"
|
|
498 |
);
|
|
499 |
my @incList=();
|
|
500 |
my $candidate;
|
|
501 |
INCLOOP: foreach $candidate (@ChopUserIncPaths,@ChopSysIncPaths) {
|
|
502 |
my $accepted; # remove duplicates
|
|
503 |
foreach $accepted (@incList) {
|
|
504 |
if ($candidate eq $accepted) {
|
|
505 |
next INCLOOP;
|
|
506 |
}
|
|
507 |
}
|
|
508 |
push @incList, $candidate;
|
|
509 |
&main::Output(
|
|
510 |
" /I \"$candidate\""
|
|
511 |
);
|
|
512 |
}
|
|
513 |
foreach (@MacroList) {
|
|
514 |
&main::Output(
|
|
515 |
" /D \"$_\""
|
|
516 |
);
|
|
517 |
}
|
|
518 |
|
|
519 |
|
|
520 |
if($VariantFile){
|
|
521 |
my $VariantFileFileName = Path_Split('FILE',$VariantFile);
|
|
522 |
&main::Output(
|
|
523 |
" /FI\"$VariantFileFileName\""
|
|
524 |
);
|
|
525 |
}
|
|
526 |
|
|
527 |
if ($Bld=~/DEB$/o) {
|
|
528 |
&main::Output(
|
|
529 |
" /FR /Fd\"$ChopRelPath\\$TrgPath$BaseTrg.PDB\""
|
|
530 |
);
|
|
531 |
}
|
|
532 |
&main::Output(
|
|
533 |
" /c\n",
|
|
534 |
);
|
|
535 |
|
|
536 |
if ($BasicTrgType=~/^DLL$/o) {
|
|
537 |
&main::Output(
|
|
538 |
"# ADD MTL /nologo"
|
|
539 |
);
|
|
540 |
if ($Bld=~/REL$/o) {
|
|
541 |
&main::Output(
|
|
542 |
" /mktyplib203 /D"
|
|
543 |
);
|
|
544 |
}
|
|
545 |
elsif ($Bld=~/DEB$/o) {
|
|
546 |
&main::Output(
|
|
547 |
" /D \"_DEBUG\" /mktyplib203"
|
|
548 |
);
|
|
549 |
}
|
|
550 |
&main::Output(
|
|
551 |
" /win32\n"
|
|
552 |
);
|
|
553 |
}
|
|
554 |
|
|
555 |
&main::Output(
|
|
556 |
"# ADD BASE RSC /l 0x809\n",
|
|
557 |
"# ADD RSC /l 0x809 /d"
|
|
558 |
);
|
|
559 |
if ($Bld=~/REL$/o) {
|
|
560 |
&main::Output(
|
|
561 |
" \"NDEBUG\""
|
|
562 |
);
|
|
563 |
}
|
|
564 |
elsif ($Bld=~/DEB$/o) {
|
|
565 |
&main::Output(
|
|
566 |
" \"_DEBUG\""
|
|
567 |
);
|
|
568 |
}
|
|
569 |
&main::Output(
|
|
570 |
"\n"
|
|
571 |
);
|
|
572 |
|
|
573 |
&main::Output(
|
|
574 |
"BSC32=bscmake.exe\n",
|
|
575 |
"# ADD BSC32 /nologo\n",
|
|
576 |
);
|
|
577 |
|
|
578 |
if ($BasicTrgType=~/^(DLL|EXE)$/o) {
|
|
579 |
&main::Output(
|
|
580 |
"LINK32=link.exe\n",
|
|
581 |
"# ADD BASE LINK32 /machine:IX86\n",
|
|
582 |
"# ADD LINK32"
|
|
583 |
);
|
|
584 |
unless (&main::Plat eq 'TOOLS') {
|
|
585 |
&main::Output(
|
|
586 |
" \"$ChopStatLinkPath\\$FirstLib\""
|
|
587 |
);
|
|
588 |
|
|
589 |
unless ($newlib) {
|
|
590 |
if ( main::SystemTrg() ) {
|
|
591 |
# System targets are PDD, LDD, VAR, KEXT and KDLL.
|
|
592 |
|
|
593 |
&main::Output(
|
|
594 |
" \"$ChopStatLinkPath\\$NewKernLib\""
|
|
595 |
);
|
|
596 |
}
|
|
597 |
else {
|
|
598 |
&main::Output(
|
|
599 |
" \"$ChopStatLinkPath\\$NewLib\""
|
|
600 |
);
|
|
601 |
}
|
|
602 |
}
|
|
603 |
else {
|
|
604 |
&main::Output(
|
|
605 |
" \"$ChopStatLinkPath\\$newlib\""
|
|
606 |
);
|
|
607 |
}
|
|
608 |
}
|
|
609 |
}
|
|
610 |
elsif ($BasicTrgType=~/^LIB$/o) {
|
|
611 |
&main::Output(
|
|
612 |
"LIB32=link.exe -lib\n",
|
|
613 |
"# ADD BASE LIB32 /machine:IX86\n",
|
|
614 |
"# ADD LIB32"
|
|
615 |
);
|
|
616 |
}
|
|
617 |
foreach (@Win32LibList) {
|
|
618 |
&main::Output(
|
|
619 |
" \"",lc $_,"\""
|
|
620 |
);
|
|
621 |
}
|
|
622 |
foreach (@StatLibList) {
|
|
623 |
&main::Output(
|
|
624 |
" \"$ChopStatLinkPath\\",lc $_,"\""
|
|
625 |
);
|
|
626 |
}
|
|
627 |
foreach (@LibList) {
|
|
628 |
&main::Output(
|
|
629 |
" \"$ChopLinkPath\\",lc $_,"\""
|
|
630 |
);
|
|
631 |
}
|
|
632 |
if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o) {
|
|
633 |
&main::Output(
|
|
634 |
" \"$ChopBldPath\\$ExportLibrary.exp\""
|
|
635 |
);
|
|
636 |
}
|
|
637 |
&main::Output(' /nologo');
|
|
638 |
if ($BasicTrgType=~/^(DLL|EXE)$/o) {
|
|
639 |
&main::Output(
|
|
640 |
" /fixed:no $BaseAddressFlag"
|
|
641 |
);
|
|
642 |
}
|
|
643 |
if (&main::HeapSize) {
|
|
644 |
my %HeapSize=&main::HeapSize;
|
|
645 |
&main::Output(
|
|
646 |
' /heap:',$HeapSize{Max},',',$HeapSize{Min}
|
|
647 |
);
|
|
648 |
}
|
|
649 |
if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o) {
|
|
650 |
&main::Output(
|
|
651 |
' /noentry /dll'
|
|
652 |
);
|
|
653 |
}
|
|
654 |
elsif ($BasicTrgType=~/^EXE$/o) {
|
|
655 |
unless (&main::Plat eq 'TOOLS') {
|
|
656 |
&main::Output(
|
|
657 |
' /entry:"?_E32Bootstrap@@YGXXZ"'
|
|
658 |
);
|
|
659 |
}
|
|
660 |
}
|
|
661 |
if (&main::Plat=~/^(WINC|TOOLS)$/o && $BasicTrgType=~/^EXE$/o) { # shouldn't really have WINC mentioned here
|
|
662 |
&main::Output(
|
|
663 |
' /subsystem:console'
|
|
664 |
);
|
|
665 |
}
|
|
666 |
else {
|
|
667 |
&main::Output(
|
|
668 |
' /subsystem:windows'
|
|
669 |
);
|
|
670 |
}
|
|
671 |
if ($BasicTrgType=~/^(DLL|EXE)$/o && $Bld=~/DEB$/o) {
|
|
672 |
&main::Output(
|
|
673 |
# pdb needs specifying here to be the same as the default applied in command-line builds
|
|
674 |
" /pdb:\"$ChopRelPath\\$TrgPath$BaseTrg.pdb\" /debug"
|
|
675 |
);
|
|
676 |
}
|
|
677 |
&main::Output(
|
|
678 |
' /machine:IX86',
|
|
679 |
' /ignore:4089', # LNK4089: all references to "dynamic-link library" discarded by /OPT:REF
|
|
680 |
' /ignore:4005' # LNK4005: no objects used from XXX
|
|
681 |
);
|
|
682 |
|
|
683 |
if ($MSVCVer >= 7) {
|
|
684 |
&main::Output(
|
|
685 |
' /ignore:4210' # LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
|
|
686 |
);
|
|
687 |
}
|
|
688 |
|
|
689 |
my $EntrySymbol='';
|
|
690 |
unless (&main::Plat eq 'TOOLS') {
|
|
691 |
if ($BasicTrgType=~/^EXE$/o) {
|
|
692 |
my $debug = '';
|
|
693 |
if ($Bld =~ /DEB$/o) {
|
|
694 |
$debug .= 'd';
|
|
695 |
}
|
|
696 |
&main::Output(
|
|
697 |
" /nodefaultlib:libcmt$debug.lib"
|
|
698 |
);
|
|
699 |
}
|
|
700 |
if ($BasicTrgType=~/^DLL$/o) {
|
|
701 |
&main::Output(
|
|
702 |
" /include:\"__E32Dll\""
|
|
703 |
);
|
|
704 |
$EntrySymbol='_E32Dll';
|
|
705 |
}
|
|
706 |
elsif ($BasicTrgType=~/^EXE$/o) {
|
|
707 |
&main::Output(
|
|
708 |
" /include:\"__E32Startup\""
|
|
709 |
);
|
|
710 |
$EntrySymbol='_E32Startup';
|
|
711 |
}
|
|
712 |
} else {
|
|
713 |
&main::Output(
|
|
714 |
' /ignore:4098' # LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
|
|
715 |
);
|
|
716 |
}
|
|
717 |
my $AbsentSubst = '';
|
|
718 |
if ($EntrySymbol) {
|
|
719 |
$AbsentSubst = " -absent $EntrySymbol";
|
|
720 |
}
|
|
721 |
&main::Output(
|
|
722 |
" /out:\"$ChopRelPath\\$TrgPath$Trg\""
|
|
723 |
);
|
|
724 |
if ($MSVCVer <= 7) {
|
|
725 |
if ($BasicTrgType=~/^(DLL|EXE)$/o) {
|
|
726 |
&main::Output(
|
|
727 |
' /WARN:3'
|
|
728 |
);
|
|
729 |
}
|
|
730 |
}
|
|
731 |
if ($BasicTrgType=~/^(DLL|EXE)$/o && $Bld=~/DEB$/o) {
|
|
732 |
&main::Output(
|
|
733 |
"\n",
|
|
734 |
"# SUBTRACT LINK32 /pdb:none"
|
|
735 |
);
|
|
736 |
}
|
|
737 |
&main::Output(
|
|
738 |
"\n"
|
|
739 |
);
|
|
740 |
if (&main::Plat eq 'TOOLS' and $BasicTrgType eq 'EXE') {
|
|
741 |
&main::Output(
|
|
742 |
"# Begin Special Build Tool\n",
|
|
743 |
"PostBuild_Cmds=copy \"$ChopRelPath\\$TrgPath$Trg\" \"",&main::EPOCToolsPath,"$Trg\" \n",
|
|
744 |
"# End Special Build Tool\n"
|
|
745 |
);
|
|
746 |
}
|
|
747 |
if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o) {
|
|
748 |
&main::Output(
|
|
749 |
"# Begin Special Build Tool\n",
|
|
750 |
"SOURCE=\$(InputPath)\n",
|
|
751 |
"PreLink_Cmds=echo Doing first-stage link by name\\\n"
|
|
752 |
);
|
|
753 |
&main::Output(
|
|
754 |
"\tnmake -nologo -f \"${PathBaseDsp}.SUP.MAKE\" PRELINK$Bld\\\n",
|
|
755 |
"\tif errorlevel 1 nmake -nologo -f \"${PathBaseDsp}.SUP.MAKE\" STOPLINK$Bld \n",
|
|
756 |
"PostBuild_Cmds=nmake -nologo -f \"${PathBaseDsp}.SUP.MAKE\" POSTBUILD$Bld\n",
|
|
757 |
"# End Special Build Tool\n"
|
|
758 |
);
|
|
759 |
|
|
760 |
|
|
761 |
# append to the supplementary makefile for each build
|
|
762 |
$SupText.=join('',
|
|
763 |
"# BUILD - $Bld\n",
|
|
764 |
"\n",
|
|
765 |
"LIBS="
|
|
766 |
);
|
|
767 |
foreach (@StatLibList) {
|
|
768 |
$SupText.=" \\\n\t\"\$(EPOCSTATLINK$Bld)\\$_\"";
|
|
769 |
}
|
|
770 |
foreach (@LibList) {
|
|
771 |
$SupText.=" \\\n\t\"\$(EPOCLINK$Bld)\\$_\"";
|
|
772 |
}
|
|
773 |
$SupText.="\n\nLINK_OBJS=";
|
|
774 |
foreach (@BaseSrcList) {
|
|
775 |
$SupText.=" \\\n\t\"\$(EPOCBLD$Bld)\\$_.obj\"";
|
|
776 |
}
|
|
777 |
if ($Win32Resrc) {
|
|
778 |
$SupText.=" \\\n\t\"\$(EPOCBLD$Bld)\\".&main::Path_Split('Base',$Win32Resrc).".res\"";
|
|
779 |
}
|
|
780 |
$SupText.="\n\nSTAGE1_LINK_FLAGS=\"\$(EPOCSTATLINK$Bld)\\$FirstLib\"";
|
|
781 |
|
|
782 |
unless ($newlib) {
|
|
783 |
if ( main::SystemTrg() ) {
|
|
784 |
# System targets are PDD, LDD, VAR, KEXT and KDLL.
|
|
785 |
|
|
786 |
$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$NewKernLib\"";
|
|
787 |
}
|
|
788 |
else {
|
|
789 |
$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$NewLib\"";
|
|
790 |
}
|
|
791 |
}
|
|
792 |
else {
|
|
793 |
$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$newlib\"";
|
|
794 |
}
|
|
795 |
|
|
796 |
foreach (@Win32LibList) {
|
|
797 |
$SupText.=' ';
|
|
798 |
$SupText.=lc $_;
|
|
799 |
}
|
|
800 |
$SupText.=" \\\n \$(LIBS) /nologo$BaseAddressFlag /noentry /dll /subsystem:windows";
|
|
801 |
if ($Bld=~/DEB$/o) {
|
|
802 |
$SupText.=' /debug';
|
|
803 |
}
|
|
804 |
$SupText.=" \\\n /incremental:no /machine:IX86 /ignore:4089";
|
|
805 |
if ($BasicTrgType=~/^EXE$/o) {
|
|
806 |
my $debug = '';
|
|
807 |
if ($Bld =~ /DEB$/o) {
|
|
808 |
$debug .= 'd';
|
|
809 |
}
|
|
810 |
$SupText .= " /nodefaultlib:libcmt$debug.lib";
|
|
811 |
}
|
|
812 |
if ($MSVCVer >= 7) {
|
|
813 |
$SupText .= " /ignore:4210";
|
|
814 |
}
|
|
815 |
if ($BasicTrgType=~/^DLL$/o) {
|
|
816 |
$SupText.=" /include:\"__E32Dll\"";
|
|
817 |
}
|
|
818 |
else {
|
|
819 |
$SupText.=" /include:\"__E32Startup\"";
|
|
820 |
}
|
|
821 |
if ($BasicTrgType=~/^(DLL)$/o) {
|
|
822 |
$SupText.=" /implib:\"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"";
|
|
823 |
} elsif ($BasicTrgType=~/^(EXE)$/o) {
|
|
824 |
$SupText.=" /implib:\"\$(EPOCBLD$Bld)\\$ExportLibrary.exe.lib\"";
|
|
825 |
}
|
|
826 |
$SupText.=join('',
|
|
827 |
' /ignore:4089', # LNK4089: all references to "dynamic-link library" discarded by /OPT:REF
|
|
828 |
' /ignore:4005' # LNK4005: no objects used from XXX
|
|
829 |
);
|
|
830 |
if ($MSVCVer >= 7) {
|
|
831 |
$SupText.=" /ignore:4210"; # LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
|
|
832 |
}
|
|
833 |
$SupText.=" /out:\"\$(EPOCBLD$Bld)\\$Trg\"";
|
|
834 |
if ($MSVCVer < 7) {
|
|
835 |
$SupText .= " /WARN:3";
|
|
836 |
}
|
|
837 |
$SupText.="\n\n";
|
|
838 |
$SupText.="PRELINK$Bld : \$(LINK_OBJS)";
|
|
839 |
if (-e $DefFile) { # effectively "if project frozen ..."
|
|
840 |
$SupText.=" \"$DefFile\"";
|
|
841 |
}
|
|
842 |
unless (&main::Plat eq 'TOOLS') {
|
|
843 |
$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$FirstLib\"";
|
|
844 |
|
|
845 |
unless ($newlib) {
|
|
846 |
if ( main::SystemTrg() ) {
|
|
847 |
# System targets are PDD, LDD, VAR, KEXT and KDLL.
|
|
848 |
|
|
849 |
$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$NewKernLib\"";
|
|
850 |
}
|
|
851 |
else {
|
|
852 |
$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$NewLib\"";
|
|
853 |
}
|
|
854 |
}
|
|
855 |
else {
|
|
856 |
$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$newlib\"";
|
|
857 |
}
|
|
858 |
}
|
|
859 |
$SupText.=" \$(LIBS)\n";
|
|
860 |
|
|
861 |
# Link by name first time round for dlls
|
|
862 |
$SupText.=join('',
|
|
863 |
"\tlink.exe \@<<\n",
|
|
864 |
"\t\t\$(STAGE1_LINK_FLAGS) \$(LINK_OBJS)\n",
|
|
865 |
"<<\n",
|
|
866 |
"\tdel \"\$(EPOCBLD$Bld)\\$Trg\"\n"
|
|
867 |
);
|
|
868 |
|
|
869 |
if ($BasicTrgType=~/^(DLL)$/o) {
|
|
870 |
$SupText.="\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.exp\"\n";
|
|
871 |
} elsif ($BasicTrgType=~/^(EXE)$/o) {
|
|
872 |
$SupText.="\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.exe.exp\"\n";
|
|
873 |
}
|
|
874 |
|
|
875 |
# Generate an export info file
|
|
876 |
if ($BasicTrgType=~/^(DLL)$/o) {
|
|
877 |
$SupText.=join('',
|
|
878 |
"\tdumpbin /exports /out:\"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\" \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n",
|
|
879 |
"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n"
|
|
880 |
);
|
|
881 |
} elsif ($BasicTrgType=~/^(EXE)$/o) {
|
|
882 |
$SupText.=join('',
|
|
883 |
"\tdumpbin /exports /out:\"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\" \"\$(EPOCBLD$Bld)\\$ExportLibrary.exe.lib\"\n",
|
|
884 |
"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.exe.lib\"\n"
|
|
885 |
);
|
|
886 |
}
|
|
887 |
|
|
888 |
# call makedef to reorder the export information
|
|
889 |
# 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
|
|
890 |
$SupText.="\tperl -S makedef.pl $AbsentSubst -Inffile \"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\"";
|
|
891 |
if (-e $DefFile) { # effectively "if project frozen ..."
|
|
892 |
$SupText.=" -Frzfile \"$DefFile\"";
|
|
893 |
}
|
|
894 |
# freeze ordinals, a maximum of 2, for polymorphic dlls
|
|
895 |
my $Ordinal;
|
|
896 |
my $Num=1;
|
|
897 |
foreach $Ordinal (&main::Exports) {
|
|
898 |
# replace "$" with "$$" so that NMAKE doesn't think there's a macro in the function name
|
|
899 |
$Ordinal=~s-\$-\$\$-go;
|
|
900 |
$SupText.=" -$Num $Ordinal";
|
|
901 |
$Num++;
|
|
902 |
}
|
|
903 |
$SupText.=join('',
|
|
904 |
" \"\$(EPOCBLD)$ExportLibrary.def\" \n",
|
|
905 |
"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\"\n"
|
|
906 |
);
|
|
907 |
|
|
908 |
# create the export object from the .DEF file
|
|
909 |
$SupText.="\tlib.exe /nologo /machine:i386 /nodefaultlib /name:\"$Trg\" /def:\"\$(EPOCBLD)$ExportLibrary.def\" /out:\"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n";
|
|
910 |
if (&main::ExportUnfrozen) {
|
|
911 |
$SupText.="\tcopy \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\" \"\$(EPOCLIB)UDEB\\$ExportLibrary.lib\"\n";
|
|
912 |
}
|
|
913 |
$SupText.=join('',
|
|
914 |
"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n",
|
|
915 |
"\t\@echo First-stage link successful\n",
|
|
916 |
"\n",
|
|
917 |
"\n",
|
|
918 |
"STOPLINK$Bld : DELEXPOBJ$Bld\n",
|
|
919 |
"\t\@echo Stopped the build by removing the export object,\n",
|
|
920 |
"\t\@echo if present, because the pre-link stage failed\n",
|
|
921 |
"\n",
|
|
922 |
"\n",
|
|
923 |
"POSTBUILD$Bld : DELEXPOBJ$Bld"
|
|
924 |
);
|
|
925 |
if ($DefFile and not &main::ExportUnfrozen) {
|
|
926 |
$SupText.=" LIBRARY";
|
|
927 |
}
|
|
928 |
$SupText.=join('',
|
|
929 |
"\n",
|
|
930 |
"\n",
|
|
931 |
"\n",
|
|
932 |
"DELEXPOBJ$Bld :\n"
|
|
933 |
);
|
|
934 |
|
|
935 |
if ($BasicTrgType=~/^(DLL)$/o) {
|
|
936 |
$SupText.="\tif exist \"\$(EPOCBLD$Bld)\\$ExportLibrary.exp\" del \"\$(EPOCBLD$Bld)\\$ExportLibrary.exp\"\n";
|
|
937 |
} elsif ($BasicTrgType=~/^(EXE)$/o) {
|
|
938 |
$SupText.="\tif exist \"\$(EPOCBLD$Bld)\\$ExportLibrary.exe.exp\" del \"\$(EPOCBLD$Bld)\\$ExportLibrary.exe.exp\"\n";
|
|
939 |
}
|
|
940 |
|
|
941 |
$SupText.=join('',
|
|
942 |
"\n",
|
|
943 |
"\n",
|
|
944 |
"\n"
|
|
945 |
);
|
|
946 |
}
|
|
947 |
|
|
948 |
&main::Output(
|
|
949 |
"\n"
|
|
950 |
);
|
|
951 |
}
|
|
952 |
|
|
953 |
sub PMEndBldList {
|
|
954 |
|
|
955 |
# CLOSE THE !IF ... !ENDIF LOOP
|
|
956 |
#------------------------------
|
|
957 |
&main::Output(
|
|
958 |
"!ENDIF \n",
|
|
959 |
"\n"
|
|
960 |
);
|
|
961 |
}
|
|
962 |
|
|
963 |
sub PMStartSrcList {
|
|
964 |
|
|
965 |
my @BldList=&main::BldList;
|
|
966 |
|
|
967 |
&main::Output(
|
|
968 |
"# Begin Target\n",
|
|
969 |
"\n"
|
|
970 |
);
|
|
971 |
foreach (@BldList) {
|
|
972 |
&main::Output(
|
|
973 |
"# Name \"".$IdeBlds{$_}."\"\n"
|
|
974 |
);
|
|
975 |
}
|
|
976 |
&main::Output(
|
|
977 |
"# Begin Group \"Source Files\"\n",
|
|
978 |
"\n",
|
|
979 |
"# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90\"\n"
|
|
980 |
);
|
|
981 |
}
|
|
982 |
|
|
983 |
sub PMResrcBld {
|
|
984 |
|
|
985 |
my $ResourceRef=&main::ResourceRef;
|
|
986 |
my $Resrc=ucfirst lc &main::Path_Split('File', $$ResourceRef{Source});
|
|
987 |
my $BaseResrc=&main::Path_Split('Base', $$ResourceRef{Source});
|
|
988 |
my $SrcPath=&main::Path_Split('Path', $$ResourceRef{Source});
|
|
989 |
my $TrgPath=&main::Path_Split('Path', $$ResourceRef{Trg});
|
|
990 |
my @LangList=($$ResourceRef{Lang});
|
|
991 |
|
|
992 |
my $inputpath="$SrcPath$Resrc";
|
|
993 |
|
|
994 |
&main::Output(
|
|
995 |
"# Begin Source File\n",
|
|
996 |
"\n",
|
|
997 |
"SOURCE=$inputpath\n"
|
|
998 |
);
|
|
999 |
|
|
1000 |
my @BldList=&main::BldList;
|
|
1001 |
my $ChopBldPath=&main::Path_Chop(&main::BldPath);
|
|
1002 |
my @ChopSysIncPaths=&main::Path_Chop(&main::SysIncPaths);
|
|
1003 |
my @ChopUserIncPaths=&main::Path_Chop(&main::UserIncPaths);
|
|
1004 |
my $DataPath=&main::DataPath;
|
|
1005 |
my @DepList=&main::DepList;
|
|
1006 |
my $PathBaseDsp=&main::MakeFilePath.&main::BaseMak;
|
|
1007 |
my $PerlLibPath=&main::PerlLibPath;
|
|
1008 |
my $RelPath=&main::RelPath;
|
|
1009 |
my $ChopSrcPath=&main::Path_Chop($SrcPath);
|
|
1010 |
|
|
1011 |
my $ResrcHdr=join '', &main::EPOCIncPath(), $BaseResrc, '.RSG';
|
|
1012 |
|
|
1013 |
&main::OutFormat(
|
|
1014 |
"USERDEP__$BaseResrc="
|
|
1015 |
);
|
|
1016 |
$SupText.="DEPEND=";
|
|
1017 |
my $Dep;
|
|
1018 |
foreach $Dep (@DepList) {
|
|
1019 |
&main::OutFormat(
|
|
1020 |
"\"$Dep\"\t"
|
|
1021 |
);
|
|
1022 |
$SupText.=" \\\n\t\"$Dep\"";
|
|
1023 |
}
|
|
1024 |
&main::Output(
|
|
1025 |
"\n"
|
|
1026 |
);
|
|
1027 |
$SupText.="\n\n";
|
|
1028 |
|
|
1029 |
my $Bld;
|
|
1030 |
foreach $Bld (@BldList) {
|
|
1031 |
my $ResrcTrgFullName="$RelPath$Bld\\$TrgPath$BaseResrc.r";
|
|
1032 |
if ($Bld eq $BldList[0]) {
|
|
1033 |
&main::Output(
|
|
1034 |
'!IF'
|
|
1035 |
);
|
|
1036 |
}
|
|
1037 |
else {
|
|
1038 |
&main::Output(
|
|
1039 |
'!ELSEIF'
|
|
1040 |
);
|
|
1041 |
}
|
|
1042 |
&main::Output(
|
|
1043 |
" \"\$(CFG)\" == \"$IdeBlds{$Bld}\"\n",
|
|
1044 |
"\n"
|
|
1045 |
);
|
|
1046 |
&main::Output(
|
|
1047 |
"# PROP Intermediate_Dir \"$ChopBldPath\"\n",
|
|
1048 |
"# Begin Custom Build - Building resources from $Resrc\n",
|
|
1049 |
"InputPath=$inputpath\n",
|
|
1050 |
"\n",
|
|
1051 |
"BuildCmds= \\\n",
|
|
1052 |
"\tnmake -nologo -f \"${PathBaseDsp}.SUP.MAKE\"\\\n",
|
|
1053 |
" \"$ResrcTrgFullName\"\n"
|
|
1054 |
);
|
|
1055 |
$SupText.="\"$ResrcTrgFullName\" :";
|
|
1056 |
my $Lang;
|
|
1057 |
foreach $Lang (@LangList) {
|
|
1058 |
if ($Lang eq 'SC') {
|
|
1059 |
# change to put dummy file in dependency list
|
|
1060 |
$SupText.=" \"$ResrcTrgFullName$Lang.dummy\"";
|
|
1061 |
next;
|
|
1062 |
}
|
|
1063 |
$SupText.=" \"$ResrcTrgFullName$Lang\"";
|
|
1064 |
}
|
|
1065 |
$SupText.="\n\n";
|
|
1066 |
foreach $Lang (@LangList) {
|
|
1067 |
# change to put dummy file in dependency list
|
|
1068 |
if ($Lang eq 'SC') {
|
|
1069 |
$SupText.="\"$ResrcTrgFullName$Lang.dummy\"";
|
|
1070 |
}
|
|
1071 |
else {
|
|
1072 |
$SupText.="\"$ResrcTrgFullName$Lang\"";
|
|
1073 |
}
|
|
1074 |
$SupText.=" : \"$SrcPath$Resrc\" \$(DEPEND)\n";
|
|
1075 |
$SupText.="\tperl -S epocrc.pl -I \"$ChopSrcPath\"";
|
|
1076 |
foreach (@ChopUserIncPaths) {
|
|
1077 |
$SupText.=" -I \"$_\"";
|
|
1078 |
}
|
|
1079 |
$SupText.=" -I-";
|
|
1080 |
foreach (@ChopSysIncPaths) {
|
|
1081 |
$SupText.=" -I \"$_\"";
|
|
1082 |
}
|
|
1083 |
$SupText.=" -DLANGUAGE_$Lang -u \"$SrcPath$Resrc\"";
|
|
1084 |
$SupText.=" -o\"$ResrcTrgFullName$Lang\" -h\"$SrcPath$BaseResrc.rs~\" -t\"\$(EPOCBLD$Bld)\"\n";
|
|
1085 |
# change because if a .RSC file is output then VC5 tries to link it to the main target as a Win32 resource file
|
|
1086 |
if ($Lang eq 'SC') {
|
|
1087 |
$SupText.="\techo this is a dummy output file > \"$ResrcTrgFullName$Lang.dummy\"\n";
|
|
1088 |
}
|
|
1089 |
$SupText.=join('',
|
|
1090 |
"\tperl -S ecopyfile.pl \"$SrcPath$BaseResrc.rs~\" \"$ResrcHdr\"\n",
|
|
1091 |
"\tdel \"$SrcPath$BaseResrc.rs~\"\n",
|
|
1092 |
"\n"
|
|
1093 |
);
|
|
1094 |
}
|
|
1095 |
|
|
1096 |
foreach $Lang (@LangList) {
|
|
1097 |
# change again to avoid VC5 linking the resource
|
|
1098 |
my $TmpLang=$Lang;
|
|
1099 |
if ($TmpLang eq 'SC') {
|
|
1100 |
$TmpLang.='.dummy';
|
|
1101 |
}
|
|
1102 |
&main::Output(
|
|
1103 |
"\n",
|
|
1104 |
"\"$ResrcTrgFullName$TmpLang\" : \$(SOURCE) \"\$(INTDIR)\"\\\n",
|
|
1105 |
" \"\$(OUTDIR)\"\n",
|
|
1106 |
" \$(BuildCmds)\n",
|
|
1107 |
);
|
|
1108 |
}
|
|
1109 |
&main::Output(
|
|
1110 |
"# End Custom Build\n",
|
|
1111 |
"\n"
|
|
1112 |
);
|
|
1113 |
}
|
|
1114 |
&main::Output(
|
|
1115 |
"!ENDIF \n",
|
|
1116 |
"\n",
|
|
1117 |
"# End Source File\n"
|
|
1118 |
);
|
|
1119 |
}
|
|
1120 |
|
|
1121 |
sub PMDoc {
|
|
1122 |
|
|
1123 |
my $SrcPath=&main::SrcPath;
|
|
1124 |
|
|
1125 |
&main::Output(
|
|
1126 |
"# Begin Source File\n",
|
|
1127 |
"\n",
|
|
1128 |
"SOURCE=",$SrcPath,ucfirst lc &main::Doc,"\n",
|
|
1129 |
"# PROP Exclude_From_Build 1\n",
|
|
1130 |
"# End Source File\n"
|
|
1131 |
);
|
|
1132 |
}
|
|
1133 |
|
|
1134 |
sub PMStartSrc {
|
|
1135 |
|
|
1136 |
&main::Output(
|
|
1137 |
"# Begin Source File\n",
|
|
1138 |
"\n",
|
|
1139 |
"SOURCE=",&main::SrcPath,ucfirst lc &main::Src,"\n",
|
|
1140 |
"# End Source File\n"
|
|
1141 |
);
|
|
1142 |
}
|
|
1143 |
|
|
1144 |
sub PMSrcDepend {
|
|
1145 |
|
|
1146 |
# Generate user header list for this src, merge with list for all sources
|
|
1147 |
foreach (&main::DepList) {
|
|
1148 |
$PrjHdrs{$_}='unusedval';
|
|
1149 |
}
|
|
1150 |
}
|
|
1151 |
|
|
1152 |
sub PMEndSrcList {
|
|
1153 |
|
|
1154 |
my $BaseDsp=&main::BaseMak;
|
|
1155 |
my $PathBaseDsp=&main::MakeFilePath.$BaseDsp;
|
|
1156 |
|
|
1157 |
&main::Output(
|
|
1158 |
"# End Group\n",
|
|
1159 |
"# Begin Group \"Resource Files\"\n",
|
|
1160 |
"\n",
|
|
1161 |
"# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe\"\n"
|
|
1162 |
);
|
|
1163 |
if ($Win32Resrc) {
|
|
1164 |
&main::Output(
|
|
1165 |
"# Begin Source File\n",
|
|
1166 |
"\n",
|
|
1167 |
"SOURCE=",ucfirst lc $Win32Resrc,"\n",
|
|
1168 |
"# End Source File\n"
|
|
1169 |
);
|
|
1170 |
# Generate user header list for this src, merge with list for all sources
|
|
1171 |
foreach (&main::Deps_GenDependsL($Win32Resrc)) {
|
|
1172 |
$PrjHdrs{$_}='unusedval';
|
|
1173 |
}
|
|
1174 |
}
|
|
1175 |
&main::Output(
|
|
1176 |
"# End Group\n"
|
|
1177 |
);
|
|
1178 |
|
|
1179 |
# Use the global %PrjHdrs Hash to produce user header listing
|
|
1180 |
&main::Output(
|
|
1181 |
"# Begin Group \"Header Files\"\n",
|
|
1182 |
"\n",
|
|
1183 |
"# PROP Default_Filter \"h;hpp;hxx;hm;inl;fi;fd\"\n"
|
|
1184 |
);
|
|
1185 |
foreach (keys %PrjHdrs) {
|
|
1186 |
&main::Output(
|
|
1187 |
"# Begin Source File\n",
|
|
1188 |
"\n",
|
|
1189 |
"SOURCE=",&main::Path_Split('Path',$_),ucfirst lc &main::Path_Split('File',$_),"\n",
|
|
1190 |
"# End Source File\n"
|
|
1191 |
);
|
|
1192 |
}
|
|
1193 |
&main::Output(
|
|
1194 |
"# End Group\n",
|
|
1195 |
"# End Target\n",
|
|
1196 |
"# End Project\n",
|
|
1197 |
);
|
|
1198 |
|
|
1199 |
&main::Path_DelFiles("$PathBaseDsp.MAK","$PathBaseDsp.MDP","$PathBaseDsp.NCB","$PathBaseDsp.OPT","$PathBaseDsp.PLG");
|
|
1200 |
|
|
1201 |
# Add target to supplementary makefile to recreate the workspace
|
|
1202 |
#
|
|
1203 |
# This target is intended for use as a custom tool within the MSVC IDE, for regenerating
|
|
1204 |
# workspace once the .MMP file has been edited within the IDE. To install the target as
|
|
1205 |
# a custom tool in the IDE, select Tools->Customise...->Tools, and choose a name for the
|
|
1206 |
# tool, e.g. "Recreate Workspace". Next, type "nmake.exe" as the command and
|
|
1207 |
# "-nologo -f $(WkspDir)\$(WkspName).sup.make recreateworkspace" as the program arguments.
|
|
1208 |
# Leave the "initial directory" field blank, and tick the "Close window on exiting" checkbox.
|
|
1209 |
# Having edited the .MMP file for a project, select the new tool from the tools menu to
|
|
1210 |
# recreate the workspace. If the commands have run correctly, you will be prompted to
|
|
1211 |
# reload the workspace.
|
|
1212 |
$SupText.=join('',
|
|
1213 |
"\n",
|
|
1214 |
"RECREATEWORKSPACE :\n",
|
|
1215 |
' cd ', &main::Path_Chop(&main::Path_WorkPath), "\n",
|
|
1216 |
' perl -S makmake.pl -D ', &main::MmpFile, ' ', &main::PlatName, "\n",
|
|
1217 |
"\n"
|
|
1218 |
);
|
|
1219 |
|
|
1220 |
# Create the supplementary makefile
|
|
1221 |
|
|
1222 |
&main::CreateExtraFile(&main::MakeFilePath.&main::BaseMak.'.SUP.MAKE', $SupText);
|
|
1223 |
|
|
1224 |
|
|
1225 |
# create the .DSW file
|
|
1226 |
my $DswText=join(
|
|
1227 |
"\n",
|
|
1228 |
"Microsoft Developer Studio Workspace File, Format Version 6.00",
|
|
1229 |
'# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!',
|
|
1230 |
'',
|
|
1231 |
'#'x79,
|
|
1232 |
'',
|
|
1233 |
"Project: \"$BaseDsp\"=.\\$BaseDsp.dsp - Package Owner=<4>",
|
|
1234 |
'',
|
|
1235 |
'Package=<5>',
|
|
1236 |
'{{{',
|
|
1237 |
'}}}',
|
|
1238 |
'',
|
|
1239 |
'Package=<4>',
|
|
1240 |
'{{{',
|
|
1241 |
'}}}',
|
|
1242 |
'',
|
|
1243 |
'#'x79,
|
|
1244 |
'',
|
|
1245 |
'Global:',
|
|
1246 |
'',
|
|
1247 |
'Package=<5>',
|
|
1248 |
'{{{',
|
|
1249 |
'}}}',
|
|
1250 |
'',
|
|
1251 |
'Package=<3>',
|
|
1252 |
'{{{',
|
|
1253 |
'}}}',
|
|
1254 |
'',
|
|
1255 |
'#'x79,
|
|
1256 |
''
|
|
1257 |
);
|
|
1258 |
|
|
1259 |
&main::CreateExtraFile("$PathBaseDsp.DSW",$DswText);
|
|
1260 |
}
|
|
1261 |
|
|
1262 |
1;
|