45 #include <qstring.h> |
45 #include <qstring.h> |
46 #include <qstringlist.h> |
46 #include <qstringlist.h> |
47 #include <qdir.h> |
47 #include <qdir.h> |
48 #include <qdatetime.h> |
48 #include <qdatetime.h> |
49 #include <qdebug.h> |
49 #include <qdebug.h> |
|
50 |
|
51 // Included from tools/shared |
|
52 #include <symbian/epocroot.h> |
50 |
53 |
51 #define DO_NOTHING_TARGET "do_nothing" |
54 #define DO_NOTHING_TARGET "do_nothing" |
52 #define CREATE_TEMPS_TARGET "create_temps" |
55 #define CREATE_TEMPS_TARGET "create_temps" |
53 #define EXTENSION_CLEAN "extension_clean" |
56 #define EXTENSION_CLEAN "extension_clean" |
54 #define PRE_TARGETDEPS_TARGET "pre_targetdeps" |
57 #define PRE_TARGETDEPS_TARGET "pre_targetdeps" |
55 #define COMPILER_CLEAN_TARGET "compiler_clean" |
58 #define COMPILER_CLEAN_TARGET "compiler_clean" |
56 #define FINALIZE_TARGET "finalize" |
59 #define FINALIZE_TARGET "finalize" |
57 #define GENERATED_SOURCES_TARGET "generated_sources" |
60 #define GENERATED_SOURCES_TARGET "generated_sources" |
58 #define ALL_SOURCE_DEPS_TARGET "all_source_deps" |
61 #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" |
62 #define DEPLOYMENT_TARGET "deployment" |
61 #define DEPLOYMENT_CLEAN_TARGET "deployment_clean" |
63 #define DEPLOYMENT_CLEAN_TARGET "deployment_clean" |
62 #define WINSCW_DEPLOYMENT_TARGET "winscw_deployment" |
64 #define WINSCW_DEPLOYMENT_TARGET "winscw_deployment" |
63 #define WINSCW_DEPLOYMENT_CLEAN_TARGET "winscw_deployment_clean" |
65 #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 |
66 #define STORE_BUILD_TARGET "store_build" |
65 * the parallel build clusters |
|
66 */ |
|
67 #define STORE_BUILD_TARGET "" |
|
68 |
67 |
69 SymbianAbldMakefileGenerator::SymbianAbldMakefileGenerator() : SymbianMakefileGenerator() { } |
68 SymbianAbldMakefileGenerator::SymbianAbldMakefileGenerator() : SymbianMakefileGenerator() { } |
70 SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } |
69 SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } |
71 |
70 |
72 void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) |
71 void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) |
114 QString cleanDeps; |
113 QString cleanDeps; |
115 QString finalDeps; |
114 QString finalDeps; |
116 QString cleanDepsWinscw; |
115 QString cleanDepsWinscw; |
117 QString finalDepsWinscw; |
116 QString finalDepsWinscw; |
118 QStringList wrapperTargets; |
117 QStringList wrapperTargets; |
119 //:QTP:QTPROD-92 Deployment of plugins requires WINSCW build before ARM build |
|
120 if (deploymentOnly) { |
118 if (deploymentOnly) { |
121 buildDeps.append(STORE_BUILD_TARGET); |
119 buildDeps.append(STORE_BUILD_TARGET); |
122 cleanDeps.append(DEPLOYMENT_CLEAN_TARGET); |
120 cleanDeps.append(DEPLOYMENT_CLEAN_TARGET); |
123 cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET); |
121 cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET " " DEPLOYMENT_CLEAN_TARGET); |
124 finalDeps.append(DEPLOYMENT_TARGET); |
122 finalDeps.append(DEPLOYMENT_TARGET); |
125 finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET); |
123 finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET " " DEPLOYMENT_TARGET); |
126 wrapperTargets << WINSCW_DEPLOYMENT_TARGET |
124 wrapperTargets << WINSCW_DEPLOYMENT_TARGET |
127 << WINSCW_DEPLOYMENT_CLEAN_TARGET |
125 << WINSCW_DEPLOYMENT_CLEAN_TARGET |
128 << DEPLOYMENT_TARGET |
126 << DEPLOYMENT_TARGET |
129 << DEPLOYMENT_CLEAN_TARGET |
127 << DEPLOYMENT_CLEAN_TARGET |
130 << STORE_BUILD_TARGET; |
128 << STORE_BUILD_TARGET; |
131 } else { |
129 } else { |
132 buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET " " STORE_BUILD_TARGET); |
130 buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET " " STORE_BUILD_TARGET); |
133 cleanDeps.append(EXTENSION_CLEAN " " DEPLOYMENT_CLEAN_TARGET); |
131 cleanDeps.append(EXTENSION_CLEAN " " DEPLOYMENT_CLEAN_TARGET); |
134 cleanDepsWinscw.append(EXTENSION_CLEAN " " WINSCW_DEPLOYMENT_CLEAN_TARGET); |
132 cleanDepsWinscw.append(EXTENSION_CLEAN " " WINSCW_DEPLOYMENT_CLEAN_TARGET " " DEPLOYMENT_CLEAN_TARGET); |
135 finalDeps.append(FINALIZE_TARGET " " DEPLOYMENT_TARGET); |
133 finalDeps.append(FINALIZE_TARGET " " DEPLOYMENT_TARGET); |
136 finalDepsWinscw.append(FINALIZE_TARGET " " WINSCW_DEPLOYMENT_TARGET); |
134 finalDepsWinscw.append(FINALIZE_TARGET " " WINSCW_DEPLOYMENT_TARGET " " DEPLOYMENT_TARGET); |
137 wrapperTargets << PRE_TARGETDEPS_TARGET |
135 wrapperTargets << PRE_TARGETDEPS_TARGET |
138 << CREATE_TEMPS_TARGET |
136 << CREATE_TEMPS_TARGET |
139 << EXTENSION_CLEAN |
137 << EXTENSION_CLEAN |
140 << FINALIZE_TARGET |
138 << FINALIZE_TARGET |
141 << WINSCW_DEPLOYMENT_CLEAN_TARGET |
139 << WINSCW_DEPLOYMENT_CLEAN_TARGET |
153 t << "else" << endl; |
151 t << "else" << endl; |
154 t << "CLEAN: " << cleanDeps << endl; |
152 t << "CLEAN: " << cleanDeps << endl; |
155 t << "endif" << endl << endl; |
153 t << "endif" << endl << endl; |
156 t << "CLEANLIB: " DO_NOTHING_TARGET << endl << endl; |
154 t << "CLEANLIB: " DO_NOTHING_TARGET << endl << endl; |
157 |
155 |
158 QStringList qmFileNames; |
156 QStringList trFileNames; |
159 QString translationFilename = project->first("TRANSLATIONS"); |
157 if (!project->values("SYMBIANTRANSLATIONS").isEmpty()) { |
160 if (!project->values("SYMBIANTRANSLATIONS").isEmpty() && !translationFilename.isEmpty()) { |
158 QString translationFilename = project->first("TRANSLATIONS"); |
161 QStringList symbianTranslations = project->values("SYMBIANTRANSLATIONS"); |
159 if (!translationFilename.isEmpty()) { |
162 QString symbianTrPath = project->first("SYMBIANTRANSLATIONDIR"); |
160 QStringList symbianTranslations = project->values("SYMBIANTRANSLATIONS"); |
163 t << "RESOURCE: create_qm" << endl << endl; |
161 QString symbianTrPath = project->first("SYMBIANTRANSLATIONDIR"); |
164 t << "create_qm : " << endl; |
162 QString symbianTrSrcPath = project->first("SYMBIANTRANSLATIONSRCDIR"); |
165 foreach (const QString &symbianTrans, symbianTranslations) { |
163 QString symbianWinscwUdebQmPath = project->first("SYMBIANWINSCWUDEBTRANSLATIONDIR"); |
166 QString translationTsFilename(translationFilename); |
164 QString symbianWinscwUrelQmPath = project->first("SYMBIANWINSCWURELTRANSLATIONDIR"); |
167 translationTsFilename.chop(3); |
165 t << "RESOURCE: create_qm" << endl << endl; |
168 translationTsFilename.insert(0,symbianTrPath); |
166 t << "create_qm : " << endl; |
169 translationTsFilename.append(QString::fromLatin1("_")); |
167 foreach (const QString &symbianTrans, symbianTranslations) { |
170 translationTsFilename.append(symbianTrans); |
168 QString translationTsFilename(translationFilename); |
171 QString translationQmFilename(translationTsFilename); |
169 translationTsFilename.chop(3); |
172 translationTsFilename.append(QString::fromLatin1(".ts")); |
170 translationTsFilename.insert(0,symbianTrPath); |
173 translationQmFilename.append(QString::fromLatin1(".qm")); |
171 translationTsFilename.append(QString::fromLatin1("_")); |
174 t << "\t$(EPOCROOT)epoc32\\tools\\qt\\lrelease -silent -idbased " << translationTsFilename << " -qm " << translationQmFilename << endl; |
172 translationTsFilename.append(symbianTrans); |
175 // qmFileNames are needed in RELEASABLES: part |
173 QString translationQmFilename(translationTsFilename); |
176 qmFileNames.append(translationQmFilename); |
174 |
|
175 translationTsFilename.append(QString::fromLatin1(".ts")); |
|
176 // output path for armv5 qm files./epoc32/data/z/resource/qt/translations/ |
|
177 translationQmFilename.append(QString::fromLatin1(".qm")); |
|
178 |
|
179 // input path for ts files. /epoc32/include/platform/qt/translations/ |
|
180 QString translationTsSrcFilename(translationFilename); |
|
181 translationTsSrcFilename.chop(3); |
|
182 translationTsSrcFilename.insert(0,symbianTrSrcPath); |
|
183 translationTsSrcFilename.append(QString::fromLatin1("_")); |
|
184 translationTsSrcFilename.append(symbianTrans); |
|
185 translationTsSrcFilename.append(QString::fromLatin1(".ts")); |
|
186 |
|
187 // output path for winscw qm files. /epoc32/release/winscw/udeb/z/resource/qt/translations/ |
|
188 QString translationQmWinscwUdebFilename(translationFilename); |
|
189 translationQmWinscwUdebFilename.chop(3); |
|
190 translationQmWinscwUdebFilename.insert(0,symbianWinscwUdebQmPath); |
|
191 translationQmWinscwUdebFilename.append(QString::fromLatin1("_")); |
|
192 translationQmWinscwUdebFilename.append(symbianTrans); |
|
193 translationQmWinscwUdebFilename.append(QString::fromLatin1(".qm")); |
|
194 |
|
195 // output path for winscw qm files. /epoc32/release/winscw/urel/z/resource/qt/translations/ |
|
196 QString translationQmWinscwUrelFilename(translationFilename); |
|
197 translationQmWinscwUrelFilename.chop(3); |
|
198 translationQmWinscwUrelFilename.insert(0,symbianWinscwUrelQmPath); |
|
199 translationQmWinscwUrelFilename.append(QString::fromLatin1("_")); |
|
200 translationQmWinscwUrelFilename.append(symbianTrans); |
|
201 translationQmWinscwUrelFilename.append(QString::fromLatin1(".qm")); |
|
202 |
|
203 //these get generated to component mk file. |
|
204 t << "\tlrelease -silent -idbased " << translationTsSrcFilename << " -qm " << translationQmFilename << endl; |
|
205 t << "\tlrelease -silent -idbased " << translationTsSrcFilename << " -qm " << translationQmWinscwUdebFilename << endl; |
|
206 t << "\tlrelease -silent -idbased " << translationTsSrcFilename << " -qm " << translationQmWinscwUrelFilename << endl; |
|
207 |
|
208 // trFileNames QStringList needed in RELEASABLES part |
|
209 trFileNames.append(translationQmFilename); |
|
210 trFileNames.append(translationQmWinscwUdebFilename); |
|
211 trFileNames.append(translationQmWinscwUrelFilename); |
|
212 } |
|
213 t << endl; |
177 } |
214 } |
178 t << endl; |
215 else |
|
216 t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl; |
179 } else { |
217 } else { |
180 t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl; |
218 t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl; |
181 } |
219 } |
182 t << "FREEZE: " DO_NOTHING_TARGET << endl << endl; |
220 t << "FREEZE: " DO_NOTHING_TARGET << endl << endl; |
183 t << "SAVESPACE: " DO_NOTHING_TARGET << endl << endl; |
221 t << "SAVESPACE: " DO_NOTHING_TARGET << endl << endl; |
184 |
222 |
185 if (!project->values("SYMBIANTRANSLATIONS").isEmpty() && !qmFileNames.isEmpty()) { |
223 if (!project->values("SYMBIANTRANSLATIONS").isEmpty()) { |
186 t << "RELEASABLES: list_qm" << endl << endl; |
224 t << "RELEASABLES: list_qm" << endl << endl; |
187 t << "list_qm : " << endl; |
225 t << "list_qm : " << endl; |
188 foreach (const QString &qmFilename, qmFileNames) { |
226 foreach (const QString &trFilename, trFileNames) { |
189 t << "\t@echo " << qmFilename << endl; |
227 t << "\t@echo " << trFilename << endl; |
190 } |
228 } |
191 t << endl; |
229 t << endl; |
192 } else { |
230 } else { |
193 t << "RELEASABLES: " DO_NOTHING_TARGET << endl << endl; |
231 t << "RELEASABLES: " DO_NOTHING_TARGET << endl << endl; |
194 } |
232 } |
195 t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl; |
233 t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl; |
241 t << "MAKEFILE = " << wrapperFile.fileName() << endl; |
279 t << "MAKEFILE = " << wrapperFile.fileName() << endl; |
242 t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl; |
280 t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl; |
243 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
281 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
244 t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; |
282 t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; |
245 t << "MOVE = " << var("QMAKE_MOVE") << endl; |
283 t << "MOVE = " << var("QMAKE_MOVE") << endl; |
|
284 t << "CHK_DIR_EXISTS = " << var("QMAKE_CHK_DIR_EXISTS") << endl; |
|
285 t << "MKDIR = " << var("QMAKE_MKDIR") << endl; |
246 t << "XCOPY = xcopy /d /f /h /r /y /i" << endl; |
286 t << "XCOPY = xcopy /d /f /h /r /y /i" << endl; |
247 t << "ABLD = ABLD.BAT" << endl; |
287 t << "ABLD = ABLD.BAT" << endl; |
248 t << "DEBUG_PLATFORMS = " << debugPlatforms.join(" ") << endl; |
288 t << "DEBUG_PLATFORMS = " << debugPlatforms.join(" ") << endl; |
249 t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl; |
289 t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl; |
250 t << "MAKE = make" << endl; |
290 t << "MAKE = make" << endl; |
405 QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets(); |
445 QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets(); |
406 writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables | SubTargetSkipDefaultTargets); |
446 writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables | SubTargetSkipDefaultTargets); |
407 qDeleteAll(subtargets); |
447 qDeleteAll(subtargets); |
408 } |
448 } |
409 |
449 |
410 writeDeploymentTargets(t); |
450 // Deploymend targets for both emulator and rom deployment |
411 //:QTP:QTPROD-92 Deployment of plugins requires WINSCW build before ARM build |
451 writeDeploymentTargets(t, false); |
412 writeDeploymentTargets(t, true); |
452 writeDeploymentTargets(t, true); |
413 |
453 |
414 writeSisTargets(t); |
454 writeSisTargets(t); |
415 |
455 |
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); |
456 writeStoreBuildTarget(t); |
419 */ |
|
420 |
457 |
421 generateDistcleanTargets(t); |
458 generateDistcleanTargets(t); |
422 |
459 |
423 t << "clean: $(ABLD)" << endl; |
460 t << "clean: $(ABLD)" << endl; |
424 t << "\t-$(ABLD)" << testClause << " reallyclean" << endl; |
461 t << "\t-$(ABLD)" << testClause << " reallyclean" << endl; |
425 t << "\t-bldmake clean" << endl; |
462 t << "\t-bldmake clean" << endl; |
426 t << endl; |
463 t << endl; |
427 |
464 |
428 // Create execution target |
465 t << "clean-debug: $(ABLD)" << endl; |
429 if (debugPlatforms.contains("winscw") && targetType == TypeExe) { |
466 foreach(QString item, debugPlatforms) { |
430 t << "run:" << endl; |
467 t << "\t$(ABLD)" << testClause << " reallyclean " << item << " udeb" << endl; |
431 t << "\t-call " << epocRoot() << "epoc32\\release\\winscw\\udeb\\" << fixedTarget << ".exe" << endl << endl; |
468 } |
432 } |
469 t << endl; |
|
470 t << "clean-release: $(ABLD)" << endl; |
|
471 foreach(QString item, releasePlatforms) { |
|
472 t << "\t$(ABLD)" << testClause << " reallyclean " << item << " urel" << endl; |
|
473 } |
|
474 t << endl; |
|
475 |
|
476 // For more specific builds, targets are in this form: clean-build-platform, e.g. clean-release-armv5 |
|
477 foreach(QString item, debugPlatforms) { |
|
478 t << "clean-debug-" << item << ": $(ABLD)" << endl; |
|
479 t << "\t$(ABLD)" << testClause << " reallyclean " << item << " udeb" << endl; |
|
480 } |
|
481 foreach(QString item, releasePlatforms) { |
|
482 t << "clean-release-" << item << ": $(ABLD)" << endl; |
|
483 t << "\t$(ABLD)" << testClause << " reallyclean " << item << " urel" << endl; |
|
484 } |
|
485 t << endl; |
|
486 |
|
487 generateExecutionTargets(t, debugPlatforms); |
433 } |
488 } |
434 |
489 |
435 void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) |
490 void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) |
436 { |
491 { |
437 // We don't use extensions for anything in abld |
492 // We don't use extensions for anything in abld |
438 Q_UNUSED(t); |
493 Q_UNUSED(t); |
439 Q_UNUSED(iconTargetFile); |
494 Q_UNUSED(iconTargetFile); |
440 } |
495 } |
441 |
496 |
442 //:QTP:QTPROD-92 Deployment of plugins requires WINSCW build before ARM build |
497 bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t, bool isRom) |
443 bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t, bool isRelease /*= false*/) |
498 { |
444 { |
499 if (isRom) |
445 if (isRelease) |
|
446 t << DEPLOYMENT_TARGET ":" << endl; |
500 t << DEPLOYMENT_TARGET ":" << endl; |
447 else |
501 else |
448 t << WINSCW_DEPLOYMENT_TARGET ":" << endl; |
502 t << WINSCW_DEPLOYMENT_TARGET ":" << endl; |
449 |
503 |
450 QString remoteTestPath = epocRoot() + QLatin1String( isRelease?"epoc32\\data\\z\\private\\":"epoc32\\winscw\\c\\private\\") |
504 QString remoteTestPath = epocRoot() |
451 + privateDirUid; // default 4 OpenC; 4 all Symbian too |
505 + QLatin1String(isRom ? "epoc32\\data\\z\\private\\" : "epoc32\\winscw\\c\\private\\") |
|
506 + privateDirUid; |
452 DeploymentList depList; |
507 DeploymentList depList; |
453 |
508 |
454 initProjectDeploySymbian(project, depList, remoteTestPath, false, QLatin1String(isRelease?"armv5":"winscw"), QLatin1String(isRelease?"urel":"udeb"), |
509 initProjectDeploySymbian(project, depList, remoteTestPath, false, |
455 generatedDirs, generatedFiles); |
510 QLatin1String(isRom ? ROM_DEPLOYMENT_PLATFORM : EMULATOR_DEPLOYMENT_PLATFORM), |
|
511 QString(), generatedDirs, generatedFiles); |
456 |
512 |
457 if (depList.size()) |
513 if (depList.size()) |
458 t << "\t-echo Deploying changed files..." << endl; |
514 t << "\t-echo Deploying changed files..." << endl; |
|
515 |
459 for (int i = 0; i < depList.size(); ++i) { |
516 for (int i = 0; i < depList.size(); ++i) { |
460 // Xcopy prompts for selecting file or directory if target doesn't exist, |
517 // Xcopy prompts for selecting file or directory if target doesn't exist, |
461 // and doesn't provide switch to force file selection. It does provide dir forcing, though, |
518 // and doesn't provide switch to force file selection. It does provide dir forcing, though, |
462 // so strip the last part of the destination. |
519 // so strip the last part of the destination. |
463 t << "\t-$(XCOPY) \"" << depList.at(i).from << "\" \"" << depList.at(i).to.left(depList.at(i).to.lastIndexOf("\\") + 1) << "\"" << endl; |
520 t << "\t-$(XCOPY) \"" << depList.at(i).from << "\" \"" |
464 } |
521 << depList.at(i).to.left(depList.at(i).to.lastIndexOf("\\") + 1) << "\"" << endl; |
465 |
522 } |
466 t << endl; |
523 |
467 |
524 t << endl; |
468 if (isRelease) |
525 |
|
526 if (isRom) |
469 t << DEPLOYMENT_CLEAN_TARGET ":" << endl; |
527 t << DEPLOYMENT_CLEAN_TARGET ":" << endl; |
470 else |
528 else |
471 t << WINSCW_DEPLOYMENT_CLEAN_TARGET ":" << endl; |
529 t << WINSCW_DEPLOYMENT_CLEAN_TARGET ":" << endl; |
472 |
530 |
473 QStringList cleanList; |
531 QStringList cleanList; |