summaryrefslogtreecommitdiffstats
path: root/qmake/generators/symbian/symmake.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2009-10-16 12:49:18 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2009-10-16 14:48:49 (GMT)
commit792bdecebdd426672bc2d687a55ef1a732322ac9 (patch)
tree281807f155a3809f24dcdd921b7ed5e689131710 /qmake/generators/symbian/symmake.cpp
parent06d1c12c24c38b0cd8822b1faf2694c7331f75cb (diff)
downloadQt-792bdecebdd426672bc2d687a55ef1a732322ac9.zip
Qt-792bdecebdd426672bc2d687a55ef1a732322ac9.tar.gz
Qt-792bdecebdd426672bc2d687a55ef1a732322ac9.tar.bz2
Refactored SymbianSubdirsMetaMakefileGenerator out of qmake.
There was no need to have SymbianSubdirsMetaMakefileGenerator in cross-platform metamakefile.cpp, so moved the Symbian specific functionality to symmake.cpp as suggested by qmake reviewers. Task-number: QT-822 Reviewed-by: Janne Anttila
Diffstat (limited to 'qmake/generators/symbian/symmake.cpp')
-rw-r--r--qmake/generators/symbian/symmake.cpp100
1 files changed, 44 insertions, 56 deletions
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index 3d24053..19af1da 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -1092,6 +1092,7 @@ void SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t)
void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension)
{
// Read user defined bld inf rules
+
QMap<QString, QStringList> userBldInfRules;
for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) {
if (it.key().startsWith(BLD_INF_RULES_BASE)) {
@@ -1122,58 +1123,44 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy
QString mmpfilename = escapeFilePath(fileFixify(project->projectFile()));
mmpfilename = mmpfilename.replace(mmpfilename.lastIndexOf("."), 4, Option::mmp_ext);
QString currentPath = qmake_getpwd();
+ QDir directory(currentPath);
- if (!currentPath.endsWith(QString("/")))
- currentPath.append("/");
-
- QStringList mmpProjects = project->values("MMPFILES_DIRECT_DEPENDS");
- QStringList shadowProjects = project->values("SHADOW_BLD_INFS");
-
- removeDuplicatedStrings(mmpProjects);
- removeDuplicatedStrings(shadowProjects);
+ const QStringList &subdirs = project->values("SUBDIRS");
+ foreach(QString item, subdirs) {
+ QString fixedItem;
+ if (!project->isEmpty(item + ".file")) {
+ fixedItem = project->first(item + ".file");
+ } else if (!project->isEmpty(item + ".subdir")) {
+ fixedItem = project->first(item + ".subdir");
+ } else {
+ fixedItem = item;
+ }
- // Go in reverse order as that is the way how we build the list
- QListIterator<QString> iT(mmpProjects);
- iT.toBack();
- while (iT.hasPrevious()) {
- QString fullMmpName = iT.previous();
- QString relativePath;
+ QFileInfo subdir(fileInfo(fixedItem));
+ QString relativePath = directory.relativeFilePath(fixedItem);
+ QString subdirFileName = subdir.completeBaseName();
+ QString fullProName = subdir.absoluteFilePath();;
QString bldinfFilename;
- QString fullProFilename = fullMmpName;
- fullProFilename.replace(Option::mmp_ext, Option::pro_ext);
- QString uid = generate_uid(fullProFilename);
-
- QString cleanMmpName = fullProFilename;
- cleanMmpName.replace(Option::pro_ext, QString(""));
- cleanMmpName.replace(0, cleanMmpName.lastIndexOf("/") + 1, QString(""));
-
- if (shadowProjects.contains(BLD_INF_FILENAME "." + cleanMmpName)) { // shadow project
- QDir directory(currentPath);
- relativePath = directory.relativeFilePath(fullProFilename);
- bldinfFilename = BLD_INF_FILENAME "." + cleanMmpName;
+ if (subdir.isDir()) {
+ // Subdir is a regular project
+ bldinfFilename = relativePath + QString("/") + QString(BLD_INF_FILENAME);
+ fullProName += QString("/") + subdirFileName + Option::pro_ext;
+ } else {
+ // Subdir is actually a .pro file
if (relativePath.contains("/")) {
- // Shadow .pro not in same directory as parent .pro
- if (relativePath.startsWith("..")) {
- // Shadow .pro out of parent .pro
- relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString(""));
- bldinfFilename.prepend("/").prepend(relativePath);
- } else {
- relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString(""));
- bldinfFilename.prepend("/").prepend(relativePath);
- }
+ // .pro not in same directory as parent .pro
+ relativePath.remove(relativePath.lastIndexOf("/") + 1, relativePath.length());
+ bldinfFilename = relativePath;
} else {
- // Shadow .pro and parent .pro in same directory
- bldinfFilename.prepend("./");
+ // .pro and parent .pro in same directory
+ bldinfFilename = QString("./");
}
- } else { // regular project
- QDir directory(currentPath);
- relativePath = directory.relativeFilePath(fullProFilename);
- relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString(""));
- bldinfFilename = relativePath.append("/").append(BLD_INF_FILENAME);
+ bldinfFilename += QString(BLD_INF_FILENAME ".") + subdirFileName;
}
- QString bldinfDefine = QString("BLD_INF_") + cleanMmpName + QString("_") + uid;
+ QString uid = generate_uid(fullProName);
+ QString bldinfDefine = QString("BLD_INF_") + subdirFileName + QString("_") + uid;
bldinfDefine = bldinfDefine.toUpper();
removeSpecialCharacters(bldinfDefine);
@@ -1195,6 +1182,7 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy
t << endl;
// Add project mmps and old style extension makefiles
+
QString mmpTag;
if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive))
mmpTag = QLatin1String(BLD_INF_TAG_TESTMMPFILES);
@@ -1204,9 +1192,7 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy
t << endl << mmpTag << endl << endl;
writeBldInfMkFilePart(t, addDeploymentExtension);
- if (targetType == TypeSubdirs) {
- mmpProjects.removeOne(mmpfilename);
- } else {
+ if (targetType != TypeSubdirs) {
QString shortProFilename = project->projectFile();
shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString(""));
shortProFilename.replace(Option::pro_ext, QString(""));
@@ -1224,6 +1210,7 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy
t << endl << BLD_INF_TAG_EXTENSIONS << endl << endl;
// Generate extension rules
+
writeBldInfExtensionRulesPart(t);
userItems = userBldInfRules.value(BLD_INF_TAG_EXTENSIONS);
@@ -1698,8 +1685,8 @@ void SymbianMakefileGenerator::writeSisTargets(QTextStream &t)
.arg(MAKE_CACHE_NAME)
.arg(OK_SIS_TARGET)
.arg(FAIL_SIS_NOCACHE_TARGET)
- .arg(FAIL_SIS_NOPKG_TARGET);
- t << siscommand << endl;
+ .arg(FAIL_SIS_NOPKG_TARGET);
+ t << siscommand << endl;
t << endl;
t << OK_SIS_TARGET ":" << endl;
@@ -1710,15 +1697,15 @@ void SymbianMakefileGenerator::writeSisTargets(QTextStream &t)
.arg("pkg");
t << pkgcommand << endl;
t << endl;
-
- t << FAIL_SIS_NOPKG_TARGET ":" << endl;
- t << "\t$(error PKG file does not exist, 'SIS' target is only supported for executables or projects with DEPLOYMENT statement)" << endl;
+
+ t << FAIL_SIS_NOPKG_TARGET ":" << endl;
+ t << "\t$(error PKG file does not exist, 'SIS' target is only supported for executables or projects with DEPLOYMENT statement)" << endl;
t << endl;
-
- t << FAIL_SIS_NOCACHE_TARGET ":" << endl;
- t << "\t$(error Project has to be build before calling 'SIS' target)" << endl;
+
+ t << FAIL_SIS_NOCACHE_TARGET ":" << endl;
+ t << "\t$(error Project has to be build before calling 'SIS' target)" << endl;
t << endl;
-
+
t << RESTORE_BUILD_TARGET ":" << endl;
t << "-include " MAKE_CACHE_NAME << endl;
@@ -1728,7 +1715,8 @@ void SymbianMakefileGenerator::writeSisTargets(QTextStream &t)
void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t)
{
t << "dodistclean:" << endl;
- foreach(QString item, project->values("SUBDIRS")) {
+ const QStringList &subdirs = project->values("SUBDIRS");
+ foreach(QString item, subdirs) {
bool fromFile = false;
QString fixedItem;
if (!project->isEmpty(item + ".file")) {