author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 19 Feb 2010 23:40:16 +0200 | |
branch | RCL_3 |
changeset 4 | 3b1da2848fc7 |
parent 3 | 41300fa6a67c |
child 5 | d3bac044e0f0 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
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_abld.h" |
|
43 |
#include "initprojectdeploy_symbian.h" |
|
44 |
||
45 |
#include <qstring.h> |
|
46 |
#include <qstringlist.h> |
|
47 |
#include <qdir.h> |
|
48 |
#include <qdatetime.h> |
|
49 |
#include <qdebug.h> |
|
50 |
||
51 |
#define DO_NOTHING_TARGET "do_nothing" |
|
52 |
#define CREATE_TEMPS_TARGET "create_temps" |
|
53 |
#define EXTENSION_CLEAN "extension_clean" |
|
54 |
#define PRE_TARGETDEPS_TARGET "pre_targetdeps" |
|
55 |
#define COMPILER_CLEAN_TARGET "compiler_clean" |
|
56 |
#define FINALIZE_TARGET "finalize" |
|
57 |
#define GENERATED_SOURCES_TARGET "generated_sources" |
|
58 |
#define ALL_SOURCE_DEPS_TARGET "all_source_deps" |
|
59 |
//:QTP:QTPROD-92 Deployment of plugins requires WINSCW build before ARM build |
|
60 |
#define DEPLOYMENT_TARGET "deployment" |
|
61 |
#define DEPLOYMENT_CLEAN_TARGET "deployment_clean" |
|
62 |
#define WINSCW_DEPLOYMENT_TARGET "winscw_deployment" |
|
63 |
#define WINSCW_DEPLOYMENT_CLEAN_TARGET "winscw_deployment_clean" |
|
64 |
/* :QTP:QTPROD-155: Don't write .make.cache during the compilation, it causes dependency problems in |
|
65 |
* the parallel build clusters |
|
66 |
*/ |
|
67 |
#define STORE_BUILD_TARGET "" |
|
68 |
||
69 |
SymbianAbldMakefileGenerator::SymbianAbldMakefileGenerator() : SymbianMakefileGenerator() { } |
|
70 |
SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } |
|
71 |
||
72 |
void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) |
|
73 |
{ |
|
74 |
QString gnuMakefileName = QLatin1String("Makefile_") + uid3; |
|
75 |
removeSpecialCharacters(gnuMakefileName); |
|
76 |
gnuMakefileName.append(".mk"); |
|
77 |
||
78 |
QFile ft(gnuMakefileName); |
|
79 |
if (ft.open(QIODevice::WriteOnly)) { |
|
80 |
if (Option::mkfile::listgen) { |
|
81 |
generatePrint(fileInfo(ft.fileName()).absoluteFilePath()); |
|
82 |
} |
|
83 |
generatedFiles << ft.fileName(); |
|
84 |
QTextStream t(&ft); |
|
85 |
||
86 |
t << "# ==============================================================================" << endl; |
|
87 |
t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
88 |
t << QDateTime::currentDateTime().toString() << endl; |
|
89 |
t << "# This file is generated by qmake and should not be modified by the" << endl; |
|
90 |
t << "# user." << endl; |
|
91 |
t << "# Name : " << gnuMakefileName << endl; |
|
92 |
t << "# Part of : " << project->values("TARGET").join(" ") << endl; |
|
93 |
t << "# Description : This file is used to call necessary targets on wrapper makefile" << endl; |
|
94 |
t << "# during normal Symbian build process." << endl; |
|
95 |
t << "# Version : " << endl; |
|
96 |
t << "#" << endl; |
|
97 |
t << "# ==============================================================================" << "\n" << endl; |
|
98 |
||
99 |
t << endl << endl; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
100 |
|
0 | 101 |
t << "MAKE = make" << endl; |
102 |
t << endl; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
103 |
|
0 | 104 |
t << "VISUAL_CFG = RELEASE" << endl; |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
105 |
t << "ifeq \"$(CFG)\" \"UDEB\"" << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
106 |
t << "VISUAL_CFG = DEBUG" << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
107 |
t << "endif" << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
108 |
t << endl; |
0 | 109 |
|
110 |
t << DO_NOTHING_TARGET " :" << endl; |
|
111 |
t << "\t" << "@rem " DO_NOTHING_TARGET << endl << endl; |
|
112 |
||
113 |
QString buildDeps; |
|
114 |
QString cleanDeps; |
|
115 |
QString finalDeps; |
|
116 |
QString cleanDepsWinscw; |
|
117 |
QString finalDepsWinscw; |
|
118 |
QStringList wrapperTargets; |
|
119 |
//:QTP:QTPROD-92 Deployment of plugins requires WINSCW build before ARM build |
|
120 |
if (deploymentOnly) { |
|
121 |
buildDeps.append(STORE_BUILD_TARGET); |
|
122 |
cleanDeps.append(DEPLOYMENT_CLEAN_TARGET); |
|
123 |
cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET); |
|
124 |
finalDeps.append(DEPLOYMENT_TARGET); |
|
125 |
finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET); |
|
126 |
wrapperTargets << WINSCW_DEPLOYMENT_TARGET |
|
127 |
<< WINSCW_DEPLOYMENT_CLEAN_TARGET |
|
128 |
<< DEPLOYMENT_TARGET |
|
129 |
<< DEPLOYMENT_CLEAN_TARGET |
|
130 |
<< STORE_BUILD_TARGET; |
|
131 |
} else { |
|
132 |
buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET " " STORE_BUILD_TARGET); |
|
133 |
cleanDeps.append(EXTENSION_CLEAN " " DEPLOYMENT_CLEAN_TARGET); |
|
134 |
cleanDepsWinscw.append(EXTENSION_CLEAN " " WINSCW_DEPLOYMENT_CLEAN_TARGET); |
|
135 |
finalDeps.append(FINALIZE_TARGET " " DEPLOYMENT_TARGET); |
|
136 |
finalDepsWinscw.append(FINALIZE_TARGET " " WINSCW_DEPLOYMENT_TARGET); |
|
137 |
wrapperTargets << PRE_TARGETDEPS_TARGET |
|
138 |
<< CREATE_TEMPS_TARGET |
|
139 |
<< EXTENSION_CLEAN |
|
140 |
<< FINALIZE_TARGET |
|
141 |
<< WINSCW_DEPLOYMENT_CLEAN_TARGET |
|
142 |
<< WINSCW_DEPLOYMENT_TARGET |
|
143 |
<< DEPLOYMENT_CLEAN_TARGET |
|
144 |
<< DEPLOYMENT_TARGET |
|
145 |
<< STORE_BUILD_TARGET; |
|
146 |
} |
|
147 |
||
148 |
t << "MAKMAKE: " << buildDeps << endl << endl; |
|
149 |
t << "LIB: " << buildDeps << endl << endl; |
|
150 |
t << "BLD: " << buildDeps << endl << endl; |
|
151 |
t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl; |
|
152 |
t << "CLEAN: " << cleanDepsWinscw << endl; |
|
153 |
t << "else" << endl; |
|
154 |
t << "CLEAN: " << cleanDeps << endl; |
|
155 |
t << "endif" << endl << endl; |
|
156 |
t << "CLEANLIB: " DO_NOTHING_TARGET << endl << endl; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
157 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
158 |
QStringList qmFileNames; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
159 |
QString translationFilename = project->first("TRANSLATIONS"); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
160 |
if (!project->values("SYMBIANTRANSLATIONS").isEmpty() && !translationFilename.isEmpty()) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
161 |
QStringList symbianTranslations = project->values("SYMBIANTRANSLATIONS"); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
162 |
QString symbianTrPath = project->first("SYMBIANTRANSLATIONDIR"); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
163 |
t << "RESOURCE: create_qm" << endl << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
164 |
t << "create_qm : " << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
165 |
foreach (const QString &symbianTrans, symbianTranslations) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
166 |
QString translationTsFilename(translationFilename); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
167 |
translationTsFilename.chop(3); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
168 |
translationTsFilename.insert(0,symbianTrPath); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
169 |
translationTsFilename.append(QString::fromLatin1("_")); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
170 |
translationTsFilename.append(symbianTrans); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
171 |
QString translationQmFilename(translationTsFilename); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
172 |
translationTsFilename.append(QString::fromLatin1(".ts")); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
173 |
translationQmFilename.append(QString::fromLatin1(".qm")); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
174 |
t << "\t$(EPOCROOT)epoc32\\tools\\qt\\lrelease -silent -idbased " << translationTsFilename << " -qm " << translationQmFilename << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
175 |
// qmFileNames are needed in RELEASABLES: part |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
176 |
qmFileNames.append(translationQmFilename); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
177 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
178 |
t << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
179 |
} else { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
180 |
t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
181 |
} |
0 | 182 |
t << "FREEZE: " DO_NOTHING_TARGET << endl << endl; |
183 |
t << "SAVESPACE: " DO_NOTHING_TARGET << endl << endl; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
184 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
185 |
if (!project->values("SYMBIANTRANSLATIONS").isEmpty() && !qmFileNames.isEmpty()) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
186 |
t << "RELEASABLES: list_qm" << endl << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
187 |
t << "list_qm : " << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
188 |
foreach (const QString &qmFilename, qmFileNames) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
189 |
t << "\t@echo " << qmFilename << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
190 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
191 |
t << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
192 |
} else { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
193 |
t << "RELEASABLES: " DO_NOTHING_TARGET << endl << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
194 |
} |
0 | 195 |
t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl; |
196 |
t << "FINAL: " << finalDepsWinscw << endl; |
|
197 |
t << "else" << endl; |
|
198 |
t << "FINAL: " << finalDeps << endl; |
|
199 |
t << "endif" << endl << endl; |
|
200 |
||
201 |
QString makefile(Option::fixPathToTargetOS(fileInfo(wrapperFileName).canonicalFilePath())); |
|
202 |
foreach(QString target, wrapperTargets) { |
|
203 |
t << target << " : " << makefile << endl; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
204 |
t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << " QT_SIS_TARGET=$(VISUAL_CFG)-$(PLATFORM)" << endl << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
205 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
206 |
|
0 | 207 |
t << endl; |
208 |
} // if(ft.open(QIODevice::WriteOnly)) |
|
209 |
} |
|
210 |
||
211 |
void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) |
|
212 |
{ |
|
213 |
QStringList allPlatforms; |
|
214 |
foreach(QString platform, project->values("SYMBIAN_PLATFORMS")) { |
|
215 |
allPlatforms << platform.toLower(); |
|
216 |
} |
|
217 |
||
218 |
QStringList debugPlatforms = allPlatforms; |
|
219 |
QStringList releasePlatforms = allPlatforms; |
|
220 |
releasePlatforms.removeAll("winscw"); // No release for emulator |
|
221 |
||
222 |
QString testClause; |
|
223 |
if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) |
|
224 |
testClause = QLatin1String(" test"); |
|
225 |
else |
|
226 |
testClause = QLatin1String(""); |
|
227 |
||
228 |
QTextStream t(&wrapperFile); |
|
229 |
||
230 |
t << "# ==============================================================================" << endl; |
|
231 |
t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
232 |
t << QDateTime::currentDateTime().toString() << endl; |
|
233 |
t << "# This file is generated by qmake and should not be modified by the" << endl; |
|
234 |
t << "# user." << endl; |
|
235 |
t << "# Name : " << wrapperFile.fileName() << endl; |
|
236 |
t << "# Description : Wrapper Makefile for calling Symbian build tools" << endl; |
|
237 |
t << "#" << endl; |
|
238 |
t << "# ==============================================================================" << "\n" << endl; |
|
239 |
t << endl; |
|
240 |
||
241 |
t << "MAKEFILE = " << wrapperFile.fileName() << endl; |
|
242 |
t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl; |
|
243 |
t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
|
244 |
t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; |
|
245 |
t << "MOVE = " << var("QMAKE_MOVE") << endl; |
|
246 |
t << "XCOPY = xcopy /d /f /h /r /y /i" << endl; |
|
247 |
t << "ABLD = ABLD.BAT" << endl; |
|
248 |
t << "DEBUG_PLATFORMS = " << debugPlatforms.join(" ") << endl; |
|
249 |
t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl; |
|
250 |
t << "MAKE = make" << endl; |
|
251 |
t << endl; |
|
252 |
t << "ifeq (WINS,$(findstring WINS, $(PLATFORM)))" << endl; |
|
253 |
t << "ZDIR=$(EPOCROOT)epoc32\\release\\$(PLATFORM)\\$(CFG)\\Z" << endl; |
|
254 |
t << "else" << endl; |
|
255 |
t << "ZDIR=$(EPOCROOT)epoc32\\data\\z" << endl; |
|
256 |
t << "endif" << endl; |
|
257 |
t << endl; |
|
258 |
t << "DEFINES" << '\t' << " = " |
|
259 |
<< varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") |
|
260 |
<< varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ") |
|
261 |
<< varGlue("DEFINES","-D"," -D","") << endl; |
|
262 |
||
263 |
t << "INCPATH" << '\t' << " = "; |
|
264 |
||
265 |
for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { |
|
266 |
QStringList values = it.value(); |
|
267 |
for (int i = 0; i < values.size(); ++i) { |
|
268 |
t << " -I\"" << values.at(i) << "\""; |
|
269 |
} |
|
270 |
} |
|
271 |
t << endl; |
|
272 |
t << "first: default" << endl; |
|
273 |
if (debugPlatforms.contains("winscw")) |
|
274 |
t << "default: debug-winscw"; |
|
275 |
else if (debugPlatforms.contains("armv5")) |
|
276 |
t << "default: debug-armv5"; |
|
277 |
else if (debugPlatforms.size()) |
|
278 |
t << "default: debug-" << debugPlatforms.first(); |
|
279 |
else |
|
280 |
t << "default: all"; |
|
281 |
||
282 |
t << endl; |
|
283 |
if (!isPrimaryMakefile) { |
|
284 |
t << "all:" << endl; |
|
285 |
} else { |
|
286 |
t << "all: debug release" << endl; |
|
287 |
t << endl; |
|
288 |
t << "qmake:" << endl; |
|
289 |
t << "\t$(QMAKE) -spec symbian-abld -o \"" << fileInfo(Option::output.fileName()).fileName() |
|
290 |
<< "\" \"" << project->projectFile() << "\"" << endl; |
|
291 |
t << endl; |
|
292 |
t << BLD_INF_FILENAME ":" << endl; |
|
293 |
t << "\t$(QMAKE)" << endl; |
|
294 |
t << endl; |
|
295 |
t << "$(ABLD): " BLD_INF_FILENAME << endl; |
|
296 |
t << "\tbldmake bldfiles" << endl; |
|
297 |
t << endl; |
|
298 |
||
299 |
t << "debug: $(ABLD)" << endl; |
|
300 |
foreach(QString item, debugPlatforms) { |
|
301 |
t << "\t$(ABLD)" << testClause << " build " << item << " udeb" << endl; |
|
302 |
} |
|
303 |
t << endl; |
|
304 |
t << "release: $(ABLD)" << endl; |
|
305 |
foreach(QString item, releasePlatforms) { |
|
306 |
t << "\t$(ABLD)" << testClause << " build " << item << " urel" << endl; |
|
307 |
} |
|
308 |
t << endl; |
|
309 |
||
310 |
// For more specific builds, targets are in this form: build-platform, e.g. release-armv5 |
|
311 |
foreach(QString item, debugPlatforms) { |
|
312 |
t << "debug-" << item << ": $(ABLD)" << endl; |
|
313 |
t << "\t$(ABLD)" << testClause << " build " << item << " udeb" << endl; |
|
314 |
} |
|
315 |
||
316 |
foreach(QString item, releasePlatforms) { |
|
317 |
t << "release-" << item << ": $(ABLD)" << endl; |
|
318 |
t << "\t$(ABLD)" << testClause << " build " << item << " urel" << endl; |
|
319 |
} |
|
320 |
||
321 |
t << endl; |
|
322 |
t << "export: $(ABLD)" << endl; |
|
323 |
t << "\t$(ABLD)" << testClause << " export" << endl; |
|
324 |
t << endl; |
|
325 |
||
326 |
t << "cleanexport: $(ABLD)" << endl; |
|
327 |
t << "\t$(ABLD)" << testClause << " cleanexport" << endl; |
|
328 |
t << endl; |
|
329 |
||
330 |
} |
|
331 |
||
332 |
// pre_targetdeps target depends on: |
|
333 |
// - all targets specified in PRE_TARGETDEPS |
|
334 |
// - the GENERATED_SOURCES sources (so that they get generated) |
|
335 |
// - all dependencies of sources targeted for compilation |
|
336 |
// (mainly to ensure that any included UNUSED_SOURCES that need to be generated get generated) |
|
337 |
// |
|
338 |
// Unfortunately, Symbian build chain doesn't support linking generated objects to target, |
|
339 |
// so supporting generating sources is the best we can do. This is enough for mocs. |
|
340 |
||
341 |
if (targetType != TypeSubdirs) { |
|
342 |
writeExtraTargets(t); |
|
343 |
writeExtraCompilerTargets(t); |
|
344 |
||
345 |
t << CREATE_TEMPS_TARGET ":" << endl; |
|
346 |
// generate command lines like this ... |
|
347 |
// -@ if NOT EXIST ".\somedir" mkdir ".\somedir" |
|
348 |
QStringList dirsToClean; |
|
349 |
for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { |
|
350 |
QStringList values = it.value(); |
|
351 |
for (int i = 0; i < values.size(); ++i) { |
|
352 |
if (values.at(i).endsWith("/" QT_EXTRA_INCLUDE_DIR)) { |
|
353 |
QString fixedValue(QDir::toNativeSeparators(values.at(i))); |
|
354 |
dirsToClean << fixedValue; |
|
355 |
t << "\t-@ if NOT EXIST \"" << fixedValue << "\" mkdir \"" |
|
356 |
<< fixedValue << "\"" << endl; |
|
357 |
} |
|
358 |
} |
|
359 |
} |
|
360 |
t << endl; |
|
361 |
||
362 |
// Note: EXTENSION_CLEAN will get called many times when doing reallyclean |
|
363 |
// This is why the "2> NUL" gets appended to generated clean targets in makefile.cpp. |
|
364 |
t << EXTENSION_CLEAN ": " COMPILER_CLEAN_TARGET << endl; |
|
365 |
generateCleanCommands(t, dirsToClean, var("QMAKE_DEL_DIR"), " /S /Q ", "", ""); |
|
366 |
t << endl; |
|
367 |
||
368 |
t << PRE_TARGETDEPS_TARGET ":" |
|
369 |
<< MAKEFILE_DEPENDENCY_SEPARATOR GENERATED_SOURCES_TARGET |
|
370 |
<< MAKEFILE_DEPENDENCY_SEPARATOR ALL_SOURCE_DEPS_TARGET; |
|
371 |
if (project->values("PRE_TARGETDEPS").size()) |
|
372 |
t << MAKEFILE_DEPENDENCY_SEPARATOR << project->values("PRE_TARGETDEPS").join(MAKEFILE_DEPENDENCY_SEPARATOR); |
|
373 |
t << endl << endl; |
|
374 |
t << GENERATED_SOURCES_TARGET ":"; |
|
375 |
if (project->values("GENERATED_SOURCES").size()) |
|
376 |
t << MAKEFILE_DEPENDENCY_SEPARATOR << project->values("GENERATED_SOURCES").join(MAKEFILE_DEPENDENCY_SEPARATOR); |
|
377 |
t << endl << endl; |
|
378 |
t << ALL_SOURCE_DEPS_TARGET ":"; |
|
379 |
||
380 |
QStringList allDeps; |
|
381 |
for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { |
|
382 |
QString currentSourcePath = it.key(); |
|
383 |
QStringList values = it.value(); |
|
384 |
for (int i = 0; i < values.size(); ++i) { |
|
385 |
// we need additional check |
|
386 |
QString sourceFile = currentSourcePath + "/" + values.at(i); |
|
387 |
QStringList deps = findDependencies(QDir::toNativeSeparators(sourceFile)); |
|
388 |
appendIfnotExist(allDeps, deps); |
|
389 |
} |
|
390 |
} |
|
391 |
||
392 |
foreach(QString item, allDeps) { |
|
393 |
t << MAKEFILE_DEPENDENCY_SEPARATOR << item; |
|
394 |
} |
|
395 |
t << endl << endl; |
|
396 |
||
397 |
// Post link operations |
|
398 |
t << FINALIZE_TARGET ":" << endl; |
|
399 |
if (!project->isEmpty("QMAKE_POST_LINK")) { |
|
400 |
t << '\t' << var("QMAKE_POST_LINK"); |
|
401 |
t << endl; |
|
402 |
} |
|
403 |
t << endl; |
|
404 |
} else { |
|
405 |
QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets(); |
|
406 |
writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables | SubTargetSkipDefaultTargets); |
|
407 |
qDeleteAll(subtargets); |
|
408 |
} |
|
409 |
||
410 |
writeDeploymentTargets(t); |
|
411 |
//:QTP:QTPROD-92 Deployment of plugins requires WINSCW build before ARM build |
|
412 |
writeDeploymentTargets(t, true); |
|
413 |
||
414 |
writeSisTargets(t); |
|
415 |
||
416 |
/* :QTP:QTPROD-155: Don't write .make.cache during the compilation, it causes dependency problems in |
|
417 |
* the parallel build clusters |
|
418 |
writeStoreBuildTarget(t); |
|
419 |
*/ |
|
420 |
||
421 |
generateDistcleanTargets(t); |
|
422 |
||
423 |
t << "clean: $(ABLD)" << endl; |
|
424 |
t << "\t-$(ABLD)" << testClause << " reallyclean" << endl; |
|
425 |
t << "\t-bldmake clean" << endl; |
|
426 |
t << endl; |
|
427 |
||
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
428 |
t << "clean-debug: $(ABLD)" << endl; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
429 |
foreach(QString item, debugPlatforms) { |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
430 |
t << "\t$(ABLD)" << testClause << " reallyclean " << item << " udeb" << endl; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
431 |
} |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
432 |
t << endl; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
433 |
t << "clean-release: $(ABLD)" << endl; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
434 |
foreach(QString item, releasePlatforms) { |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
435 |
t << "\t$(ABLD)" << testClause << " reallyclean " << item << " urel" << endl; |
0 | 436 |
} |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
437 |
t << endl; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
438 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
439 |
// For more specific builds, targets are in this form: clean-build-platform, e.g. clean-release-armv5 |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
440 |
foreach(QString item, debugPlatforms) { |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
441 |
t << "clean-debug-" << item << ": $(ABLD)" << endl; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
442 |
t << "\t$(ABLD)" << testClause << " reallyclean " << item << " udeb" << endl; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
443 |
} |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
444 |
foreach(QString item, releasePlatforms) { |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
445 |
t << "clean-release-" << item << ": $(ABLD)" << endl; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
446 |
t << "\t$(ABLD)" << testClause << " reallyclean " << item << " urel" << endl; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
447 |
} |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
448 |
t << endl; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
449 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
450 |
generateExecutionTargets(t, debugPlatforms); |
0 | 451 |
} |
452 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
453 |
void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) |
0 | 454 |
{ |
455 |
// We don't use extensions for anything in abld |
|
456 |
Q_UNUSED(t); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
457 |
Q_UNUSED(iconTargetFile); |
0 | 458 |
} |
459 |
||
460 |
//:QTP:QTPROD-92 Deployment of plugins requires WINSCW build before ARM build |
|
461 |
bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t, bool isRelease /*= false*/) |
|
462 |
{ |
|
463 |
if (isRelease) |
|
464 |
t << DEPLOYMENT_TARGET ":" << endl; |
|
465 |
else |
|
466 |
t << WINSCW_DEPLOYMENT_TARGET ":" << endl; |
|
467 |
||
468 |
QString remoteTestPath = epocRoot() + QLatin1String( isRelease?"epoc32\\data\\z\\private\\":"epoc32\\winscw\\c\\private\\") |
|
469 |
+ privateDirUid; // default 4 OpenC; 4 all Symbian too |
|
470 |
DeploymentList depList; |
|
471 |
||
472 |
initProjectDeploySymbian(project, depList, remoteTestPath, false, QLatin1String(isRelease?"armv5":"winscw"), QLatin1String(isRelease?"urel":"udeb"), |
|
473 |
generatedDirs, generatedFiles); |
|
474 |
||
475 |
if (depList.size()) |
|
476 |
t << "\t-echo Deploying changed files..." << endl; |
|
477 |
for (int i = 0; i < depList.size(); ++i) { |
|
478 |
// Xcopy prompts for selecting file or directory if target doesn't exist, |
|
479 |
// and doesn't provide switch to force file selection. It does provide dir forcing, though, |
|
480 |
// so strip the last part of the destination. |
|
481 |
t << "\t-$(XCOPY) \"" << depList.at(i).from << "\" \"" << depList.at(i).to.left(depList.at(i).to.lastIndexOf("\\") + 1) << "\"" << endl; |
|
482 |
} |
|
483 |
||
484 |
t << endl; |
|
485 |
||
486 |
if (isRelease) |
|
487 |
t << DEPLOYMENT_CLEAN_TARGET ":" << endl; |
|
488 |
else |
|
489 |
t << WINSCW_DEPLOYMENT_CLEAN_TARGET ":" << endl; |
|
490 |
||
491 |
QStringList cleanList; |
|
492 |
for (int i = 0; i < depList.size(); ++i) { |
|
493 |
cleanList.append(depList.at(i).to); |
|
494 |
} |
|
495 |
generateCleanCommands(t, cleanList, "$(DEL_FILE)", "", "", ""); |
|
496 |
||
497 |
// Note: If deployment creates any directories, they will not get deleted after cleanup. |
|
498 |
// To do this in robust fashion could be quite complex. |
|
499 |
||
500 |
t << endl; |
|
501 |
||
502 |
return true; |
|
503 |
} |
|
504 |
||
505 |
void SymbianAbldMakefileGenerator::writeStoreBuildTarget(QTextStream &t) |
|
506 |
{ |
|
507 |
t << STORE_BUILD_TARGET ":" << endl; |
|
508 |
t << "\t@echo # ============================================================================== > " MAKE_CACHE_NAME << endl; |
|
509 |
t << "\t@echo # This file is generated by make and should not be modified by the user >> " MAKE_CACHE_NAME << endl; |
|
510 |
t << "\t@echo # Name : " << MAKE_CACHE_NAME << " >> " MAKE_CACHE_NAME << endl; |
|
511 |
t << "\t@echo # Part of : " << project->values("TARGET").join(" ") << " >> " MAKE_CACHE_NAME << endl; |
|
512 |
t << "\t@echo # Description : This file is used to cache last build target for >> " MAKE_CACHE_NAME << endl; |
|
513 |
t << "\t@echo # make sis target. >> " MAKE_CACHE_NAME << endl; |
|
514 |
t << "\t@echo # Version : >> " MAKE_CACHE_NAME << endl; |
|
515 |
t << "\t@echo # >> " MAKE_CACHE_NAME << endl; |
|
516 |
t << "\t@echo # ============================================================================== >> " MAKE_CACHE_NAME << endl; |
|
517 |
t << "\t@echo. >> " MAKE_CACHE_NAME << endl; |
|
518 |
t << "\t@echo QT_SIS_TARGET ?= $(QT_SIS_TARGET) >> " MAKE_CACHE_NAME << endl; |
|
519 |
t << endl; |
|
520 |
||
521 |
generatedFiles << MAKE_CACHE_NAME; |
|
522 |
} |
|
523 |
||
524 |
void SymbianAbldMakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) |
|
525 |
{ |
|
526 |
// Normally emulator deployment gets done via regular makefile, but since subdirs |
|
527 |
// do not get that, special deployment only makefile is generated for them if needed. |
|
528 |
if (targetType != TypeSubdirs || addDeploymentExtension) { |
|
529 |
QString gnuMakefileName = QLatin1String("Makefile_") + uid3; |
|
530 |
removeSpecialCharacters(gnuMakefileName); |
|
531 |
gnuMakefileName.append(".mk"); |
|
532 |
t << "gnumakefile " << gnuMakefileName << endl; |
|
533 |
} |
|
534 |
} |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
535 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
536 |
void SymbianAbldMakefileGenerator::appendAbldTempDirs(QStringList& sysincspaths, QString includepath) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
537 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
538 |
// As a workaround for Symbian toolchain insistence to treat include |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
539 |
// statements as relative to source file rather than the file they appear in, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
540 |
// we generate extra temporary include directories to make |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
541 |
// relative include paths used in various headers to work properly. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
542 |
// Note that this is not a fix-all solution; it's just a stop-gap measure |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
543 |
// to make Qt itself build until toolchain can support relative includes in |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
544 |
// a way that Qt expects. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
545 |
QString epocPath("epoc32"); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
546 |
if (!includepath.contains(epocPath)) // No temp dirs for epoc includes |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
547 |
appendIfnotExist(sysincspaths, includepath + QString("/" QT_EXTRA_INCLUDE_DIR)); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
548 |
} |