author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 12 Mar 2010 15:46:37 +0200 | |
branch | RCL_3 |
changeset 5 | d3bac044e0f0 |
parent 4 | 3b1da2848fc7 |
child 8 | 3f74d0d4af4c |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the qmake application of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#include "winmakefile.h" |
|
43 |
#include "option.h" |
|
44 |
#include "project.h" |
|
45 |
#include "meta.h" |
|
46 |
#include <qtextstream.h> |
|
47 |
#include <qstring.h> |
|
48 |
#include <qhash.h> |
|
49 |
#include <qregexp.h> |
|
50 |
#include <qstringlist.h> |
|
51 |
#include <qdir.h> |
|
52 |
#include <stdlib.h> |
|
53 |
||
54 |
QT_BEGIN_NAMESPACE |
|
55 |
||
56 |
Win32MakefileGenerator::Win32MakefileGenerator() : MakefileGenerator() |
|
57 |
{ |
|
58 |
} |
|
59 |
||
60 |
int |
|
61 |
Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem, const QString &ext) |
|
62 |
{ |
|
63 |
QString bd = Option::fixPathToLocalOS(d, true); |
|
64 |
if(!exists(bd)) |
|
65 |
return -1; |
|
66 |
||
67 |
QString dllStem = stem + QTDLL_POSTFIX; |
|
68 |
QMakeMetaInfo libinfo; |
|
69 |
bool libInfoRead = libinfo.readLib(bd + Option::dir_sep + dllStem); |
|
70 |
||
71 |
// If the library, for which we're trying to find the highest version |
|
72 |
// number, is a static library |
|
73 |
if (libInfoRead && libinfo.values("QMAKE_PRL_CONFIG").contains("staticlib")) |
|
74 |
return -1; |
|
75 |
||
76 |
if(!project->values("QMAKE_" + stem.toUpper() + "_VERSION_OVERRIDE").isEmpty()) |
|
77 |
return project->values("QMAKE_" + stem.toUpper() + "_VERSION_OVERRIDE").first().toInt(); |
|
78 |
||
79 |
int biggest=-1; |
|
80 |
if(!project->isActiveConfig("no_versionlink")) { |
|
81 |
QDir dir(bd); |
|
82 |
QStringList entries = dir.entryList(); |
|
83 |
QRegExp regx(QString("((lib)?%1([0-9]*)).(%2|prl)$").arg(dllStem).arg(ext), Qt::CaseInsensitive); |
|
84 |
for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) { |
|
85 |
if(regx.exactMatch((*it))) { |
|
86 |
if (!regx.cap(3).isEmpty()) { |
|
87 |
bool ok = true; |
|
88 |
int num = regx.cap(3).toInt(&ok); |
|
89 |
biggest = qMax(biggest, (!ok ? -1 : num)); |
|
90 |
} |
|
91 |
} |
|
92 |
} |
|
93 |
} |
|
94 |
if(libInfoRead |
|
95 |
&& !libinfo.values("QMAKE_PRL_CONFIG").contains("staticlib") |
|
96 |
&& !libinfo.isEmpty("QMAKE_PRL_VERSION")) |
|
97 |
biggest = qMax(biggest, libinfo.first("QMAKE_PRL_VERSION").replace(".", "").toInt()); |
|
98 |
return biggest; |
|
99 |
} |
|
100 |
||
101 |
bool |
|
102 |
Win32MakefileGenerator::findLibraries(const QString &where) |
|
103 |
{ |
|
104 |
QStringList &l = project->values(where); |
|
105 |
QList<QMakeLocalFileName> dirs; |
|
106 |
{ |
|
107 |
QStringList &libpaths = project->values("QMAKE_LIBDIR"); |
|
108 |
for(QStringList::Iterator libpathit = libpaths.begin(); |
|
109 |
libpathit != libpaths.end(); ++libpathit) |
|
110 |
dirs.append(QMakeLocalFileName((*libpathit))); |
|
111 |
} |
|
112 |
for(QStringList::Iterator it = l.begin(); it != l.end();) { |
|
113 |
QChar quote; |
|
114 |
bool modified_opt = false, remove = false; |
|
115 |
QString opt = (*it).trimmed(); |
|
116 |
if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) { |
|
117 |
quote = opt[0]; |
|
118 |
opt = opt.mid(1, opt.length()-2); |
|
119 |
} |
|
120 |
if(opt.startsWith("/LIBPATH:")) { |
|
121 |
dirs.append(QMakeLocalFileName(opt.mid(9))); |
|
122 |
} else if(opt.startsWith("-L") || opt.startsWith("/L")) { |
|
123 |
QString libpath = opt.mid(2); |
|
124 |
QMakeLocalFileName l(libpath); |
|
125 |
if(!dirs.contains(l)) { |
|
126 |
dirs.append(l); |
|
127 |
modified_opt = true; |
|
128 |
if (!quote.isNull()) { |
|
129 |
libpath = quote + libpath + quote; |
|
130 |
quote = QChar(); |
|
131 |
} |
|
132 |
(*it) = "/LIBPATH:" + libpath; |
|
133 |
} else { |
|
134 |
remove = true; |
|
135 |
} |
|
136 |
} else if(opt.startsWith("-l") || opt.startsWith("/l")) { |
|
137 |
QString lib = opt.right(opt.length() - 2), out; |
|
138 |
if(!lib.isEmpty()) { |
|
139 |
QString suffix; |
|
140 |
if(!project->isEmpty("QMAKE_" + lib.toUpper() + "_SUFFIX")) |
|
141 |
suffix = project->first("QMAKE_" + lib.toUpper() + "_SUFFIX"); |
|
142 |
for(QList<QMakeLocalFileName>::Iterator it = dirs.begin(); |
|
143 |
it != dirs.end(); ++it) { |
|
144 |
QString extension; |
|
145 |
int ver = findHighestVersion((*it).local(), lib); |
|
146 |
if(ver > 0) |
|
147 |
extension += QString::number(ver); |
|
148 |
extension += suffix; |
|
149 |
extension += ".lib"; |
|
150 |
if(QMakeMetaInfo::libExists((*it).local() + Option::dir_sep + lib) || |
|
151 |
exists((*it).local() + Option::dir_sep + lib + extension)) { |
|
152 |
out = (*it).real() + Option::dir_sep + lib + extension; |
|
153 |
break; |
|
154 |
} |
|
155 |
} |
|
156 |
} |
|
157 |
if(out.isEmpty()) |
|
158 |
out = lib + ".lib"; |
|
159 |
modified_opt = true; |
|
160 |
(*it) = out; |
|
161 |
} else if(!exists(Option::fixPathToLocalOS(opt))) { |
|
162 |
QList<QMakeLocalFileName> lib_dirs; |
|
163 |
QString file = opt; |
|
164 |
int slsh = file.lastIndexOf(Option::dir_sep); |
|
165 |
if(slsh != -1) { |
|
166 |
lib_dirs.append(QMakeLocalFileName(file.left(slsh+1))); |
|
167 |
file = file.right(file.length() - slsh - 1); |
|
168 |
} else { |
|
169 |
lib_dirs = dirs; |
|
170 |
} |
|
171 |
if(file.endsWith(".lib")) { |
|
172 |
file = file.left(file.length() - 4); |
|
173 |
if(!file.at(file.length()-1).isNumber()) { |
|
174 |
QString suffix; |
|
175 |
if(!project->isEmpty("QMAKE_" + file.section(Option::dir_sep, -1).toUpper() + "_SUFFIX")) |
|
176 |
suffix = project->first("QMAKE_" + file.section(Option::dir_sep, -1).toUpper() + "_SUFFIX"); |
|
177 |
for(QList<QMakeLocalFileName>::Iterator dep_it = lib_dirs.begin(); dep_it != lib_dirs.end(); ++dep_it) { |
|
178 |
QString lib_tmpl(file + "%1" + suffix + ".lib"); |
|
179 |
int ver = findHighestVersion((*dep_it).local(), file); |
|
180 |
if(ver != -1) { |
|
181 |
if(ver) |
|
182 |
lib_tmpl = lib_tmpl.arg(ver); |
|
183 |
else |
|
184 |
lib_tmpl = lib_tmpl.arg(""); |
|
185 |
if(slsh != -1) { |
|
186 |
QString dir = (*dep_it).real(); |
|
187 |
if(!dir.endsWith(Option::dir_sep)) |
|
188 |
dir += Option::dir_sep; |
|
189 |
lib_tmpl.prepend(dir); |
|
190 |
} |
|
191 |
modified_opt = true; |
|
192 |
(*it) = lib_tmpl; |
|
193 |
break; |
|
194 |
} |
|
195 |
} |
|
196 |
} |
|
197 |
} |
|
198 |
} |
|
199 |
if(remove) { |
|
200 |
it = l.erase(it); |
|
201 |
} else { |
|
202 |
if(!quote.isNull() && modified_opt) |
|
203 |
(*it) = quote + (*it) + quote; |
|
204 |
++it; |
|
205 |
} |
|
206 |
} |
|
207 |
return true; |
|
208 |
} |
|
209 |
||
210 |
void |
|
211 |
Win32MakefileGenerator::processPrlFiles() |
|
212 |
{ |
|
213 |
QHash<QString, bool> processed; |
|
214 |
QList<QMakeLocalFileName> libdirs; |
|
215 |
{ |
|
216 |
QStringList &libpaths = project->values("QMAKE_LIBDIR"); |
|
217 |
for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) |
|
218 |
libdirs.append(QMakeLocalFileName((*libpathit))); |
|
219 |
} |
|
220 |
for(bool ret = false; true; ret = false) { |
|
221 |
//read in any prl files included.. |
|
222 |
QStringList l_out; |
|
223 |
QString where = "QMAKE_LIBS"; |
|
224 |
if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) |
|
225 |
where = project->first("QMAKE_INTERNAL_PRL_LIBS"); |
|
226 |
QStringList l = project->values(where); |
|
227 |
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
|
228 |
QString opt = (*it).trimmed(); |
|
229 |
if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) |
|
230 |
opt = opt.mid(1, opt.length()-2); |
|
231 |
if(opt.startsWith("/")) { |
|
232 |
if(opt.startsWith("/LIBPATH:")) { |
|
233 |
QMakeLocalFileName l(opt.mid(9)); |
|
234 |
if(!libdirs.contains(l)) |
|
235 |
libdirs.append(l); |
|
236 |
} |
|
237 |
} else if(!processed.contains(opt)) { |
|
238 |
if(processPrlFile(opt)) { |
|
239 |
processed.insert(opt, true); |
|
240 |
ret = true; |
|
241 |
} else if(QDir::isRelativePath(opt) || opt.startsWith("-l")) { |
|
242 |
QString tmp; |
|
243 |
if (opt.startsWith("-l")) |
|
244 |
tmp = opt.mid(2); |
|
245 |
else |
|
246 |
tmp = opt; |
|
247 |
for(QList<QMakeLocalFileName>::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) { |
|
248 |
QString prl = (*it).local() + Option::dir_sep + tmp; |
|
249 |
// the original is used as the key |
|
250 |
QString orgprl = prl; |
|
251 |
if(processed.contains(prl)) { |
|
252 |
break; |
|
253 |
} else if(processPrlFile(prl)) { |
|
254 |
processed.insert(orgprl, true); |
|
255 |
ret = true; |
|
256 |
break; |
|
257 |
} |
|
258 |
} |
|
259 |
} |
|
260 |
} |
|
261 |
if(!opt.isEmpty()) |
|
262 |
l_out.append(opt); |
|
263 |
} |
|
264 |
if(ret) |
|
265 |
l = l_out; |
|
266 |
else |
|
267 |
break; |
|
268 |
} |
|
269 |
} |
|
270 |
||
271 |
||
272 |
void Win32MakefileGenerator::processVars() |
|
273 |
{ |
|
274 |
//If the TARGET looks like a path split it into DESTDIR and the resulting TARGET |
|
275 |
if(!project->isEmpty("TARGET")) { |
|
276 |
QString targ = project->first("TARGET"); |
|
277 |
int slsh = qMax(targ.lastIndexOf('/'), targ.lastIndexOf(Option::dir_sep)); |
|
278 |
if(slsh != -1) { |
|
279 |
if(project->isEmpty("DESTDIR")) |
|
280 |
project->values("DESTDIR").append(""); |
|
281 |
else if(project->first("DESTDIR").right(1) != Option::dir_sep) |
|
282 |
project->values("DESTDIR") = QStringList(project->first("DESTDIR") + Option::dir_sep); |
|
283 |
project->values("DESTDIR") = QStringList(project->first("DESTDIR") + targ.left(slsh+1)); |
|
284 |
project->values("TARGET") = QStringList(targ.mid(slsh+1)); |
|
285 |
} |
|
286 |
} |
|
287 |
||
288 |
project->values("QMAKE_ORIG_TARGET") = project->values("TARGET"); |
|
289 |
if (!project->values("QMAKE_INCDIR").isEmpty()) |
|
290 |
project->values("INCLUDEPATH") += project->values("QMAKE_INCDIR"); |
|
291 |
||
292 |
if (!project->values("VERSION").isEmpty()) { |
|
293 |
QStringList l = project->first("VERSION").split('.'); |
|
294 |
if (l.size() > 0) |
|
295 |
project->values("VER_MAJ").append(l[0]); |
|
296 |
if (l.size() > 1) |
|
297 |
project->values("VER_MIN").append(l[1]); |
|
298 |
} |
|
299 |
||
300 |
// TARGET_VERSION_EXT will be used to add a version number onto the target name |
|
301 |
if (project->values("TARGET_VERSION_EXT").isEmpty() |
|
302 |
&& !project->values("VER_MAJ").isEmpty()) |
|
303 |
project->values("TARGET_VERSION_EXT").append(project->values("VER_MAJ").first()); |
|
304 |
||
305 |
if(project->isEmpty("QMAKE_COPY_FILE")) |
|
306 |
project->values("QMAKE_COPY_FILE").append("$(COPY)"); |
|
307 |
if(project->isEmpty("QMAKE_COPY_DIR")) |
|
308 |
project->values("QMAKE_COPY_DIR").append("xcopy /s /q /y /i"); |
|
309 |
if(project->isEmpty("QMAKE_INSTALL_FILE")) |
|
310 |
project->values("QMAKE_INSTALL_FILE").append("$(COPY_FILE)"); |
|
311 |
if(project->isEmpty("QMAKE_INSTALL_PROGRAM")) |
|
312 |
project->values("QMAKE_INSTALL_PROGRAM").append("$(COPY_FILE)"); |
|
313 |
if(project->isEmpty("QMAKE_INSTALL_DIR")) |
|
314 |
project->values("QMAKE_INSTALL_DIR").append("$(COPY_DIR)"); |
|
315 |
||
316 |
fixTargetExt(); |
|
317 |
processRcFileVar(); |
|
318 |
processFileTagsVar(); |
|
319 |
||
320 |
QStringList &incDir = project->values("INCLUDEPATH"); |
|
321 |
for(QStringList::Iterator incDir_it = incDir.begin(); incDir_it != incDir.end(); ++incDir_it) { |
|
322 |
if(!(*incDir_it).isEmpty()) |
|
323 |
(*incDir_it) = Option::fixPathToTargetOS((*incDir_it), false, false); |
|
324 |
} |
|
325 |
QStringList &libDir = project->values("QMAKE_LIBDIR"); |
|
326 |
for(QStringList::Iterator libDir_it = libDir.begin(); libDir_it != libDir.end(); ++libDir_it) { |
|
327 |
if(!(*libDir_it).isEmpty()) |
|
328 |
(*libDir_it) = Option::fixPathToTargetOS((*libDir_it), false, false); |
|
329 |
} |
|
330 |
} |
|
331 |
||
332 |
void Win32MakefileGenerator::fixTargetExt() |
|
333 |
{ |
|
334 |
if (!project->values("QMAKE_APP_FLAG").isEmpty()) |
|
335 |
project->values("TARGET_EXT").append(".exe"); |
|
336 |
else if (project->isActiveConfig("shared")) |
|
337 |
project->values("TARGET_EXT").append(project->first("TARGET_VERSION_EXT") + ".dll"); |
|
338 |
else |
|
339 |
project->values("TARGET_EXT").append(".lib"); |
|
340 |
} |
|
341 |
||
342 |
void Win32MakefileGenerator::processRcFileVar() |
|
343 |
{ |
|
344 |
if (Option::qmake_mode == Option::QMAKE_GENERATE_NOTHING) |
|
345 |
return; |
|
346 |
||
347 |
if (((!project->values("VERSION").isEmpty()) |
|
348 |
&& project->values("RC_FILE").isEmpty() |
|
349 |
&& project->values("RES_FILE").isEmpty() |
|
350 |
&& !project->isActiveConfig("no_generated_target_info") |
|
351 |
&& (project->isActiveConfig("shared") || !project->values("QMAKE_APP_FLAG").isEmpty())) |
|
352 |
|| !project->values("QMAKE_WRITE_DEFAULT_RC").isEmpty()){ |
|
353 |
||
354 |
QByteArray rcString; |
|
355 |
QTextStream ts(&rcString, QFile::WriteOnly); |
|
356 |
||
357 |
QStringList vers = project->values("VERSION").first().split("."); |
|
358 |
for (int i = vers.size(); i < 4; i++) |
|
359 |
vers += "0"; |
|
360 |
QString versionString = vers.join("."); |
|
361 |
||
362 |
QString companyName; |
|
363 |
if (!project->values("QMAKE_TARGET_COMPANY").isEmpty()) |
|
364 |
companyName = project->values("QMAKE_TARGET_COMPANY").join(" "); |
|
365 |
||
366 |
QString description; |
|
367 |
if (!project->values("QMAKE_TARGET_DESCRIPTION").isEmpty()) |
|
368 |
description = project->values("QMAKE_TARGET_DESCRIPTION").join(" "); |
|
369 |
||
370 |
QString copyright; |
|
371 |
if (!project->values("QMAKE_TARGET_COPYRIGHT").isEmpty()) |
|
372 |
copyright = project->values("QMAKE_TARGET_COPYRIGHT").join(" "); |
|
373 |
||
374 |
QString productName; |
|
375 |
if (!project->values("QMAKE_TARGET_PRODUCT").isEmpty()) |
|
376 |
productName = project->values("QMAKE_TARGET_PRODUCT").join(" "); |
|
377 |
else |
|
378 |
productName = project->values("TARGET").first(); |
|
379 |
||
380 |
QString originalName = project->values("TARGET").first() + project->values("TARGET_EXT").first(); |
|
381 |
||
382 |
ts << "# if defined(UNDER_CE)" << endl; |
|
383 |
ts << "# include <winbase.h>" << endl; |
|
384 |
ts << "# else" << endl; |
|
385 |
ts << "# include <winver.h>" << endl; |
|
386 |
ts << "# endif" << endl; |
|
387 |
ts << endl; |
|
388 |
ts << "VS_VERSION_INFO VERSIONINFO" << endl; |
|
389 |
ts << "\tFILEVERSION " << QString(versionString).replace(".", ",") << endl; |
|
390 |
ts << "\tPRODUCTVERSION " << QString(versionString).replace(".", ",") << endl; |
|
391 |
ts << "\tFILEFLAGSMASK 0x3fL" << endl; |
|
392 |
ts << "#ifdef _DEBUG" << endl; |
|
393 |
ts << "\tFILEFLAGS VS_FF_DEBUG" << endl; |
|
394 |
ts << "#else" << endl; |
|
395 |
ts << "\tFILEFLAGS 0x0L" << endl; |
|
396 |
ts << "#endif" << endl; |
|
397 |
ts << "\tFILEOS VOS__WINDOWS32" << endl; |
|
398 |
if (project->isActiveConfig("shared")) |
|
399 |
ts << "\tFILETYPE VFT_DLL" << endl; |
|
400 |
else |
|
401 |
ts << "\tFILETYPE VFT_APP" << endl; |
|
402 |
ts << "\tFILESUBTYPE 0x0L" << endl; |
|
403 |
ts << "\tBEGIN" << endl; |
|
404 |
ts << "\t\tBLOCK \"StringFileInfo\"" << endl; |
|
405 |
ts << "\t\tBEGIN" << endl; |
|
406 |
ts << "\t\t\tBLOCK \"040904B0\"" << endl; |
|
407 |
ts << "\t\t\tBEGIN" << endl; |
|
408 |
ts << "\t\t\t\tVALUE \"CompanyName\", \"" << companyName << "\\0\"" << endl; |
|
409 |
ts << "\t\t\t\tVALUE \"FileDescription\", \"" << description << "\\0\"" << endl; |
|
410 |
ts << "\t\t\t\tVALUE \"FileVersion\", \"" << versionString << "\\0\"" << endl; |
|
411 |
ts << "\t\t\t\tVALUE \"LegalCopyright\", \"" << copyright << "\\0\"" << endl; |
|
412 |
ts << "\t\t\t\tVALUE \"OriginalFilename\", \"" << originalName << "\\0\"" << endl; |
|
413 |
ts << "\t\t\t\tVALUE \"ProductName\", \"" << productName << "\\0\"" << endl; |
|
414 |
ts << "\t\t\tEND" << endl; |
|
415 |
ts << "\t\tEND" << endl; |
|
416 |
ts << "\tEND" << endl; |
|
417 |
ts << "/* End of Version info */" << endl; |
|
418 |
ts << endl; |
|
419 |
||
420 |
ts.flush(); |
|
421 |
||
422 |
||
423 |
QString rcFilename = project->values("OUT_PWD").first() |
|
424 |
+ "/" |
|
425 |
+ project->values("TARGET").first() |
|
426 |
+ "_resource" |
|
427 |
+ ".rc"; |
|
428 |
QFile rcFile(QDir::cleanPath(rcFilename)); |
|
429 |
||
430 |
bool writeRcFile = true; |
|
431 |
if (rcFile.exists() && rcFile.open(QFile::ReadOnly)) { |
|
432 |
writeRcFile = rcFile.readAll() != rcString; |
|
433 |
rcFile.close(); |
|
434 |
} |
|
435 |
if (writeRcFile) { |
|
436 |
bool ok; |
|
437 |
ok = rcFile.open(QFile::WriteOnly); |
|
438 |
if (!ok) { |
|
439 |
// The file can't be opened... try creating the containing |
|
440 |
// directory first (needed for clean shadow builds) |
|
441 |
QDir().mkpath(QFileInfo(rcFile).path()); |
|
442 |
ok = rcFile.open(QFile::WriteOnly); |
|
443 |
} |
|
444 |
if (!ok) { |
|
445 |
::fprintf(stderr, "Cannot open for writing: %s", rcFile.fileName().toLatin1().constData()); |
|
446 |
::exit(1); |
|
447 |
} |
|
448 |
if (Option::mkfile::listgen) { |
|
449 |
generatePrint(fileInfo(rcFile.fileName()).absoluteFilePath()); |
|
450 |
} |
|
451 |
rcFile.write(rcString); |
|
452 |
rcFile.close(); |
|
453 |
} |
|
454 |
if (project->values("QMAKE_WRITE_DEFAULT_RC").isEmpty()) |
|
455 |
project->values("RC_FILE").insert(0, rcFile.fileName()); |
|
456 |
} |
|
457 |
if (!project->values("RC_FILE").isEmpty()) { |
|
458 |
if (!project->values("RES_FILE").isEmpty()) { |
|
459 |
fprintf(stderr, "Both rc and res file specified.\n"); |
|
460 |
fprintf(stderr, "Please specify one of them, not both."); |
|
461 |
exit(1); |
|
462 |
} |
|
463 |
QString resFile = project->values("RC_FILE").first(); |
|
464 |
||
465 |
// if this is a shadow build then use the absolute path of the rc file |
|
466 |
if (Option::output_dir != qmake_getpwd()) { |
|
467 |
QFileInfo fi(resFile); |
|
468 |
project->values("RC_FILE").first() = fi.absoluteFilePath(); |
|
469 |
} |
|
470 |
||
471 |
resFile.replace(".rc", Option::res_ext); |
|
472 |
project->values("RES_FILE").prepend(fileInfo(resFile).fileName()); |
|
5
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
473 |
if (!project->values("OBJECTS_DIR").isEmpty()) { |
0 | 474 |
if(project->isActiveConfig("staticlib")) |
475 |
project->values("RES_FILE").first().prepend(fileInfo(project->values("DESTDIR").first()).absoluteFilePath() + Option::dir_sep); |
|
476 |
else |
|
477 |
project->values("RES_FILE").first().prepend(project->values("OBJECTS_DIR").first() + Option::dir_sep); |
|
5
d3bac044e0f0
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
4
diff
changeset
|
478 |
} |
0 | 479 |
project->values("RES_FILE").first() = Option::fixPathToTargetOS(project->values("RES_FILE").first(), false, false); |
480 |
project->values("POST_TARGETDEPS") += project->values("RES_FILE"); |
|
481 |
project->values("CLEAN_FILES") += project->values("RES_FILE"); |
|
482 |
} |
|
483 |
} |
|
484 |
||
485 |
void Win32MakefileGenerator::processFileTagsVar() |
|
486 |
{ |
|
487 |
QStringList tags; |
|
488 |
tags << "SOURCES" << "GENERATED_SOURCES" << "DEF_FILE" << "RC_FILE" |
|
489 |
<< "TARGET" << "QMAKE_LIBS" << "DESTDIR" << "DLLDESTDIR" << "INCLUDEPATH"; |
|
490 |
if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) { |
|
491 |
const QStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); |
|
492 |
for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) |
|
493 |
tags += project->values((*it)+".input"); |
|
494 |
} |
|
495 |
||
496 |
//clean path |
|
497 |
QStringList &filetags = project->values("QMAKE_FILETAGS"); |
|
498 |
for(int i = 0; i < tags.size(); ++i) |
|
499 |
filetags += Option::fixPathToTargetOS(tags.at(i), false); |
|
500 |
} |
|
501 |
||
502 |
void Win32MakefileGenerator::writeCleanParts(QTextStream &t) |
|
503 |
{ |
|
504 |
t << "clean: compiler_clean " << var("CLEAN_DEPS"); |
|
505 |
{ |
|
506 |
const char *clean_targets[] = { "OBJECTS", "QMAKE_CLEAN", "CLEAN_FILES", 0 }; |
|
507 |
for(int i = 0; clean_targets[i]; ++i) { |
|
508 |
const QStringList &list = project->values(clean_targets[i]); |
|
509 |
const QString del_statement("-$(DEL_FILE)"); |
|
510 |
if(project->isActiveConfig("no_delete_multiple_files")) { |
|
511 |
for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) |
|
512 |
t << "\n\t" << del_statement << " " << escapeFilePath((*it)); |
|
513 |
} else { |
|
514 |
QString files, file; |
|
515 |
const int commandlineLimit = 2047; // NT limit, expanded |
|
516 |
for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { |
|
517 |
file = " " + escapeFilePath((*it)); |
|
518 |
if(del_statement.length() + files.length() + |
|
519 |
qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) { |
|
520 |
t << "\n\t" << del_statement << files; |
|
521 |
files.clear(); |
|
522 |
} |
|
523 |
files += file; |
|
524 |
} |
|
525 |
if(!files.isEmpty()) |
|
526 |
t << "\n\t" << del_statement << files; |
|
527 |
} |
|
528 |
} |
|
529 |
} |
|
530 |
t << endl << endl; |
|
531 |
||
532 |
t << "distclean: clean"; |
|
533 |
{ |
|
534 |
const char *clean_targets[] = { "QMAKE_DISTCLEAN", 0 }; |
|
535 |
for(int i = 0; clean_targets[i]; ++i) { |
|
536 |
const QStringList &list = project->values(clean_targets[i]); |
|
537 |
const QString del_statement("-$(DEL_FILE)"); |
|
538 |
if(project->isActiveConfig("no_delete_multiple_files")) { |
|
539 |
for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) |
|
540 |
t << "\n\t" << del_statement << " " << escapeFilePath((*it)); |
|
541 |
} else { |
|
542 |
QString files, file; |
|
543 |
const int commandlineLimit = 2047; // NT limit, expanded |
|
544 |
for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { |
|
545 |
file = " " + escapeFilePath((*it)); |
|
546 |
if(del_statement.length() + files.length() + |
|
547 |
qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) { |
|
548 |
t << "\n\t" << del_statement << files; |
|
549 |
files.clear(); |
|
550 |
} |
|
551 |
files += file; |
|
552 |
} |
|
553 |
if(!files.isEmpty()) |
|
554 |
t << "\n\t" << del_statement << files; |
|
555 |
} |
|
556 |
} |
|
557 |
} |
|
558 |
t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET)" << endl; |
|
559 |
{ |
|
560 |
QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName())); |
|
561 |
if(!ofile.isEmpty()) |
|
562 |
t << "\t-$(DEL_FILE) " << ofile << endl; |
|
563 |
} |
|
564 |
t << endl; |
|
565 |
} |
|
566 |
||
567 |
void Win32MakefileGenerator::writeIncPart(QTextStream &t) |
|
568 |
{ |
|
569 |
t << "INCPATH = "; |
|
570 |
||
571 |
const QStringList &incs = project->values("INCLUDEPATH"); |
|
572 |
for(int i = 0; i < incs.size(); ++i) { |
|
573 |
QString inc = incs.at(i); |
|
574 |
inc.replace(QRegExp("\\\\$"), ""); |
|
575 |
inc.replace(QRegExp("\""), ""); |
|
576 |
if(!inc.isEmpty()) |
|
577 |
t << "-I" << "\"" << inc << "\" "; |
|
578 |
} |
|
579 |
t << "-I\"" << specdir() << "\"" |
|
580 |
<< endl; |
|
581 |
} |
|
582 |
||
583 |
void Win32MakefileGenerator::writeStandardParts(QTextStream &t) |
|
584 |
{ |
|
585 |
t << "####### Compiler, tools and options" << endl << endl; |
|
586 |
t << "CC = " << var("QMAKE_CC") << endl; |
|
587 |
t << "CXX = " << var("QMAKE_CXX") << endl; |
|
588 |
t << "DEFINES = " |
|
589 |
<< varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") |
|
590 |
<< varGlue("DEFINES","-D"," -D","") << endl; |
|
591 |
t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)" << endl; |
|
592 |
t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)" << endl; |
|
593 |
||
594 |
writeIncPart(t); |
|
595 |
writeLibsPart(t); |
|
596 |
||
597 |
t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : |
|
598 |
Option::fixPathToTargetOS(var("QMAKE_QMAKE"), false)) << endl; |
|
599 |
t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") : |
|
600 |
Option::fixPathToTargetOS(var("QMAKE_IDC"), false)) << endl; |
|
601 |
t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") : |
|
602 |
Option::fixPathToTargetOS(var("QMAKE_IDL"), false)) << endl; |
|
603 |
t << "ZIP = " << var("QMAKE_ZIP") << endl; |
|
604 |
t << "DEF_FILE = " << varList("DEF_FILE") << endl; |
|
605 |
t << "RES_FILE = " << varList("RES_FILE") << endl; // Not on mingw, can't see why not though... |
|
606 |
t << "COPY = " << var("QMAKE_COPY") << endl; |
|
607 |
t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; |
|
608 |
t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; |
|
609 |
t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
|
610 |
t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; |
|
611 |
t << "MOVE = " << var("QMAKE_MOVE") << endl; |
|
612 |
t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; |
|
613 |
t << "MKDIR = " << var("QMAKE_MKDIR") << endl; |
|
614 |
t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl; |
|
615 |
t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl; |
|
616 |
t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; |
|
617 |
t << endl; |
|
618 |
||
619 |
t << "####### Output directory" << endl << endl; |
|
620 |
if(!project->values("OBJECTS_DIR").isEmpty()) |
|
621 |
t << "OBJECTS_DIR = " << var("OBJECTS_DIR").replace(QRegExp("\\\\$"),"") << endl; |
|
622 |
else |
|
623 |
t << "OBJECTS_DIR = . " << endl; |
|
624 |
t << endl; |
|
625 |
||
626 |
t << "####### Files" << endl << endl; |
|
627 |
t << "SOURCES = " << valList(escapeFilePaths(project->values("SOURCES"))) |
|
628 |
<< " " << valList(escapeFilePaths(project->values("GENERATED_SOURCES"))) << endl; |
|
629 |
||
630 |
// do this here so we can set DEST_TARGET to be the complete path to the final target if it is needed. |
|
631 |
QString orgDestDir = var("DESTDIR"); |
|
632 |
QString destDir = Option::fixPathToTargetOS(orgDestDir, false); |
|
633 |
if (!destDir.isEmpty() && (orgDestDir.endsWith('/') || orgDestDir.endsWith(Option::dir_sep))) |
|
634 |
destDir += Option::dir_sep; |
|
635 |
QString target = QString(project->first("TARGET")+project->first("TARGET_EXT")); |
|
636 |
target.remove("\""); |
|
637 |
project->values("DEST_TARGET").prepend(destDir + target); |
|
638 |
||
639 |
writeObjectsPart(t); |
|
640 |
||
641 |
writeExtraCompilerVariables(t); |
|
642 |
writeExtraVariables(t); |
|
643 |
||
644 |
t << "DIST = " << varList("DISTFILES") << endl; |
|
645 |
t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; |
|
646 |
// The comment is important to maintain variable compatability with Unix |
|
647 |
// Makefiles, while not interpreting a trailing-slash as a linebreak |
|
648 |
t << "DESTDIR = " << escapeFilePath(destDir) << " #avoid trailing-slash linebreak" << endl; |
|
649 |
t << "TARGET = " << escapeFilePath(target) << endl; |
|
650 |
t << "DESTDIR_TARGET = " << escapeFilePath(var("DEST_TARGET")) << endl; |
|
651 |
t << endl; |
|
652 |
||
653 |
t << "####### Implicit rules" << endl << endl; |
|
654 |
writeImplicitRulesPart(t); |
|
655 |
||
656 |
t << "####### Build rules" << endl << endl; |
|
657 |
writeBuildRulesPart(t); |
|
658 |
||
659 |
if(project->isActiveConfig("shared") && !project->values("DLLDESTDIR").isEmpty()) { |
|
660 |
QStringList dlldirs = project->values("DLLDESTDIR"); |
|
661 |
for (QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) { |
|
662 |
t << "\n\t" << "-$(COPY_FILE) \"$(DESTDIR_TARGET)\" " << Option::fixPathToTargetOS(*dlldir, false); |
|
663 |
} |
|
664 |
} |
|
665 |
t << endl << endl; |
|
666 |
||
667 |
writeRcFilePart(t); |
|
668 |
||
669 |
writeMakeQmake(t); |
|
670 |
||
671 |
QStringList dist_files = fileFixify(Option::mkfile::project_files); |
|
672 |
if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES")) |
|
673 |
dist_files += project->values("QMAKE_INTERNAL_INCLUDED_FILES"); |
|
674 |
if(!project->isEmpty("TRANSLATIONS")) |
|
675 |
dist_files << var("TRANSLATIONS"); |
|
676 |
if(!project->isEmpty("FORMS")) { |
|
677 |
QStringList &forms = project->values("FORMS"); |
|
678 |
for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { |
|
679 |
QString ui_h = fileFixify((*formit) + Option::h_ext.first()); |
|
680 |
if(exists(ui_h)) |
|
681 |
dist_files << ui_h; |
|
682 |
} |
|
683 |
} |
|
684 |
t << "dist:" << "\n\t" |
|
685 |
<< "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip " << "$(SOURCES) $(DIST) " |
|
686 |
<< dist_files.join(" ") << " " << var("TRANSLATIONS") << " "; |
|
687 |
if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) { |
|
688 |
const QStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); |
|
689 |
for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { |
|
690 |
const QStringList &inputs = project->values((*it)+".input"); |
|
691 |
for(QStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) { |
|
692 |
t << (*input) << " "; |
|
693 |
} |
|
694 |
} |
|
695 |
} |
|
696 |
t << endl << endl; |
|
697 |
||
698 |
writeCleanParts(t); |
|
699 |
writeExtraTargets(t); |
|
700 |
writeExtraCompilerTargets(t); |
|
701 |
t << endl << endl; |
|
702 |
} |
|
703 |
||
704 |
void Win32MakefileGenerator::writeLibsPart(QTextStream &t) |
|
705 |
{ |
|
706 |
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { |
|
707 |
t << "LIBAPP = " << var("QMAKE_LIB") << endl; |
|
708 |
t << "LIBFLAGS = " << var("QMAKE_LIBFLAGS") << endl; |
|
709 |
} else { |
|
710 |
t << "LINK = " << var("QMAKE_LINK") << endl; |
|
711 |
t << "LFLAGS = "; |
|
712 |
if(!project->values("QMAKE_LIBDIR").isEmpty()) |
|
713 |
writeLibDirPart(t); |
|
714 |
t << var("QMAKE_LFLAGS") << endl; |
|
715 |
t << "LIBS = " << var("QMAKE_LIBS") << " " << var("QMAKE_LIBS_PRIVATE") << endl; |
|
716 |
} |
|
717 |
} |
|
718 |
||
719 |
void Win32MakefileGenerator::writeLibDirPart(QTextStream &t) |
|
720 |
{ |
|
721 |
QStringList libDirs = project->values("QMAKE_LIBDIR"); |
|
722 |
for (int i = 0; i < libDirs.size(); ++i) |
|
723 |
libDirs[i].remove("\""); |
|
724 |
t << valGlue(libDirs,"-L\"","\" -L\"","\"") << " "; |
|
725 |
} |
|
726 |
||
727 |
void Win32MakefileGenerator::writeObjectsPart(QTextStream &t) |
|
728 |
{ |
|
729 |
t << "OBJECTS = " << valList(escapeDependencyPaths(project->values("OBJECTS"))) << endl; |
|
730 |
} |
|
731 |
||
732 |
void Win32MakefileGenerator::writeImplicitRulesPart(QTextStream &t) |
|
733 |
{ |
|
734 |
t << ".SUFFIXES:"; |
|
735 |
for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
|
736 |
t << " " << (*cppit); |
|
737 |
for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit) |
|
738 |
t << " " << (*cit); |
|
739 |
t << endl << endl; |
|
740 |
for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
|
741 |
t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; |
|
742 |
for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit) |
|
743 |
t << (*cit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; |
|
744 |
} |
|
745 |
||
746 |
void Win32MakefileGenerator::writeBuildRulesPart(QTextStream &) |
|
747 |
{ |
|
748 |
} |
|
749 |
||
750 |
void Win32MakefileGenerator::writeRcFilePart(QTextStream &t) |
|
751 |
{ |
|
752 |
if(!project->values("RC_FILE").isEmpty()) { |
|
753 |
const QString res_file = project->first("RES_FILE"), |
|
754 |
rc_file = fileFixify(project->first("RC_FILE")); |
|
755 |
// The resource tool needs to have the same defines passed in as the compiler, since you may |
|
756 |
// use these defines in the .rc file itself. Also, we need to add the _DEBUG define manually |
|
757 |
// since the compiler defines this symbol by itself, and we use it in the automatically |
|
758 |
// created rc file when VERSION is define the .pro file. |
|
759 |
t << res_file << ": " << rc_file << "\n\t" |
|
760 |
<< var("QMAKE_RC") << (project->isActiveConfig("debug") ? " -D_DEBUG" : "") << " $(DEFINES) -fo " << res_file << " " << rc_file; |
|
761 |
t << endl << endl; |
|
762 |
} |
|
763 |
} |
|
764 |
||
765 |
QString Win32MakefileGenerator::getLibTarget() |
|
766 |
{ |
|
767 |
return QString(project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".lib"); |
|
768 |
} |
|
769 |
||
770 |
QString Win32MakefileGenerator::defaultInstall(const QString &t) |
|
771 |
{ |
|
772 |
if((t != "target" && t != "dlltarget") || |
|
773 |
(t == "dlltarget" && (project->first("TEMPLATE") != "lib" || !project->isActiveConfig("shared"))) || |
|
774 |
project->first("TEMPLATE") == "subdirs") |
|
775 |
return QString(); |
|
776 |
||
777 |
const QString root = "$(INSTALL_ROOT)"; |
|
778 |
QStringList &uninst = project->values(t + ".uninstall"); |
|
779 |
QString ret; |
|
780 |
QString targetdir = Option::fixPathToTargetOS(project->first(t + ".path"), false); |
|
781 |
targetdir = fileFixify(targetdir, FileFixifyAbsolute); |
|
782 |
if(targetdir.right(1) != Option::dir_sep) |
|
783 |
targetdir += Option::dir_sep; |
|
784 |
||
785 |
if(t == "target" && project->first("TEMPLATE") == "lib") { |
|
786 |
if(project->isActiveConfig("create_prl") && !project->isActiveConfig("no_install_prl") && |
|
787 |
!project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { |
|
788 |
QString dst_prl = Option::fixPathToTargetOS(project->first("QMAKE_INTERNAL_PRL_FILE")); |
|
789 |
int slsh = dst_prl.lastIndexOf(Option::dir_sep); |
|
790 |
if(slsh != -1) |
|
791 |
dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); |
|
792 |
dst_prl = filePrefixRoot(root, targetdir + dst_prl); |
|
793 |
ret += "-$(INSTALL_FILE) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\""; |
|
794 |
if(!uninst.isEmpty()) |
|
795 |
uninst.append("\n\t"); |
|
796 |
uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); |
|
797 |
} |
|
798 |
if(project->isActiveConfig("shared") && !project->isActiveConfig("plugin")) { |
|
799 |
QString lib_target = getLibTarget(); |
|
800 |
lib_target.remove('"'); |
|
801 |
QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + lib_target; |
|
802 |
QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + lib_target, FileFixifyAbsolute)); |
|
803 |
if(!ret.isEmpty()) |
|
804 |
ret += "\n\t"; |
|
805 |
ret += QString("-$(INSTALL_FILE)") + " \"" + src_targ + "\" \"" + dst_targ + "\""; |
|
806 |
if(!uninst.isEmpty()) |
|
807 |
uninst.append("\n\t"); |
|
808 |
uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); |
|
809 |
} |
|
810 |
} |
|
811 |
||
812 |
if(t == "dlltarget" || project->values(t + ".CONFIG").indexOf("no_dll") == -1) { |
|
813 |
QString src_targ = "$(DESTDIR_TARGET)"; |
|
814 |
QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + "$(TARGET)", FileFixifyAbsolute)); |
|
815 |
if(!ret.isEmpty()) |
|
816 |
ret += "\n\t"; |
|
817 |
ret += QString("-$(INSTALL_FILE)") + " \"" + src_targ + "\" \"" + dst_targ + "\""; |
|
818 |
if(!uninst.isEmpty()) |
|
819 |
uninst.append("\n\t"); |
|
820 |
uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); |
|
821 |
} |
|
822 |
return ret; |
|
823 |
} |
|
824 |
||
825 |
QString Win32MakefileGenerator::escapeFilePath(const QString &path) const |
|
826 |
{ |
|
827 |
QString ret = path; |
|
828 |
if(!ret.isEmpty()) { |
|
829 |
ret = unescapeFilePath(ret); |
|
830 |
if(ret.contains(" ")) |
|
831 |
ret = "\"" + ret + "\""; |
|
832 |
debug_msg(2, "EscapeFilePath: %s -> %s", path.toLatin1().constData(), ret.toLatin1().constData()); |
|
833 |
} |
|
834 |
return ret; |
|
835 |
} |
|
836 |
||
837 |
QT_END_NAMESPACE |