author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 33 | 3e2da88830cd |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
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 "symmake.h" |
|
43 |
||
44 |
#include <qstring.h> |
|
45 |
#include <qhash.h> |
|
46 |
#include <qstringlist.h> |
|
47 |
#include <qdir.h> |
|
48 |
#include <qdatetime.h> |
|
49 |
#include <stdlib.h> |
|
50 |
#include <qdebug.h> |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
51 |
#include <QSettings> |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
52 |
|
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
53 |
// Included from tools/shared |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
54 |
#include <symbian/epocroot.h> |
0 | 55 |
|
56 |
#define RESOURCE_DIRECTORY_MMP "/resource/apps" |
|
57 |
#define REGISTRATION_RESOURCE_DIRECTORY_HW "/private/10003a3f/import/apps" |
|
58 |
#define PLUGIN_COMMON_DEF_FILE_FOR_MMP "./plugin_common.def" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
59 |
#define BLD_INF_FILENAME_LEN (sizeof(BLD_INF_FILENAME) - 1) |
0 | 60 |
|
61 |
#define BLD_INF_RULES_BASE "BLD_INF_RULES." |
|
62 |
#define BLD_INF_TAG_PLATFORMS "prj_platforms" |
|
63 |
#define BLD_INF_TAG_MMPFILES "prj_mmpfiles" |
|
64 |
#define BLD_INF_TAG_TESTMMPFILES "prj_testmmpfiles" |
|
65 |
#define BLD_INF_TAG_EXTENSIONS "prj_extensions" |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
66 |
#define BLD_INF_TAG_TESTEXTENSIONS "prj_testextensions" |
0 | 67 |
|
68 |
#define MMP_TARGET "TARGET" |
|
69 |
#define MMP_TARGETTYPE "TARGETTYPE" |
|
70 |
#define MMP_SECUREID "SECUREID" |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
71 |
#define MMP_OPTION "OPTION" |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
72 |
#define MMP_LINKEROPTION "LINKEROPTION" |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
#define MMP_CAPABILITY "CAPABILITY" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
#define MMP_EPOCALLOWDLLDATA "EPOCALLOWDLLDATA" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
#define MMP_EPOCHEAPSIZE "EPOCHEAPSIZE" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
#define MMP_EPOCSTACKSIZE "EPOCSTACKSIZE" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
77 |
#define MMP_UID "UID" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
78 |
#define MMP_VENDORID "VENDORID" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
79 |
#define MMP_VERSION "VERSION" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
80 |
#define MMP_START_RESOURCE "START RESOURCE" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
81 |
#define MMP_END_RESOURCE "END" |
0 | 82 |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
83 |
#define VAR_CXXFLAGS "QMAKE_CXXFLAGS" |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
84 |
#define VAR_CFLAGS "QMAKE_CFLAGS" |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
85 |
#define VAR_LFLAGS "QMAKE_LFLAGS" |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
86 |
|
0 | 87 |
QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const QDir& parentDir) |
88 |
{ |
|
89 |
static QString epocRootStr; |
|
90 |
if (epocRootStr.isEmpty()) { |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
91 |
epocRootStr = epocRoot(); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
92 |
QFileInfo efi(epocRootStr); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
93 |
if (!efi.exists() || epocRootStr.isEmpty()) { |
0 | 94 |
fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(epocRoot())); |
95 |
epocRootStr = "/"; |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
96 |
} else { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
97 |
epocRootStr = efi.absoluteFilePath(); |
0 | 98 |
} |
99 |
if (!epocRootStr.endsWith("/")) |
|
100 |
epocRootStr += "/"; |
|
101 |
||
102 |
epocRootStr += "epoc32/"; |
|
103 |
} |
|
104 |
||
105 |
QString resultPath = origPath; |
|
106 |
||
107 |
// Make it relative, unless it starts with "%epocroot%/epoc32/" |
|
108 |
if (resultPath.startsWith(epocRootStr, Qt::CaseInsensitive)) { |
|
109 |
resultPath.replace(epocRootStr, "/epoc32/", Qt::CaseInsensitive); |
|
110 |
} else { |
|
111 |
resultPath = parentDir.relativeFilePath(resultPath); |
|
112 |
} |
|
113 |
resultPath = QDir::cleanPath(resultPath); |
|
114 |
||
115 |
if (resultPath.isEmpty()) |
|
116 |
resultPath = "."; |
|
117 |
||
118 |
return resultPath; |
|
119 |
} |
|
120 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
121 |
QString SymbianMakefileGenerator::absolutizePath(const QString& origPath) |
0 | 122 |
{ |
123 |
// Prepend epocroot to any paths beginning with "/epoc32/" |
|
124 |
QString resultPath = QDir::fromNativeSeparators(origPath); |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
125 |
if (resultPath.startsWith("/epoc32/", Qt::CaseInsensitive)) |
0 | 126 |
resultPath = QDir::fromNativeSeparators(epocRoot()) + resultPath.mid(1); |
127 |
||
128 |
QFileInfo fi(fileInfo(resultPath)); |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
129 |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
130 |
// Since origPath can be something given in HEADERS, we need to check if we are dealing |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
131 |
// with a file or a directory. In case the origPath doesn't yet exist, isFile() returns |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
132 |
// false and we default to assuming it is a dir. |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
133 |
if (fi.isFile()) { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
134 |
resultPath = fi.absolutePath(); |
0 | 135 |
} else { |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
136 |
resultPath = fi.absoluteFilePath(); |
0 | 137 |
} |
138 |
||
139 |
resultPath = QDir::cleanPath(resultPath); |
|
140 |
||
141 |
return resultPath; |
|
142 |
} |
|
143 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
144 |
SymbianMakefileGenerator::SymbianMakefileGenerator() : MakefileGenerator(), SymbianCommonGenerator(this) { } |
0 | 145 |
SymbianMakefileGenerator::~SymbianMakefileGenerator() { } |
146 |
||
147 |
void SymbianMakefileGenerator::writeHeader(QTextStream &t) |
|
148 |
{ |
|
149 |
t << "// ============================================================================" << endl; |
|
150 |
t << "// * Makefile for building: " << escapeFilePath(var("TARGET")) << endl; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
151 |
t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; |
0 | 152 |
t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
153 |
t << "// * This file is generated by qmake and should not be modified by the" << endl; |
|
154 |
t << "// * user." << endl; |
|
155 |
t << "// * Project: " << fileFixify(project->projectFile()) << endl; |
|
156 |
t << "// * Template: " << var("TEMPLATE") << endl; |
|
157 |
t << "// ============================================================================" << endl; |
|
158 |
t << endl; |
|
159 |
||
160 |
// Defining define for bld.inf |
|
161 |
||
162 |
QString shortProFilename = project->projectFile(); |
|
163 |
shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); |
|
164 |
shortProFilename.replace(Option::pro_ext, QString("")); |
|
165 |
||
166 |
QString bldinfDefine = shortProFilename; |
|
167 |
bldinfDefine.append("_"); |
|
168 |
bldinfDefine.append(generate_uid(project->projectFile())); |
|
169 |
||
170 |
bldinfDefine.prepend("BLD_INF_"); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
171 |
removeEpocSpecialCharacters(bldinfDefine); |
0 | 172 |
|
173 |
t << "#define " << bldinfDefine.toUpper() << endl << endl; |
|
174 |
} |
|
175 |
||
176 |
bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) |
|
177 |
{ |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
178 |
if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
179 |
fprintf(stderr, "Project files not generated because all requirements are not met:\n\t%s\n", |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
180 |
qPrintable(var("QMAKE_FAILED_REQUIREMENTS"))); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
181 |
return false; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
182 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
183 |
|
0 | 184 |
writeHeader(t); |
185 |
||
186 |
QString numberOfIcons; |
|
187 |
QString iconFile; |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
188 |
QMap<QString, QStringList> userRssRules; |
0 | 189 |
readRssRules(numberOfIcons, iconFile, userRssRules); |
190 |
||
191 |
// Get the application translations and convert to symbian OS lang code, i.e. decical number |
|
192 |
QStringList symbianLangCodes = symbianLangCodesFromTsFiles(); |
|
193 |
||
194 |
// Generate pkg files if there are any actual files to deploy |
|
195 |
bool generatePkg = false; |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
196 |
|
0 | 197 |
if (targetType == TypeExe) { |
198 |
generatePkg = true; |
|
199 |
} else { |
|
200 |
foreach(QString item, project->values("DEPLOYMENT")) { |
|
201 |
if (!project->values(item + ".sources").isEmpty()) { |
|
202 |
generatePkg = true; |
|
203 |
break; |
|
204 |
} |
|
205 |
} |
|
206 |
} |
|
207 |
||
208 |
if (generatePkg) { |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
209 |
generatePkgFile(iconFile, true); |
0 | 210 |
} |
211 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
212 |
writeBldInfContent(t, generatePkg, iconFile); |
0 | 213 |
|
214 |
// Generate empty wrapper makefile here, because wrapper makefile must exist before writeMkFile, |
|
215 |
// but all required data is not yet available. |
|
216 |
bool isPrimaryMakefile = true; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
217 |
QString wrapperFileName = Option::output_dir + QLatin1Char('/') + QLatin1String("Makefile"); |
0 | 218 |
QString outputFileName = fileInfo(Option::output.fileName()).fileName(); |
219 |
if (outputFileName != BLD_INF_FILENAME) { |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
220 |
wrapperFileName.append(".").append(outputFileName.startsWith(BLD_INF_FILENAME) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
221 |
? outputFileName.mid(sizeof(BLD_INF_FILENAME)) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
222 |
: outputFileName); |
0 | 223 |
isPrimaryMakefile = false; |
224 |
} |
|
225 |
||
226 |
QFile wrapperMakefile(wrapperFileName); |
|
227 |
if (wrapperMakefile.open(QIODevice::WriteOnly)) { |
|
228 |
generatedFiles << wrapperFileName; |
|
229 |
if (Option::mkfile::listgen) { |
|
230 |
generatePrint(fileInfo(wrapperMakefile.fileName()).absoluteFilePath()); |
|
231 |
} |
|
232 |
||
233 |
} else { |
|
234 |
PRINT_FILE_CREATE_ERROR(wrapperFileName); |
|
235 |
return false; |
|
236 |
} |
|
237 |
||
238 |
if (targetType == TypeSubdirs) { |
|
239 |
// If we have something to deploy, generate extension makefile for just that, since |
|
240 |
// normal extension makefile is not getting generated and we need emulator deployment to be done. |
|
241 |
if (generatePkg) |
|
242 |
writeMkFile(wrapperFileName, true); |
|
243 |
writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); |
|
244 |
return true; |
|
245 |
} |
|
246 |
||
247 |
writeMkFile(wrapperFileName, false); |
|
248 |
||
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
249 |
QString absoluteMmpFileName = Option::output_dir + QLatin1Char('/') + mmpFileName; |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
250 |
writeMmpFile(absoluteMmpFileName, symbianLangCodes); |
0 | 251 |
|
252 |
if (targetType == TypeExe) { |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
253 |
if (!project->isActiveConfig("no_icon")) { |
0 | 254 |
writeRegRssFile(userRssRules); |
255 |
writeRssFile(numberOfIcons, iconFile); |
|
256 |
writeLocFile(symbianLangCodes); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
257 |
if (!project->values("SYMBIANTRANSLATIONS").isEmpty()) |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
258 |
writeSymbianLocFile(symbianLangCodes); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
259 |
|
0 | 260 |
} |
261 |
} |
|
262 |
||
263 |
writeCustomDefFile(); |
|
264 |
writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); |
|
265 |
||
266 |
return true; |
|
267 |
} |
|
268 |
||
269 |
void SymbianMakefileGenerator::init() |
|
270 |
{ |
|
271 |
MakefileGenerator::init(); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
272 |
SymbianCommonGenerator::init(); |
0 | 273 |
|
274 |
if (0 != project->values("QMAKE_PLATFORM").size()) |
|
275 |
platform = varGlue("QMAKE_PLATFORM", "", " ", ""); |
|
276 |
||
277 |
if (0 == project->values("QMAKESPEC").size()) |
|
278 |
project->values("QMAKESPEC").append(qgetenv("QMAKESPEC")); |
|
279 |
||
280 |
project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); |
|
281 |
project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE")); |
|
282 |
||
283 |
// bld.inf |
|
284 |
project->values("MAKEFILE") += BLD_INF_FILENAME; |
|
285 |
||
286 |
// .mmp |
|
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
287 |
mmpFileName = fixedTarget; |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
288 |
if (targetType == TypeExe) |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
289 |
mmpFileName.append("_exe"); |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
290 |
else if (targetType == TypeDll || targetType == TypePlugin) |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
291 |
mmpFileName.append("_dll"); |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
292 |
else if (targetType == TypeLib) |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
293 |
mmpFileName.append("_lib"); |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
294 |
mmpFileName.append(Option::mmp_ext); |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
295 |
|
0 | 296 |
initMmpVariables(); |
297 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
298 |
uid2 = project->first("TARGET.UID2"); |
0 | 299 |
|
300 |
uid2 = uid2.trimmed(); |
|
301 |
} |
|
302 |
||
303 |
QString SymbianMakefileGenerator::getTargetExtension() |
|
304 |
{ |
|
305 |
QString ret; |
|
306 |
if (targetType == TypeExe) { |
|
307 |
ret.append("exe"); |
|
308 |
} else if (targetType == TypeLib) { |
|
309 |
ret.append("lib"); |
|
310 |
} else if (targetType == TypeDll || targetType == TypePlugin) { |
|
311 |
ret.append("dll"); |
|
312 |
} else if (targetType == TypeSubdirs) { |
|
313 |
// Not actually usable, so return empty |
|
314 |
} else { |
|
315 |
// If nothing else set, default to exe |
|
316 |
ret.append("exe"); |
|
317 |
} |
|
318 |
||
319 |
return ret; |
|
320 |
} |
|
321 |
||
322 |
QString SymbianMakefileGenerator::generateUID3() |
|
323 |
{ |
|
324 |
QString target = project->first("TARGET"); |
|
325 |
QString currPath = qmake_getpwd(); |
|
326 |
target.prepend("/").prepend(currPath); |
|
327 |
return generate_test_uid(target); |
|
328 |
} |
|
329 |
||
330 |
void SymbianMakefileGenerator::initMmpVariables() |
|
331 |
{ |
|
332 |
QStringList sysincspaths; |
|
333 |
QStringList srcincpaths; |
|
334 |
QStringList srcpaths; |
|
335 |
||
336 |
srcpaths << project->values("SOURCES") << project->values("GENERATED_SOURCES"); |
|
337 |
srcpaths << project->values("UNUSED_SOURCES") << project->values("UI_SOURCES_DIR"); |
|
338 |
srcpaths << project->values("UI_DIR"); |
|
339 |
||
340 |
QDir current = QDir::current(); |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
341 |
QString absolutizedCurrent = absolutizePath("."); |
0 | 342 |
|
343 |
for (int j = 0; j < srcpaths.size(); ++j) { |
|
344 |
QFileInfo fi(fileInfo(srcpaths.at(j))); |
|
345 |
// Sometimes sources have other than *.c* files (e.g. *.moc); prune them. |
|
346 |
if (fi.suffix().startsWith("c")) { |
|
347 |
if (fi.filePath().length() > fi.fileName().length()) { |
|
348 |
appendIfnotExist(srcincpaths, fi.path()); |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
349 |
sources[absolutizePath(fi.path())] += fi.fileName(); |
0 | 350 |
} else { |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
351 |
sources[absolutizedCurrent] += fi.fileName(); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
352 |
appendIfnotExist(srcincpaths, absolutizedCurrent); |
0 | 353 |
} |
354 |
} |
|
355 |
} |
|
356 |
||
357 |
QStringList incpaths; |
|
358 |
incpaths << project->values("INCLUDEPATH"); |
|
359 |
incpaths << QLibraryInfo::location(QLibraryInfo::HeadersPath); |
|
360 |
incpaths << project->values("HEADERS"); |
|
361 |
incpaths << srcincpaths; |
|
362 |
incpaths << project->values("UI_HEADERS_DIR"); |
|
363 |
incpaths << project->values("UI_DIR"); |
|
364 |
||
365 |
for (int j = 0; j < incpaths.size(); ++j) { |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
366 |
QString includepath = absolutizePath(incpaths.at(j)); |
0 | 367 |
appendIfnotExist(sysincspaths, includepath); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
368 |
appendAbldTempDirs(sysincspaths, includepath); |
0 | 369 |
} |
370 |
||
371 |
// Remove duplicate include path entries |
|
372 |
QStringList temporary; |
|
373 |
for (int i = 0; i < sysincspaths.size(); ++i) { |
|
374 |
QString origPath = sysincspaths.at(i); |
|
375 |
QFileInfo origPathInfo(fileInfo(origPath)); |
|
376 |
bool bFound = false; |
|
377 |
||
378 |
for (int j = 0; j < temporary.size(); ++j) { |
|
379 |
QString tmpPath = temporary.at(j); |
|
380 |
QFileInfo tmpPathInfo(fileInfo(tmpPath)); |
|
381 |
||
382 |
if (origPathInfo.absoluteFilePath() == tmpPathInfo.absoluteFilePath()) { |
|
383 |
bFound = true; |
|
384 |
if (!tmpPathInfo.isRelative() && origPathInfo.isRelative()) { |
|
385 |
// We keep the relative notation |
|
386 |
temporary.removeOne(tmpPath); |
|
387 |
temporary << origPath; |
|
388 |
} |
|
389 |
} |
|
390 |
} |
|
391 |
||
392 |
if (!bFound) |
|
393 |
temporary << origPath; |
|
394 |
||
395 |
} |
|
396 |
||
397 |
sysincspaths.clear(); |
|
398 |
sysincspaths << temporary; |
|
399 |
||
400 |
systeminclude.insert("SYSTEMINCLUDE", sysincspaths); |
|
401 |
||
402 |
// Check MMP_RULES for singleton keywords that are overridden |
|
403 |
QStringList overridableMmpKeywords; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
404 |
QStringList restrictableMmpKeywords; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
405 |
QStringList restrictedMmpKeywords; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
406 |
bool inResourceBlock = false; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
407 |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
408 |
overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE) << QLatin1String(MMP_EPOCHEAPSIZE); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
409 |
restrictableMmpKeywords << QLatin1String(MMP_TARGET) << QLatin1String(MMP_SECUREID) |
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
410 |
<< QLatin1String(MMP_OPTION) << QLatin1String(MMP_LINKEROPTION) |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
411 |
<< QLatin1String(MMP_CAPABILITY) << QLatin1String(MMP_EPOCALLOWDLLDATA) |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
412 |
<< QLatin1String(MMP_EPOCSTACKSIZE) << QLatin1String(MMP_UID) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
413 |
<< QLatin1String(MMP_VENDORID) << QLatin1String(MMP_VERSION); |
0 | 414 |
|
415 |
foreach (QString item, project->values("MMP_RULES")) { |
|
416 |
if (project->values(item).isEmpty()) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
417 |
handleMmpRulesOverrides(item, inResourceBlock, restrictedMmpKeywords, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
418 |
restrictableMmpKeywords, overridableMmpKeywords); |
0 | 419 |
} else { |
420 |
foreach (QString itemRow, project->values(item)) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
421 |
handleMmpRulesOverrides(itemRow, inResourceBlock, restrictedMmpKeywords, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
422 |
restrictableMmpKeywords, overridableMmpKeywords); |
0 | 423 |
} |
424 |
} |
|
425 |
} |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
426 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
427 |
if (restrictedMmpKeywords.size()) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
428 |
fprintf(stderr, "Warning: Restricted statements detected in MMP_RULES:\n" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
429 |
" (%s)\n" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
430 |
" Use corresponding qmake variable(s) instead.\n", |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
431 |
qPrintable(restrictedMmpKeywords.join(", "))); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
432 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
433 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
434 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
435 |
void SymbianMakefileGenerator::handleMmpRulesOverrides(QString &checkString, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
436 |
bool &inResourceBlock, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
437 |
QStringList &restrictedMmpKeywords, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
438 |
const QStringList &restrictableMmpKeywords, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
439 |
const QStringList &overridableMmpKeywords) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
440 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
441 |
QString simplifiedString = checkString.simplified(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
442 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
443 |
if (!inResourceBlock && simplifiedString.startsWith(MMP_START_RESOURCE, Qt::CaseInsensitive)) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
444 |
inResourceBlock = true; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
445 |
else if (inResourceBlock && simplifiedString.startsWith(MMP_END_RESOURCE, Qt::CaseInsensitive)) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
446 |
inResourceBlock = false; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
447 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
448 |
// Allow restricted and overridable items in RESOURCE blocks as those do not actually |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
449 |
// override anything. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
450 |
if (!inResourceBlock) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
451 |
appendKeywordIfMatchFound(overriddenMmpKeywords, overridableMmpKeywords, simplifiedString); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
452 |
appendKeywordIfMatchFound(restrictedMmpKeywords, restrictableMmpKeywords, simplifiedString); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
453 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
454 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
455 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
456 |
void SymbianMakefileGenerator::appendKeywordIfMatchFound(QStringList &list, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
457 |
const QStringList &keywordList, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
458 |
QString &checkString) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
459 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
460 |
// Check if checkString starts with any supplied keyword and |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
461 |
// add the found keyword to list if it does. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
462 |
foreach (QString item, keywordList) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
463 |
if (checkString.startsWith(QString(item).append(" "), Qt::CaseInsensitive) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
464 |
|| checkString.compare(item, Qt::CaseInsensitive) == 0) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
465 |
appendIfnotExist(list, item); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
466 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
467 |
} |
0 | 468 |
} |
469 |
||
470 |
||
471 |
bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList &stringList) |
|
472 |
{ |
|
473 |
QStringList tmpStringList; |
|
474 |
||
475 |
for (int i = 0; i < stringList.size(); ++i) { |
|
476 |
QString string = stringList.at(i); |
|
477 |
if (tmpStringList.contains(string)) |
|
478 |
continue; |
|
479 |
else |
|
480 |
tmpStringList.append(string); |
|
481 |
} |
|
482 |
||
483 |
stringList.clear(); |
|
484 |
stringList = tmpStringList; |
|
485 |
return true; |
|
486 |
} |
|
487 |
||
488 |
void SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t) |
|
489 |
{ |
|
490 |
t << "// ==============================================================================" << endl; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
491 |
t << "// Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; |
0 | 492 |
t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
493 |
t << "// This file is generated by qmake and should not be modified by the" << endl; |
|
494 |
t << "// user." << endl; |
|
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
495 |
t << "// Name : " << mmpFileName << endl; |
0 | 496 |
t << "// ==============================================================================" << endl << endl; |
497 |
} |
|
498 |
||
499 |
void SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symbianLangCodes) |
|
500 |
{ |
|
501 |
QFile ft(filename); |
|
502 |
if (ft.open(QIODevice::WriteOnly)) { |
|
503 |
if (Option::mkfile::listgen) { |
|
504 |
generatePrint(fileInfo(ft.fileName()).absoluteFilePath()); |
|
505 |
} |
|
506 |
||
507 |
generatedFiles << ft.fileName(); |
|
508 |
||
509 |
QTextStream t(&ft); |
|
510 |
||
511 |
writeMmpFileHeader(t); |
|
512 |
||
513 |
writeMmpFileTargetPart(t); |
|
514 |
||
515 |
writeMmpFileResourcePart(t, symbianLangCodes); |
|
516 |
||
517 |
writeMmpFileMacrosPart(t); |
|
518 |
||
519 |
writeMmpFileIncludePart(t); |
|
520 |
||
521 |
QDir current = QDir::current(); |
|
522 |
||
523 |
for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { |
|
524 |
QStringList values = it.value(); |
|
525 |
QString currentSourcePath = it.key(); |
|
526 |
||
527 |
if (values.size()) |
|
528 |
t << "SOURCEPATH \t" << fixPathForMmp(currentSourcePath, current) << endl; |
|
529 |
||
530 |
for (int i = 0; i < values.size(); ++i) { |
|
531 |
QString sourceFileName = values.at(i); |
|
532 |
t << "SOURCE\t\t" << sourceFileName << endl; |
|
533 |
} |
|
534 |
t << endl; |
|
535 |
} |
|
536 |
t << endl; |
|
537 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
538 |
if (!project->isActiveConfig("static") && !project->isActiveConfig("staticlib")) { |
0 | 539 |
writeMmpFileLibraryPart(t); |
540 |
} |
|
541 |
||
542 |
writeMmpFileCapabilityPart(t); |
|
543 |
||
544 |
writeMmpFileCompilerOptionPart(t); |
|
545 |
||
546 |
writeMmpFileBinaryVersionPart(t); |
|
547 |
||
548 |
writeMmpFileRulesPart(t); |
|
549 |
} else { |
|
550 |
PRINT_FILE_CREATE_ERROR(filename) |
|
551 |
} |
|
552 |
} |
|
553 |
||
554 |
void SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) |
|
555 |
{ |
|
556 |
t << endl; |
|
557 |
||
558 |
QStringList &defines = project->values("DEFINES"); |
|
559 |
if (defines.size()) |
|
560 |
t << "// Qt Macros" << endl; |
|
561 |
for (int i = 0; i < defines.size(); ++i) { |
|
562 |
QString def = defines.at(i); |
|
563 |
addMacro(t, def); |
|
564 |
} |
|
565 |
||
566 |
// These are required in order that all methods will be correctly exported e.g from qtestlib |
|
567 |
QStringList &exp_defines = project->values("PRL_EXPORT_DEFINES"); |
|
568 |
if (exp_defines.size()) |
|
569 |
t << endl << "// Qt Export Defines" << endl; |
|
570 |
for (int i = 0; i < exp_defines.size(); ++i) { |
|
571 |
QString def = exp_defines.at(i); |
|
572 |
addMacro(t, def); |
|
573 |
} |
|
574 |
||
575 |
t << endl; |
|
576 |
} |
|
577 |
||
578 |
void SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) |
|
579 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
580 |
t << "MACRO\t\t" << value << endl; |
0 | 581 |
} |
582 |
||
583 |
||
584 |
void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) |
|
585 |
{ |
|
586 |
bool skipTargetType = overriddenMmpKeywords.contains(MMP_TARGETTYPE); |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
587 |
bool skipEpocHeapSize = overriddenMmpKeywords.contains(MMP_EPOCHEAPSIZE); |
0 | 588 |
|
589 |
if (targetType == TypeExe) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
590 |
t << MMP_TARGET "\t\t" << fixedTarget << ".exe" << endl; |
0 | 591 |
if (!skipTargetType) { |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
592 |
if (project->isActiveConfig("stdbinary")) |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
593 |
t << MMP_TARGETTYPE "\t\tSTDEXE" << endl; |
0 | 594 |
else |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
595 |
t << MMP_TARGETTYPE "\t\tEXE" << endl; |
0 | 596 |
} |
597 |
} else if (targetType == TypeDll || targetType == TypePlugin) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
598 |
t << MMP_TARGET "\t\t" << fixedTarget << ".dll" << endl; |
0 | 599 |
if (!skipTargetType) { |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
600 |
if (project->isActiveConfig("stdbinary")) |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
601 |
t << MMP_TARGETTYPE "\t\tSTDDLL" << endl; |
0 | 602 |
else |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
603 |
t << MMP_TARGETTYPE "\t\tDLL" << endl; |
0 | 604 |
} |
605 |
} else if (targetType == TypeLib) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
606 |
t << MMP_TARGET "\t\t" << fixedTarget << ".lib" << endl; |
0 | 607 |
if (!skipTargetType) { |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
608 |
if (project->isActiveConfig("stdbinary")) |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
609 |
t << MMP_TARGETTYPE "\t\tSTDLIB" << endl; |
0 | 610 |
else |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
611 |
t << MMP_TARGETTYPE "\t\tLIB" << endl; |
0 | 612 |
} |
613 |
} else { |
|
614 |
fprintf(stderr, "Error: Unexpected targettype (%d) in SymbianMakefileGenerator::writeMmpFileTargetPart\n", targetType); |
|
615 |
} |
|
616 |
||
617 |
t << endl; |
|
618 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
619 |
t << MMP_UID "\t\t" << uid2 << " " << uid3 << endl; |
0 | 620 |
|
621 |
if (0 != project->values("TARGET.SID").size()) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
622 |
t << MMP_SECUREID "\t\t" << project->values("TARGET.SID").join(" ") << endl; |
0 | 623 |
} else { |
624 |
if (0 == uid3.size()) |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
625 |
t << MMP_SECUREID "\t\t0" << endl; |
0 | 626 |
else |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
627 |
t << MMP_SECUREID "\t\t" << uid3 << endl; |
0 | 628 |
} |
629 |
||
630 |
// default value used from mkspecs is 0 |
|
631 |
if (0 != project->values("TARGET.VID").size()) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
632 |
t << MMP_VENDORID "\t\t" << project->values("TARGET.VID").join(" ") << endl; |
0 | 633 |
} |
634 |
||
635 |
t << endl; |
|
636 |
||
637 |
if (0 != project->first("TARGET.EPOCSTACKSIZE").size()) |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
638 |
t << MMP_EPOCSTACKSIZE "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl; |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
639 |
if (!skipEpocHeapSize && 0 != project->values("TARGET.EPOCHEAPSIZE").size()) |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
640 |
t << MMP_EPOCHEAPSIZE "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl; |
0 | 641 |
if (0 != project->values("TARGET.EPOCALLOWDLLDATA").size()) |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
642 |
t << MMP_EPOCALLOWDLLDATA << endl; |
0 | 643 |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
644 |
if (targetType == TypePlugin && !project->isActiveConfig("stdbinary")) { |
0 | 645 |
// Use custom def file for Qt plugins |
646 |
t << "DEFFILE " PLUGIN_COMMON_DEF_FILE_FOR_MMP << endl; |
|
647 |
} |
|
648 |
||
649 |
t << endl; |
|
650 |
} |
|
651 |
||
652 |
||
653 |
/* |
|
654 |
Application registration resource files should be installed to the |
|
655 |
\private\10003a3f\import\apps directory. |
|
656 |
*/ |
|
657 |
void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) |
|
658 |
{ |
|
659 |
if ((targetType == TypeExe) && |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
660 |
!project->isActiveConfig("no_icon")) { |
0 | 661 |
|
662 |
QString locTarget = fixedTarget; |
|
663 |
locTarget.append(".rss"); |
|
664 |
||
665 |
t << "SOURCEPATH\t\t\t. " << endl; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
666 |
|
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
667 |
//QTP: org 47 start |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
668 |
/* t << "LANG SC "; // no endl |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
669 |
foreach(QString lang, symbianLangCodes) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
670 |
t << lang << " "; // no endl |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
671 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
672 |
t << endl; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
673 |
t << MMP_START_RESOURCE "\t\t" << locTarget << endl; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
674 |
t << "HEADER" << endl; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
675 |
t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP << endl; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
676 |
t << MMP_END_RESOURCE << endl << endl;*/ |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
677 |
//QTP: org 47 end |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
678 |
|
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
679 |
//QTP: loc change start |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
680 |
if (!project->values("SYMBIANTRANSLATIONS").isEmpty()) { |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
681 |
t << MMP_START_RESOURCE "\t\t" << locTarget << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
682 |
t << "LANGUAGE_IDS" << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
683 |
t << "HEADER" << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
684 |
t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
685 |
t << MMP_END_RESOURCE << endl << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
686 |
} else { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
687 |
t << "LANG SC "; // no endl |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
688 |
foreach(QString lang, symbianLangCodes) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
689 |
t << lang << " "; // no endl |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
690 |
} |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
691 |
t << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
692 |
t << MMP_START_RESOURCE "\t\t" << locTarget << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
693 |
t << "HEADER" << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
694 |
t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
695 |
t << MMP_END_RESOURCE << endl << endl; |
0 | 696 |
} |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
697 |
//QTP: loc change end |
0 | 698 |
QString regTarget = fixedTarget; |
699 |
regTarget.append("_reg.rss"); |
|
700 |
||
701 |
t << "SOURCEPATH\t\t\t." << endl; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
702 |
t << MMP_START_RESOURCE "\t\t" << regTarget << endl; |
0 | 703 |
if (isForSymbianSbsv2()) |
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
704 |
t << "DEPENDS " << fixedTarget.toLower() << ".rsg" << endl; |
0 | 705 |
t << "TARGETPATH\t\t" REGISTRATION_RESOURCE_DIRECTORY_HW << endl; |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
706 |
t << MMP_END_RESOURCE << endl << endl; |
0 | 707 |
} |
708 |
} |
|
709 |
||
710 |
void SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) |
|
711 |
{ |
|
712 |
QDir current = QDir::current(); |
|
713 |
||
714 |
for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { |
|
715 |
QStringList values = it.value(); |
|
716 |
for (int i = 0; i < values.size(); ++i) { |
|
717 |
QString handledPath = values.at(i); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
718 |
t << "SYSTEMINCLUDE\t\t" << fixPathForMmp(handledPath, current) << endl; |
0 | 719 |
} |
720 |
} |
|
721 |
||
722 |
t << endl; |
|
723 |
} |
|
724 |
||
725 |
void SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t) |
|
726 |
{ |
|
727 |
writeMmpFileSystemIncludePart(t); |
|
728 |
} |
|
729 |
||
730 |
void SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) |
|
731 |
{ |
|
732 |
QStringList &libs = project->values("LIBS"); |
|
733 |
libs << project->values("QMAKE_LIBS") << project->values("QMAKE_LIBS_PRIVATE"); |
|
734 |
||
735 |
removeDuplicatedStrings(libs); |
|
736 |
||
737 |
for (int i = 0; i < libs.size(); ++i) { |
|
738 |
QString lib = libs.at(i); |
|
739 |
// The -L flag is uninteresting, since all symbian libraries exist in the same directory. |
|
740 |
if (lib.startsWith("-l")) { |
|
741 |
lib.remove(0, 2); |
|
742 |
QString mmpStatement; |
|
743 |
if (lib.endsWith(".dll")) { |
|
744 |
lib.chop(4); |
|
745 |
mmpStatement = "LIBRARY\t\t"; |
|
746 |
} else if (lib.endsWith(".lib")) { |
|
747 |
lib.chop(4); |
|
748 |
mmpStatement = "STATICLIBRARY\t"; |
|
749 |
} else { |
|
750 |
// Hacky way to find out what kind of library it is. Check the |
|
751 |
// ARMV5 build directory for library type. We default to shared |
|
752 |
// library, since that is more common. |
|
753 |
QString udebStaticLibLocation(epocRoot()); |
|
754 |
QString urelStaticLibLocation(udebStaticLibLocation); |
|
755 |
udebStaticLibLocation += QString("epoc32/release/armv5/udeb/%1.lib").arg(lib); |
|
756 |
urelStaticLibLocation += QString("epoc32/release/armv5/urel/%1.lib").arg(lib); |
|
757 |
if (QFile::exists(udebStaticLibLocation) || QFile::exists(urelStaticLibLocation)) { |
|
758 |
mmpStatement = "STATICLIBRARY\t"; |
|
759 |
} else { |
|
760 |
mmpStatement = "LIBRARY\t\t"; |
|
761 |
} |
|
762 |
} |
|
763 |
t << mmpStatement << lib << ".lib" << endl; |
|
764 |
} |
|
765 |
} |
|
766 |
||
767 |
t << endl; |
|
768 |
} |
|
769 |
||
770 |
void SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) |
|
771 |
{ |
|
772 |
if (0 != project->first("TARGET.CAPABILITY").size()) { |
|
773 |
QStringList &capabilities = project->values("TARGET.CAPABILITY"); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
774 |
t << MMP_CAPABILITY "\t\t"; |
0 | 775 |
|
776 |
for (int i = 0; i < capabilities.size(); ++i) { |
|
777 |
QString cap = capabilities.at(i); |
|
778 |
t << cap << " "; |
|
779 |
} |
|
780 |
} else { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
781 |
t << MMP_CAPABILITY "\t\tNone"; |
0 | 782 |
} |
783 |
t << endl << endl; |
|
784 |
} |
|
785 |
||
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
786 |
void SymbianMakefileGenerator::writeMmpFileConditionalOptions(QTextStream& t, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
787 |
const QString &optionType, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
788 |
const QString &optionTag, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
789 |
const QString &variableBase) |
0 | 790 |
{ |
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
791 |
foreach(QString compilerVersion, project->values("VERSION_FLAGS." + optionTag)) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
792 |
QStringList currentValues = project->values(variableBase + "." + compilerVersion); |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
793 |
if (currentValues.size()) { |
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
794 |
t << "#if defined(" << compilerVersion << ")" << endl; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
795 |
t << optionType << " " << optionTag << " " << currentValues.join(" ") << endl; |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
796 |
t << "#endif" << endl; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
797 |
} |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
798 |
} |
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
799 |
} |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
800 |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
801 |
void SymbianMakefileGenerator::writeMmpFileSimpleOption(QTextStream& t, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
802 |
const QString &optionType, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
803 |
const QString &optionTag, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
804 |
const QString &options) |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
805 |
{ |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
806 |
QString trimmedOptions = options.trimmed(); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
807 |
if (!trimmedOptions.isEmpty()) |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
808 |
t << optionType << " " << optionTag << " " << trimmedOptions << endl; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
809 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
810 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
811 |
void SymbianMakefileGenerator::appendMmpFileOptions(QString &options, const QStringList &list) |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
812 |
{ |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
813 |
if (list.size()) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
814 |
options.append(list.join(" ")); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
815 |
options.append(" "); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
816 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
817 |
} |
0 | 818 |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
819 |
void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
820 |
{ |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
821 |
QStringList keywords = project->values("MMP_OPTION_KEYWORDS"); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
822 |
QStringList commonCxxFlags = project->values(VAR_CXXFLAGS); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
823 |
QStringList commonCFlags = project->values(VAR_CFLAGS); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
824 |
QStringList commonLFlags = project->values(VAR_LFLAGS); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
825 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
826 |
foreach(QString item, keywords) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
827 |
QString compilerOption; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
828 |
QString linkerOption; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
829 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
830 |
appendMmpFileOptions(compilerOption, project->values(VAR_CXXFLAGS "." + item)); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
831 |
appendMmpFileOptions(compilerOption, project->values(VAR_CFLAGS "." + item)); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
832 |
appendMmpFileOptions(compilerOption, commonCxxFlags); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
833 |
appendMmpFileOptions(compilerOption, commonCFlags); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
834 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
835 |
appendMmpFileOptions(linkerOption, project->values(VAR_LFLAGS "." + item)); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
836 |
appendMmpFileOptions(linkerOption, commonLFlags); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
837 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
838 |
writeMmpFileSimpleOption(t, MMP_OPTION, item, compilerOption); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
839 |
writeMmpFileSimpleOption(t, MMP_LINKEROPTION, item, linkerOption); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
840 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
841 |
writeMmpFileConditionalOptions(t, MMP_OPTION, item, VAR_CXXFLAGS); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
842 |
writeMmpFileConditionalOptions(t, MMP_LINKEROPTION, item, VAR_LFLAGS); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
843 |
} |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
844 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
845 |
t << endl; |
0 | 846 |
} |
847 |
||
848 |
void SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) |
|
849 |
{ |
|
850 |
QString applicationVersion = project->first("VERSION"); |
|
851 |
QStringList verNumList = applicationVersion.split('.'); |
|
852 |
uint major = 0; |
|
853 |
uint minor = 0; |
|
854 |
uint patch = 0; |
|
855 |
bool success = false; |
|
856 |
||
857 |
if (verNumList.size() > 0) { |
|
858 |
major = verNumList[0].toUInt(&success); |
|
859 |
if (success && verNumList.size() > 1) { |
|
860 |
minor = verNumList[1].toUInt(&success); |
|
861 |
if (success && verNumList.size() > 2) { |
|
862 |
patch = verNumList[2].toUInt(&success); |
|
863 |
} |
|
864 |
} |
|
865 |
} |
|
866 |
||
867 |
QString mmpVersion; |
|
868 |
if (success && major <= 0xFFFF && minor <= 0xFF && patch <= 0xFF) { |
|
869 |
// Symbian binary version only has major and minor components, so compress |
|
870 |
// Qt's minor and patch values into the minor component. Since Symbian's minor |
|
871 |
// component is a 16 bit value, only allow 8 bits for each to avoid overflow. |
|
872 |
mmpVersion.append(QString::number(major)) |
|
873 |
.append('.') |
|
874 |
.append(QString::number((minor << 8) + patch)); |
|
875 |
} else { |
|
876 |
if (!applicationVersion.isEmpty()) |
|
877 |
fprintf(stderr, "Invalid VERSION string: %s\n", qPrintable(applicationVersion)); |
|
878 |
mmpVersion = "10.0"; // Default binary version for symbian is 10.0 |
|
879 |
} |
|
880 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
881 |
t << MMP_VERSION " " << mmpVersion << endl; |
0 | 882 |
} |
883 |
||
884 |
void SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) |
|
885 |
{ |
|
886 |
foreach(QString item, project->values("MMP_RULES")) { |
|
887 |
t << endl; |
|
888 |
// If there is no stringlist defined for a rule, use rule name directly |
|
889 |
// This is convenience for defining single line mmp statements |
|
890 |
if (project->values(item).isEmpty()) { |
|
891 |
t << item << endl; |
|
892 |
} else { |
|
893 |
foreach(QString itemRow, project->values(item)) { |
|
894 |
t << itemRow << endl; |
|
895 |
} |
|
896 |
} |
|
897 |
} |
|
898 |
} |
|
899 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
900 |
void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension, const QString &iconFile) |
0 | 901 |
{ |
902 |
// Read user defined bld inf rules |
|
903 |
||
904 |
QMap<QString, QStringList> userBldInfRules; |
|
905 |
for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { |
|
906 |
if (it.key().startsWith(BLD_INF_RULES_BASE)) { |
|
907 |
QString newKey = it.key().mid(sizeof(BLD_INF_RULES_BASE) - 1); |
|
908 |
if (newKey.isEmpty()) { |
|
909 |
fprintf(stderr, "Warning: Empty BLD_INF_RULES key encountered\n"); |
|
910 |
continue; |
|
911 |
} |
|
912 |
QStringList newValues; |
|
913 |
QStringList values = it.value(); |
|
914 |
foreach(QString item, values) { |
|
915 |
// If there is no stringlist defined for a rule, use rule name directly |
|
916 |
// This is convenience for defining single line statements |
|
917 |
if (project->values(item).isEmpty()) { |
|
918 |
newValues << item; |
|
919 |
} else { |
|
920 |
foreach(QString itemRow, project->values(item)) { |
|
921 |
newValues << itemRow; |
|
922 |
} |
|
923 |
} |
|
924 |
} |
|
925 |
userBldInfRules.insert(newKey, newValues); |
|
926 |
} |
|
927 |
} |
|
928 |
||
929 |
// Add includes of subdirs bld.inf files |
|
930 |
||
931 |
QString currentPath = qmake_getpwd(); |
|
932 |
QDir directory(currentPath); |
|
933 |
||
934 |
const QStringList &subdirs = project->values("SUBDIRS"); |
|
935 |
foreach(QString item, subdirs) { |
|
936 |
QString fixedItem; |
|
937 |
if (!project->isEmpty(item + ".file")) { |
|
938 |
fixedItem = project->first(item + ".file"); |
|
939 |
} else if (!project->isEmpty(item + ".subdir")) { |
|
940 |
fixedItem = project->first(item + ".subdir"); |
|
941 |
} else { |
|
942 |
fixedItem = item; |
|
943 |
} |
|
944 |
||
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
945 |
QString condition; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
946 |
if (!project->isEmpty(item + ".condition")) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
947 |
condition = project->first(item + ".condition"); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
948 |
|
0 | 949 |
QFileInfo subdir(fileInfo(fixedItem)); |
950 |
QString relativePath = directory.relativeFilePath(fixedItem); |
|
951 |
QString subdirFileName = subdir.completeBaseName(); |
|
952 |
QString fullProName = subdir.absoluteFilePath();; |
|
953 |
QString bldinfFilename; |
|
954 |
||
955 |
if (subdir.isDir()) { |
|
956 |
// Subdir is a regular project |
|
957 |
bldinfFilename = relativePath + QString("/") + QString(BLD_INF_FILENAME); |
|
958 |
fullProName += QString("/") + subdirFileName + Option::pro_ext; |
|
959 |
} else { |
|
960 |
// Subdir is actually a .pro file |
|
961 |
if (relativePath.contains("/")) { |
|
962 |
// .pro not in same directory as parent .pro |
|
963 |
relativePath.remove(relativePath.lastIndexOf("/") + 1, relativePath.length()); |
|
964 |
bldinfFilename = relativePath; |
|
965 |
} else { |
|
966 |
// .pro and parent .pro in same directory |
|
967 |
bldinfFilename = QString("./"); |
|
968 |
} |
|
969 |
bldinfFilename += QString(BLD_INF_FILENAME ".") + subdirFileName; |
|
970 |
} |
|
971 |
||
972 |
QString uid = generate_uid(fullProName); |
|
973 |
QString bldinfDefine = QString("BLD_INF_") + subdirFileName + QString("_") + uid; |
|
974 |
bldinfDefine = bldinfDefine.toUpper(); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
975 |
removeEpocSpecialCharacters(bldinfDefine); |
0 | 976 |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
977 |
if (!condition.isEmpty()) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
978 |
t << "#if defined(" << condition << ")" << endl; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
979 |
|
0 | 980 |
t << "#ifndef " << bldinfDefine << endl; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
981 |
t << "\t#include \"" << bldinfFilename << "\"" << endl; |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
982 |
t << "#endif" << endl; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
983 |
|
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
984 |
if (!condition.isEmpty()) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
985 |
t << "#endif" << endl; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
986 |
|
0 | 987 |
} |
988 |
||
989 |
// Add supported project platforms |
|
990 |
||
991 |
t << endl << BLD_INF_TAG_PLATFORMS << endl << endl; |
|
992 |
if (0 != project->values("SYMBIAN_PLATFORMS").size()) |
|
993 |
t << project->values("SYMBIAN_PLATFORMS").join(" ") << endl; |
|
994 |
||
995 |
QStringList userItems = userBldInfRules.value(BLD_INF_TAG_PLATFORMS); |
|
996 |
foreach(QString item, userItems) |
|
997 |
t << item << endl; |
|
998 |
userBldInfRules.remove(BLD_INF_TAG_PLATFORMS); |
|
999 |
t << endl; |
|
1000 |
||
1001 |
// Add project mmps and old style extension makefiles |
|
1002 |
||
1003 |
QString mmpTag; |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1004 |
if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) |
0 | 1005 |
mmpTag = QLatin1String(BLD_INF_TAG_TESTMMPFILES); |
1006 |
else |
|
1007 |
mmpTag = QLatin1String(BLD_INF_TAG_MMPFILES); |
|
1008 |
||
1009 |
t << endl << mmpTag << endl << endl; |
|
1010 |
||
1011 |
writeBldInfMkFilePart(t, addDeploymentExtension); |
|
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1012 |
if (targetType != TypeSubdirs) |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1013 |
t << mmpFileName << endl; |
0 | 1014 |
|
1015 |
userItems = userBldInfRules.value(mmpTag); |
|
1016 |
foreach(QString item, userItems) |
|
1017 |
t << item << endl; |
|
1018 |
userBldInfRules.remove(mmpTag); |
|
1019 |
||
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1020 |
QString extensionTag; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1021 |
if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1022 |
extensionTag = QLatin1String(BLD_INF_TAG_TESTEXTENSIONS); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1023 |
else |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1024 |
extensionTag = QLatin1String(BLD_INF_TAG_EXTENSIONS); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1025 |
|
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1026 |
t << endl << extensionTag << endl << endl; |
0 | 1027 |
|
1028 |
// Generate extension rules |
|
1029 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1030 |
writeBldInfExtensionRulesPart(t, iconFile); |
0 | 1031 |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1032 |
userItems = userBldInfRules.value(extensionTag); |
0 | 1033 |
foreach(QString item, userItems) |
1034 |
t << item << endl; |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1035 |
userBldInfRules.remove(extensionTag); |
0 | 1036 |
|
1037 |
// Add rest of the user defined content |
|
1038 |
||
1039 |
for (QMap<QString, QStringList>::iterator it = userBldInfRules.begin(); it != userBldInfRules.end(); ++it) { |
|
1040 |
t << endl << endl << it.key() << endl << endl; |
|
1041 |
userItems = it.value(); |
|
1042 |
foreach(QString item, userItems) |
|
1043 |
t << item << endl; |
|
1044 |
} |
|
1045 |
} |
|
1046 |
||
1047 |
void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QString value) |
|
1048 |
{ |
|
1049 |
if (!list.contains(value)) |
|
1050 |
list += value; |
|
1051 |
} |
|
1052 |
||
1053 |
void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QStringList values) |
|
1054 |
{ |
|
1055 |
foreach(QString item, values) |
|
1056 |
appendIfnotExist(list, item); |
|
1057 |
} |
|
1058 |
||
1059 |
||
1060 |
QString SymbianMakefileGenerator::removeTrailingPathSeparators(QString &file) |
|
1061 |
{ |
|
1062 |
QString ret = file; |
|
1063 |
if (ret.endsWith(QDir::separator())) { |
|
1064 |
ret.remove(ret.length() - 1, 1); |
|
1065 |
} |
|
1066 |
||
1067 |
return ret; |
|
1068 |
} |
|
1069 |
||
1070 |
void SymbianMakefileGenerator::generateCleanCommands(QTextStream& t, |
|
1071 |
const QStringList& toClean, |
|
1072 |
const QString& cmd, |
|
1073 |
const QString& cmdOptions, |
|
1074 |
const QString& itemPrefix, |
|
1075 |
const QString& itemSuffix) |
|
1076 |
{ |
|
1077 |
for (int i = 0; i < toClean.size(); ++i) { |
|
1078 |
QString item = toClean.at(i); |
|
1079 |
item.prepend(itemPrefix).append(itemSuffix); |
|
1080 |
#if defined(Q_OS_WIN) |
|
1081 |
t << "\t-@ if EXIST \"" << QDir::toNativeSeparators(item) << "\" "; |
|
1082 |
t << cmd << " " << cmdOptions << " \"" << QDir::toNativeSeparators(item) << "\"" << endl; |
|
1083 |
#else |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
1084 |
t << "\t-if test -e " << QDir::toNativeSeparators(item) << "; then "; |
0 | 1085 |
t << cmd << " " << cmdOptions << " " << QDir::toNativeSeparators(item) << "; fi" << endl; |
1086 |
#endif |
|
1087 |
} |
|
1088 |
} |
|
1089 |
||
1090 |
void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) |
|
1091 |
{ |
|
1092 |
t << "dodistclean:" << endl; |
|
1093 |
const QStringList &subdirs = project->values("SUBDIRS"); |
|
1094 |
foreach(QString item, subdirs) { |
|
1095 |
bool fromFile = false; |
|
1096 |
QString fixedItem; |
|
1097 |
if (!project->isEmpty(item + ".file")) { |
|
1098 |
fixedItem = project->first(item + ".file"); |
|
1099 |
fromFile = true; |
|
1100 |
} else if (!project->isEmpty(item + ".subdir")) { |
|
1101 |
fixedItem = project->first(item + ".subdir"); |
|
1102 |
fromFile = false; |
|
1103 |
} else { |
|
1104 |
fromFile = item.endsWith(Option::pro_ext); |
|
1105 |
fixedItem = item; |
|
1106 |
} |
|
1107 |
QFileInfo fi(fileInfo(fixedItem)); |
|
1108 |
if (!fromFile) { |
|
1109 |
t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fi.absoluteFilePath() + "/Makefile") << "\" dodistclean" << endl; |
|
1110 |
} else { |
|
1111 |
QString itemName = fi.fileName(); |
|
1112 |
int extIndex = itemName.lastIndexOf(Option::pro_ext); |
|
1113 |
if (extIndex) |
|
1114 |
fixedItem = fi.absolutePath() + "/" + QString("Makefile.") + itemName.mid(0, extIndex); |
|
1115 |
t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fixedItem) << "\" dodistclean" << endl; |
|
1116 |
} |
|
1117 |
||
1118 |
} |
|
1119 |
||
1120 |
generatedFiles << Option::fixPathToTargetOS(fileInfo(Option::output.fileName()).absoluteFilePath()); // bld.inf |
|
1121 |
generatedFiles << project->values("QMAKE_INTERNAL_PRL_FILE"); // Add generated prl files for cleanup |
|
1122 |
generatedFiles << project->values("QMAKE_DISTCLEAN"); // Add any additional files marked for distclean |
|
1123 |
QStringList fixedFiles; |
|
1124 |
QStringList fixedDirs; |
|
1125 |
foreach(QString item, generatedFiles) { |
|
1126 |
QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); |
|
1127 |
if (!fixedFiles.contains(fixedItem)) { |
|
1128 |
fixedFiles << fixedItem; |
|
1129 |
} |
|
1130 |
} |
|
1131 |
foreach(QString item, generatedDirs) { |
|
1132 |
QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); |
|
1133 |
if (!fixedDirs.contains(fixedItem)) { |
|
1134 |
fixedDirs << fixedItem; |
|
1135 |
} |
|
1136 |
} |
|
1137 |
generateCleanCommands(t, fixedFiles, "$(DEL_FILE)", "", "", ""); |
|
1138 |
generateCleanCommands(t, fixedDirs, "$(DEL_DIR)", "", "", ""); |
|
1139 |
t << endl; |
|
1140 |
||
1141 |
t << "distclean: clean dodistclean" << endl; |
|
1142 |
t << endl; |
|
1143 |
} |