|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
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 "symmake.h" |
|
43 #include "initprojectdeploy_symbian.h" |
|
44 |
|
45 #include <qstring.h> |
|
46 #include <qhash.h> |
|
47 #include <qstringlist.h> |
|
48 #include <qdir.h> |
|
49 #include <qdatetime.h> |
|
50 #include <stdlib.h> |
|
51 #include <qdebug.h> |
|
52 |
|
53 #define RESOURCE_DIRECTORY_MMP "/resource/apps" |
|
54 #define RESOURCE_DIRECTORY_RESOURCE "\\\\resource\\\\apps\\\\" |
|
55 #define REGISTRATION_RESOURCE_DIRECTORY_HW "/private/10003a3f/import/apps" |
|
56 #define PLUGIN_COMMON_DEF_FILE_FOR_MMP "./plugin_common.def" |
|
57 #define PLUGIN_COMMON_DEF_FILE_ACTUAL "plugin_commonU.def" |
|
58 #define BLD_INF_FILENAME_LEN (sizeof(BLD_INF_FILENAME) - 1) |
|
59 |
|
60 #define BLD_INF_RULES_BASE "BLD_INF_RULES." |
|
61 #define BLD_INF_TAG_PLATFORMS "prj_platforms" |
|
62 #define BLD_INF_TAG_MMPFILES "prj_mmpfiles" |
|
63 #define BLD_INF_TAG_TESTMMPFILES "prj_testmmpfiles" |
|
64 #define BLD_INF_TAG_EXTENSIONS "prj_extensions" |
|
65 |
|
66 #define RSS_RULES "RSS_RULES" |
|
67 #define RSS_RULES_BASE "RSS_RULES." |
|
68 #define RSS_TAG_NBROFICONS "number_of_icons" |
|
69 #define RSS_TAG_ICONFILE "icon_file" |
|
70 |
|
71 #define MMP_TARGET "TARGET" |
|
72 #define MMP_TARGETTYPE "TARGETTYPE" |
|
73 #define MMP_SECUREID "SECUREID" |
|
74 #define MMP_OPTION_CW "OPTION CW" |
|
75 #define MMP_OPTION_ARMCC "OPTION ARMCC" |
|
76 #define MMP_OPTION_GCCE "OPTION GCCE" |
|
77 |
|
78 #define SIS_TARGET "sis" |
|
79 #define OK_SIS_TARGET "ok_sis" |
|
80 #define FAIL_SIS_NOPKG_TARGET "fail_sis_nopkg" |
|
81 #define FAIL_SIS_NOCACHE_TARGET "fail_sis_nocache" |
|
82 #define RESTORE_BUILD_TARGET "restore_build" |
|
83 |
|
84 #define PRINT_FILE_CREATE_ERROR(filename) fprintf(stderr, "Error: Could not create '%s'\n", qPrintable(filename)); |
|
85 |
|
86 QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const QDir& parentDir) |
|
87 { |
|
88 static QString epocRootStr; |
|
89 if (epocRootStr.isEmpty()) { |
|
90 QFileInfo efi(epocRoot()); |
|
91 epocRootStr = efi.canonicalFilePath(); |
|
92 if (epocRootStr.isEmpty()) { |
|
93 fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(epocRoot())); |
|
94 epocRootStr = "/"; |
|
95 } |
|
96 if (!epocRootStr.endsWith("/")) |
|
97 epocRootStr += "/"; |
|
98 |
|
99 epocRootStr += "epoc32/"; |
|
100 } |
|
101 |
|
102 QString resultPath = origPath; |
|
103 |
|
104 // Make it relative, unless it starts with "%epocroot%/epoc32/" |
|
105 if (resultPath.startsWith(epocRootStr, Qt::CaseInsensitive)) { |
|
106 resultPath.replace(epocRootStr, "/epoc32/", Qt::CaseInsensitive); |
|
107 } else { |
|
108 resultPath = parentDir.relativeFilePath(resultPath); |
|
109 } |
|
110 resultPath = QDir::cleanPath(resultPath); |
|
111 |
|
112 if (resultPath.isEmpty()) |
|
113 resultPath = "."; |
|
114 |
|
115 return resultPath; |
|
116 } |
|
117 |
|
118 QString SymbianMakefileGenerator::canonizePath(const QString& origPath) |
|
119 { |
|
120 // Since current path gets appended almost always anyway, use it as default |
|
121 // for nonexisting paths. |
|
122 static QString defaultPath; |
|
123 if (defaultPath.isEmpty()) { |
|
124 QFileInfo fi("."); |
|
125 defaultPath = fi.canonicalFilePath(); |
|
126 } |
|
127 |
|
128 // Prepend epocroot to any paths beginning with "/epoc32/" |
|
129 QString resultPath = QDir::fromNativeSeparators(origPath); |
|
130 QString tempPath(resultPath); |
|
131 bool isEpoc = false; |
|
132 if (resultPath.startsWith("/epoc32/", Qt::CaseInsensitive)) { |
|
133 isEpoc = true; |
|
134 resultPath = QDir::fromNativeSeparators(epocRoot()) + resultPath.mid(1); |
|
135 } |
|
136 |
|
137 QFileInfo fi(fileInfo(resultPath)); |
|
138 if(fi.isDir()) { |
|
139 if (isEpoc) |
|
140 resultPath = fi.absoluteFilePath();//canonicalFilePath(); |
|
141 else |
|
142 resultPath = fi.canonicalFilePath(); |
|
143 } else { |
|
144 if (isEpoc) |
|
145 resultPath = fi.absolutePath();//canonicalPath(); |
|
146 else |
|
147 resultPath = fi.canonicalPath(); |
|
148 } |
|
149 //some fix for the not existed EPOC32\include folder |
|
150 if (isEpoc) { |
|
151 int index = resultPath.lastIndexOf("/epoc32/"); |
|
152 QString tmpRes = resultPath.mid(index); |
|
153 if (tmpRes != tempPath) { |
|
154 //we have the problems for not existed include directory |
|
155 //change the path |
|
156 resultPath.replace(tmpRes, tempPath); |
|
157 } |
|
158 } |
|
159 |
|
160 resultPath = QDir::cleanPath(resultPath); |
|
161 |
|
162 if (resultPath.isEmpty()) |
|
163 resultPath = defaultPath; |
|
164 |
|
165 return resultPath; |
|
166 } |
|
167 |
|
168 SymbianMakefileGenerator::SymbianMakefileGenerator() : MakefileGenerator() { } |
|
169 SymbianMakefileGenerator::~SymbianMakefileGenerator() { } |
|
170 |
|
171 void SymbianMakefileGenerator::writeHeader(QTextStream &t) |
|
172 { |
|
173 t << "// ============================================================================" << endl; |
|
174 t << "// * Makefile for building: " << escapeFilePath(var("TARGET")) << endl; |
|
175 t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
176 t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
|
177 t << "// * This file is generated by qmake and should not be modified by the" << endl; |
|
178 t << "// * user." << endl; |
|
179 t << "// * Project: " << fileFixify(project->projectFile()) << endl; |
|
180 t << "// * Template: " << var("TEMPLATE") << endl; |
|
181 t << "// ============================================================================" << endl; |
|
182 t << endl; |
|
183 |
|
184 // Defining define for bld.inf |
|
185 |
|
186 QString shortProFilename = project->projectFile(); |
|
187 shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); |
|
188 shortProFilename.replace(Option::pro_ext, QString("")); |
|
189 |
|
190 QString bldinfDefine = shortProFilename; |
|
191 bldinfDefine.append("_"); |
|
192 bldinfDefine.append(generate_uid(project->projectFile())); |
|
193 |
|
194 bldinfDefine.prepend("BLD_INF_"); |
|
195 removeSpecialCharacters(bldinfDefine); |
|
196 |
|
197 t << "#define " << bldinfDefine.toUpper() << endl << endl; |
|
198 } |
|
199 |
|
200 bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) |
|
201 { |
|
202 writeHeader(t); |
|
203 |
|
204 QString numberOfIcons; |
|
205 QString iconFile; |
|
206 QStringList userRssRules; |
|
207 readRssRules(numberOfIcons, iconFile, userRssRules); |
|
208 |
|
209 // Get the application translations and convert to symbian OS lang code, i.e. decical number |
|
210 QStringList symbianLangCodes = symbianLangCodesFromTsFiles(); |
|
211 |
|
212 // Generate pkg files if there are any actual files to deploy |
|
213 bool generatePkg = false; |
|
214 if (targetType == TypeExe) { |
|
215 generatePkg = true; |
|
216 } else { |
|
217 foreach(QString item, project->values("DEPLOYMENT")) { |
|
218 if (!project->values(item + ".sources").isEmpty()) { |
|
219 generatePkg = true; |
|
220 break; |
|
221 } |
|
222 } |
|
223 } |
|
224 |
|
225 if (generatePkg) { |
|
226 generatePkgFile(iconFile); |
|
227 } |
|
228 |
|
229 writeBldInfContent(t, generatePkg); |
|
230 |
|
231 // Generate empty wrapper makefile here, because wrapper makefile must exist before writeMkFile, |
|
232 // but all required data is not yet available. |
|
233 bool isPrimaryMakefile = true; |
|
234 QString wrapperFileName("Makefile"); |
|
235 QString outputFileName = fileInfo(Option::output.fileName()).fileName(); |
|
236 if (outputFileName != BLD_INF_FILENAME) { |
|
237 wrapperFileName.append(".").append((outputFileName.size() > BLD_INF_FILENAME_LEN && outputFileName.left(BLD_INF_FILENAME_LEN) == BLD_INF_FILENAME) ? outputFileName.mid(8) : outputFileName); |
|
238 isPrimaryMakefile = false; |
|
239 } |
|
240 |
|
241 QFile wrapperMakefile(wrapperFileName); |
|
242 if (wrapperMakefile.open(QIODevice::WriteOnly)) { |
|
243 generatedFiles << wrapperFileName; |
|
244 if (Option::mkfile::listgen) { |
|
245 generatePrint(fileInfo(wrapperMakefile.fileName()).absoluteFilePath()); |
|
246 } |
|
247 |
|
248 } else { |
|
249 PRINT_FILE_CREATE_ERROR(wrapperFileName); |
|
250 return false; |
|
251 } |
|
252 |
|
253 if (targetType == TypeSubdirs) { |
|
254 // If we have something to deploy, generate extension makefile for just that, since |
|
255 // normal extension makefile is not getting generated and we need emulator deployment to be done. |
|
256 if (generatePkg) |
|
257 writeMkFile(wrapperFileName, true); |
|
258 writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); |
|
259 return true; |
|
260 } |
|
261 |
|
262 writeMkFile(wrapperFileName, false); |
|
263 |
|
264 QString shortProFilename = project->projectFile(); |
|
265 shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); |
|
266 shortProFilename.replace(Option::pro_ext, QString("")); |
|
267 |
|
268 QString mmpFilename = shortProFilename; |
|
269 mmpFilename.append("_"); |
|
270 mmpFilename.append(uid3); |
|
271 mmpFilename.append(Option::mmp_ext); |
|
272 writeMmpFile(mmpFilename, symbianLangCodes); |
|
273 |
|
274 if (targetType == TypeExe) { |
|
275 if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { |
|
276 writeRegRssFile(userRssRules); |
|
277 writeRssFile(numberOfIcons, iconFile); |
|
278 writeLocFile(symbianLangCodes); |
|
279 } |
|
280 } |
|
281 |
|
282 writeCustomDefFile(); |
|
283 writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); |
|
284 |
|
285 return true; |
|
286 } |
|
287 |
|
288 void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile) |
|
289 { |
|
290 QString pkgFilename = QString("%1_template.%2") |
|
291 .arg(fixedTarget) |
|
292 .arg("pkg"); |
|
293 QFile pkgFile(pkgFilename); |
|
294 if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { |
|
295 PRINT_FILE_CREATE_ERROR(pkgFilename); |
|
296 return; |
|
297 } |
|
298 if (Option::mkfile::listgen) { |
|
299 generatePrint(fileInfo(pkgFile.fileName()).absoluteFilePath()); |
|
300 } |
|
301 generatedFiles << pkgFile.fileName(); |
|
302 |
|
303 // Header info |
|
304 QTextStream t(&pkgFile); |
|
305 t << QString("; %1 generated by qmake at %2").arg(pkgFilename).arg(QDateTime::currentDateTime().toString(Qt::ISODate)) << endl; |
|
306 t << "; This file is generated by qmake and should not be modified by the user" << endl; |
|
307 t << ";" << endl << endl; |
|
308 |
|
309 // Construct QStringList from pkg_prerules since we need search it before printed to file |
|
310 QStringList rawPkgPreRules; |
|
311 foreach(QString deploymentItem, project->values("DEPLOYMENT")) { |
|
312 foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_prerules")) { |
|
313 QStringList pkgrulesValue = project->values(pkgrulesItem); |
|
314 // If there is no stringlist defined for a rule, use rule name directly |
|
315 // This is convenience for defining single line mmp statements |
|
316 if (pkgrulesValue.isEmpty()) { |
|
317 rawPkgPreRules << pkgrulesItem; |
|
318 } else { |
|
319 foreach(QString pkgrule, pkgrulesValue) { |
|
320 rawPkgPreRules << pkgrule; |
|
321 } |
|
322 } |
|
323 } |
|
324 } |
|
325 |
|
326 // Apply some defaults if specific data does not exist in PKG pre-rules |
|
327 |
|
328 if (!containsStartWithItem('&', rawPkgPreRules)) { |
|
329 // language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS) |
|
330 t << "; Language" << endl; |
|
331 t << "&EN" << endl << endl; |
|
332 } else { |
|
333 // In case user defines langs, he must take care also about SIS header |
|
334 if (!containsStartWithItem('#', rawPkgPreRules)) |
|
335 fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n"); |
|
336 } |
|
337 |
|
338 // name of application, UID and version |
|
339 QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ','); |
|
340 |
|
341 if (!containsStartWithItem('#', rawPkgPreRules)) { |
|
342 QString visualTarget = escapeFilePath(fileFixify(project->first("TARGET"))); |
|
343 visualTarget = removePathSeparators(visualTarget); |
|
344 |
|
345 t << "; SIS header: name, uid, version" << endl; |
|
346 t << QString("#{\"%1\"},(%2),%3").arg(visualTarget).arg(uid3).arg(applicationVersion) << endl << endl; |
|
347 } |
|
348 |
|
349 // Localized vendor name |
|
350 if (!containsStartWithItem('%', rawPkgPreRules)) { |
|
351 t << "; Localised Vendor name" << endl; |
|
352 t << "%{\"Vendor\"}" << endl << endl; |
|
353 } |
|
354 |
|
355 // Unique vendor name |
|
356 if (!containsStartWithItem(':', rawPkgPreRules)) { |
|
357 t << "; Unique Vendor name" << endl; |
|
358 t << ":\"Vendor\"" << endl << endl; |
|
359 } |
|
360 |
|
361 // PKG pre-rules - these are added before actual file installations i.e. SIS package body |
|
362 if (rawPkgPreRules.size()) { |
|
363 t << "; Manual PKG pre-rules from PRO files" << endl; |
|
364 foreach(QString item, rawPkgPreRules) { |
|
365 t << item << endl; |
|
366 } |
|
367 t << endl; |
|
368 } |
|
369 |
|
370 // Install paths on the phone *** should be dynamic at some point |
|
371 QString installPathBin = "!:\\sys\\bin"; |
|
372 QString installPathResource = "!:\\resource\\apps"; |
|
373 QString installPathRegResource = "!:\\private\\10003a3f\\import\\apps"; |
|
374 |
|
375 // Find location of builds |
|
376 QString epocReleasePath = QString("%1epoc32/release/$(PLATFORM)/$(TARGET)") |
|
377 .arg(epocRoot()); |
|
378 |
|
379 |
|
380 if (targetType == TypeExe) { |
|
381 // deploy .exe file |
|
382 t << "; Executable and default resource files" << endl; |
|
383 QString exeFile = fixedTarget + ".exe"; |
|
384 t << QString("\"%1/%2\" - \"%3\\%4\"") |
|
385 .arg(epocReleasePath) |
|
386 .arg(exeFile) |
|
387 .arg(installPathBin) |
|
388 .arg(exeFile) << endl; |
|
389 |
|
390 // deploy rsc & reg_rsc file |
|
391 if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { |
|
392 t << QString("\"%1epoc32/data/z/resource/apps/%2\" - \"%3\\%4\"") |
|
393 .arg(epocRoot()) |
|
394 .arg(fixedTarget + ".rsc") |
|
395 .arg(installPathResource) |
|
396 .arg(fixedTarget + ".rsc") << endl; |
|
397 |
|
398 t << QString("\"%1epoc32/data/z/private/10003a3f/import/apps/%2\" - \"%3\\%4\"") |
|
399 .arg(epocRoot()) |
|
400 .arg(fixedTarget + "_reg.rsc") |
|
401 .arg(installPathRegResource) |
|
402 .arg(fixedTarget + "_reg.rsc") << endl; |
|
403 |
|
404 QString myIconFile = iconFile; |
|
405 myIconFile = myIconFile.replace("\\\\", "\\"); |
|
406 |
|
407 if (!iconFile.isEmpty()) { |
|
408 t << QString("\"%1epoc32/data/z%2\" - \"!:%3\"") |
|
409 .arg(epocRoot()) |
|
410 .arg(QString(myIconFile).replace('\\','/')) |
|
411 .arg(myIconFile) << endl << endl; |
|
412 } |
|
413 } |
|
414 } |
|
415 |
|
416 // deploy any additional DEPLOYMENT files |
|
417 DeploymentList depList; |
|
418 QString remoteTestPath; |
|
419 remoteTestPath = QString("!:\\private\\%1").arg(privateDirUid); |
|
420 |
|
421 initProjectDeploySymbian(project, depList, remoteTestPath, true, "$(PLATFORM)", "$(TARGET)", generatedDirs, generatedFiles); |
|
422 if (depList.size()) |
|
423 t << "; DEPLOYMENT" << endl; |
|
424 for (int i = 0; i < depList.size(); ++i) { |
|
425 t << QString("\"%1\" - \"%2\"") |
|
426 .arg(QString(depList.at(i).from).replace('\\','/')) |
|
427 .arg(depList.at(i).to) << endl; |
|
428 } |
|
429 t << endl; |
|
430 |
|
431 // PKG post-rules - these are added after actual file installations i.e. SIS package body |
|
432 t << "; Manual PKG post-rules from PRO files" << endl; |
|
433 foreach(QString deploymentItem, project->values("DEPLOYMENT")) { |
|
434 foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_postrules")) { |
|
435 QStringList pkgrulesValue = project->values(pkgrulesItem); |
|
436 // If there is no stringlist defined for a rule, use rule name directly |
|
437 // This is convenience for defining single line statements |
|
438 if (pkgrulesValue.isEmpty()) { |
|
439 t << pkgrulesItem << endl; |
|
440 } else { |
|
441 foreach(QString pkgrule, pkgrulesValue) { |
|
442 t << pkgrule << endl; |
|
443 } |
|
444 } |
|
445 t << endl; |
|
446 } |
|
447 } |
|
448 } |
|
449 |
|
450 bool SymbianMakefileGenerator::containsStartWithItem(const QChar &c, const QStringList& src) |
|
451 { |
|
452 bool result = false; |
|
453 foreach(QString str, src) { |
|
454 if (str.startsWith(c)) { |
|
455 result = true; |
|
456 break; |
|
457 } |
|
458 } |
|
459 return result; |
|
460 } |
|
461 |
|
462 void SymbianMakefileGenerator::writeCustomDefFile() |
|
463 { |
|
464 if (targetType == TypePlugin && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { |
|
465 // Create custom def file for plugin |
|
466 QFile ft(QLatin1String(PLUGIN_COMMON_DEF_FILE_ACTUAL)); |
|
467 |
|
468 if (ft.open(QIODevice::WriteOnly)) { |
|
469 if (Option::mkfile::listgen) { |
|
470 generatePrint(fileInfo(ft.fileName()).absoluteFilePath()); |
|
471 } |
|
472 generatedFiles << ft.fileName(); |
|
473 QTextStream t(&ft); |
|
474 |
|
475 t << "; ==============================================================================" << endl; |
|
476 t << "; Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
477 t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
|
478 t << "; This file is generated by qmake and should not be modified by the" << endl; |
|
479 t << "; user." << endl; |
|
480 t << "; Name : " PLUGIN_COMMON_DEF_FILE_ACTUAL << endl; |
|
481 t << "; Part of : " << project->values("TARGET").join(" ") << endl; |
|
482 t << "; Description : Fixes common plugin symbols to known ordinals" << endl; |
|
483 t << "; Version : " << endl; |
|
484 t << ";" << endl; |
|
485 t << "; ==============================================================================" << "\n" << endl; |
|
486 |
|
487 t << endl; |
|
488 |
|
489 t << "EXPORTS" << endl; |
|
490 t << "\tqt_plugin_query_verification_data @ 1 NONAME" << endl; |
|
491 t << "\tqt_plugin_instance @ 2 NONAME" << endl; |
|
492 t << endl; |
|
493 } else { |
|
494 PRINT_FILE_CREATE_ERROR(QString(PLUGIN_COMMON_DEF_FILE_ACTUAL)) |
|
495 } |
|
496 } |
|
497 } |
|
498 |
|
499 void SymbianMakefileGenerator::init() |
|
500 { |
|
501 MakefileGenerator::init(); |
|
502 fixedTarget = escapeFilePath(fileFixify(project->first("TARGET"))); |
|
503 fixedTarget = removePathSeparators(fixedTarget); |
|
504 removeSpecialCharacters(fixedTarget); |
|
505 |
|
506 if (0 != project->values("QMAKE_PLATFORM").size()) |
|
507 platform = varGlue("QMAKE_PLATFORM", "", " ", ""); |
|
508 |
|
509 if (0 == project->values("QMAKESPEC").size()) |
|
510 project->values("QMAKESPEC").append(qgetenv("QMAKESPEC")); |
|
511 |
|
512 project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); |
|
513 project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE")); |
|
514 |
|
515 // bld.inf |
|
516 project->values("MAKEFILE") += BLD_INF_FILENAME; |
|
517 |
|
518 // .mmp |
|
519 initMmpVariables(); |
|
520 |
|
521 // Check TARGET.UID3 presence |
|
522 if (0 != project->values("TARGET.UID3").size()) { |
|
523 uid3 = project->first("TARGET.UID3"); |
|
524 } else { |
|
525 uid3 = generateUID3(); |
|
526 } |
|
527 |
|
528 if ((project->values("TEMPLATE")).contains("app")) |
|
529 targetType = TypeExe; |
|
530 else if ((project->values("TEMPLATE")).contains("lib")) { |
|
531 // Check CONFIG to see if we are to build staticlib or dll |
|
532 if (project->values("CONFIG").contains("staticlib") || project->values("CONFIG").contains("static")) |
|
533 targetType = TypeLib; |
|
534 else if (project->values("CONFIG").contains("plugin")) |
|
535 targetType = TypePlugin; |
|
536 else |
|
537 targetType = TypeDll; |
|
538 } else { |
|
539 targetType = TypeSubdirs; |
|
540 } |
|
541 |
|
542 if (0 != project->values("TARGET.UID2").size()) { |
|
543 uid2 = project->first("TARGET.UID2"); |
|
544 } else if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { |
|
545 uid2 = "0x20004C45"; |
|
546 } else { |
|
547 if (targetType == TypeExe) { |
|
548 if (project->values("QT").contains("gui", Qt::CaseInsensitive)) { |
|
549 // exe and gui -> uid2 needed |
|
550 uid2 = "0x100039CE"; |
|
551 } else { |
|
552 // exe but not gui: uid2 is ignored anyway -> set it to 0 |
|
553 uid2 = "0"; |
|
554 } |
|
555 } else if (targetType == TypeDll || targetType == TypeLib || targetType == TypePlugin) { |
|
556 uid2 = "0x1000008d"; |
|
557 } |
|
558 } |
|
559 |
|
560 uid2 = uid2.trimmed(); |
|
561 uid3 = uid3.trimmed(); |
|
562 |
|
563 // UID is valid as either hex or decimal, so just convert it to number and back to hex |
|
564 // to get proper string for private dir |
|
565 bool conversionOk = false; |
|
566 uint uidNum = uid3.toUInt(&conversionOk, 0); |
|
567 |
|
568 if (!conversionOk) { |
|
569 fprintf(stderr, "Error: Invalid UID \"%s\".\n", uid3.toUtf8().constData()); |
|
570 } else { |
|
571 privateDirUid.setNum(uidNum, 16); |
|
572 while (privateDirUid.length() < 8) |
|
573 privateDirUid.insert(0, QLatin1Char('0')); |
|
574 } |
|
575 } |
|
576 |
|
577 QString SymbianMakefileGenerator::getTargetExtension() |
|
578 { |
|
579 QString ret; |
|
580 if (targetType == TypeExe) { |
|
581 ret.append("exe"); |
|
582 } else if (targetType == TypeLib) { |
|
583 ret.append("lib"); |
|
584 } else if (targetType == TypeDll || targetType == TypePlugin) { |
|
585 ret.append("dll"); |
|
586 } else if (targetType == TypeSubdirs) { |
|
587 // Not actually usable, so return empty |
|
588 } else { |
|
589 // If nothing else set, default to exe |
|
590 ret.append("exe"); |
|
591 } |
|
592 |
|
593 return ret; |
|
594 } |
|
595 |
|
596 QString SymbianMakefileGenerator::generateUID3() |
|
597 { |
|
598 QString target = project->first("TARGET"); |
|
599 QString currPath = qmake_getpwd(); |
|
600 target.prepend("/").prepend(currPath); |
|
601 return generate_test_uid(target); |
|
602 } |
|
603 |
|
604 void SymbianMakefileGenerator::initMmpVariables() |
|
605 { |
|
606 QStringList sysincspaths; |
|
607 QStringList srcincpaths; |
|
608 QStringList srcpaths; |
|
609 |
|
610 srcpaths << project->values("SOURCES") << project->values("GENERATED_SOURCES"); |
|
611 srcpaths << project->values("UNUSED_SOURCES") << project->values("UI_SOURCES_DIR"); |
|
612 srcpaths << project->values("UI_DIR"); |
|
613 |
|
614 QDir current = QDir::current(); |
|
615 QString canonizedCurrent = canonizePath("."); |
|
616 |
|
617 for (int j = 0; j < srcpaths.size(); ++j) { |
|
618 QFileInfo fi(fileInfo(srcpaths.at(j))); |
|
619 // Sometimes sources have other than *.c* files (e.g. *.moc); prune them. |
|
620 if (fi.suffix().startsWith("c")) { |
|
621 if (fi.filePath().length() > fi.fileName().length()) { |
|
622 appendIfnotExist(srcincpaths, fi.path()); |
|
623 sources[canonizePath(fi.path())] += fi.fileName(); |
|
624 } else { |
|
625 sources[canonizedCurrent] += fi.fileName(); |
|
626 appendIfnotExist(srcincpaths, canonizedCurrent); |
|
627 } |
|
628 } |
|
629 } |
|
630 |
|
631 QStringList incpaths; |
|
632 incpaths << project->values("INCLUDEPATH"); |
|
633 incpaths << QLibraryInfo::location(QLibraryInfo::HeadersPath); |
|
634 incpaths << project->values("HEADERS"); |
|
635 incpaths << srcincpaths; |
|
636 incpaths << project->values("UI_HEADERS_DIR"); |
|
637 incpaths << project->values("UI_DIR"); |
|
638 |
|
639 QString epocPath("epoc32"); |
|
640 for (int j = 0; j < incpaths.size(); ++j) { |
|
641 QString includepath = canonizePath(incpaths.at(j)); |
|
642 appendIfnotExist(sysincspaths, includepath); |
|
643 // As a workaround for Symbian toolchain insistence to treat include |
|
644 // statements as relative to source file rather than the file they appear in, |
|
645 // we generate extra temporary include directories to make |
|
646 // relative include paths used in various headers to work properly. |
|
647 // Note that this is not a fix-all solution; it's just a stop-gap measure |
|
648 // to make Qt itself build until toolchain can support relative includes in |
|
649 // a way that Qt expects. |
|
650 if (!includepath.contains(epocPath)) // No temp dirs for epoc includes |
|
651 appendIfnotExist(sysincspaths, includepath + QString("/" QT_EXTRA_INCLUDE_DIR)); |
|
652 } |
|
653 |
|
654 // Remove duplicate include path entries |
|
655 QStringList temporary; |
|
656 for (int i = 0; i < sysincspaths.size(); ++i) { |
|
657 QString origPath = sysincspaths.at(i); |
|
658 QFileInfo origPathInfo(fileInfo(origPath)); |
|
659 bool bFound = false; |
|
660 |
|
661 for (int j = 0; j < temporary.size(); ++j) { |
|
662 QString tmpPath = temporary.at(j); |
|
663 QFileInfo tmpPathInfo(fileInfo(tmpPath)); |
|
664 |
|
665 if (origPathInfo.absoluteFilePath() == tmpPathInfo.absoluteFilePath()) { |
|
666 bFound = true; |
|
667 if (!tmpPathInfo.isRelative() && origPathInfo.isRelative()) { |
|
668 // We keep the relative notation |
|
669 temporary.removeOne(tmpPath); |
|
670 temporary << origPath; |
|
671 } |
|
672 } |
|
673 } |
|
674 |
|
675 if (!bFound) |
|
676 temporary << origPath; |
|
677 |
|
678 } |
|
679 |
|
680 sysincspaths.clear(); |
|
681 sysincspaths << temporary; |
|
682 |
|
683 systeminclude.insert("SYSTEMINCLUDE", sysincspaths); |
|
684 |
|
685 // Check MMP_RULES for singleton keywords that are overridden |
|
686 QStringList overridableMmpKeywords; |
|
687 overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE) << QLatin1String(MMP_OPTION_CW) |
|
688 << QLatin1String(MMP_OPTION_ARMCC) << QLatin1String(MMP_OPTION_GCCE); |
|
689 |
|
690 foreach (QString item, project->values("MMP_RULES")) { |
|
691 if (project->values(item).isEmpty()) { |
|
692 checkOverridability(overridableMmpKeywords, item); |
|
693 } else { |
|
694 foreach (QString itemRow, project->values(item)) { |
|
695 checkOverridability(overridableMmpKeywords, itemRow); |
|
696 } |
|
697 } |
|
698 } |
|
699 } |
|
700 |
|
701 void SymbianMakefileGenerator::checkOverridability(QStringList &overridableKeywords, QString &checkString) |
|
702 { |
|
703 // Check if checkString contains overridable keyword and |
|
704 // add the keyword to overridden keywords list if so. |
|
705 QString simplifiedString = checkString.simplified(); |
|
706 foreach (QString item, overridableKeywords) { |
|
707 if (simplifiedString.startsWith(item)) |
|
708 appendIfnotExist(overriddenMmpKeywords, item); |
|
709 } |
|
710 } |
|
711 |
|
712 bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList &stringList) |
|
713 { |
|
714 QStringList tmpStringList; |
|
715 |
|
716 for (int i = 0; i < stringList.size(); ++i) { |
|
717 QString string = stringList.at(i); |
|
718 if (tmpStringList.contains(string)) |
|
719 continue; |
|
720 else |
|
721 tmpStringList.append(string); |
|
722 } |
|
723 |
|
724 stringList.clear(); |
|
725 stringList = tmpStringList; |
|
726 return true; |
|
727 } |
|
728 |
|
729 void SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t) |
|
730 { |
|
731 t << "// ==============================================================================" << endl; |
|
732 t << "// Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
733 t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
|
734 t << "// This file is generated by qmake and should not be modified by the" << endl; |
|
735 t << "// user." << endl; |
|
736 t << "// Name : " << escapeFilePath(fileFixify(project->projectFile().remove(project->projectFile().length() - 4, 4))) << Option::mmp_ext << endl; |
|
737 t << "// ==============================================================================" << endl << endl; |
|
738 } |
|
739 |
|
740 void SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symbianLangCodes) |
|
741 { |
|
742 QFile ft(filename); |
|
743 if (ft.open(QIODevice::WriteOnly)) { |
|
744 if (Option::mkfile::listgen) { |
|
745 generatePrint(fileInfo(ft.fileName()).absoluteFilePath()); |
|
746 } |
|
747 |
|
748 generatedFiles << ft.fileName(); |
|
749 |
|
750 QTextStream t(&ft); |
|
751 |
|
752 writeMmpFileHeader(t); |
|
753 |
|
754 writeMmpFileTargetPart(t); |
|
755 |
|
756 writeMmpFileResourcePart(t, symbianLangCodes); |
|
757 |
|
758 writeMmpFileMacrosPart(t); |
|
759 |
|
760 writeMmpFileIncludePart(t); |
|
761 |
|
762 QDir current = QDir::current(); |
|
763 |
|
764 for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { |
|
765 QStringList values = it.value(); |
|
766 QString currentSourcePath = it.key(); |
|
767 |
|
768 if (values.size()) |
|
769 t << "SOURCEPATH \t" << fixPathForMmp(currentSourcePath, current) << endl; |
|
770 |
|
771 for (int i = 0; i < values.size(); ++i) { |
|
772 QString sourceFileName = values.at(i); |
|
773 t << "SOURCE\t\t" << sourceFileName << endl; |
|
774 } |
|
775 t << endl; |
|
776 } |
|
777 t << endl; |
|
778 |
|
779 if (!project->values("CONFIG").contains("static") && !project->values("CONFIG").contains("staticlib")) { |
|
780 writeMmpFileLibraryPart(t); |
|
781 } |
|
782 |
|
783 writeMmpFileCapabilityPart(t); |
|
784 |
|
785 writeMmpFileCompilerOptionPart(t); |
|
786 |
|
787 writeMmpFileBinaryVersionPart(t); |
|
788 |
|
789 writeMmpFileRulesPart(t); |
|
790 } else { |
|
791 PRINT_FILE_CREATE_ERROR(filename) |
|
792 } |
|
793 } |
|
794 |
|
795 void SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) |
|
796 { |
|
797 t << endl; |
|
798 |
|
799 QStringList &defines = project->values("DEFINES"); |
|
800 if (defines.size()) |
|
801 t << "// Qt Macros" << endl; |
|
802 for (int i = 0; i < defines.size(); ++i) { |
|
803 QString def = defines.at(i); |
|
804 addMacro(t, def); |
|
805 } |
|
806 |
|
807 // These are required in order that all methods will be correctly exported e.g from qtestlib |
|
808 QStringList &exp_defines = project->values("PRL_EXPORT_DEFINES"); |
|
809 if (exp_defines.size()) |
|
810 t << endl << "// Qt Export Defines" << endl; |
|
811 for (int i = 0; i < exp_defines.size(); ++i) { |
|
812 QString def = exp_defines.at(i); |
|
813 addMacro(t, def); |
|
814 } |
|
815 |
|
816 t << endl; |
|
817 } |
|
818 |
|
819 void SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) |
|
820 { |
|
821 t << "MACRO" << "\t\t" << value << endl; |
|
822 } |
|
823 |
|
824 |
|
825 void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) |
|
826 { |
|
827 bool skipTargetType = overriddenMmpKeywords.contains(MMP_TARGETTYPE); |
|
828 |
|
829 if (targetType == TypeExe) { |
|
830 t << MMP_TARGET << "\t\t" << fixedTarget << ".exe" << endl; |
|
831 if (!skipTargetType) { |
|
832 if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) |
|
833 t << MMP_TARGETTYPE << "\t\t" << "STDEXE" << endl; |
|
834 else |
|
835 t << MMP_TARGETTYPE << "\t\t" << "EXE" << endl; |
|
836 } |
|
837 } else if (targetType == TypeDll || targetType == TypePlugin) { |
|
838 t << MMP_TARGET << "\t\t" << fixedTarget << ".dll" << endl; |
|
839 if (!skipTargetType) { |
|
840 if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) |
|
841 t << MMP_TARGETTYPE << "\t\t" << "STDDLL" << endl; |
|
842 else |
|
843 t << MMP_TARGETTYPE << "\t\t" << "DLL" << endl; |
|
844 } |
|
845 } else if (targetType == TypeLib) { |
|
846 t << MMP_TARGET << "\t\t" << fixedTarget << ".lib" << endl; |
|
847 if (!skipTargetType) { |
|
848 if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) |
|
849 t << MMP_TARGETTYPE << "\t\t" << "STDLIB" << endl; |
|
850 else |
|
851 t << MMP_TARGETTYPE << "\t\t" << "LIB" << endl; |
|
852 } |
|
853 } else { |
|
854 fprintf(stderr, "Error: Unexpected targettype (%d) in SymbianMakefileGenerator::writeMmpFileTargetPart\n", targetType); |
|
855 } |
|
856 |
|
857 t << endl; |
|
858 |
|
859 t << "UID" << "\t\t" << uid2 << " " << uid3 << endl; |
|
860 |
|
861 if (0 != project->values("TARGET.SID").size()) { |
|
862 t << MMP_SECUREID << "\t\t" << project->values("TARGET.SID").join(" ") << endl; |
|
863 } else { |
|
864 if (0 == uid3.size()) |
|
865 t << MMP_SECUREID << "\t\t" << "0" << endl; |
|
866 else |
|
867 t << MMP_SECUREID << "\t\t" << uid3 << endl; |
|
868 } |
|
869 |
|
870 // default value used from mkspecs is 0 |
|
871 if (0 != project->values("TARGET.VID").size()) { |
|
872 t << "VENDORID" << "\t\t" << project->values("TARGET.VID").join(" ") << endl; |
|
873 } |
|
874 |
|
875 t << endl; |
|
876 |
|
877 if (0 != project->first("TARGET.EPOCSTACKSIZE").size()) |
|
878 t << "EPOCSTACKSIZE" << "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl; |
|
879 if (0 != project->values("TARGET.EPOCHEAPSIZE").size()) |
|
880 t << "EPOCHEAPSIZE" << "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl; |
|
881 if (0 != project->values("TARGET.EPOCALLOWDLLDATA").size()) |
|
882 t << "EPOCALLOWDLLDATA" << endl; |
|
883 |
|
884 if (targetType == TypePlugin && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { |
|
885 // Use custom def file for Qt plugins |
|
886 t << "DEFFILE " PLUGIN_COMMON_DEF_FILE_FOR_MMP << endl; |
|
887 } |
|
888 |
|
889 t << endl; |
|
890 } |
|
891 |
|
892 |
|
893 /* |
|
894 Application registration resource files should be installed to the |
|
895 \private\10003a3f\import\apps directory. |
|
896 */ |
|
897 void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) |
|
898 { |
|
899 if ((targetType == TypeExe) && |
|
900 !project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { |
|
901 |
|
902 QString locTarget = fixedTarget; |
|
903 locTarget.append(".rss"); |
|
904 |
|
905 t << "SOURCEPATH\t\t\t. " << endl; |
|
906 t << "LANG SC "; // no endl |
|
907 foreach(QString lang, symbianLangCodes) { |
|
908 t << lang << " "; // no endl |
|
909 } |
|
910 t << endl; |
|
911 t << "START RESOURCE\t\t" << locTarget << endl; |
|
912 t << "HEADER" << endl; |
|
913 t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP << endl; |
|
914 t << "END" << endl << endl; |
|
915 |
|
916 QString regTarget = fixedTarget; |
|
917 regTarget.append("_reg.rss"); |
|
918 |
|
919 t << "SOURCEPATH\t\t\t." << endl; |
|
920 t << "START RESOURCE\t\t" << regTarget << endl; |
|
921 if (isForSymbianSbsv2()) |
|
922 t << "DEPENDS " << fixedTarget << ".rsg" << endl; |
|
923 t << "TARGETPATH\t\t" REGISTRATION_RESOURCE_DIRECTORY_HW << endl; |
|
924 t << "END" << endl << endl; |
|
925 } |
|
926 } |
|
927 |
|
928 void SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) |
|
929 { |
|
930 QDir current = QDir::current(); |
|
931 |
|
932 for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { |
|
933 QStringList values = it.value(); |
|
934 for (int i = 0; i < values.size(); ++i) { |
|
935 QString handledPath = values.at(i); |
|
936 t << "SYSTEMINCLUDE" << "\t\t" << fixPathForMmp(handledPath, current) << endl; |
|
937 } |
|
938 } |
|
939 |
|
940 t << endl; |
|
941 } |
|
942 |
|
943 void SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t) |
|
944 { |
|
945 writeMmpFileSystemIncludePart(t); |
|
946 } |
|
947 |
|
948 void SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) |
|
949 { |
|
950 QStringList &libs = project->values("LIBS"); |
|
951 libs << project->values("QMAKE_LIBS") << project->values("QMAKE_LIBS_PRIVATE"); |
|
952 |
|
953 removeDuplicatedStrings(libs); |
|
954 |
|
955 for (int i = 0; i < libs.size(); ++i) { |
|
956 QString lib = libs.at(i); |
|
957 // The -L flag is uninteresting, since all symbian libraries exist in the same directory. |
|
958 if (lib.startsWith("-l")) { |
|
959 lib.remove(0, 2); |
|
960 QString mmpStatement; |
|
961 if (lib.endsWith(".dll")) { |
|
962 lib.chop(4); |
|
963 mmpStatement = "LIBRARY\t\t"; |
|
964 } else if (lib.endsWith(".lib")) { |
|
965 lib.chop(4); |
|
966 mmpStatement = "STATICLIBRARY\t"; |
|
967 } else { |
|
968 // Hacky way to find out what kind of library it is. Check the |
|
969 // ARMV5 build directory for library type. We default to shared |
|
970 // library, since that is more common. |
|
971 QString udebStaticLibLocation(epocRoot()); |
|
972 QString urelStaticLibLocation(udebStaticLibLocation); |
|
973 udebStaticLibLocation += QString("epoc32/release/armv5/udeb/%1.lib").arg(lib); |
|
974 urelStaticLibLocation += QString("epoc32/release/armv5/urel/%1.lib").arg(lib); |
|
975 if (QFile::exists(udebStaticLibLocation) || QFile::exists(urelStaticLibLocation)) { |
|
976 mmpStatement = "STATICLIBRARY\t"; |
|
977 } else { |
|
978 mmpStatement = "LIBRARY\t\t"; |
|
979 } |
|
980 } |
|
981 t << mmpStatement << lib << ".lib" << endl; |
|
982 } |
|
983 } |
|
984 |
|
985 t << endl; |
|
986 } |
|
987 |
|
988 void SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) |
|
989 { |
|
990 if (0 != project->first("TARGET.CAPABILITY").size()) { |
|
991 QStringList &capabilities = project->values("TARGET.CAPABILITY"); |
|
992 t << "CAPABILITY" << "\t\t"; |
|
993 |
|
994 for (int i = 0; i < capabilities.size(); ++i) { |
|
995 QString cap = capabilities.at(i); |
|
996 t << cap << " "; |
|
997 } |
|
998 } else { |
|
999 t << "CAPABILITY" << "\t\t" << "None"; |
|
1000 } |
|
1001 t << endl << endl; |
|
1002 } |
|
1003 |
|
1004 void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) |
|
1005 { |
|
1006 QString cw, armcc, gcce; |
|
1007 |
|
1008 if (0 != project->values("QMAKE_CXXFLAGS.CW").size()) { |
|
1009 cw.append(project->values("QMAKE_CXXFLAGS.CW").join(" ")); |
|
1010 cw.append(" "); |
|
1011 } |
|
1012 |
|
1013 if (0 != project->values("QMAKE_CXXFLAGS.ARMCC").size()) { |
|
1014 armcc.append(project->values("QMAKE_CXXFLAGS.ARMCC").join(" ")); |
|
1015 armcc.append(" "); |
|
1016 } |
|
1017 |
|
1018 if (0 != project->values("QMAKE_CXXFLAGS.GCCE").size()) { |
|
1019 gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" ")); |
|
1020 gcce.append(" "); |
|
1021 } |
|
1022 |
|
1023 if (0 != project->values("QMAKE_CFLAGS.CW").size()) { |
|
1024 cw.append(project->values("QMAKE_CFLAGS.CW").join(" ")); |
|
1025 cw.append(" "); |
|
1026 } |
|
1027 |
|
1028 if (0 != project->values("QMAKE_CFLAGS.ARMCC").size()) { |
|
1029 armcc.append(project->values("QMAKE_CFLAGS.ARMCC").join(" ")); |
|
1030 armcc.append(" "); |
|
1031 } |
|
1032 |
|
1033 if (0 != project->values("QMAKE_CFLAGS.GCCE").size()) { |
|
1034 gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" ")); |
|
1035 gcce.append(" "); |
|
1036 } |
|
1037 |
|
1038 if (0 != project->values("QMAKE_CXXFLAGS").size()) { |
|
1039 cw.append(project->values("QMAKE_CXXFLAGS").join(" ")); |
|
1040 cw.append(" "); |
|
1041 armcc.append(project->values("QMAKE_CXXFLAGS").join(" ")); |
|
1042 armcc.append(" "); |
|
1043 gcce.append(project->values("QMAKE_CXXFLAGS").join(" ")); |
|
1044 gcce.append(" "); |
|
1045 } |
|
1046 |
|
1047 if (0 != project->values("QMAKE_CFLAGS").size()) { |
|
1048 cw.append(project->values("QMAKE_CFLAGS").join(" ")); |
|
1049 cw.append(" "); |
|
1050 armcc.append(project->values("QMAKE_CFLAGS").join(" ")); |
|
1051 armcc.append(" "); |
|
1052 gcce.append(project->values("QMAKE_CFLAGS").join(" ")); |
|
1053 gcce.append(" "); |
|
1054 } |
|
1055 |
|
1056 if (!cw.isEmpty() && cw[cw.size()-1] == ' ') |
|
1057 cw.chop(1); |
|
1058 if (!armcc.isEmpty() && armcc[armcc.size()-1] == ' ') |
|
1059 armcc.chop(1); |
|
1060 if (!gcce.isEmpty() && gcce[gcce.size()-1] == ' ') |
|
1061 gcce.chop(1); |
|
1062 |
|
1063 if (!cw.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_CW)) |
|
1064 t << MMP_OPTION_CW " " << cw << endl; |
|
1065 if (!armcc.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_ARMCC)) |
|
1066 t << MMP_OPTION_ARMCC " " << armcc << endl; |
|
1067 if (!gcce.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_GCCE)) |
|
1068 t << MMP_OPTION_GCCE " " << gcce << endl; |
|
1069 |
|
1070 t << endl; |
|
1071 } |
|
1072 |
|
1073 void SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) |
|
1074 { |
|
1075 QString applicationVersion = project->first("VERSION"); |
|
1076 QStringList verNumList = applicationVersion.split('.'); |
|
1077 uint major = 0; |
|
1078 uint minor = 0; |
|
1079 uint patch = 0; |
|
1080 bool success = false; |
|
1081 |
|
1082 if (verNumList.size() > 0) { |
|
1083 major = verNumList[0].toUInt(&success); |
|
1084 if (success && verNumList.size() > 1) { |
|
1085 minor = verNumList[1].toUInt(&success); |
|
1086 if (success && verNumList.size() > 2) { |
|
1087 patch = verNumList[2].toUInt(&success); |
|
1088 } |
|
1089 } |
|
1090 } |
|
1091 |
|
1092 QString mmpVersion; |
|
1093 if (success && major <= 0xFFFF && minor <= 0xFF && patch <= 0xFF) { |
|
1094 // Symbian binary version only has major and minor components, so compress |
|
1095 // Qt's minor and patch values into the minor component. Since Symbian's minor |
|
1096 // component is a 16 bit value, only allow 8 bits for each to avoid overflow. |
|
1097 mmpVersion.append(QString::number(major)) |
|
1098 .append('.') |
|
1099 .append(QString::number((minor << 8) + patch)); |
|
1100 } else { |
|
1101 if (!applicationVersion.isEmpty()) |
|
1102 fprintf(stderr, "Invalid VERSION string: %s\n", qPrintable(applicationVersion)); |
|
1103 mmpVersion = "10.0"; // Default binary version for symbian is 10.0 |
|
1104 } |
|
1105 |
|
1106 t << "VERSION " << mmpVersion << endl; |
|
1107 } |
|
1108 |
|
1109 void SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) |
|
1110 { |
|
1111 foreach(QString item, project->values("MMP_RULES")) { |
|
1112 t << endl; |
|
1113 // If there is no stringlist defined for a rule, use rule name directly |
|
1114 // This is convenience for defining single line mmp statements |
|
1115 if (project->values(item).isEmpty()) { |
|
1116 t << item << endl; |
|
1117 } else { |
|
1118 foreach(QString itemRow, project->values(item)) { |
|
1119 t << itemRow << endl; |
|
1120 } |
|
1121 } |
|
1122 } |
|
1123 } |
|
1124 |
|
1125 void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension) |
|
1126 { |
|
1127 // Read user defined bld inf rules |
|
1128 |
|
1129 QMap<QString, QStringList> userBldInfRules; |
|
1130 for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { |
|
1131 if (it.key().startsWith(BLD_INF_RULES_BASE)) { |
|
1132 QString newKey = it.key().mid(sizeof(BLD_INF_RULES_BASE) - 1); |
|
1133 if (newKey.isEmpty()) { |
|
1134 fprintf(stderr, "Warning: Empty BLD_INF_RULES key encountered\n"); |
|
1135 continue; |
|
1136 } |
|
1137 QStringList newValues; |
|
1138 QStringList values = it.value(); |
|
1139 foreach(QString item, values) { |
|
1140 // If there is no stringlist defined for a rule, use rule name directly |
|
1141 // This is convenience for defining single line statements |
|
1142 if (project->values(item).isEmpty()) { |
|
1143 newValues << item; |
|
1144 } else { |
|
1145 foreach(QString itemRow, project->values(item)) { |
|
1146 newValues << itemRow; |
|
1147 } |
|
1148 } |
|
1149 } |
|
1150 userBldInfRules.insert(newKey, newValues); |
|
1151 } |
|
1152 } |
|
1153 |
|
1154 // Add includes of subdirs bld.inf files |
|
1155 |
|
1156 QString mmpfilename = escapeFilePath(fileFixify(project->projectFile())); |
|
1157 mmpfilename = mmpfilename.replace(mmpfilename.lastIndexOf("."), 4, Option::mmp_ext); |
|
1158 QString currentPath = qmake_getpwd(); |
|
1159 QDir directory(currentPath); |
|
1160 |
|
1161 const QStringList &subdirs = project->values("SUBDIRS"); |
|
1162 foreach(QString item, subdirs) { |
|
1163 QString fixedItem; |
|
1164 if (!project->isEmpty(item + ".file")) { |
|
1165 fixedItem = project->first(item + ".file"); |
|
1166 } else if (!project->isEmpty(item + ".subdir")) { |
|
1167 fixedItem = project->first(item + ".subdir"); |
|
1168 } else { |
|
1169 fixedItem = item; |
|
1170 } |
|
1171 |
|
1172 QFileInfo subdir(fileInfo(fixedItem)); |
|
1173 QString relativePath = directory.relativeFilePath(fixedItem); |
|
1174 QString subdirFileName = subdir.completeBaseName(); |
|
1175 QString fullProName = subdir.absoluteFilePath();; |
|
1176 QString bldinfFilename; |
|
1177 |
|
1178 if (subdir.isDir()) { |
|
1179 // Subdir is a regular project |
|
1180 bldinfFilename = relativePath + QString("/") + QString(BLD_INF_FILENAME); |
|
1181 fullProName += QString("/") + subdirFileName + Option::pro_ext; |
|
1182 } else { |
|
1183 // Subdir is actually a .pro file |
|
1184 if (relativePath.contains("/")) { |
|
1185 // .pro not in same directory as parent .pro |
|
1186 relativePath.remove(relativePath.lastIndexOf("/") + 1, relativePath.length()); |
|
1187 bldinfFilename = relativePath; |
|
1188 } else { |
|
1189 // .pro and parent .pro in same directory |
|
1190 bldinfFilename = QString("./"); |
|
1191 } |
|
1192 bldinfFilename += QString(BLD_INF_FILENAME ".") + subdirFileName; |
|
1193 } |
|
1194 |
|
1195 QString uid = generate_uid(fullProName); |
|
1196 QString bldinfDefine = QString("BLD_INF_") + subdirFileName + QString("_") + uid; |
|
1197 bldinfDefine = bldinfDefine.toUpper(); |
|
1198 removeSpecialCharacters(bldinfDefine); |
|
1199 |
|
1200 t << "#ifndef " << bldinfDefine << endl; |
|
1201 t << "\t#include \"" << QDir::toNativeSeparators(bldinfFilename) << "\"" << endl; |
|
1202 t << "#endif // " << bldinfDefine << endl; |
|
1203 } |
|
1204 |
|
1205 // Add supported project platforms |
|
1206 |
|
1207 t << endl << BLD_INF_TAG_PLATFORMS << endl << endl; |
|
1208 if (0 != project->values("SYMBIAN_PLATFORMS").size()) |
|
1209 t << project->values("SYMBIAN_PLATFORMS").join(" ") << endl; |
|
1210 |
|
1211 QStringList userItems = userBldInfRules.value(BLD_INF_TAG_PLATFORMS); |
|
1212 foreach(QString item, userItems) |
|
1213 t << item << endl; |
|
1214 userBldInfRules.remove(BLD_INF_TAG_PLATFORMS); |
|
1215 t << endl; |
|
1216 |
|
1217 // Add project mmps and old style extension makefiles |
|
1218 |
|
1219 QString mmpTag; |
|
1220 if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) |
|
1221 mmpTag = QLatin1String(BLD_INF_TAG_TESTMMPFILES); |
|
1222 else |
|
1223 mmpTag = QLatin1String(BLD_INF_TAG_MMPFILES); |
|
1224 |
|
1225 t << endl << mmpTag << endl << endl; |
|
1226 |
|
1227 writeBldInfMkFilePart(t, addDeploymentExtension); |
|
1228 if (targetType != TypeSubdirs) { |
|
1229 QString shortProFilename = project->projectFile(); |
|
1230 shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); |
|
1231 shortProFilename.replace(Option::pro_ext, QString("")); |
|
1232 |
|
1233 QString mmpFilename = shortProFilename + QString("_") + uid3 + Option::mmp_ext; |
|
1234 |
|
1235 t << mmpFilename << endl; |
|
1236 } |
|
1237 |
|
1238 userItems = userBldInfRules.value(mmpTag); |
|
1239 foreach(QString item, userItems) |
|
1240 t << item << endl; |
|
1241 userBldInfRules.remove(mmpTag); |
|
1242 |
|
1243 t << endl << BLD_INF_TAG_EXTENSIONS << endl << endl; |
|
1244 |
|
1245 // Generate extension rules |
|
1246 |
|
1247 writeBldInfExtensionRulesPart(t); |
|
1248 |
|
1249 userItems = userBldInfRules.value(BLD_INF_TAG_EXTENSIONS); |
|
1250 foreach(QString item, userItems) |
|
1251 t << item << endl; |
|
1252 userBldInfRules.remove(BLD_INF_TAG_EXTENSIONS); |
|
1253 |
|
1254 // Add rest of the user defined content |
|
1255 |
|
1256 for (QMap<QString, QStringList>::iterator it = userBldInfRules.begin(); it != userBldInfRules.end(); ++it) { |
|
1257 t << endl << endl << it.key() << endl << endl; |
|
1258 userItems = it.value(); |
|
1259 foreach(QString item, userItems) |
|
1260 t << item << endl; |
|
1261 } |
|
1262 if (project->values("CONFIG").contains("headerexport", Qt::CaseInsensitive)) { |
|
1263 writeExportPart(t); |
|
1264 } |
|
1265 } |
|
1266 |
|
1267 void SymbianMakefileGenerator::writeExportPart(QTextStream &t) |
|
1268 { |
|
1269 QDir currentDir = QDir::current(); |
|
1270 t << "prj_exports" << endl; |
|
1271 |
|
1272 foreach(QString install, project->values("INSTALLS")) { |
|
1273 QString installDir = project->first(install + ".path"); |
|
1274 |
|
1275 // Export macros are the recommended way, but might not be used |
|
1276 // in all cases (such as Qt headers). We handle it either way, |
|
1277 // macros or not. |
|
1278 bool useLayerMacro = false; |
|
1279 if (installDir.startsWith("MW_LAYER_") || |
|
1280 installDir.startsWith("APP_LAYER_") || |
|
1281 installDir.startsWith("APP_LAYER_")) { |
|
1282 useLayerMacro = true; |
|
1283 } else { |
|
1284 #ifdef Q_OS_WIN |
|
1285 // If we are running on Windows, and the export target starts |
|
1286 // with a drive letter, we need to remove it, the build tools |
|
1287 // cannot handle drives in export paths |
|
1288 |
|
1289 if (installDir.length() > 2 && installDir[1] == ':') { |
|
1290 installDir.remove(0, 2); |
|
1291 } |
|
1292 #endif |
|
1293 installDir.replace("\\", "/"); |
|
1294 if (!installDir.endsWith("/")) { |
|
1295 installDir.append("/"); |
|
1296 } |
|
1297 } |
|
1298 |
|
1299 foreach(QString target, project->values(install + ".files")) { |
|
1300 // Handle glob targets (only in the current directory) |
|
1301 if (target.contains("*") || target.contains("?")) { |
|
1302 QDir globber = QDir::current(); |
|
1303 globber.setNameFilters(QStringList(target)); |
|
1304 foreach(QString globbedTarget, globber.entryList()) { |
|
1305 if (useLayerMacro) { |
|
1306 QFileInfo globbedInfo(globbedTarget); |
|
1307 t << globbedTarget << " " << installDir << |
|
1308 "(" << globbedInfo.fileName() << ")" << endl; |
|
1309 } else { |
|
1310 t << globbedTarget << " " << installDir << |
|
1311 globbedTarget << endl; |
|
1312 } |
|
1313 } |
|
1314 } else { |
|
1315 target = currentDir.relativeFilePath(target); |
|
1316 QFileInfo targetInfo(target); |
|
1317 |
|
1318 // Not possible to export whole directories, extension makefile needed for this |
|
1319 // Note that this check requires the file to be exported to exist in the qmake phase! |
|
1320 if (targetInfo.isFile()) { |
|
1321 if (useLayerMacro) { |
|
1322 t << target << " " << installDir << |
|
1323 "(" << targetInfo.fileName() << ")" << endl; |
|
1324 } else { |
|
1325 t << target << " " << installDir << |
|
1326 targetInfo.fileName() << endl; |
|
1327 } |
|
1328 } |
|
1329 } |
|
1330 } |
|
1331 } |
|
1332 t << endl; |
|
1333 } |
|
1334 |
|
1335 void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems) |
|
1336 { |
|
1337 QString filename(fixedTarget); |
|
1338 filename.append("_reg.rss"); |
|
1339 QFile ft(filename); |
|
1340 if (ft.open(QIODevice::WriteOnly)) { |
|
1341 if (Option::mkfile::listgen) { |
|
1342 generatePrint(fileInfo(ft.fileName()).absoluteFilePath()); |
|
1343 } |
|
1344 generatedFiles << ft.fileName(); |
|
1345 QTextStream t(&ft); |
|
1346 t << "// ============================================================================" << endl; |
|
1347 t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
1348 t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
|
1349 t << "// * This file is generated by qmake and should not be modified by the" << endl; |
|
1350 t << "// * user." << endl; |
|
1351 t << "// ============================================================================" << endl; |
|
1352 t << endl; |
|
1353 t << "#include <" << fixedTarget << ".rsg>" << endl; |
|
1354 t << "#include <appinfo.rh>" << endl; |
|
1355 t << endl; |
|
1356 //t << "#include <data_caging_paths.hrh>" << "\n" << endl; |
|
1357 t << "UID2 " << "KUidAppRegistrationResourceFile" << endl; |
|
1358 t << "UID3 " << uid3 << endl << endl; |
|
1359 t << "RESOURCE APP_REGISTRATION_INFO" << endl; |
|
1360 t << "\t{" << endl; |
|
1361 t << "\tapp_file=\"" << fixedTarget << "\";" << endl; |
|
1362 t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << fixedTarget << "\";" << endl; |
|
1363 t << endl; |
|
1364 |
|
1365 foreach(QString item, userItems) |
|
1366 t << "\t" << item << endl; |
|
1367 t << "\t}" << endl; |
|
1368 } else { |
|
1369 PRINT_FILE_CREATE_ERROR(filename) |
|
1370 } |
|
1371 } |
|
1372 |
|
1373 void SymbianMakefileGenerator::writeRssFile(QString &numberOfIcons, QString &iconFile) |
|
1374 { |
|
1375 QString filename(fixedTarget); |
|
1376 filename.append(".rss"); |
|
1377 QFile ft(filename); |
|
1378 if (ft.open(QIODevice::WriteOnly)) { |
|
1379 if (Option::mkfile::listgen) { |
|
1380 generatePrint(fileInfo(ft.fileName()).absoluteFilePath()); |
|
1381 } |
|
1382 generatedFiles << ft.fileName(); |
|
1383 QTextStream t(&ft); |
|
1384 t << "// ============================================================================" << endl; |
|
1385 t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
1386 t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
|
1387 t << "// * This file is generated by qmake and should not be modified by the" << endl; |
|
1388 t << "// * user." << endl; |
|
1389 t << "// ============================================================================" << endl; |
|
1390 t << endl; |
|
1391 t << "#include <appinfo.rh>" << endl; |
|
1392 t << "#include \"" << fixedTarget << ".loc\"" << endl; |
|
1393 t << endl; |
|
1394 t << "RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info" << endl; |
|
1395 t << "\t{" << endl; |
|
1396 t << "\tshort_caption = STRING_r_short_caption;" << endl; |
|
1397 t << "\tcaption_and_icon =" << endl; |
|
1398 t << "\tCAPTION_AND_ICON_INFO" << endl; |
|
1399 t << "\t\t{" << endl; |
|
1400 t << "\t\tcaption = STRING_r_caption;" << endl; |
|
1401 |
|
1402 if (numberOfIcons.isEmpty() || iconFile.isEmpty()) { |
|
1403 // There can be maximum one item in this tag, validated when parsed |
|
1404 t << "\t\tnumber_of_icons = 0;" << endl; |
|
1405 t << "\t\ticon_file = \"\";" << endl; |
|
1406 } else { |
|
1407 // There can be maximum one item in this tag, validated when parsed |
|
1408 t << "\t\tnumber_of_icons = " << numberOfIcons << ";" << endl; |
|
1409 t << "\t\ticon_file = \"" << iconFile << "\";" << endl; |
|
1410 } |
|
1411 t << "\t\t};" << endl; |
|
1412 t << "\t}" << endl; |
|
1413 t << endl; |
|
1414 } else { |
|
1415 PRINT_FILE_CREATE_ERROR(filename); |
|
1416 } |
|
1417 } |
|
1418 |
|
1419 void SymbianMakefileGenerator::writeLocFile(QStringList &symbianLangCodes) |
|
1420 { |
|
1421 QString filename(fixedTarget); |
|
1422 filename.append(".loc"); |
|
1423 QFile ft(filename); |
|
1424 if (ft.open(QIODevice::WriteOnly)) { |
|
1425 if (Option::mkfile::listgen) { |
|
1426 generatePrint(fileInfo(ft.fileName()).absoluteFilePath()); |
|
1427 } |
|
1428 generatedFiles << ft.fileName(); |
|
1429 QTextStream t(&ft); |
|
1430 t << "// ============================================================================" << endl; |
|
1431 t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
1432 t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
|
1433 t << "// * This file is generated by qmake and should not be modified by the" << endl; |
|
1434 t << "// * user." << endl; |
|
1435 t << "// ============================================================================" << endl; |
|
1436 t << endl; |
|
1437 t << "#ifdef LANGUAGE_SC" << endl; |
|
1438 t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; |
|
1439 t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; |
|
1440 foreach(QString lang, symbianLangCodes) { |
|
1441 t << "#elif defined LANGUAGE_" << lang << endl; |
|
1442 t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; |
|
1443 t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; |
|
1444 } |
|
1445 t << "#else" << endl; |
|
1446 t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; |
|
1447 t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; |
|
1448 t << "#endif" << endl; |
|
1449 } else { |
|
1450 PRINT_FILE_CREATE_ERROR(filename); |
|
1451 } |
|
1452 } |
|
1453 |
|
1454 void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules) |
|
1455 { |
|
1456 for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { |
|
1457 if (it.key().startsWith(RSS_RULES_BASE)) { |
|
1458 QString newKey = it.key().mid(sizeof(RSS_RULES_BASE) - 1); |
|
1459 if (newKey.isEmpty()) { |
|
1460 fprintf(stderr, "Warning: Empty RSS_RULES_BASE key encountered\n"); |
|
1461 continue; |
|
1462 } |
|
1463 QStringList newValues; |
|
1464 QStringList values = it.value(); |
|
1465 foreach(QString item, values) { |
|
1466 // If there is no stringlist defined for a rule, use rule name directly |
|
1467 // This is convenience for defining single line statements |
|
1468 if (project->values(item).isEmpty()) { |
|
1469 newValues << item; |
|
1470 } else { |
|
1471 foreach(QString itemRow, project->values(item)) { |
|
1472 newValues << itemRow; |
|
1473 } |
|
1474 } |
|
1475 } |
|
1476 // Verify thet there is exactly one value in RSS_TAG_NBROFICONS |
|
1477 if (newKey == RSS_TAG_NBROFICONS) { |
|
1478 if (newValues.count() == 1) { |
|
1479 numberOfIcons = newValues[0]; |
|
1480 } else { |
|
1481 fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", |
|
1482 RSS_RULES_BASE, RSS_TAG_NBROFICONS); |
|
1483 continue; |
|
1484 } |
|
1485 // Verify thet there is exactly one value in RSS_TAG_ICONFILE |
|
1486 } else if (newKey == RSS_TAG_ICONFILE) { |
|
1487 if (newValues.count() == 1) { |
|
1488 iconFile = newValues[0]; |
|
1489 } else { |
|
1490 fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", |
|
1491 RSS_RULES_BASE, RSS_TAG_ICONFILE); |
|
1492 continue; |
|
1493 } |
|
1494 } else { |
|
1495 fprintf(stderr, "Warning: Unsupported key:'%s%s'\n", |
|
1496 RSS_RULES_BASE, newKey.toLatin1().constData()); |
|
1497 continue; |
|
1498 } |
|
1499 } |
|
1500 } |
|
1501 |
|
1502 foreach(QString item, project->values(RSS_RULES)) { |
|
1503 // If there is no stringlist defined for a rule, use rule name directly |
|
1504 // This is convenience for defining single line mmp statements |
|
1505 if (project->values(item).isEmpty()) { |
|
1506 userRssRules << item; |
|
1507 } else { |
|
1508 userRssRules << project->values(item); |
|
1509 } |
|
1510 } |
|
1511 |
|
1512 // Validate that either both RSS_TAG_NBROFICONS and RSS_TAG_ICONFILE keys exist |
|
1513 // or neither of them exist |
|
1514 if (!((numberOfIcons.isEmpty() && iconFile.isEmpty()) || |
|
1515 (!numberOfIcons.isEmpty() && !iconFile.isEmpty()))) { |
|
1516 numberOfIcons.clear(); |
|
1517 iconFile.clear(); |
|
1518 fprintf(stderr, "Warning: Both or neither of '%s%s' and '%s%s' keys must exist.\n", |
|
1519 RSS_RULES_BASE, RSS_TAG_NBROFICONS, RSS_RULES_BASE, RSS_TAG_ICONFILE); |
|
1520 } |
|
1521 |
|
1522 // Validate that RSS_TAG_NBROFICONS contains only numbers |
|
1523 if (!numberOfIcons.isEmpty()) { |
|
1524 bool ok; |
|
1525 numberOfIcons = numberOfIcons.simplified(); |
|
1526 int tmp = numberOfIcons.toInt(&ok); |
|
1527 if (!ok) { |
|
1528 numberOfIcons.clear(); |
|
1529 iconFile.clear(); |
|
1530 fprintf(stderr, "Warning: '%s%s' must be integer in decimal format.\n", |
|
1531 RSS_RULES_BASE, RSS_TAG_NBROFICONS); |
|
1532 } |
|
1533 } |
|
1534 } |
|
1535 |
|
1536 QStringList SymbianMakefileGenerator::symbianLangCodesFromTsFiles() |
|
1537 { |
|
1538 QStringList tsfiles; |
|
1539 QStringList symbianLangCodes; |
|
1540 tsfiles << project->values("TRANSLATIONS"); |
|
1541 |
|
1542 fillQt2S60LangMapTable(); |
|
1543 |
|
1544 foreach(QString file, tsfiles) { |
|
1545 int extIndex = file.lastIndexOf("."); |
|
1546 int langIndex = file.lastIndexOf("_", (extIndex - file.length())); |
|
1547 langIndex += 1; |
|
1548 QString qtlang = file.mid(langIndex, extIndex - langIndex); |
|
1549 QString s60lang = qt2S60LangMapTable.value(qtlang, QString("SC")); |
|
1550 |
|
1551 if (!symbianLangCodes.contains(s60lang) && s60lang != "SC") |
|
1552 symbianLangCodes += s60lang; |
|
1553 } |
|
1554 |
|
1555 return symbianLangCodes; |
|
1556 } |
|
1557 |
|
1558 void SymbianMakefileGenerator::fillQt2S60LangMapTable() |
|
1559 { |
|
1560 qt2S60LangMapTable.reserve(170); // 165 items at time of writing. |
|
1561 qt2S60LangMapTable.insert("ab", "SC"); //Abkhazian // |
|
1562 qt2S60LangMapTable.insert("om", "SC"); //Afan // |
|
1563 qt2S60LangMapTable.insert("aa", "SC"); //Afar // |
|
1564 qt2S60LangMapTable.insert("af", "34"); //Afrikaans //Afrikaans |
|
1565 qt2S60LangMapTable.insert("sq", "35"); //Albanian //Albanian |
|
1566 qt2S60LangMapTable.insert("am", "36"); //Amharic //Amharic |
|
1567 qt2S60LangMapTable.insert("ar", "37"); //Arabic //Arabic |
|
1568 qt2S60LangMapTable.insert("hy", "38"); //Armenian //Armenian |
|
1569 qt2S60LangMapTable.insert("as", "SC"); //Assamese // |
|
1570 qt2S60LangMapTable.insert("ay", "SC"); //Aymara // |
|
1571 qt2S60LangMapTable.insert("az", "SC"); //Azerbaijani // |
|
1572 qt2S60LangMapTable.insert("ba", "SC"); //Bashkir // |
|
1573 qt2S60LangMapTable.insert("eu", "SC"); //Basque // |
|
1574 qt2S60LangMapTable.insert("bn", "41"); //Bengali //Bengali |
|
1575 qt2S60LangMapTable.insert("dz", "SC"); //Bhutani // |
|
1576 qt2S60LangMapTable.insert("bh", "SC"); //Bihari // |
|
1577 qt2S60LangMapTable.insert("bi", "SC"); //Bislama // |
|
1578 qt2S60LangMapTable.insert("br", "SC"); //Breton // |
|
1579 qt2S60LangMapTable.insert("bg", "42"); //Bulgarian //Bulgarian |
|
1580 qt2S60LangMapTable.insert("my", "43"); //Burmese //Burmese |
|
1581 qt2S60LangMapTable.insert("be", "40"); //Byelorussian //Belarussian |
|
1582 qt2S60LangMapTable.insert("km", "SC"); //Cambodian // |
|
1583 qt2S60LangMapTable.insert("ca", "44"); //Catalan //Catalan |
|
1584 qt2S60LangMapTable.insert("zh", "SC"); //Chinese // |
|
1585 qt2S60LangMapTable.insert("co", "SC"); //Corsican // |
|
1586 qt2S60LangMapTable.insert("hr", "45"); //Croatian //Croatian |
|
1587 qt2S60LangMapTable.insert("cs", "25"); //Czech //Czech |
|
1588 qt2S60LangMapTable.insert("da", "07"); //Danish //Danish |
|
1589 qt2S60LangMapTable.insert("nl", "18"); //Dutch //Dutch |
|
1590 qt2S60LangMapTable.insert("en", "01"); //English //English(UK) |
|
1591 qt2S60LangMapTable.insert("eo", "SC"); //Esperanto // |
|
1592 qt2S60LangMapTable.insert("et", "49"); //Estonian //Estonian |
|
1593 qt2S60LangMapTable.insert("fo", "SC"); //Faroese // |
|
1594 qt2S60LangMapTable.insert("fj", "SC"); //Fiji // |
|
1595 qt2S60LangMapTable.insert("fi", "09"); //Finnish //Finnish |
|
1596 qt2S60LangMapTable.insert("fr", "02"); //French //French |
|
1597 qt2S60LangMapTable.insert("fy", "SC"); //Frisian // |
|
1598 qt2S60LangMapTable.insert("gd", "52"); //Gaelic //Gaelic |
|
1599 qt2S60LangMapTable.insert("gl", "SC"); //Galician // |
|
1600 qt2S60LangMapTable.insert("ka", "53"); //Georgian //Georgian |
|
1601 qt2S60LangMapTable.insert("de", "03"); //German //German |
|
1602 qt2S60LangMapTable.insert("el", "54"); //Greek //Greek |
|
1603 qt2S60LangMapTable.insert("kl", "SC"); //Greenlandic // |
|
1604 qt2S60LangMapTable.insert("gn", "SC"); //Guarani // |
|
1605 qt2S60LangMapTable.insert("gu", "56"); //Gujarati //Gujarati |
|
1606 qt2S60LangMapTable.insert("ha", "SC"); //Hausa // |
|
1607 qt2S60LangMapTable.insert("he", "57"); //Hebrew //Hebrew |
|
1608 qt2S60LangMapTable.insert("hi", "58"); //Hindi //Hindi |
|
1609 qt2S60LangMapTable.insert("hu", "17"); //Hungarian //Hungarian |
|
1610 qt2S60LangMapTable.insert("is", "15"); //Icelandic //Icelandic |
|
1611 qt2S60LangMapTable.insert("id", "59"); //Indonesian //Indonesian |
|
1612 qt2S60LangMapTable.insert("ia", "SC"); //Interlingua // |
|
1613 qt2S60LangMapTable.insert("ie", "SC"); //Interlingue // |
|
1614 qt2S60LangMapTable.insert("iu", "SC"); //Inuktitut // |
|
1615 qt2S60LangMapTable.insert("ik", "SC"); //Inupiak // |
|
1616 qt2S60LangMapTable.insert("ga", "60"); //Irish //Irish |
|
1617 qt2S60LangMapTable.insert("it", "05"); //Italian //Italian |
|
1618 qt2S60LangMapTable.insert("ja", "32"); //Japanese //Japanese |
|
1619 qt2S60LangMapTable.insert("jv", "SC"); //Javanese // |
|
1620 qt2S60LangMapTable.insert("kn", "62"); //Kannada //Kannada |
|
1621 qt2S60LangMapTable.insert("ks", "SC"); //Kashmiri // |
|
1622 qt2S60LangMapTable.insert("kk", "63"); //Kazakh //Kazakh |
|
1623 qt2S60LangMapTable.insert("rw", "SC"); //Kinyarwanda // |
|
1624 qt2S60LangMapTable.insert("ky", "SC"); //Kirghiz // |
|
1625 qt2S60LangMapTable.insert("ko", "65"); //Korean //Korean |
|
1626 qt2S60LangMapTable.insert("ku", "SC"); //Kurdish // |
|
1627 qt2S60LangMapTable.insert("rn", "SC"); //Kurundi // |
|
1628 qt2S60LangMapTable.insert("lo", "66"); //Laothian //Laothian |
|
1629 qt2S60LangMapTable.insert("la", "SC"); //Latin // |
|
1630 qt2S60LangMapTable.insert("lv", "67"); //Latvian //Latvian |
|
1631 qt2S60LangMapTable.insert("ln", "SC"); //Lingala // |
|
1632 qt2S60LangMapTable.insert("lt", "68"); //Lithuanian //Lithuanian |
|
1633 qt2S60LangMapTable.insert("mk", "69"); //Macedonian //Macedonian |
|
1634 qt2S60LangMapTable.insert("mg", "SC"); //Malagasy // |
|
1635 qt2S60LangMapTable.insert("ms", "70"); //Malay //Malay |
|
1636 qt2S60LangMapTable.insert("ml", "71"); //Malayalam //Malayalam |
|
1637 qt2S60LangMapTable.insert("mt", "SC"); //Maltese // |
|
1638 qt2S60LangMapTable.insert("mi", "SC"); //Maori // |
|
1639 qt2S60LangMapTable.insert("mr", "72"); //Marathi //Marathi |
|
1640 qt2S60LangMapTable.insert("mo", "73"); //Moldavian //Moldovian |
|
1641 qt2S60LangMapTable.insert("mn", "74"); //Mongolian //Mongolian |
|
1642 qt2S60LangMapTable.insert("na", "SC"); //Nauru // |
|
1643 qt2S60LangMapTable.insert("ne", "SC"); //Nepali // |
|
1644 qt2S60LangMapTable.insert("nb", "08"); //Norwegian //Norwegian |
|
1645 qt2S60LangMapTable.insert("oc", "SC"); //Occitan // |
|
1646 qt2S60LangMapTable.insert("or", "SC"); //Oriya // |
|
1647 qt2S60LangMapTable.insert("ps", "SC"); //Pashto // |
|
1648 qt2S60LangMapTable.insert("fa", "SC"); //Persian // |
|
1649 qt2S60LangMapTable.insert("pl", "27"); //Polish //Polish |
|
1650 qt2S60LangMapTable.insert("pt", "13"); //Portuguese //Portuguese |
|
1651 qt2S60LangMapTable.insert("pa", "77"); //Punjabi //Punjabi |
|
1652 qt2S60LangMapTable.insert("qu", "SC"); //Quechua // |
|
1653 qt2S60LangMapTable.insert("rm", "SC"); //RhaetoRomance // |
|
1654 qt2S60LangMapTable.insert("ro", "78"); //Romanian //Romanian |
|
1655 qt2S60LangMapTable.insert("ru", "16"); //Russian //Russian |
|
1656 qt2S60LangMapTable.insert("sm", "SC"); //Samoan // |
|
1657 qt2S60LangMapTable.insert("sg", "SC"); //Sangho // |
|
1658 qt2S60LangMapTable.insert("sa", "SC"); //Sanskrit // |
|
1659 qt2S60LangMapTable.insert("sr", "79"); //Serbian //Serbian |
|
1660 qt2S60LangMapTable.insert("sh", "SC"); //SerboCroatian // |
|
1661 qt2S60LangMapTable.insert("st", "SC"); //Sesotho // |
|
1662 qt2S60LangMapTable.insert("tn", "SC"); //Setswana // |
|
1663 qt2S60LangMapTable.insert("sn", "SC"); //Shona // |
|
1664 qt2S60LangMapTable.insert("sd", "SC"); //Sindhi // |
|
1665 qt2S60LangMapTable.insert("si", "80"); //Singhalese //Sinhalese |
|
1666 qt2S60LangMapTable.insert("ss", "SC"); //Siswati // |
|
1667 qt2S60LangMapTable.insert("sk", "26"); //Slovak //Slovak |
|
1668 qt2S60LangMapTable.insert("sl", "28"); //Slovenian //Slovenian |
|
1669 qt2S60LangMapTable.insert("so", "81"); //Somali //Somali |
|
1670 qt2S60LangMapTable.insert("es", "04"); //Spanish //Spanish |
|
1671 qt2S60LangMapTable.insert("su", "SC"); //Sundanese // |
|
1672 qt2S60LangMapTable.insert("sw", "84"); //Swahili //Swahili |
|
1673 qt2S60LangMapTable.insert("sv", "06"); //Swedish //Swedish |
|
1674 qt2S60LangMapTable.insert("tl", "39"); //Tagalog //Tagalog |
|
1675 qt2S60LangMapTable.insert("tg", "SC"); //Tajik // |
|
1676 qt2S60LangMapTable.insert("ta", "87"); //Tamil //Tamil |
|
1677 qt2S60LangMapTable.insert("tt", "SC"); //Tatar // |
|
1678 qt2S60LangMapTable.insert("te", "88"); //Telugu //Telugu |
|
1679 qt2S60LangMapTable.insert("th", "33"); //Thai //Thai |
|
1680 qt2S60LangMapTable.insert("bo", "89"); //Tibetan //Tibetan |
|
1681 qt2S60LangMapTable.insert("ti", "90"); //Tigrinya //Tigrinya |
|
1682 qt2S60LangMapTable.insert("to", "SC"); //Tonga // |
|
1683 qt2S60LangMapTable.insert("ts", "SC"); //Tsonga // |
|
1684 qt2S60LangMapTable.insert("tr", "14"); //Turkish //Turkish |
|
1685 qt2S60LangMapTable.insert("tk", "92"); //Turkmen //Turkmen |
|
1686 qt2S60LangMapTable.insert("tw", "SC"); //Twi // |
|
1687 qt2S60LangMapTable.insert("ug", "SC"); //Uigur // |
|
1688 qt2S60LangMapTable.insert("uk", "93"); //Ukrainian //Ukrainian |
|
1689 qt2S60LangMapTable.insert("ur", "94"); //Urdu //Urdu |
|
1690 qt2S60LangMapTable.insert("uz", "SC"); //Uzbek // |
|
1691 qt2S60LangMapTable.insert("vi", "96"); //Vietnamese //Vietnamese |
|
1692 qt2S60LangMapTable.insert("vo", "SC"); //Volapuk // |
|
1693 qt2S60LangMapTable.insert("cy", "97"); //Welsh //Welsh |
|
1694 qt2S60LangMapTable.insert("wo", "SC"); //Wolof // |
|
1695 qt2S60LangMapTable.insert("xh", "SC"); //Xhosa // |
|
1696 qt2S60LangMapTable.insert("yi", "SC"); //Yiddish // |
|
1697 qt2S60LangMapTable.insert("yo", "SC"); //Yoruba // |
|
1698 qt2S60LangMapTable.insert("za", "SC"); //Zhuang // |
|
1699 qt2S60LangMapTable.insert("zu", "98"); //Zulu //Zulu |
|
1700 qt2S60LangMapTable.insert("nn", "75"); //Nynorsk //NorwegianNynorsk |
|
1701 qt2S60LangMapTable.insert("bs", "SC"); //Bosnian // |
|
1702 qt2S60LangMapTable.insert("dv", "SC"); //Divehi // |
|
1703 qt2S60LangMapTable.insert("gv", "SC"); //Manx // |
|
1704 qt2S60LangMapTable.insert("kw", "SC"); //Cornish // |
|
1705 qt2S60LangMapTable.insert("ak", "SC"); //Akan // |
|
1706 qt2S60LangMapTable.insert("kok", "SC"); //Konkani // |
|
1707 qt2S60LangMapTable.insert("gaa", "SC"); //Ga // |
|
1708 qt2S60LangMapTable.insert("ig", "SC"); //Igbo // |
|
1709 qt2S60LangMapTable.insert("kam", "SC"); //Kamba // |
|
1710 qt2S60LangMapTable.insert("syr", "SC"); //Syriac // |
|
1711 qt2S60LangMapTable.insert("byn", "SC"); //Blin // |
|
1712 qt2S60LangMapTable.insert("gez", "SC"); //Geez // |
|
1713 qt2S60LangMapTable.insert("kfo", "SC"); //Koro // |
|
1714 qt2S60LangMapTable.insert("sid", "SC"); //Sidamo // |
|
1715 qt2S60LangMapTable.insert("cch", "SC"); //Atsam // |
|
1716 qt2S60LangMapTable.insert("tig", "SC"); //Tigre // |
|
1717 qt2S60LangMapTable.insert("kaj", "SC"); //Jju // |
|
1718 qt2S60LangMapTable.insert("fur", "SC"); //Friulian // |
|
1719 qt2S60LangMapTable.insert("ve", "SC"); //Venda // |
|
1720 qt2S60LangMapTable.insert("ee", "SC"); //Ewe // |
|
1721 qt2S60LangMapTable.insert("wa", "SC"); //Walamo // |
|
1722 qt2S60LangMapTable.insert("haw", "SC"); //Hawaiian // |
|
1723 qt2S60LangMapTable.insert("kcg", "SC"); //Tyap // |
|
1724 qt2S60LangMapTable.insert("ny", "SC"); //Chewa // |
|
1725 } |
|
1726 |
|
1727 void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QString value) |
|
1728 { |
|
1729 if (!list.contains(value)) |
|
1730 list += value; |
|
1731 } |
|
1732 |
|
1733 void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QStringList values) |
|
1734 { |
|
1735 foreach(QString item, values) |
|
1736 appendIfnotExist(list, item); |
|
1737 } |
|
1738 |
|
1739 QString SymbianMakefileGenerator::removePathSeparators(QString &file) |
|
1740 { |
|
1741 QString ret = file; |
|
1742 while (ret.indexOf(QDir::separator()) > 0) { |
|
1743 ret.remove(0, ret.indexOf(QDir::separator()) + 1); |
|
1744 } |
|
1745 |
|
1746 return ret; |
|
1747 } |
|
1748 |
|
1749 |
|
1750 QString SymbianMakefileGenerator::removeTrailingPathSeparators(QString &file) |
|
1751 { |
|
1752 QString ret = file; |
|
1753 if (ret.endsWith(QDir::separator())) { |
|
1754 ret.remove(ret.length() - 1, 1); |
|
1755 } |
|
1756 |
|
1757 return ret; |
|
1758 } |
|
1759 |
|
1760 void SymbianMakefileGenerator::generateCleanCommands(QTextStream& t, |
|
1761 const QStringList& toClean, |
|
1762 const QString& cmd, |
|
1763 const QString& cmdOptions, |
|
1764 const QString& itemPrefix, |
|
1765 const QString& itemSuffix) |
|
1766 { |
|
1767 for (int i = 0; i < toClean.size(); ++i) { |
|
1768 QString item = toClean.at(i); |
|
1769 item.prepend(itemPrefix).append(itemSuffix); |
|
1770 #if defined(Q_OS_WIN) |
|
1771 t << "\t-@ if EXIST \"" << QDir::toNativeSeparators(item) << "\" "; |
|
1772 t << cmd << " " << cmdOptions << " \"" << QDir::toNativeSeparators(item) << "\"" << endl; |
|
1773 #else |
|
1774 t << "\t-if test -f " << QDir::toNativeSeparators(item) << "; then "; |
|
1775 t << cmd << " " << cmdOptions << " " << QDir::toNativeSeparators(item) << "; fi" << endl; |
|
1776 #endif |
|
1777 } |
|
1778 } |
|
1779 |
|
1780 void SymbianMakefileGenerator::removeSpecialCharacters(QString& str) |
|
1781 { |
|
1782 str.replace(QString("/"), QString("_")); |
|
1783 str.replace(QString("\\"), QString("_")); |
|
1784 str.replace(QString("-"), QString("_")); |
|
1785 str.replace(QString(":"), QString("_")); |
|
1786 str.replace(QString("."), QString("_")); |
|
1787 str.replace(QString(" "), QString("_")); |
|
1788 } |
|
1789 |
|
1790 void SymbianMakefileGenerator::writeSisTargets(QTextStream &t) |
|
1791 { |
|
1792 t << SIS_TARGET ": " RESTORE_BUILD_TARGET << endl; |
|
1793 QString siscommand = QString("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \ |
|
1794 "$(MAKE) -s -f $(MAKEFILE) %4,$(MAKE) -s -f $(MAKEFILE) %5)," \ |
|
1795 "$(MAKE) -s -f $(MAKEFILE) %6)") |
|
1796 .arg(fixedTarget) |
|
1797 .arg("pkg") |
|
1798 .arg(MAKE_CACHE_NAME) |
|
1799 .arg(OK_SIS_TARGET) |
|
1800 .arg(FAIL_SIS_NOCACHE_TARGET) |
|
1801 .arg(FAIL_SIS_NOPKG_TARGET); |
|
1802 t << siscommand << endl; |
|
1803 t << endl; |
|
1804 |
|
1805 t << OK_SIS_TARGET ":" << endl; |
|
1806 |
|
1807 QString pkgcommand = QString("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_template.%2 $(QT_SIS_TARGET) " \ |
|
1808 "$(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)") |
|
1809 .arg(fixedTarget) |
|
1810 .arg("pkg"); |
|
1811 t << pkgcommand << endl; |
|
1812 t << endl; |
|
1813 |
|
1814 t << FAIL_SIS_NOPKG_TARGET ":" << endl; |
|
1815 t << "\t$(error PKG file does not exist, 'SIS' target is only supported for executables or projects with DEPLOYMENT statement)" << endl; |
|
1816 t << endl; |
|
1817 |
|
1818 t << FAIL_SIS_NOCACHE_TARGET ":" << endl; |
|
1819 t << "\t$(error Project has to be build before calling 'SIS' target)" << endl; |
|
1820 t << endl; |
|
1821 |
|
1822 |
|
1823 t << RESTORE_BUILD_TARGET ":" << endl; |
|
1824 t << "-include " MAKE_CACHE_NAME << endl; |
|
1825 t << endl; |
|
1826 } |
|
1827 |
|
1828 void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) |
|
1829 { |
|
1830 t << "dodistclean:" << endl; |
|
1831 const QStringList &subdirs = project->values("SUBDIRS"); |
|
1832 foreach(QString item, subdirs) { |
|
1833 bool fromFile = false; |
|
1834 QString fixedItem; |
|
1835 if (!project->isEmpty(item + ".file")) { |
|
1836 fixedItem = project->first(item + ".file"); |
|
1837 fromFile = true; |
|
1838 } else if (!project->isEmpty(item + ".subdir")) { |
|
1839 fixedItem = project->first(item + ".subdir"); |
|
1840 fromFile = false; |
|
1841 } else { |
|
1842 fromFile = item.endsWith(Option::pro_ext); |
|
1843 fixedItem = item; |
|
1844 } |
|
1845 QFileInfo fi(fileInfo(fixedItem)); |
|
1846 if (!fromFile) { |
|
1847 t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fi.absoluteFilePath() + "/Makefile") << "\" dodistclean" << endl; |
|
1848 } else { |
|
1849 QString itemName = fi.fileName(); |
|
1850 int extIndex = itemName.lastIndexOf(Option::pro_ext); |
|
1851 if (extIndex) |
|
1852 fixedItem = fi.absolutePath() + "/" + QString("Makefile.") + itemName.mid(0, extIndex); |
|
1853 t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fixedItem) << "\" dodistclean" << endl; |
|
1854 } |
|
1855 |
|
1856 } |
|
1857 |
|
1858 generatedFiles << Option::fixPathToTargetOS(fileInfo(Option::output.fileName()).absoluteFilePath()); // bld.inf |
|
1859 generatedFiles << project->values("QMAKE_INTERNAL_PRL_FILE"); // Add generated prl files for cleanup |
|
1860 generatedFiles << project->values("QMAKE_DISTCLEAN"); // Add any additional files marked for distclean |
|
1861 QStringList fixedFiles; |
|
1862 QStringList fixedDirs; |
|
1863 foreach(QString item, generatedFiles) { |
|
1864 QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); |
|
1865 if (!fixedFiles.contains(fixedItem)) { |
|
1866 fixedFiles << fixedItem; |
|
1867 } |
|
1868 } |
|
1869 foreach(QString item, generatedDirs) { |
|
1870 QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); |
|
1871 if (!fixedDirs.contains(fixedItem)) { |
|
1872 fixedDirs << fixedItem; |
|
1873 } |
|
1874 } |
|
1875 generateCleanCommands(t, fixedFiles, "$(DEL_FILE)", "", "", ""); |
|
1876 generateCleanCommands(t, fixedDirs, "$(DEL_DIR)", "", "", ""); |
|
1877 t << endl; |
|
1878 |
|
1879 t << "distclean: clean dodistclean" << endl; |
|
1880 t << endl; |
|
1881 } |