summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2009-07-01 12:39:01 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2009-07-01 12:39:01 (GMT)
commit42e63a7e65d4dbfb2a79133eb63a561f50760344 (patch)
tree3fea415cc6152354578f8457a4db6b264b1b0dd4 /qmake/generators
parentb69bf0e7c936de19ae31e55bee3c85ec3b2b2c59 (diff)
downloadQt-42e63a7e65d4dbfb2a79133eb63a561f50760344.zip
Qt-42e63a7e65d4dbfb2a79133eb63a561f50760344.tar.gz
Qt-42e63a7e65d4dbfb2a79133eb63a561f50760344.tar.bz2
Added temporary include file generation to symbian-sbsv2 generator
and cleaned related functionality up a bit.
Diffstat (limited to 'qmake/generators')
-rw-r--r--qmake/generators/symbian/symmake.cpp76
-rw-r--r--qmake/generators/symbian/symmake.h5
-rw-r--r--qmake/generators/symbian/symmake_abld.cpp64
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.cpp72
4 files changed, 105 insertions, 112 deletions
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index f1e9165..5ad50bb 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -581,8 +581,15 @@ bool SymbianMakefileGenerator::initMmpVariables() {
for(int j = 0; j < incpaths.size(); ++j) {
QString includepath = canonizePath(incpaths.at(j));
appendIfnotExist(sysincspaths, includepath);
+ // As a workaround for Symbian toolchain insistence to treat include
+ // statements as relative to source file rather than the file they appear in,
+ // we generate extra temporary include directories to make
+ // relative include paths used in various headers to work properly.
+ // Note that this is not a fix-all solution; it's just a stop-gap measure
+ // to make Qt itself build until toolchain can support relative includes in
+ // a way that Qt expects.
if (!includepath.contains(epocPath)) // No temp dirs for epoc includes
- appendIfnotExist(sysincspaths, includepath + QString("/tmp"));
+ appendIfnotExist(sysincspaths, includepath + QString("/" QT_EXTRA_INCLUDE_DIR));
}
// remove duplicate include path entries
@@ -1605,12 +1612,13 @@ QString SymbianMakefileGenerator::removeTrailingPathSeparators(QString &file)
return ret;
}
-bool SymbianMakefileGenerator::generateCleanCommands(QTextStream& t,
+void SymbianMakefileGenerator::generateCleanCommands(QTextStream& t,
const QStringList& toClean,
const QString& cmd,
const QString& cmdOptions,
const QString& itemPrefix,
- const QString& itemSuffix) {
+ const QString& itemSuffix)
+{
for (int i = 0; i < toClean.size(); ++i) {
QString item = toClean.at(i);
item.prepend(itemPrefix).append(itemSuffix);
@@ -1622,11 +1630,10 @@ bool SymbianMakefileGenerator::generateCleanCommands(QTextStream& t,
t << cmd << " " << cmdOptions << " " << QDir::toNativeSeparators(item) << "; fi" << endl;
#endif
}
-
- return true;
}
-QString SymbianMakefileGenerator::getWithoutSpecialCharacters(QString& str) {
+QString SymbianMakefileGenerator::getWithoutSpecialCharacters(QString& str)
+{
QString tmp = str;
tmp.replace(QString("/"), QString("_"));
@@ -1638,7 +1645,8 @@ QString SymbianMakefileGenerator::getWithoutSpecialCharacters(QString& str) {
return tmp;
}
-void SymbianMakefileGenerator::removeSpecialCharacters(QString& str) {
+void SymbianMakefileGenerator::removeSpecialCharacters(QString& str)
+{
str.replace(QString("/"), QString("_"));
str.replace(QString("\\"), QString("_"));
str.replace(QString("-"), QString("_"));
@@ -1646,3 +1654,57 @@ void SymbianMakefileGenerator::removeSpecialCharacters(QString& str) {
str.replace(QString("."), QString("_"));
str.replace(QString(" "), QString("_"));
}
+
+void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t)
+{
+ t << "dodistclean:" << endl;
+ foreach(QString item, project->values("SUBDIRS")) {
+ bool fromFile = false;
+ QString fixedItem;
+ if(!project->isEmpty(item + ".file")) {
+ fixedItem = project->first(item + ".file");
+ fromFile = true;
+ } else if(!project->isEmpty(item + ".subdir")) {
+ fixedItem = project->first(item + ".subdir");
+ fromFile = false;
+ } else {
+ fromFile = item.endsWith(Option::pro_ext);
+ fixedItem = item;
+ }
+ QFileInfo fi(fileInfo(fixedItem));
+ if (!fromFile) {
+ t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fi.absoluteFilePath() + "/Makefile") << "\" dodistclean" << endl;
+ } else {
+ QString itemName = fi.fileName();
+ int extIndex = itemName.lastIndexOf(Option::pro_ext);
+ if (extIndex)
+ fixedItem = fi.absolutePath() + "/" + QString("Makefile.") + itemName.mid(0,extIndex);
+ t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fixedItem) << "\" dodistclean" << endl;
+ }
+
+ }
+
+ generatedFiles << Option::fixPathToTargetOS(fileInfo(Option::output.fileName()).absoluteFilePath()); // bld.inf
+ generatedFiles << project->values("QMAKE_INTERNAL_PRL_FILE"); // Add generated prl files for cleanup
+ generatedFiles << project->values("QMAKE_DISTCLEAN"); // Add any additional files marked for distclean
+ QStringList fixedFiles;
+ QStringList fixedDirs;
+ foreach(QString item, generatedFiles) {
+ QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath());
+ if (!fixedFiles.contains(fixedItem)) {
+ fixedFiles << fixedItem;
+ }
+ }
+ foreach(QString item, generatedDirs) {
+ QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath());
+ if (!fixedDirs.contains(fixedItem)) {
+ fixedDirs << fixedItem;
+ }
+ }
+ generateCleanCommands(t, fixedFiles, "$(DEL_FILE)", "", "", "");
+ generateCleanCommands(t, fixedDirs, "$(DEL_DIR)", "", "", "");
+ t << endl;
+
+ t << "distclean: clean dodistclean" << endl;
+ t << endl;
+} \ No newline at end of file
diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h
index 037faff..52c3c4d 100644
--- a/qmake/generators/symbian/symmake.h
+++ b/qmake/generators/symbian/symmake.h
@@ -57,6 +57,8 @@ QT_BEGIN_NAMESPACE
#define BLD_INF_FILENAME "bld.inf"
#define MAKEFILE_DEPENDENCY_SEPARATOR " \\\n\t"
+#define QT_EXTRA_INCLUDE_DIR "tmp"
+
class SymbianMakefileGenerator : public MakefileGenerator {
protected:
@@ -127,13 +129,14 @@ protected:
QString removePathSeparators(QString &file);
QString removeTrailingPathSeparators(QString &file);
- bool generateCleanCommands(QTextStream& t,
+ void generateCleanCommands(QTextStream& t,
const QStringList& toClean,
const QString& cmd,
const QString& cmdOptions,
const QString& itemPrefix,
const QString& itemSuffix);
+ void generateDistcleanTargets(QTextStream& t);
bool writeCustomDefFile();
diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp
index 8501224..ccda9f2 100644
--- a/qmake/generators/symbian/symmake_abld.cpp
+++ b/qmake/generators/symbian/symmake_abld.cpp
@@ -293,11 +293,16 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
t << CREATE_TEMPS_TARGET ":" << endl;
// generate command lines like this ...
// -@ if NOT EXIST ".\somedir" mkdir ".\somedir"
+ QStringList dirsToClean;
for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) {
QStringList values = it.value();
for (int i = 0; i < values.size(); ++i) {
- t << "\t-@ if NOT EXIST \"" << QDir::toNativeSeparators(values.at(i)) << "\\tmp\" mkdir \""
- << QDir::toNativeSeparators(values.at(i)) << "\\tmp\"" << endl;
+ if (values.at(i).endsWith("/" QT_EXTRA_INCLUDE_DIR)) {
+ QString fixedValue(QDir::toNativeSeparators(values.at(i)));
+ dirsToClean << fixedValue;
+ t << "\t-@ if NOT EXIST \"" << fixedValue << "\" mkdir \""
+ << fixedValue << "\"" << endl;
+ }
}
}
t << endl;
@@ -305,10 +310,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
// Note: EXTENSION_CLEAN will get called many times when doing reallyclean
// This is why the "2> NUL" gets appended to generated clean targets in makefile.cpp.
t << EXTENSION_CLEAN ": " COMPILER_CLEAN_TARGET << endl;
- for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) {
- QStringList dirsToClean = it.value();
- generateCleanCommands(t, dirsToClean, var("QMAKE_DEL_DIR"), " /S /Q ", "", "/tmp");
- }
+ generateCleanCommands(t, dirsToClean, var("QMAKE_DEL_DIR"), " /S /Q ", "", "");
t << endl;
t << PRE_TARGETDEPS_TARGET ":"
@@ -356,56 +358,8 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
writeDeploymentTargets(t);
- t << "dodistclean:" << endl;
- foreach(QString item, project->values("SUBDIRS")) {
- bool fromFile = false;
- QString fixedItem;
- if(!project->isEmpty(item + ".file")) {
- fixedItem = project->first(item + ".file");
- fromFile = true;
- } else if(!project->isEmpty(item + ".subdir")) {
- fixedItem = project->first(item + ".subdir");
- fromFile = false;
- } else {
- fromFile = item.endsWith(Option::pro_ext);
- fixedItem = item;
- }
- QFileInfo fi(fileInfo(fixedItem));
- if (!fromFile) {
- t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fi.canonicalFilePath()) << "\\Makefile\" dodistclean" << endl;
- } else {
- QString itemName = fi.fileName();
- int extIndex = itemName.lastIndexOf(Option::pro_ext);
- if (extIndex)
- fixedItem = fi.canonicalPath() + "/" + QString("Makefile.") + itemName.mid(0,extIndex);
- t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fixedItem) << "\" dodistclean" << endl;
- }
-
- }
+ generateDistcleanTargets(t);
- generatedFiles << Option::fixPathToTargetOS(fileInfo(Option::output.fileName()).canonicalFilePath()); // bld.inf
- generatedFiles << project->values("QMAKE_INTERNAL_PRL_FILE"); // Add generated prl files for cleanup
- generatedFiles << project->values("QMAKE_DISTCLEAN"); // Add any additional files marked for distclean
- QStringList fixedFiles;
- QStringList fixedDirs;
- foreach(QString item, generatedFiles) {
- QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).canonicalFilePath());
- if (!fixedFiles.contains(fixedItem)) {
- fixedFiles << fixedItem;
- }
- }
- foreach(QString item, generatedDirs) {
- QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).canonicalFilePath());
- if (!fixedDirs.contains(fixedItem)) {
- fixedDirs << fixedItem;
- }
- }
- generateCleanCommands(t, fixedFiles, "$(DEL_FILE)", "", "", "");
- generateCleanCommands(t, fixedDirs, "$(DEL_DIR)", "", "", "");
- t << endl;
-
- t << "distclean: clean dodistclean" << endl;
- t << endl;
t << "clean: $(ABLD)" << endl;
t << "\t-$(ABLD)" << testClause << " reallyclean" << endl;
t << "\t-bldmake clean" << endl;
diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp
index 7b739c7..0266bac 100644
--- a/qmake/generators/symbian/symmake_sbsv2.cpp
+++ b/qmake/generators/symbian/symmake_sbsv2.cpp
@@ -220,56 +220,8 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo
qDeleteAll(subtargets);
}
- t << "dodistclean:" << endl;
- foreach(QString item, project->values("SUBDIRS")) {
- bool fromFile = false;
- QString fixedItem;
- if(!project->isEmpty(item + ".file")) {
- fixedItem = project->first(item + ".file");
- fromFile = true;
- } else if(!project->isEmpty(item + ".subdir")) {
- fixedItem = project->first(item + ".subdir");
- fromFile = false;
- } else {
- fromFile = item.endsWith(Option::pro_ext);
- fixedItem = item;
- }
- QFileInfo fi(fileInfo(fixedItem));
- if (!fromFile) {
- t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fi.absoluteFilePath() + "/Makefile") << "\" dodistclean" << endl;
- } else {
- QString itemName = fi.fileName();
- int extIndex = itemName.lastIndexOf(Option::pro_ext);
- if (extIndex)
- fixedItem = fi.absolutePath() + "/" + QString("Makefile.") + itemName.mid(0,extIndex);
- t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fixedItem) << "\" dodistclean" << endl;
- }
-
- }
+ generateDistcleanTargets(t);
- generatedFiles << Option::fixPathToTargetOS(fileInfo(Option::output.fileName()).absoluteFilePath()); // bld.inf
- generatedFiles << project->values("QMAKE_INTERNAL_PRL_FILE"); // Add generated prl files for cleanup
- generatedFiles << project->values("QMAKE_DISTCLEAN"); // Add any additional files marked for distclean
- QStringList fixedFiles;
- QStringList fixedDirs;
- foreach(QString item, generatedFiles) {
- QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath());
- if (!fixedFiles.contains(fixedItem)) {
- fixedFiles << fixedItem;
- }
- }
- foreach(QString item, generatedDirs) {
- QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath());
- if (!fixedDirs.contains(fixedItem)) {
- fixedDirs << fixedItem;
- }
- }
- generateCleanCommands(t, fixedFiles, "$(DEL_FILE)", "", "", "");
- generateCleanCommands(t, fixedDirs, "$(DEL_DIR)", "", "", "");
- t << endl;
-
- t << "distclean: clean dodistclean" << endl;
- t << endl;
t << "clean: " << BLD_INF_FILENAME << endl;
t << "\t-$(SBS) reallyclean" << endl;
t << endl;
@@ -433,6 +385,28 @@ bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t
t << "END" << endl;
}
+ // Generate temp dirs
+ QString tempDirs;
+ for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) {
+ QStringList values = it.value();
+ for (int i = 0; i < values.size(); ++i) {
+ QString value = values.at(i);
+ if (value.endsWith("/" QT_EXTRA_INCLUDE_DIR)) {
+ value = fileInfo(value).absoluteFilePath();
+ tempDirs.append(value);
+ tempDirs.append(" ");
+ }
+ }
+ }
+
+ if (tempDirs.size())
+ tempDirs.chop(1); // Remove final space
+
+ t << "START EXTENSION qt/qmake_generate_temp_dirs" << endl;
+ t << "OPTION DIRS " << tempDirs << endl;
+ t << "END" << endl;
+ t << endl;
+
t << endl;
return true;