summaryrefslogtreecommitdiffstats
path: root/qmake/generators/symbian
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/generators/symbian')
-rw-r--r--qmake/generators/symbian/epocroot.h51
-rw-r--r--qmake/generators/symbian/initprojectdeploy_symbian.cpp385
-rw-r--r--qmake/generators/symbian/initprojectdeploy_symbian.h75
-rw-r--r--qmake/generators/symbian/symmake.cpp1800
-rw-r--r--qmake/generators/symbian/symmake.h158
-rw-r--r--qmake/generators/symbian/symmake_abld.cpp467
-rw-r--r--qmake/generators/symbian/symmake_abld.h69
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.cpp414
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.h72
9 files changed, 3491 insertions, 0 deletions
diff --git a/qmake/generators/symbian/epocroot.h b/qmake/generators/symbian/epocroot.h
new file mode 100644
index 000000000..a4eefaea9
--- /dev/null
+++ b/qmake/generators/symbian/epocroot.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef EPOCROOT_H
+#define EPOCROOT_H
+
+#include <qstring.h>
+
+// Implementation of epocRoot method is in initprojectdeploy_symbian.cpp
+// Defined in separate header for inclusion clarity
+extern QString epocRoot();
+
+#endif // EPOCROOT_H
diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp
new file mode 100644
index 000000000..f27d1ba71
--- /dev/null
+++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp
@@ -0,0 +1,385 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "initprojectdeploy_symbian.h"
+#include <QDirIterator>
+#include <project.h>
+#include <qxmlstream.h>
+#include <qsettings.h>
+#include <qdebug.h>
+
+#define PLUGIN_STUB_DIR "qmakepluginstubs"
+#define SYSBIN_DIR "\\sys\\bin"
+
+#define SUFFIX_DLL "dll"
+#define SUFFIX_EXE "exe"
+#define SUFFIX_QTPLUGIN "qtplugin"
+
+static void fixEpocRootStr(QString& path)
+{
+ path.replace("\\", "/");
+
+ if (path.size() > 1 && path[1] == QChar(':')) {
+ path = path.mid(2);
+ }
+
+ if (!path.size() || path[path.size()-1] != QChar('/')) {
+ path += QChar('/');
+ }
+}
+
+#define SYMBIAN_SDKS_KEY "HKEY_LOCAL_MACHINE\\Software\\Symbian\\EPOC SDKs"
+
+static QString epocRootStr;
+
+QString epocRoot()
+{
+ if (!epocRootStr.isEmpty()) {
+ return epocRootStr;
+ }
+
+ // First, check the env variable
+ epocRootStr = qgetenv("EPOCROOT");
+
+ if (epocRootStr.isEmpty()) {
+ // No EPOCROOT set, check the default device
+ // First check EPOCDEVICE env variable
+ QString defaultDevice = qgetenv("EPOCDEVICE");
+
+ // Check the windows registry via QSettings for devices.xml path
+ QSettings settings(SYMBIAN_SDKS_KEY, QSettings::NativeFormat);
+ QString devicesXmlPath = settings.value("CommonPath").toString();
+
+ if (!devicesXmlPath.isEmpty()) {
+ // Parse xml for correct device
+ devicesXmlPath += "/devices.xml";
+ QFile devicesFile(devicesXmlPath);
+ if (devicesFile.open(QIODevice::ReadOnly)) {
+ QXmlStreamReader xml(&devicesFile);
+ while (!xml.atEnd()) {
+ xml.readNext();
+ if (xml.isStartElement() && xml.name() == "devices") {
+ if (xml.attributes().value("version") == "1.0") {
+ // Look for correct device
+ while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) {
+ xml.readNext();
+ if (xml.isStartElement() && xml.name() == "device") {
+ if ((defaultDevice.isEmpty() && xml.attributes().value("default") == "yes") ||
+ (!defaultDevice.isEmpty() && (xml.attributes().value("id").toString() + QString(":") + xml.attributes().value("name").toString()) == defaultDevice)) {
+ // Found the correct device
+ while (!(xml.isEndElement() && xml.name() == "device") && !xml.atEnd()) {
+ xml.readNext();
+ if (xml.isStartElement() && xml.name() == "epocroot") {
+ epocRootStr = xml.readElementText();
+ fixEpocRootStr(epocRootStr);
+ return epocRootStr;
+ }
+ }
+ xml.raiseError("No epocroot element found");
+ }
+ }
+ }
+ } else {
+ xml.raiseError("Invalid 'devices' element version");
+ }
+ }
+ }
+ if (xml.hasError()) {
+ fprintf(stderr, "ERROR: \"%s\" when parsing devices.xml\n", qPrintable(xml.errorString()));
+ }
+ } else {
+ fprintf(stderr, "Could not open devices.xml (%s)\n", qPrintable(devicesXmlPath));
+ }
+ } else {
+ fprintf(stderr, "Could not retrieve " SYMBIAN_SDKS_KEY " setting\n");
+ }
+
+ fprintf(stderr, "Failed to determine epoc root.\n");
+ if (!defaultDevice.isEmpty())
+ fprintf(stderr, "The device indicated by EPOCDEVICE environment variable (%s) could not be found.\n", qPrintable(defaultDevice));
+ fprintf(stderr, "Either set EPOCROOT or EPOCDEVICE environment variable to a valid value, or provide a default Symbian device.\n");
+
+ // No valid device found; set epocroot to "/"
+ epocRootStr = QLatin1String("/");
+ }
+
+ fixEpocRootStr(epocRootStr);
+ return epocRootStr;
+}
+
+
+static bool isPlugin(const QFileInfo& info, const QString& devicePath)
+{
+ // Libraries are plugins if deployment path is something else than
+ // SYSBIN_DIR with or without drive letter
+ if (0 == info.suffix().compare(QLatin1String(SUFFIX_DLL), Qt::CaseInsensitive) &&
+ (devicePath.size() < 8 ||
+ (0 != devicePath.compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive) &&
+ 0 != devicePath.mid(1).compare(QLatin1String(":" SYSBIN_DIR), Qt::CaseInsensitive)))) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+static bool isBinary(const QFileInfo& info)
+{
+ if (0 == info.suffix().compare(QLatin1String(SUFFIX_DLL), Qt::CaseInsensitive) ||
+ 0 == info.suffix().compare(QLatin1String(SUFFIX_EXE), Qt::CaseInsensitive)) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+static void createPluginStub(const QFileInfo& info,
+ const QString& devicePath,
+ DeploymentList &deploymentList,
+ QStringList& generatedDirs,
+ QStringList& generatedFiles)
+{
+ QDir().mkpath(QLatin1String(PLUGIN_STUB_DIR "\\"));
+ if (!generatedDirs.contains(PLUGIN_STUB_DIR))
+ generatedDirs << PLUGIN_STUB_DIR;
+ // Plugin stubs must have different name from the actual plugins, because
+ // the toolchain for creating ROM images cannot handle non-binary .dll files properly.
+ QFile stubFile(QLatin1String(PLUGIN_STUB_DIR "\\") + info.completeBaseName() + "." SUFFIX_QTPLUGIN);
+ if (stubFile.open(QIODevice::WriteOnly)) {
+ if (!generatedFiles.contains(stubFile.fileName()))
+ generatedFiles << stubFile.fileName();
+ QTextStream t(&stubFile);
+ // Add note to stub so that people will not wonder what it is.
+ // Creation date is added to make new stub to deploy always to
+ // force plugin cache miss when loading plugins.
+ t << "This file is a Qt plugin stub file. The real Qt plugin is located in " SYSBIN_DIR ". Created:" << QDateTime::currentDateTime().toString(Qt::ISODate) << "\n";
+ } else {
+ fprintf(stderr, "cannot deploy \"%s\" because of plugin stub file creation failed\n", info.fileName().toLatin1().constData());
+ }
+ QFileInfo stubInfo(stubFile);
+ deploymentList.append(CopyItem(Option::fixPathToLocalOS(stubInfo.absoluteFilePath()),
+ Option::fixPathToLocalOS(devicePath + "\\" + stubInfo.fileName())));
+}
+
+QString generate_uid(const QString& target)
+{
+ static QMap<QString, QString> targetToUid;
+
+ QString tmp = targetToUid[target];
+
+ if (!tmp.isEmpty()) {
+ return tmp;
+ }
+
+ unsigned long hash = 5381;
+ int c;
+
+ for (int i = 0; i < target.size(); ++i) {
+ c = target.at(i).toAscii();
+ hash ^= c + ((c - i) << i % 20) + ((c + i) << (i + 5) % 20) + ((c - 2 * i) << (i + 10) % 20) + ((c + 2 * i) << (i + 15) % 20);
+ }
+
+ tmp.setNum(hash, 16);
+ for (int i = tmp.size(); i < 8; ++i)
+ tmp.prepend("0");
+
+ targetToUid[target] = tmp;
+
+ return tmp;
+}
+
+// UIDs starting with 0xE are test UIDs in symbian
+QString generate_test_uid(const QString& target)
+{
+ QString tmp = generate_uid(target);
+ tmp.replace(0, 1, "E");
+ tmp.prepend("0x");
+
+ return tmp;
+}
+
+
+void initProjectDeploySymbian(QMakeProject* project,
+ DeploymentList &deploymentList,
+ const QString &testPath,
+ bool deployBinaries,
+ const QString &platform,
+ const QString &build,
+ QStringList& generatedDirs,
+ QStringList& generatedFiles)
+{
+ QString targetPath = project->values("deploy.path").join(" ");
+ if (targetPath.isEmpty())
+ targetPath = testPath;
+ if (targetPath.endsWith("/") || targetPath.endsWith("\\"))
+ targetPath = targetPath.mid(0, targetPath.size() - 1);
+
+ bool targetPathHasDriveLetter = false;
+ if (targetPath.size() > 1) {
+ targetPathHasDriveLetter = targetPath.at(1) == QLatin1Char(':');
+ }
+ QString deploymentDrive = targetPathHasDriveLetter ? targetPath.left(2) : QLatin1String("c:");
+
+ foreach(QString item, project->values("DEPLOYMENT")) {
+ QString devicePath = project->first(item + ".path");
+ if (!deployBinaries
+ && !devicePath.isEmpty()
+ && (0 == devicePath.compare(project->values("APP_RESOURCE_DIR").join(""), Qt::CaseInsensitive)
+ || 0 == devicePath.compare(project->values("REG_RESOURCE_IMPORT_DIR").join(""), Qt::CaseInsensitive))) {
+ // Do not deploy resources in emulator builds, as that seems to cause conflicts
+ // If there is ever a real need to deploy pre-built resources for emulator,
+ // BLD_INF_RULES.prj_exports can be used as a workaround.
+ continue;
+ }
+
+ bool devicePathHasDriveLetter = false;
+ if (devicePath.size() > 1) {
+ devicePathHasDriveLetter = devicePath.at(1) == QLatin1Char(':');
+ }
+
+ if (devicePath.isEmpty() || devicePath == QLatin1String(".")) {
+ devicePath = targetPath;
+ }
+ // check if item.path is relative (! either / or \)
+ else if (!(devicePath.at(0) == QLatin1Char('/')
+ || devicePath.at(0) == QLatin1Char('\\')
+ || devicePathHasDriveLetter)) {
+ // create output path
+ devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('\\') + devicePath));
+ } else {
+ if (0 == platform.compare(QLatin1String("winscw"), Qt::CaseInsensitive)) {
+ if (devicePathHasDriveLetter) {
+ devicePath = epocRoot() + "epoc32\\winscw\\" + devicePath.remove(1, 1);
+ } else {
+ devicePath = epocRoot() + "epoc32\\winscw\\c" + devicePath;
+ }
+ } else {
+ // Drive letter needed if targetpath contains one and it is not already in
+ if (targetPathHasDriveLetter && !devicePathHasDriveLetter) {
+ devicePath = deploymentDrive + devicePath;
+ }
+ }
+ }
+
+ devicePath.replace(QLatin1String("/"), QLatin1String("\\"));
+
+ if (!deployBinaries &&
+ 0 == devicePath.right(8).compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive)) {
+ // Skip deploying to SYSBIN_DIR for anything but binary deployments
+ // Note: Deploying pre-built binaries also follow this rule, so emulator builds
+ // will not get those deployed. Since there is no way to differentiate currently
+ // between pre-built binaries for emulator and HW anyway, this is not a major issue.
+ continue;
+ }
+
+ foreach(QString source, project->values(item + ".sources")) {
+ source = Option::fixPathToLocalOS(source);
+ QString nameFilter;
+ QFileInfo info(source);
+ QString searchPath;
+ bool dirSearch = false;
+
+ if (info.isDir()) {
+ nameFilter = QLatin1String("*");
+ searchPath = info.absoluteFilePath();
+ dirSearch = true;
+ } else {
+ if (info.exists() || source.indexOf('*') != -1) {
+ nameFilter = source.split('\\').last();
+ searchPath = info.absolutePath();
+ } else {
+ // Entry was not found. That is ok if it is a binary, since those do not necessarily yet exist.
+ // Dlls need to be processed even when not deploying binaries for the stubs
+ if (isBinary(info)) {
+ if (deployBinaries) {
+ // Executables and libraries are deployed to \sys\bin
+ QFileInfo releasePath(epocRoot() + "epoc32\\release\\" + platform + "\\" + build + "\\");
+ if(devicePathHasDriveLetter) {
+ deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "\\" + info.fileName(), false, true),
+ Option::fixPathToLocalOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "\\") + info.fileName())));
+ } else {
+ deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "\\" + info.fileName(), false, true),
+ Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + info.fileName())));
+ }
+ }
+ if (isPlugin(info, devicePath)) {
+ createPluginStub(info, devicePath, deploymentList, generatedDirs, generatedFiles);
+ continue;
+ }
+ } else {
+ // Generate deployment even if file doesn't exist, as this may be the case
+ // when generating .pkg files.
+ deploymentList.append(CopyItem(Option::fixPathToLocalOS(info.absoluteFilePath()),
+ Option::fixPathToLocalOS(devicePath + "\\" + info.fileName())));
+ continue;
+ }
+ }
+ }
+
+ int pathSize = info.absolutePath().size();
+ QDirIterator iterator(searchPath, QStringList() << nameFilter
+ , QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks
+ , dirSearch ? QDirIterator::Subdirectories : QDirIterator::NoIteratorFlags);
+
+ while (iterator.hasNext()) {
+ iterator.next();
+ QFileInfo iteratorInfo(iterator.filePath());
+ QString absoluteItemPath = Option::fixPathToLocalOS(iteratorInfo.absolutePath());
+ int diffSize = absoluteItemPath.size() - pathSize;
+
+ if (!iteratorInfo.isDir()) {
+ if (isPlugin(iterator.fileInfo(), devicePath)) {
+ // This deploys pre-built plugins. Other pre-built binaries will deploy normally,
+ // as they have SYSBIN_DIR target path.
+ if (deployBinaries) {
+ deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()),
+ Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + iterator.fileName())));
+ }
+ createPluginStub(info, devicePath + "\\" + absoluteItemPath.right(diffSize), deploymentList, generatedDirs, generatedFiles);
+ continue;
+ } else {
+ deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()),
+ Option::fixPathToLocalOS(devicePath + "\\" + absoluteItemPath.right(diffSize) + "\\" + iterator.fileName())));
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.h b/qmake/generators/symbian/initprojectdeploy_symbian.h
new file mode 100644
index 000000000..9f574e3cc
--- /dev/null
+++ b/qmake/generators/symbian/initprojectdeploy_symbian.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INITPROJECTDEPLOYSYMBIAN_H
+#define INITPROJECTDEPLOYSYMBIAN_H
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qdatetime.h>
+#include <option.h>
+#include <qdir.h>
+#include <qfile.h>
+#include <stdlib.h>
+
+#include "epocroot.h"
+
+struct CopyItem
+{
+ CopyItem(const QString& f, const QString& t) : from(f) , to(t) { }
+ QString from;
+ QString to;
+};
+typedef QList<CopyItem> DeploymentList;
+
+extern QString generate_uid(const QString& target);
+extern QString generate_test_uid(const QString& target);
+
+extern void initProjectDeploySymbian(QMakeProject* project,
+ DeploymentList &deploymentList,
+ const QString &testPath,
+ bool deployBinaries,
+ const QString &platform,
+ const QString &build,
+ QStringList& generatedDirs,
+ QStringList& generatedFiles);
+
+#endif // INITPROJECTDEPLOYSYMBIAN_H
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
new file mode 100644
index 000000000..afaf338db
--- /dev/null
+++ b/qmake/generators/symbian/symmake.cpp
@@ -0,0 +1,1800 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "symmake.h"
+#include "initprojectdeploy_symbian.h"
+
+#include <qstring.h>
+#include <qhash.h>
+#include <qstringlist.h>
+#include <qdir.h>
+#include <qdatetime.h>
+#include <stdlib.h>
+#include <qdebug.h>
+
+#define RESOURCE_DIRECTORY_MMP "/resource/apps"
+#define RESOURCE_DIRECTORY_RESOURCE "\\\\resource\\\\apps\\\\"
+#define REGISTRATION_RESOURCE_DIRECTORY_HW "/private/10003a3f/import/apps"
+#define PLUGIN_COMMON_DEF_FILE_FOR_MMP "./plugin_common.def"
+#define PLUGIN_COMMON_DEF_FILE_ACTUAL "plugin_commonU.def"
+#define BLD_INF_FILENAME_LEN (sizeof(BLD_INF_FILENAME) - 1)
+
+#define BLD_INF_RULES_BASE "BLD_INF_RULES."
+#define BLD_INF_TAG_PLATFORMS "prj_platforms"
+#define BLD_INF_TAG_MMPFILES "prj_mmpfiles"
+#define BLD_INF_TAG_TESTMMPFILES "prj_testmmpfiles"
+#define BLD_INF_TAG_EXTENSIONS "prj_extensions"
+
+#define RSS_RULES "RSS_RULES"
+#define RSS_RULES_BASE "RSS_RULES."
+#define RSS_TAG_NBROFICONS "number_of_icons"
+#define RSS_TAG_ICONFILE "icon_file"
+
+#define MMP_TARGET "TARGET"
+#define MMP_TARGETTYPE "TARGETTYPE"
+#define MMP_SECUREID "SECUREID"
+#define MMP_OPTION_CW "OPTION CW"
+#define MMP_OPTION_ARMCC "OPTION ARMCC"
+#define MMP_OPTION_GCCE "OPTION GCCE"
+#define MMP_LINKEROPTION_CW "LINKEROPTION CW"
+#define MMP_LINKEROPTION_ARMCC "LINKEROPTION ARMCC"
+#define MMP_LINKEROPTION_GCCE "LINKEROPTION GCCE"
+
+#define SIS_TARGET "sis"
+#define OK_SIS_TARGET "ok_sis"
+#define FAIL_SIS_NOPKG_TARGET "fail_sis_nopkg"
+#define FAIL_SIS_NOCACHE_TARGET "fail_sis_nocache"
+#define RESTORE_BUILD_TARGET "restore_build"
+
+#define PRINT_FILE_CREATE_ERROR(filename) fprintf(stderr, "Error: Could not create '%s'\n", qPrintable(filename));
+
+QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const QDir& parentDir)
+{
+ static QString epocRootStr;
+ if (epocRootStr.isEmpty()) {
+ QFileInfo efi(epocRoot());
+ epocRootStr = efi.canonicalFilePath();
+ if (epocRootStr.isEmpty()) {
+ fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(epocRoot()));
+ epocRootStr = "/";
+ }
+ if (!epocRootStr.endsWith("/"))
+ epocRootStr += "/";
+
+ epocRootStr += "epoc32/";
+ }
+
+ QString resultPath = origPath;
+
+ // Make it relative, unless it starts with "%epocroot%/epoc32/"
+ if (resultPath.startsWith(epocRootStr, Qt::CaseInsensitive)) {
+ resultPath.replace(epocRootStr, "/epoc32/", Qt::CaseInsensitive);
+ } else {
+ resultPath = parentDir.relativeFilePath(resultPath);
+ }
+ resultPath = QDir::cleanPath(resultPath);
+
+ if (resultPath.isEmpty())
+ resultPath = ".";
+
+ return resultPath;
+}
+
+QString SymbianMakefileGenerator::canonizePath(const QString& origPath)
+{
+ // Since current path gets appended almost always anyway, use it as default
+ // for nonexisting paths.
+ static QString defaultPath;
+ if (defaultPath.isEmpty()) {
+ QFileInfo fi(".");
+ defaultPath = fi.canonicalFilePath();
+ }
+
+ // Prepend epocroot to any paths beginning with "/epoc32/"
+ QString resultPath = QDir::fromNativeSeparators(origPath);
+ if (resultPath.startsWith("/epoc32/", Qt::CaseInsensitive))
+ resultPath = QDir::fromNativeSeparators(epocRoot()) + resultPath.mid(1);
+
+ QFileInfo fi(fileInfo(resultPath));
+ if (fi.isDir()) {
+ resultPath = fi.canonicalFilePath();
+ } else {
+ resultPath = fi.canonicalPath();
+ }
+
+ resultPath = QDir::cleanPath(resultPath);
+
+ if (resultPath.isEmpty())
+ resultPath = defaultPath;
+
+ return resultPath;
+}
+
+SymbianMakefileGenerator::SymbianMakefileGenerator() : MakefileGenerator() { }
+SymbianMakefileGenerator::~SymbianMakefileGenerator() { }
+
+void SymbianMakefileGenerator::writeHeader(QTextStream &t)
+{
+ t << "// ============================================================================" << endl;
+ t << "// * Makefile for building: " << escapeFilePath(var("TARGET")) << endl;
+ t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl;
+ t << "// * This file is generated by qmake and should not be modified by the" << endl;
+ t << "// * user." << endl;
+ t << "// * Project: " << fileFixify(project->projectFile()) << endl;
+ t << "// * Template: " << var("TEMPLATE") << endl;
+ t << "// ============================================================================" << endl;
+ t << endl;
+
+ // Defining define for bld.inf
+
+ QString shortProFilename = project->projectFile();
+ shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString(""));
+ shortProFilename.replace(Option::pro_ext, QString(""));
+
+ QString bldinfDefine = shortProFilename;
+ bldinfDefine.append("_");
+ bldinfDefine.append(generate_uid(project->projectFile()));
+
+ bldinfDefine.prepend("BLD_INF_");
+ removeSpecialCharacters(bldinfDefine);
+
+ t << "#define " << bldinfDefine.toUpper() << endl << endl;
+}
+
+bool SymbianMakefileGenerator::writeMakefile(QTextStream &t)
+{
+ writeHeader(t);
+
+ QString numberOfIcons;
+ QString iconFile;
+ QStringList userRssRules;
+ readRssRules(numberOfIcons, iconFile, userRssRules);
+
+ // Get the application translations and convert to symbian OS lang code, i.e. decical number
+ QStringList symbianLangCodes = symbianLangCodesFromTsFiles();
+
+ // Generate pkg files if there are any actual files to deploy
+ bool generatePkg = false;
+ if (targetType == TypeExe) {
+ generatePkg = true;
+ } else {
+ foreach(QString item, project->values("DEPLOYMENT")) {
+ if (!project->values(item + ".sources").isEmpty()) {
+ generatePkg = true;
+ break;
+ }
+ }
+ }
+
+ if (generatePkg) {
+ generatePkgFile(iconFile);
+ }
+
+ writeBldInfContent(t, generatePkg, iconFile);
+
+ // Generate empty wrapper makefile here, because wrapper makefile must exist before writeMkFile,
+ // but all required data is not yet available.
+ bool isPrimaryMakefile = true;
+ QString wrapperFileName("Makefile");
+ QString outputFileName = fileInfo(Option::output.fileName()).fileName();
+ if (outputFileName != BLD_INF_FILENAME) {
+ wrapperFileName.append(".").append((outputFileName.size() > BLD_INF_FILENAME_LEN && outputFileName.left(BLD_INF_FILENAME_LEN) == BLD_INF_FILENAME) ? outputFileName.mid(8) : outputFileName);
+ isPrimaryMakefile = false;
+ }
+
+ QFile wrapperMakefile(wrapperFileName);
+ if (wrapperMakefile.open(QIODevice::WriteOnly)) {
+ generatedFiles << wrapperFileName;
+ } else {
+ PRINT_FILE_CREATE_ERROR(wrapperFileName);
+ return false;
+ }
+
+ if (targetType == TypeSubdirs) {
+ // If we have something to deploy, generate extension makefile for just that, since
+ // normal extension makefile is not getting generated and we need emulator deployment to be done.
+ if (generatePkg)
+ writeMkFile(wrapperFileName, true);
+ writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile);
+ return true;
+ }
+
+ writeMkFile(wrapperFileName, false);
+
+ QString shortProFilename = project->projectFile();
+ shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString(""));
+ shortProFilename.replace(Option::pro_ext, QString(""));
+
+ QString mmpFilename = shortProFilename;
+ mmpFilename.append("_");
+ mmpFilename.append(uid3);
+ mmpFilename.append(Option::mmp_ext);
+ writeMmpFile(mmpFilename, symbianLangCodes);
+
+ if (targetType == TypeExe) {
+ if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) {
+ writeRegRssFile(userRssRules);
+ writeRssFile(numberOfIcons, iconFile);
+ writeLocFile(symbianLangCodes);
+ }
+ }
+
+ writeCustomDefFile();
+ writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile);
+
+ return true;
+}
+
+void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile)
+{
+ QString pkgFilename = QString("%1_template.%2")
+ .arg(fixedTarget)
+ .arg("pkg");
+ QFile pkgFile(pkgFilename);
+ if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ PRINT_FILE_CREATE_ERROR(pkgFilename);
+ return;
+ }
+
+ generatedFiles << pkgFile.fileName();
+
+ // Header info
+ QTextStream t(&pkgFile);
+ t << QString("; %1 generated by qmake at %2").arg(pkgFilename).arg(QDateTime::currentDateTime().toString(Qt::ISODate)) << endl;
+ t << "; This file is generated by qmake and should not be modified by the user" << endl;
+ t << ";" << endl << endl;
+
+ // Construct QStringList from pkg_prerules since we need search it before printed to file
+ QStringList rawPkgPreRules;
+ foreach(QString deploymentItem, project->values("DEPLOYMENT")) {
+ foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_prerules")) {
+ QStringList pkgrulesValue = project->values(pkgrulesItem);
+ // If there is no stringlist defined for a rule, use rule name directly
+ // This is convenience for defining single line mmp statements
+ if (pkgrulesValue.isEmpty()) {
+ rawPkgPreRules << pkgrulesItem;
+ } else {
+ foreach(QString pkgrule, pkgrulesValue) {
+ rawPkgPreRules << pkgrule;
+ }
+ }
+ }
+ }
+
+ // Apply some defaults if specific data does not exist in PKG pre-rules
+
+ if (!containsStartWithItem('&', rawPkgPreRules)) {
+ // language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS)
+ t << "; Language" << endl;
+ t << "&EN" << endl << endl;
+ } else {
+ // In case user defines langs, he must take care also about SIS header
+ if (!containsStartWithItem('#', rawPkgPreRules))
+ fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n");
+ }
+
+ // name of application, UID and version
+ QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ',');
+
+ if (!containsStartWithItem('#', rawPkgPreRules)) {
+ QString visualTarget = escapeFilePath(fileFixify(project->first("TARGET")));
+ visualTarget = removePathSeparators(visualTarget);
+
+ t << "; SIS header: name, uid, version" << endl;
+ t << QString("#{\"%1\"},(%2),%3").arg(visualTarget).arg(uid3).arg(applicationVersion) << endl << endl;
+ }
+
+ // Localized vendor name
+ if (!containsStartWithItem('%', rawPkgPreRules)) {
+ t << "; Localised Vendor name" << endl;
+ t << "%{\"Vendor\"}" << endl << endl;
+ }
+
+ // Unique vendor name
+ if (!containsStartWithItem(':', rawPkgPreRules)) {
+ t << "; Unique Vendor name" << endl;
+ t << ":\"Vendor\"" << endl << endl;
+ }
+
+ // PKG pre-rules - these are added before actual file installations i.e. SIS package body
+ if (rawPkgPreRules.size()) {
+ t << "; Manual PKG pre-rules from PRO files" << endl;
+ foreach(QString item, rawPkgPreRules) {
+ t << item << endl;
+ }
+ t << endl;
+ }
+
+ // Install paths on the phone *** should be dynamic at some point
+ QString installPathBin = "!:\\sys\\bin";
+ QString installPathResource = "!:\\resource\\apps";
+ QString installPathRegResource = "!:\\private\\10003a3f\\import\\apps";
+
+ // Find location of builds
+ QString epocReleasePath = QString("%1epoc32/release/$(PLATFORM)/$(TARGET)")
+ .arg(epocRoot());
+
+
+ if (targetType == TypeExe) {
+ // deploy .exe file
+ t << "; Executable and default resource files" << endl;
+ QString exeFile = fixedTarget + ".exe";
+ t << QString("\"%1/%2\" - \"%3\\%4\"")
+ .arg(epocReleasePath)
+ .arg(exeFile)
+ .arg(installPathBin)
+ .arg(exeFile) << endl;
+
+ // deploy rsc & reg_rsc file
+ if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) {
+ t << QString("\"%1epoc32/data/z/resource/apps/%2\" - \"%3\\%4\"")
+ .arg(epocRoot())
+ .arg(fixedTarget + ".rsc")
+ .arg(installPathResource)
+ .arg(fixedTarget + ".rsc") << endl;
+
+ t << QString("\"%1epoc32/data/z/private/10003a3f/import/apps/%2\" - \"%3\\%4\"")
+ .arg(epocRoot())
+ .arg(fixedTarget + "_reg.rsc")
+ .arg(installPathRegResource)
+ .arg(fixedTarget + "_reg.rsc") << endl;
+
+ if (!iconFile.isEmpty()) {
+ t << QString("\"%1epoc32/data/z%2\" - \"!:%3\"")
+ .arg(epocRoot())
+ .arg(iconFile)
+ .arg(QDir::toNativeSeparators(iconFile)) << endl << endl;
+ }
+ }
+ }
+
+ // deploy any additional DEPLOYMENT files
+ DeploymentList depList;
+ QString remoteTestPath;
+ remoteTestPath = QString("!:\\private\\%1").arg(privateDirUid);
+
+ initProjectDeploySymbian(project, depList, remoteTestPath, true, "$(PLATFORM)", "$(TARGET)", generatedDirs, generatedFiles);
+ if (depList.size())
+ t << "; DEPLOYMENT" << endl;
+ for (int i = 0; i < depList.size(); ++i) {
+ t << QString("\"%1\" - \"%2\"")
+ .arg(QString(depList.at(i).from).replace('\\','/'))
+ .arg(depList.at(i).to) << endl;
+ }
+ t << endl;
+
+ // PKG post-rules - these are added after actual file installations i.e. SIS package body
+ t << "; Manual PKG post-rules from PRO files" << endl;
+ foreach(QString deploymentItem, project->values("DEPLOYMENT")) {
+ foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_postrules")) {
+ QStringList pkgrulesValue = project->values(pkgrulesItem);
+ // If there is no stringlist defined for a rule, use rule name directly
+ // This is convenience for defining single line statements
+ if (pkgrulesValue.isEmpty()) {
+ t << pkgrulesItem << endl;
+ } else {
+ foreach(QString pkgrule, pkgrulesValue) {
+ t << pkgrule << endl;
+ }
+ }
+ t << endl;
+ }
+ }
+}
+
+bool SymbianMakefileGenerator::containsStartWithItem(const QChar &c, const QStringList& src)
+{
+ bool result = false;
+ foreach(QString str, src) {
+ if (str.startsWith(c)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+}
+
+void SymbianMakefileGenerator::writeCustomDefFile()
+{
+ if (targetType == TypePlugin && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) {
+ // Create custom def file for plugin
+ QFile ft(QLatin1String(PLUGIN_COMMON_DEF_FILE_ACTUAL));
+
+ if (ft.open(QIODevice::WriteOnly)) {
+ generatedFiles << ft.fileName();
+ QTextStream t(&ft);
+
+ t << "; ==============================================================================" << endl;
+ t << "; Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl;
+ t << "; This file is generated by qmake and should not be modified by the" << endl;
+ t << "; user." << endl;
+ t << "; Name : " PLUGIN_COMMON_DEF_FILE_ACTUAL << endl;
+ t << "; Part of : " << project->values("TARGET").join(" ") << endl;
+ t << "; Description : Fixes common plugin symbols to known ordinals" << endl;
+ t << "; Version : " << endl;
+ t << ";" << endl;
+ t << "; ==============================================================================" << "\n" << endl;
+
+ t << endl;
+
+ t << "EXPORTS" << endl;
+ t << "\tqt_plugin_query_verification_data @ 1 NONAME" << endl;
+ t << "\tqt_plugin_instance @ 2 NONAME" << endl;
+ t << endl;
+ } else {
+ PRINT_FILE_CREATE_ERROR(QString(PLUGIN_COMMON_DEF_FILE_ACTUAL))
+ }
+ }
+}
+
+void SymbianMakefileGenerator::init()
+{
+ MakefileGenerator::init();
+ fixedTarget = escapeFilePath(fileFixify(project->first("TARGET")));
+ fixedTarget = removePathSeparators(fixedTarget);
+ removeSpecialCharacters(fixedTarget);
+
+ if (0 != project->values("QMAKE_PLATFORM").size())
+ platform = varGlue("QMAKE_PLATFORM", "", " ", "");
+
+ if (0 == project->values("QMAKESPEC").size())
+ project->values("QMAKESPEC").append(qgetenv("QMAKESPEC"));
+
+ project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS"));
+ project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE"));
+
+ // bld.inf
+ project->values("MAKEFILE") += BLD_INF_FILENAME;
+
+ // .mmp
+ initMmpVariables();
+
+ // Check TARGET.UID3 presence
+ if (0 != project->values("TARGET.UID3").size()) {
+ uid3 = project->first("TARGET.UID3");
+ } else {
+ uid3 = generateUID3();
+ }
+
+ if ((project->values("TEMPLATE")).contains("app"))
+ targetType = TypeExe;
+ else if ((project->values("TEMPLATE")).contains("lib")) {
+ // Check CONFIG to see if we are to build staticlib or dll
+ if (project->values("CONFIG").contains("staticlib") || project->values("CONFIG").contains("static"))
+ targetType = TypeLib;
+ else if (project->values("CONFIG").contains("plugin"))
+ targetType = TypePlugin;
+ else
+ targetType = TypeDll;
+ } else {
+ targetType = TypeSubdirs;
+ }
+
+ if (0 != project->values("TARGET.UID2").size()) {
+ uid2 = project->first("TARGET.UID2");
+ } else if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) {
+ uid2 = "0x20004C45";
+ } else {
+ if (targetType == TypeExe) {
+ if (project->values("QT").contains("gui", Qt::CaseInsensitive)) {
+ // exe and gui -> uid2 needed
+ uid2 = "0x100039CE";
+ } else {
+ // exe but not gui: uid2 is ignored anyway -> set it to 0
+ uid2 = "0";
+ }
+ } else if (targetType == TypeDll || targetType == TypeLib || targetType == TypePlugin) {
+ uid2 = "0x1000008d";
+ }
+ }
+
+ uid2 = uid2.trimmed();
+ uid3 = uid3.trimmed();
+
+ // UID is valid as either hex or decimal, so just convert it to number and back to hex
+ // to get proper string for private dir
+ bool conversionOk = false;
+ uint uidNum = uid3.toUInt(&conversionOk, 0);
+
+ if (!conversionOk) {
+ fprintf(stderr, "Error: Invalid UID \"%s\".\n", uid3.toUtf8().constData());
+ } else {
+ privateDirUid.setNum(uidNum, 16);
+ while (privateDirUid.length() < 8)
+ privateDirUid.insert(0, QLatin1Char('0'));
+ }
+}
+
+QString SymbianMakefileGenerator::getTargetExtension()
+{
+ QString ret;
+ if (targetType == TypeExe) {
+ ret.append("exe");
+ } else if (targetType == TypeLib) {
+ ret.append("lib");
+ } else if (targetType == TypeDll || targetType == TypePlugin) {
+ ret.append("dll");
+ } else if (targetType == TypeSubdirs) {
+ // Not actually usable, so return empty
+ } else {
+ // If nothing else set, default to exe
+ ret.append("exe");
+ }
+
+ return ret;
+}
+
+QString SymbianMakefileGenerator::generateUID3()
+{
+ QString target = project->first("TARGET");
+ QString currPath = qmake_getpwd();
+ target.prepend("/").prepend(currPath);
+ return generate_test_uid(target);
+}
+
+void SymbianMakefileGenerator::initMmpVariables()
+{
+ QStringList sysincspaths;
+ QStringList srcincpaths;
+ QStringList srcpaths;
+
+ srcpaths << project->values("SOURCES") << project->values("GENERATED_SOURCES");
+ srcpaths << project->values("UNUSED_SOURCES") << project->values("UI_SOURCES_DIR");
+ srcpaths << project->values("UI_DIR");
+
+ QDir current = QDir::current();
+ QString canonizedCurrent = canonizePath(".");
+
+ for (int j = 0; j < srcpaths.size(); ++j) {
+ QFileInfo fi(fileInfo(srcpaths.at(j)));
+ // Sometimes sources have other than *.c* files (e.g. *.moc); prune them.
+ if (fi.suffix().startsWith("c")) {
+ if (fi.filePath().length() > fi.fileName().length()) {
+ appendIfnotExist(srcincpaths, fi.path());
+ sources[canonizePath(fi.path())] += fi.fileName();
+ } else {
+ sources[canonizedCurrent] += fi.fileName();
+ appendIfnotExist(srcincpaths, canonizedCurrent);
+ }
+ }
+ }
+
+ QStringList incpaths;
+ incpaths << project->values("INCLUDEPATH");
+ incpaths << QLibraryInfo::location(QLibraryInfo::HeadersPath);
+ incpaths << project->values("HEADERS");
+ incpaths << srcincpaths;
+ incpaths << project->values("UI_HEADERS_DIR");
+ incpaths << project->values("UI_DIR");
+
+ for (int j = 0; j < incpaths.size(); ++j) {
+ QString includepath = canonizePath(incpaths.at(j));
+ appendIfnotExist(sysincspaths, includepath);
+ appendAbldTempDirs(sysincspaths, includepath);
+ }
+
+ // Remove duplicate include path entries
+ QStringList temporary;
+ for (int i = 0; i < sysincspaths.size(); ++i) {
+ QString origPath = sysincspaths.at(i);
+ QFileInfo origPathInfo(fileInfo(origPath));
+ bool bFound = false;
+
+ for (int j = 0; j < temporary.size(); ++j) {
+ QString tmpPath = temporary.at(j);
+ QFileInfo tmpPathInfo(fileInfo(tmpPath));
+
+ if (origPathInfo.absoluteFilePath() == tmpPathInfo.absoluteFilePath()) {
+ bFound = true;
+ if (!tmpPathInfo.isRelative() && origPathInfo.isRelative()) {
+ // We keep the relative notation
+ temporary.removeOne(tmpPath);
+ temporary << origPath;
+ }
+ }
+ }
+
+ if (!bFound)
+ temporary << origPath;
+
+ }
+
+ sysincspaths.clear();
+ sysincspaths << temporary;
+
+ systeminclude.insert("SYSTEMINCLUDE", sysincspaths);
+
+ // Check MMP_RULES for singleton keywords that are overridden
+ QStringList overridableMmpKeywords;
+ overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE);
+
+ foreach (QString item, project->values("MMP_RULES")) {
+ if (project->values(item).isEmpty()) {
+ checkOverridability(overridableMmpKeywords, item);
+ } else {
+ foreach (QString itemRow, project->values(item)) {
+ checkOverridability(overridableMmpKeywords, itemRow);
+ }
+ }
+ }
+}
+
+void SymbianMakefileGenerator::checkOverridability(QStringList &overridableKeywords, QString &checkString)
+{
+ // Check if checkString contains overridable keyword and
+ // add the keyword to overridden keywords list if so.
+ QString simplifiedString = checkString.simplified();
+ foreach (QString item, overridableKeywords) {
+ if (simplifiedString.startsWith(item))
+ appendIfnotExist(overriddenMmpKeywords, item);
+ }
+}
+
+bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList &stringList)
+{
+ QStringList tmpStringList;
+
+ for (int i = 0; i < stringList.size(); ++i) {
+ QString string = stringList.at(i);
+ if (tmpStringList.contains(string))
+ continue;
+ else
+ tmpStringList.append(string);
+ }
+
+ stringList.clear();
+ stringList = tmpStringList;
+ return true;
+}
+
+void SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t)
+{
+ t << "// ==============================================================================" << endl;
+ t << "// Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl;
+ t << "// This file is generated by qmake and should not be modified by the" << endl;
+ t << "// user." << endl;
+ t << "// Name : " << escapeFilePath(fileFixify(project->projectFile().remove(project->projectFile().length() - 4, 4))) << Option::mmp_ext << endl;
+ t << "// ==============================================================================" << endl << endl;
+}
+
+void SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symbianLangCodes)
+{
+ QFile ft(filename);
+ if (ft.open(QIODevice::WriteOnly)) {
+ generatedFiles << ft.fileName();
+
+ QTextStream t(&ft);
+
+ writeMmpFileHeader(t);
+
+ writeMmpFileTargetPart(t);
+
+ writeMmpFileResourcePart(t, symbianLangCodes);
+
+ writeMmpFileMacrosPart(t);
+
+ writeMmpFileIncludePart(t);
+
+ QDir current = QDir::current();
+
+ for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) {
+ QStringList values = it.value();
+ QString currentSourcePath = it.key();
+
+ if (values.size())
+ t << "SOURCEPATH \t" << fixPathForMmp(currentSourcePath, current) << endl;
+
+ for (int i = 0; i < values.size(); ++i) {
+ QString sourceFileName = values.at(i);
+ t << "SOURCE\t\t" << sourceFileName << endl;
+ }
+ t << endl;
+ }
+ t << endl;
+
+ if (!project->values("CONFIG").contains("static") && !project->values("CONFIG").contains("staticlib")) {
+ writeMmpFileLibraryPart(t);
+ }
+
+ writeMmpFileCapabilityPart(t);
+
+ writeMmpFileCompilerOptionPart(t);
+
+ writeMmpFileBinaryVersionPart(t);
+
+ writeMmpFileRulesPart(t);
+ } else {
+ PRINT_FILE_CREATE_ERROR(filename)
+ }
+}
+
+void SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t)
+{
+ t << endl;
+
+ QStringList &defines = project->values("DEFINES");
+ if (defines.size())
+ t << "// Qt Macros" << endl;
+ for (int i = 0; i < defines.size(); ++i) {
+ QString def = defines.at(i);
+ addMacro(t, def);
+ }
+
+ // These are required in order that all methods will be correctly exported e.g from qtestlib
+ QStringList &exp_defines = project->values("PRL_EXPORT_DEFINES");
+ if (exp_defines.size())
+ t << endl << "// Qt Export Defines" << endl;
+ for (int i = 0; i < exp_defines.size(); ++i) {
+ QString def = exp_defines.at(i);
+ addMacro(t, def);
+ }
+
+ t << endl;
+}
+
+void SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value)
+{
+ t << "MACRO" << "\t\t" << value << endl;
+}
+
+
+void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t)
+{
+ bool skipTargetType = overriddenMmpKeywords.contains(MMP_TARGETTYPE);
+
+ if (targetType == TypeExe) {
+ t << MMP_TARGET << "\t\t" << fixedTarget << ".exe" << endl;
+ if (!skipTargetType) {
+ if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
+ t << MMP_TARGETTYPE << "\t\t" << "STDEXE" << endl;
+ else
+ t << MMP_TARGETTYPE << "\t\t" << "EXE" << endl;
+ }
+ } else if (targetType == TypeDll || targetType == TypePlugin) {
+ t << MMP_TARGET << "\t\t" << fixedTarget << ".dll" << endl;
+ if (!skipTargetType) {
+ if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
+ t << MMP_TARGETTYPE << "\t\t" << "STDDLL" << endl;
+ else
+ t << MMP_TARGETTYPE << "\t\t" << "DLL" << endl;
+ }
+ } else if (targetType == TypeLib) {
+ t << MMP_TARGET << "\t\t" << fixedTarget << ".lib" << endl;
+ if (!skipTargetType) {
+ if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
+ t << MMP_TARGETTYPE << "\t\t" << "STDLIB" << endl;
+ else
+ t << MMP_TARGETTYPE << "\t\t" << "LIB" << endl;
+ }
+ } else {
+ fprintf(stderr, "Error: Unexpected targettype (%d) in SymbianMakefileGenerator::writeMmpFileTargetPart\n", targetType);
+ }
+
+ t << endl;
+
+ t << "UID" << "\t\t" << uid2 << " " << uid3 << endl;
+
+ if (0 != project->values("TARGET.SID").size()) {
+ t << MMP_SECUREID << "\t\t" << project->values("TARGET.SID").join(" ") << endl;
+ } else {
+ if (0 == uid3.size())
+ t << MMP_SECUREID << "\t\t" << "0" << endl;
+ else
+ t << MMP_SECUREID << "\t\t" << uid3 << endl;
+ }
+
+ // default value used from mkspecs is 0
+ if (0 != project->values("TARGET.VID").size()) {
+ t << "VENDORID" << "\t\t" << project->values("TARGET.VID").join(" ") << endl;
+ }
+
+ t << endl;
+
+ if (0 != project->first("TARGET.EPOCSTACKSIZE").size())
+ t << "EPOCSTACKSIZE" << "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl;
+ if (0 != project->values("TARGET.EPOCHEAPSIZE").size())
+ t << "EPOCHEAPSIZE" << "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl;
+ if (0 != project->values("TARGET.EPOCALLOWDLLDATA").size())
+ t << "EPOCALLOWDLLDATA" << endl;
+
+ if (targetType == TypePlugin && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) {
+ // Use custom def file for Qt plugins
+ t << "DEFFILE " PLUGIN_COMMON_DEF_FILE_FOR_MMP << endl;
+ }
+
+ t << endl;
+}
+
+
+/*
+ Application registration resource files should be installed to the
+ \private\10003a3f\import\apps directory.
+*/
+void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes)
+{
+ if ((targetType == TypeExe) &&
+ !project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) {
+
+ QString locTarget = fixedTarget;
+ locTarget.append(".rss");
+
+ t << "SOURCEPATH\t\t\t. " << endl;
+ t << "LANG SC "; // no endl
+ foreach(QString lang, symbianLangCodes) {
+ t << lang << " "; // no endl
+ }
+ t << endl;
+ t << "START RESOURCE\t\t" << locTarget << endl;
+ t << "HEADER" << endl;
+ t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP << endl;
+ t << "END" << endl << endl;
+
+ QString regTarget = fixedTarget;
+ regTarget.append("_reg.rss");
+
+ t << "SOURCEPATH\t\t\t." << endl;
+ t << "START RESOURCE\t\t" << regTarget << endl;
+ if (isForSymbianSbsv2())
+ t << "DEPENDS " << fixedTarget << ".rsg" << endl;
+ t << "TARGETPATH\t\t" REGISTRATION_RESOURCE_DIRECTORY_HW << endl;
+ t << "END" << endl << endl;
+ }
+}
+
+void SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t)
+{
+ QDir current = QDir::current();
+
+ 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 handledPath = values.at(i);
+ t << "SYSTEMINCLUDE" << "\t\t" << fixPathForMmp(handledPath, current) << endl;
+ }
+ }
+
+ t << endl;
+}
+
+void SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t)
+{
+ writeMmpFileSystemIncludePart(t);
+}
+
+void SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t)
+{
+ QStringList &libs = project->values("LIBS");
+ libs << project->values("QMAKE_LIBS") << project->values("QMAKE_LIBS_PRIVATE");
+
+ removeDuplicatedStrings(libs);
+
+ for (int i = 0; i < libs.size(); ++i) {
+ QString lib = libs.at(i);
+ // The -L flag is uninteresting, since all symbian libraries exist in the same directory.
+ if (lib.startsWith("-l")) {
+ lib.remove(0, 2);
+ QString mmpStatement;
+ if (lib.endsWith(".dll")) {
+ lib.chop(4);
+ mmpStatement = "LIBRARY\t\t";
+ } else if (lib.endsWith(".lib")) {
+ lib.chop(4);
+ mmpStatement = "STATICLIBRARY\t";
+ } else {
+ // Hacky way to find out what kind of library it is. Check the
+ // ARMV5 build directory for library type. We default to shared
+ // library, since that is more common.
+ QString udebStaticLibLocation(epocRoot());
+ QString urelStaticLibLocation(udebStaticLibLocation);
+ udebStaticLibLocation += QString("epoc32/release/armv5/udeb/%1.lib").arg(lib);
+ urelStaticLibLocation += QString("epoc32/release/armv5/urel/%1.lib").arg(lib);
+ if (QFile::exists(udebStaticLibLocation) || QFile::exists(urelStaticLibLocation)) {
+ mmpStatement = "STATICLIBRARY\t";
+ } else {
+ mmpStatement = "LIBRARY\t\t";
+ }
+ }
+ t << mmpStatement << lib << ".lib" << endl;
+ }
+ }
+
+ t << endl;
+}
+
+void SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t)
+{
+ if (0 != project->first("TARGET.CAPABILITY").size()) {
+ QStringList &capabilities = project->values("TARGET.CAPABILITY");
+ t << "CAPABILITY" << "\t\t";
+
+ for (int i = 0; i < capabilities.size(); ++i) {
+ QString cap = capabilities.at(i);
+ t << cap << " ";
+ }
+ } else {
+ t << "CAPABILITY" << "\t\t" << "None";
+ }
+ t << endl << endl;
+}
+
+void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t)
+{
+ QString cw, armcc, gcce;
+ QString cwlink, armlink, gccelink;
+
+ if (0 != project->values("QMAKE_CXXFLAGS.CW").size()) {
+ cw.append(project->values("QMAKE_CXXFLAGS.CW").join(" "));
+ cw.append(" ");
+ }
+
+ if (0 != project->values("QMAKE_CXXFLAGS.ARMCC").size()) {
+ armcc.append(project->values("QMAKE_CXXFLAGS.ARMCC").join(" "));
+ armcc.append(" ");
+ }
+
+ if (0 != project->values("QMAKE_CXXFLAGS.GCCE").size()) {
+ gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" "));
+ gcce.append(" ");
+ }
+
+ if (0 != project->values("QMAKE_CFLAGS.CW").size()) {
+ cw.append(project->values("QMAKE_CFLAGS.CW").join(" "));
+ cw.append(" ");
+ }
+
+ if (0 != project->values("QMAKE_CFLAGS.ARMCC").size()) {
+ armcc.append(project->values("QMAKE_CFLAGS.ARMCC").join(" "));
+ armcc.append(" ");
+ }
+
+ if (0 != project->values("QMAKE_CFLAGS.GCCE").size()) {
+ gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" "));
+ gcce.append(" ");
+ }
+
+ if (0 != project->values("QMAKE_CXXFLAGS").size()) {
+ cw.append(project->values("QMAKE_CXXFLAGS").join(" "));
+ cw.append(" ");
+ armcc.append(project->values("QMAKE_CXXFLAGS").join(" "));
+ armcc.append(" ");
+ gcce.append(project->values("QMAKE_CXXFLAGS").join(" "));
+ gcce.append(" ");
+ }
+
+ if (0 != project->values("QMAKE_CFLAGS").size()) {
+ cw.append(project->values("QMAKE_CFLAGS").join(" "));
+ cw.append(" ");
+ armcc.append(project->values("QMAKE_CFLAGS").join(" "));
+ armcc.append(" ");
+ gcce.append(project->values("QMAKE_CFLAGS").join(" "));
+ gcce.append(" ");
+ }
+
+ if (0 != project->values("QMAKE_LFLAGS.CW").size()) {
+ cwlink.append(project->values("QMAKE_LFLAGS.CW").join(" "));
+ cwlink.append(" ");
+ }
+
+ if (0 != project->values("QMAKE_LFLAGS.ARMCC").size()) {
+ armlink.append(project->values("QMAKE_LFLAGS.ARMCC").join(" "));
+ armlink.append(" ");
+ }
+
+ if (0 != project->values("QMAKE_LFLAGS.GCCE").size()) {
+ gccelink.append(project->values("QMAKE_LFLAGS.GCCE").join(" "));
+ gccelink.append(" ");
+ }
+
+ if (0 != project->values("QMAKE_LFLAGS").size()) {
+ cwlink.append(project->values("QMAKE_LFLAGS").join(" "));
+ cwlink.append(" ");
+ armlink.append(project->values("QMAKE_LFLAGS").join(" "));
+ armlink.append(" ");
+ gccelink.append(project->values("QMAKE_LFLAGS").join(" "));
+ gccelink.append(" ");
+ }
+
+ if (!cw.isEmpty() && cw[cw.size()-1] == ' ')
+ cw.chop(1);
+ if (!armcc.isEmpty() && armcc[armcc.size()-1] == ' ')
+ armcc.chop(1);
+ if (!gcce.isEmpty() && gcce[gcce.size()-1] == ' ')
+ gcce.chop(1);
+ if (!cwlink.isEmpty() && cwlink[cwlink.size()-1] == ' ')
+ cwlink.chop(1);
+ if (!armlink.isEmpty() && armlink[armlink.size()-1] == ' ')
+ armlink.chop(1);
+ if (!gccelink.isEmpty() && gccelink[gccelink.size()-1] == ' ')
+ gccelink.chop(1);
+
+ if (!cw.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_CW))
+ t << MMP_OPTION_CW " " << cw << endl;
+ if (!armcc.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_ARMCC))
+ t << MMP_OPTION_ARMCC " " << armcc << endl;
+ if (!gcce.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_GCCE))
+ t << MMP_OPTION_GCCE " " << gcce << endl;
+
+ if (!cwlink.isEmpty() && !overriddenMmpKeywords.contains(MMP_LINKEROPTION_CW))
+ t << MMP_LINKEROPTION_CW " " << cwlink << endl;
+ if (!armlink.isEmpty() && !overriddenMmpKeywords.contains(MMP_LINKEROPTION_ARMCC))
+ t << MMP_LINKEROPTION_ARMCC " " << armlink << endl;
+ if (!gccelink.isEmpty() && !overriddenMmpKeywords.contains(MMP_LINKEROPTION_GCCE))
+ t << MMP_LINKEROPTION_GCCE " " << gccelink << endl;
+
+ t << endl;
+}
+
+void SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t)
+{
+ QString applicationVersion = project->first("VERSION");
+ QStringList verNumList = applicationVersion.split('.');
+ uint major = 0;
+ uint minor = 0;
+ uint patch = 0;
+ bool success = false;
+
+ if (verNumList.size() > 0) {
+ major = verNumList[0].toUInt(&success);
+ if (success && verNumList.size() > 1) {
+ minor = verNumList[1].toUInt(&success);
+ if (success && verNumList.size() > 2) {
+ patch = verNumList[2].toUInt(&success);
+ }
+ }
+ }
+
+ QString mmpVersion;
+ if (success && major <= 0xFFFF && minor <= 0xFF && patch <= 0xFF) {
+ // Symbian binary version only has major and minor components, so compress
+ // Qt's minor and patch values into the minor component. Since Symbian's minor
+ // component is a 16 bit value, only allow 8 bits for each to avoid overflow.
+ mmpVersion.append(QString::number(major))
+ .append('.')
+ .append(QString::number((minor << 8) + patch));
+ } else {
+ if (!applicationVersion.isEmpty())
+ fprintf(stderr, "Invalid VERSION string: %s\n", qPrintable(applicationVersion));
+ mmpVersion = "10.0"; // Default binary version for symbian is 10.0
+ }
+
+ t << "VERSION " << mmpVersion << endl;
+}
+
+void SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t)
+{
+ foreach(QString item, project->values("MMP_RULES")) {
+ t << endl;
+ // If there is no stringlist defined for a rule, use rule name directly
+ // This is convenience for defining single line mmp statements
+ if (project->values(item).isEmpty()) {
+ t << item << endl;
+ } else {
+ foreach(QString itemRow, project->values(item)) {
+ t << itemRow << endl;
+ }
+ }
+ }
+}
+
+void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension, const QString &iconFile)
+{
+ // 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)) {
+ QString newKey = it.key().mid(sizeof(BLD_INF_RULES_BASE) - 1);
+ if (newKey.isEmpty()) {
+ fprintf(stderr, "Warning: Empty BLD_INF_RULES key encountered\n");
+ continue;
+ }
+ QStringList newValues;
+ QStringList values = it.value();
+ foreach(QString item, values) {
+ // If there is no stringlist defined for a rule, use rule name directly
+ // This is convenience for defining single line statements
+ if (project->values(item).isEmpty()) {
+ newValues << item;
+ } else {
+ foreach(QString itemRow, project->values(item)) {
+ newValues << itemRow;
+ }
+ }
+ }
+ userBldInfRules.insert(newKey, newValues);
+ }
+ }
+
+ // Add includes of subdirs bld.inf files
+
+ QString mmpfilename = escapeFilePath(fileFixify(project->projectFile()));
+ mmpfilename = mmpfilename.replace(mmpfilename.lastIndexOf("."), 4, Option::mmp_ext);
+ QString currentPath = qmake_getpwd();
+ QDir directory(currentPath);
+
+ 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;
+ }
+
+ QFileInfo subdir(fileInfo(fixedItem));
+ QString relativePath = directory.relativeFilePath(fixedItem);
+ QString subdirFileName = subdir.completeBaseName();
+ QString fullProName = subdir.absoluteFilePath();;
+ QString bldinfFilename;
+
+ 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("/")) {
+ // .pro not in same directory as parent .pro
+ relativePath.remove(relativePath.lastIndexOf("/") + 1, relativePath.length());
+ bldinfFilename = relativePath;
+ } else {
+ // .pro and parent .pro in same directory
+ bldinfFilename = QString("./");
+ }
+ bldinfFilename += QString(BLD_INF_FILENAME ".") + subdirFileName;
+ }
+
+ QString uid = generate_uid(fullProName);
+ QString bldinfDefine = QString("BLD_INF_") + subdirFileName + QString("_") + uid;
+ bldinfDefine = bldinfDefine.toUpper();
+ removeSpecialCharacters(bldinfDefine);
+
+ t << "#ifndef " << bldinfDefine << endl;
+ t << "\t#include \"" << QDir::toNativeSeparators(bldinfFilename) << "\"" << endl;
+ t << "#endif // " << bldinfDefine << endl;
+ }
+
+ // Add supported project platforms
+
+ t << endl << BLD_INF_TAG_PLATFORMS << endl << endl;
+ if (0 != project->values("SYMBIAN_PLATFORMS").size())
+ t << project->values("SYMBIAN_PLATFORMS").join(" ") << endl;
+
+ QStringList userItems = userBldInfRules.value(BLD_INF_TAG_PLATFORMS);
+ foreach(QString item, userItems)
+ t << item << endl;
+ userBldInfRules.remove(BLD_INF_TAG_PLATFORMS);
+ 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);
+ else
+ mmpTag = QLatin1String(BLD_INF_TAG_MMPFILES);
+
+ t << endl << mmpTag << endl << endl;
+
+ writeBldInfMkFilePart(t, addDeploymentExtension);
+ if (targetType != TypeSubdirs) {
+ QString shortProFilename = project->projectFile();
+ shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString(""));
+ shortProFilename.replace(Option::pro_ext, QString(""));
+
+ QString mmpFilename = shortProFilename + QString("_") + uid3 + Option::mmp_ext;
+
+ t << mmpFilename << endl;
+ }
+
+ userItems = userBldInfRules.value(mmpTag);
+ foreach(QString item, userItems)
+ t << item << endl;
+ userBldInfRules.remove(mmpTag);
+
+ t << endl << BLD_INF_TAG_EXTENSIONS << endl << endl;
+
+ // Generate extension rules
+
+ writeBldInfExtensionRulesPart(t, iconFile);
+
+ userItems = userBldInfRules.value(BLD_INF_TAG_EXTENSIONS);
+ foreach(QString item, userItems)
+ t << item << endl;
+ userBldInfRules.remove(BLD_INF_TAG_EXTENSIONS);
+
+ // Add rest of the user defined content
+
+ for (QMap<QString, QStringList>::iterator it = userBldInfRules.begin(); it != userBldInfRules.end(); ++it) {
+ t << endl << endl << it.key() << endl << endl;
+ userItems = it.value();
+ foreach(QString item, userItems)
+ t << item << endl;
+ }
+}
+
+void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems)
+{
+ QString filename(fixedTarget);
+ filename.append("_reg.rss");
+ QFile ft(filename);
+ if (ft.open(QIODevice::WriteOnly)) {
+ generatedFiles << ft.fileName();
+ QTextStream t(&ft);
+ t << "// ============================================================================" << endl;
+ t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl;
+ t << "// * This file is generated by qmake and should not be modified by the" << endl;
+ t << "// * user." << endl;
+ t << "// ============================================================================" << endl;
+ t << endl;
+ t << "#include <" << fixedTarget << ".rsg>" << endl;
+ t << "#include <appinfo.rh>" << endl;
+ t << endl;
+ //t << "#include <data_caging_paths.hrh>" << "\n" << endl;
+ t << "UID2 " << "KUidAppRegistrationResourceFile" << endl;
+ t << "UID3 " << uid3 << endl << endl;
+ t << "RESOURCE APP_REGISTRATION_INFO" << endl;
+ t << "\t{" << endl;
+ t << "\tapp_file=\"" << fixedTarget << "\";" << endl;
+ t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << fixedTarget << "\";" << endl;
+ t << endl;
+
+ foreach(QString item, userItems)
+ t << "\t" << item << endl;
+ t << "\t}" << endl;
+ } else {
+ PRINT_FILE_CREATE_ERROR(filename)
+ }
+}
+
+void SymbianMakefileGenerator::writeRssFile(QString &numberOfIcons, QString &iconFile)
+{
+ QString filename(fixedTarget);
+ filename.append(".rss");
+ QFile ft(filename);
+ if (ft.open(QIODevice::WriteOnly)) {
+ generatedFiles << ft.fileName();
+ QTextStream t(&ft);
+ t << "// ============================================================================" << endl;
+ t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl;
+ t << "// * This file is generated by qmake and should not be modified by the" << endl;
+ t << "// * user." << endl;
+ t << "// ============================================================================" << endl;
+ t << endl;
+ t << "#include <appinfo.rh>" << endl;
+ t << "#include \"" << fixedTarget << ".loc\"" << endl;
+ t << endl;
+ t << "RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info" << endl;
+ t << "\t{" << endl;
+ t << "\tshort_caption = STRING_r_short_caption;" << endl;
+ t << "\tcaption_and_icon =" << endl;
+ t << "\tCAPTION_AND_ICON_INFO" << endl;
+ t << "\t\t{" << endl;
+ t << "\t\tcaption = STRING_r_caption;" << endl;
+
+ QString rssIconFile = iconFile;
+ rssIconFile = rssIconFile.replace("/", "\\\\");
+
+ if (numberOfIcons.isEmpty() || rssIconFile.isEmpty()) {
+ // There can be maximum one item in this tag, validated when parsed
+ t << "\t\tnumber_of_icons = 0;" << endl;
+ t << "\t\ticon_file = \"\";" << endl;
+ } else {
+ // There can be maximum one item in this tag, validated when parsed
+ t << "\t\tnumber_of_icons = " << numberOfIcons << ";" << endl;
+ t << "\t\ticon_file = \"" << rssIconFile << "\";" << endl;
+ }
+ t << "\t\t};" << endl;
+ t << "\t}" << endl;
+ t << endl;
+ } else {
+ PRINT_FILE_CREATE_ERROR(filename);
+ }
+}
+
+void SymbianMakefileGenerator::writeLocFile(QStringList &symbianLangCodes)
+{
+ QString filename(fixedTarget);
+ filename.append(".loc");
+ QFile ft(filename);
+ if (ft.open(QIODevice::WriteOnly)) {
+ generatedFiles << ft.fileName();
+ QTextStream t(&ft);
+ t << "// ============================================================================" << endl;
+ t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl;
+ t << "// * This file is generated by qmake and should not be modified by the" << endl;
+ t << "// * user." << endl;
+ t << "// ============================================================================" << endl;
+ t << endl;
+ t << "#ifdef LANGUAGE_SC" << endl;
+ t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl;
+ t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl;
+ foreach(QString lang, symbianLangCodes) {
+ t << "#elif defined LANGUAGE_" << lang << endl;
+ t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl;
+ t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl;
+ }
+ t << "#else" << endl;
+ t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl;
+ t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl;
+ t << "#endif" << endl;
+ } else {
+ PRINT_FILE_CREATE_ERROR(filename);
+ }
+}
+
+void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules)
+{
+ for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) {
+ if (it.key().startsWith(RSS_RULES_BASE)) {
+ QString newKey = it.key().mid(sizeof(RSS_RULES_BASE) - 1);
+ if (newKey.isEmpty()) {
+ fprintf(stderr, "Warning: Empty RSS_RULES_BASE key encountered\n");
+ continue;
+ }
+ QStringList newValues;
+ QStringList values = it.value();
+ foreach(QString item, values) {
+ // If there is no stringlist defined for a rule, use rule name directly
+ // This is convenience for defining single line statements
+ if (project->values(item).isEmpty()) {
+ newValues << item;
+ } else {
+ foreach(QString itemRow, project->values(item)) {
+ newValues << itemRow;
+ }
+ }
+ }
+ // Verify thet there is exactly one value in RSS_TAG_NBROFICONS
+ if (newKey == RSS_TAG_NBROFICONS) {
+ if (newValues.count() == 1) {
+ numberOfIcons = newValues[0];
+ } else {
+ fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n",
+ RSS_RULES_BASE, RSS_TAG_NBROFICONS);
+ continue;
+ }
+ // Verify thet there is exactly one value in RSS_TAG_ICONFILE
+ } else if (newKey == RSS_TAG_ICONFILE) {
+ if (newValues.count() == 1) {
+ iconFile = newValues[0];
+ } else {
+ fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n",
+ RSS_RULES_BASE, RSS_TAG_ICONFILE);
+ continue;
+ }
+ } else {
+ fprintf(stderr, "Warning: Unsupported key:'%s%s'\n",
+ RSS_RULES_BASE, newKey.toLatin1().constData());
+ continue;
+ }
+ }
+ }
+
+ foreach(QString item, project->values(RSS_RULES)) {
+ // If there is no stringlist defined for a rule, use rule name directly
+ // This is convenience for defining single line mmp statements
+ if (project->values(item).isEmpty()) {
+ userRssRules << item;
+ } else {
+ userRssRules << project->values(item);
+ }
+ }
+
+ // Validate that either both RSS_TAG_NBROFICONS and RSS_TAG_ICONFILE keys exist
+ // or neither of them exist
+ if (!((numberOfIcons.isEmpty() && iconFile.isEmpty()) ||
+ (!numberOfIcons.isEmpty() && !iconFile.isEmpty()))) {
+ numberOfIcons.clear();
+ iconFile.clear();
+ fprintf(stderr, "Warning: Both or neither of '%s%s' and '%s%s' keys must exist.\n",
+ RSS_RULES_BASE, RSS_TAG_NBROFICONS, RSS_RULES_BASE, RSS_TAG_ICONFILE);
+ }
+
+ // Validate that RSS_TAG_NBROFICONS contains only numbers
+ if (!numberOfIcons.isEmpty()) {
+ bool ok;
+ numberOfIcons = numberOfIcons.simplified();
+ int tmp = numberOfIcons.toInt(&ok);
+ if (!ok) {
+ numberOfIcons.clear();
+ iconFile.clear();
+ fprintf(stderr, "Warning: '%s%s' must be integer in decimal format.\n",
+ RSS_RULES_BASE, RSS_TAG_NBROFICONS);
+ }
+ }
+}
+
+QStringList SymbianMakefileGenerator::symbianLangCodesFromTsFiles()
+{
+ QStringList tsfiles;
+ QStringList symbianLangCodes;
+ tsfiles << project->values("TRANSLATIONS");
+
+ fillQt2S60LangMapTable();
+
+ foreach(QString file, tsfiles) {
+ int extIndex = file.lastIndexOf(".");
+ int langIndex = file.lastIndexOf("_", (extIndex - file.length()));
+ langIndex += 1;
+ QString qtlang = file.mid(langIndex, extIndex - langIndex);
+ QString s60lang = qt2S60LangMapTable.value(qtlang, QString("SC"));
+
+ if (!symbianLangCodes.contains(s60lang) && s60lang != "SC")
+ symbianLangCodes += s60lang;
+ }
+
+ return symbianLangCodes;
+}
+
+void SymbianMakefileGenerator::fillQt2S60LangMapTable()
+{
+ qt2S60LangMapTable.reserve(170); // 165 items at time of writing.
+ qt2S60LangMapTable.insert("ab", "SC"); //Abkhazian //
+ qt2S60LangMapTable.insert("om", "SC"); //Afan //
+ qt2S60LangMapTable.insert("aa", "SC"); //Afar //
+ qt2S60LangMapTable.insert("af", "34"); //Afrikaans //Afrikaans
+ qt2S60LangMapTable.insert("sq", "35"); //Albanian //Albanian
+ qt2S60LangMapTable.insert("am", "36"); //Amharic //Amharic
+ qt2S60LangMapTable.insert("ar", "37"); //Arabic //Arabic
+ qt2S60LangMapTable.insert("hy", "38"); //Armenian //Armenian
+ qt2S60LangMapTable.insert("as", "SC"); //Assamese //
+ qt2S60LangMapTable.insert("ay", "SC"); //Aymara //
+ qt2S60LangMapTable.insert("az", "SC"); //Azerbaijani //
+ qt2S60LangMapTable.insert("ba", "SC"); //Bashkir //
+ qt2S60LangMapTable.insert("eu", "SC"); //Basque //
+ qt2S60LangMapTable.insert("bn", "41"); //Bengali //Bengali
+ qt2S60LangMapTable.insert("dz", "SC"); //Bhutani //
+ qt2S60LangMapTable.insert("bh", "SC"); //Bihari //
+ qt2S60LangMapTable.insert("bi", "SC"); //Bislama //
+ qt2S60LangMapTable.insert("br", "SC"); //Breton //
+ qt2S60LangMapTable.insert("bg", "42"); //Bulgarian //Bulgarian
+ qt2S60LangMapTable.insert("my", "43"); //Burmese //Burmese
+ qt2S60LangMapTable.insert("be", "40"); //Byelorussian //Belarussian
+ qt2S60LangMapTable.insert("km", "SC"); //Cambodian //
+ qt2S60LangMapTable.insert("ca", "44"); //Catalan //Catalan
+ qt2S60LangMapTable.insert("zh", "SC"); //Chinese //
+ qt2S60LangMapTable.insert("co", "SC"); //Corsican //
+ qt2S60LangMapTable.insert("hr", "45"); //Croatian //Croatian
+ qt2S60LangMapTable.insert("cs", "25"); //Czech //Czech
+ qt2S60LangMapTable.insert("da", "07"); //Danish //Danish
+ qt2S60LangMapTable.insert("nl", "18"); //Dutch //Dutch
+ qt2S60LangMapTable.insert("en", "01"); //English //English(UK)
+ qt2S60LangMapTable.insert("eo", "SC"); //Esperanto //
+ qt2S60LangMapTable.insert("et", "49"); //Estonian //Estonian
+ qt2S60LangMapTable.insert("fo", "SC"); //Faroese //
+ qt2S60LangMapTable.insert("fj", "SC"); //Fiji //
+ qt2S60LangMapTable.insert("fi", "09"); //Finnish //Finnish
+ qt2S60LangMapTable.insert("fr", "02"); //French //French
+ qt2S60LangMapTable.insert("fy", "SC"); //Frisian //
+ qt2S60LangMapTable.insert("gd", "52"); //Gaelic //Gaelic
+ qt2S60LangMapTable.insert("gl", "SC"); //Galician //
+ qt2S60LangMapTable.insert("ka", "53"); //Georgian //Georgian
+ qt2S60LangMapTable.insert("de", "03"); //German //German
+ qt2S60LangMapTable.insert("el", "54"); //Greek //Greek
+ qt2S60LangMapTable.insert("kl", "SC"); //Greenlandic //
+ qt2S60LangMapTable.insert("gn", "SC"); //Guarani //
+ qt2S60LangMapTable.insert("gu", "56"); //Gujarati //Gujarati
+ qt2S60LangMapTable.insert("ha", "SC"); //Hausa //
+ qt2S60LangMapTable.insert("he", "57"); //Hebrew //Hebrew
+ qt2S60LangMapTable.insert("hi", "58"); //Hindi //Hindi
+ qt2S60LangMapTable.insert("hu", "17"); //Hungarian //Hungarian
+ qt2S60LangMapTable.insert("is", "15"); //Icelandic //Icelandic
+ qt2S60LangMapTable.insert("id", "59"); //Indonesian //Indonesian
+ qt2S60LangMapTable.insert("ia", "SC"); //Interlingua //
+ qt2S60LangMapTable.insert("ie", "SC"); //Interlingue //
+ qt2S60LangMapTable.insert("iu", "SC"); //Inuktitut //
+ qt2S60LangMapTable.insert("ik", "SC"); //Inupiak //
+ qt2S60LangMapTable.insert("ga", "60"); //Irish //Irish
+ qt2S60LangMapTable.insert("it", "05"); //Italian //Italian
+ qt2S60LangMapTable.insert("ja", "32"); //Japanese //Japanese
+ qt2S60LangMapTable.insert("jv", "SC"); //Javanese //
+ qt2S60LangMapTable.insert("kn", "62"); //Kannada //Kannada
+ qt2S60LangMapTable.insert("ks", "SC"); //Kashmiri //
+ qt2S60LangMapTable.insert("kk", "63"); //Kazakh //Kazakh
+ qt2S60LangMapTable.insert("rw", "SC"); //Kinyarwanda //
+ qt2S60LangMapTable.insert("ky", "SC"); //Kirghiz //
+ qt2S60LangMapTable.insert("ko", "65"); //Korean //Korean
+ qt2S60LangMapTable.insert("ku", "SC"); //Kurdish //
+ qt2S60LangMapTable.insert("rn", "SC"); //Kurundi //
+ qt2S60LangMapTable.insert("lo", "66"); //Laothian //Laothian
+ qt2S60LangMapTable.insert("la", "SC"); //Latin //
+ qt2S60LangMapTable.insert("lv", "67"); //Latvian //Latvian
+ qt2S60LangMapTable.insert("ln", "SC"); //Lingala //
+ qt2S60LangMapTable.insert("lt", "68"); //Lithuanian //Lithuanian
+ qt2S60LangMapTable.insert("mk", "69"); //Macedonian //Macedonian
+ qt2S60LangMapTable.insert("mg", "SC"); //Malagasy //
+ qt2S60LangMapTable.insert("ms", "70"); //Malay //Malay
+ qt2S60LangMapTable.insert("ml", "71"); //Malayalam //Malayalam
+ qt2S60LangMapTable.insert("mt", "SC"); //Maltese //
+ qt2S60LangMapTable.insert("mi", "SC"); //Maori //
+ qt2S60LangMapTable.insert("mr", "72"); //Marathi //Marathi
+ qt2S60LangMapTable.insert("mo", "73"); //Moldavian //Moldovian
+ qt2S60LangMapTable.insert("mn", "74"); //Mongolian //Mongolian
+ qt2S60LangMapTable.insert("na", "SC"); //Nauru //
+ qt2S60LangMapTable.insert("ne", "SC"); //Nepali //
+ qt2S60LangMapTable.insert("nb", "08"); //Norwegian //Norwegian
+ qt2S60LangMapTable.insert("oc", "SC"); //Occitan //
+ qt2S60LangMapTable.insert("or", "SC"); //Oriya //
+ qt2S60LangMapTable.insert("ps", "SC"); //Pashto //
+ qt2S60LangMapTable.insert("fa", "SC"); //Persian //
+ qt2S60LangMapTable.insert("pl", "27"); //Polish //Polish
+ qt2S60LangMapTable.insert("pt", "13"); //Portuguese //Portuguese
+ qt2S60LangMapTable.insert("pa", "77"); //Punjabi //Punjabi
+ qt2S60LangMapTable.insert("qu", "SC"); //Quechua //
+ qt2S60LangMapTable.insert("rm", "SC"); //RhaetoRomance //
+ qt2S60LangMapTable.insert("ro", "78"); //Romanian //Romanian
+ qt2S60LangMapTable.insert("ru", "16"); //Russian //Russian
+ qt2S60LangMapTable.insert("sm", "SC"); //Samoan //
+ qt2S60LangMapTable.insert("sg", "SC"); //Sangho //
+ qt2S60LangMapTable.insert("sa", "SC"); //Sanskrit //
+ qt2S60LangMapTable.insert("sr", "79"); //Serbian //Serbian
+ qt2S60LangMapTable.insert("sh", "SC"); //SerboCroatian //
+ qt2S60LangMapTable.insert("st", "SC"); //Sesotho //
+ qt2S60LangMapTable.insert("tn", "SC"); //Setswana //
+ qt2S60LangMapTable.insert("sn", "SC"); //Shona //
+ qt2S60LangMapTable.insert("sd", "SC"); //Sindhi //
+ qt2S60LangMapTable.insert("si", "80"); //Singhalese //Sinhalese
+ qt2S60LangMapTable.insert("ss", "SC"); //Siswati //
+ qt2S60LangMapTable.insert("sk", "26"); //Slovak //Slovak
+ qt2S60LangMapTable.insert("sl", "28"); //Slovenian //Slovenian
+ qt2S60LangMapTable.insert("so", "81"); //Somali //Somali
+ qt2S60LangMapTable.insert("es", "04"); //Spanish //Spanish
+ qt2S60LangMapTable.insert("su", "SC"); //Sundanese //
+ qt2S60LangMapTable.insert("sw", "84"); //Swahili //Swahili
+ qt2S60LangMapTable.insert("sv", "06"); //Swedish //Swedish
+ qt2S60LangMapTable.insert("tl", "39"); //Tagalog //Tagalog
+ qt2S60LangMapTable.insert("tg", "SC"); //Tajik //
+ qt2S60LangMapTable.insert("ta", "87"); //Tamil //Tamil
+ qt2S60LangMapTable.insert("tt", "SC"); //Tatar //
+ qt2S60LangMapTable.insert("te", "88"); //Telugu //Telugu
+ qt2S60LangMapTable.insert("th", "33"); //Thai //Thai
+ qt2S60LangMapTable.insert("bo", "89"); //Tibetan //Tibetan
+ qt2S60LangMapTable.insert("ti", "90"); //Tigrinya //Tigrinya
+ qt2S60LangMapTable.insert("to", "SC"); //Tonga //
+ qt2S60LangMapTable.insert("ts", "SC"); //Tsonga //
+ qt2S60LangMapTable.insert("tr", "14"); //Turkish //Turkish
+ qt2S60LangMapTable.insert("tk", "92"); //Turkmen //Turkmen
+ qt2S60LangMapTable.insert("tw", "SC"); //Twi //
+ qt2S60LangMapTable.insert("ug", "SC"); //Uigur //
+ qt2S60LangMapTable.insert("uk", "93"); //Ukrainian //Ukrainian
+ qt2S60LangMapTable.insert("ur", "94"); //Urdu //Urdu
+ qt2S60LangMapTable.insert("uz", "SC"); //Uzbek //
+ qt2S60LangMapTable.insert("vi", "96"); //Vietnamese //Vietnamese
+ qt2S60LangMapTable.insert("vo", "SC"); //Volapuk //
+ qt2S60LangMapTable.insert("cy", "97"); //Welsh //Welsh
+ qt2S60LangMapTable.insert("wo", "SC"); //Wolof //
+ qt2S60LangMapTable.insert("xh", "SC"); //Xhosa //
+ qt2S60LangMapTable.insert("yi", "SC"); //Yiddish //
+ qt2S60LangMapTable.insert("yo", "SC"); //Yoruba //
+ qt2S60LangMapTable.insert("za", "SC"); //Zhuang //
+ qt2S60LangMapTable.insert("zu", "98"); //Zulu //Zulu
+ qt2S60LangMapTable.insert("nn", "75"); //Nynorsk //NorwegianNynorsk
+ qt2S60LangMapTable.insert("bs", "SC"); //Bosnian //
+ qt2S60LangMapTable.insert("dv", "SC"); //Divehi //
+ qt2S60LangMapTable.insert("gv", "SC"); //Manx //
+ qt2S60LangMapTable.insert("kw", "SC"); //Cornish //
+ qt2S60LangMapTable.insert("ak", "SC"); //Akan //
+ qt2S60LangMapTable.insert("kok", "SC"); //Konkani //
+ qt2S60LangMapTable.insert("gaa", "SC"); //Ga //
+ qt2S60LangMapTable.insert("ig", "SC"); //Igbo //
+ qt2S60LangMapTable.insert("kam", "SC"); //Kamba //
+ qt2S60LangMapTable.insert("syr", "SC"); //Syriac //
+ qt2S60LangMapTable.insert("byn", "SC"); //Blin //
+ qt2S60LangMapTable.insert("gez", "SC"); //Geez //
+ qt2S60LangMapTable.insert("kfo", "SC"); //Koro //
+ qt2S60LangMapTable.insert("sid", "SC"); //Sidamo //
+ qt2S60LangMapTable.insert("cch", "SC"); //Atsam //
+ qt2S60LangMapTable.insert("tig", "SC"); //Tigre //
+ qt2S60LangMapTable.insert("kaj", "SC"); //Jju //
+ qt2S60LangMapTable.insert("fur", "SC"); //Friulian //
+ qt2S60LangMapTable.insert("ve", "SC"); //Venda //
+ qt2S60LangMapTable.insert("ee", "SC"); //Ewe //
+ qt2S60LangMapTable.insert("wa", "SC"); //Walamo //
+ qt2S60LangMapTable.insert("haw", "SC"); //Hawaiian //
+ qt2S60LangMapTable.insert("kcg", "SC"); //Tyap //
+ qt2S60LangMapTable.insert("ny", "SC"); //Chewa //
+}
+
+void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QString value)
+{
+ if (!list.contains(value))
+ list += value;
+}
+
+void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QStringList values)
+{
+ foreach(QString item, values)
+ appendIfnotExist(list, item);
+}
+
+QString SymbianMakefileGenerator::removePathSeparators(QString &file)
+{
+ QString ret = file;
+ while (ret.indexOf(QDir::separator()) > 0) {
+ ret.remove(0, ret.indexOf(QDir::separator()) + 1);
+ }
+
+ return ret;
+}
+
+
+QString SymbianMakefileGenerator::removeTrailingPathSeparators(QString &file)
+{
+ QString ret = file;
+ if (ret.endsWith(QDir::separator())) {
+ ret.remove(ret.length() - 1, 1);
+ }
+
+ return ret;
+}
+
+void SymbianMakefileGenerator::generateCleanCommands(QTextStream& t,
+ const QStringList& toClean,
+ const QString& cmd,
+ const QString& cmdOptions,
+ const QString& itemPrefix,
+ const QString& itemSuffix)
+{
+ for (int i = 0; i < toClean.size(); ++i) {
+ QString item = toClean.at(i);
+ item.prepend(itemPrefix).append(itemSuffix);
+#if defined(Q_OS_WIN)
+ t << "\t-@ if EXIST \"" << QDir::toNativeSeparators(item) << "\" ";
+ t << cmd << " " << cmdOptions << " \"" << QDir::toNativeSeparators(item) << "\"" << endl;
+#else
+ t << "\t-if test -f " << QDir::toNativeSeparators(item) << "; then ";
+ t << cmd << " " << cmdOptions << " " << QDir::toNativeSeparators(item) << "; fi" << endl;
+#endif
+ }
+}
+
+void SymbianMakefileGenerator::removeSpecialCharacters(QString& str)
+{
+ // When modifying this method check also application_icon.prf
+ str.replace(QString("/"), QString("_"));
+ str.replace(QString("\\"), QString("_"));
+ str.replace(QString("-"), QString("_"));
+ str.replace(QString(":"), QString("_"));
+ str.replace(QString("."), QString("_"));
+ str.replace(QString(" "), QString("_"));
+}
+
+void SymbianMakefileGenerator::writeSisTargets(QTextStream &t)
+{
+ t << SIS_TARGET ": " RESTORE_BUILD_TARGET << endl;
+ QString siscommand = QString("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \
+ "$(MAKE) -s -f $(MAKEFILE) %4,$(MAKE) -s -f $(MAKEFILE) %5)," \
+ "$(MAKE) -s -f $(MAKEFILE) %6)")
+ .arg(fixedTarget)
+ .arg("pkg")
+ .arg(MAKE_CACHE_NAME)
+ .arg(OK_SIS_TARGET)
+ .arg(FAIL_SIS_NOCACHE_TARGET)
+ .arg(FAIL_SIS_NOPKG_TARGET);
+ t << siscommand << endl;
+ t << endl;
+
+ t << OK_SIS_TARGET ":" << endl;
+
+ QString pkgcommand = QString("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_template.%2 $(QT_SIS_TARGET) " \
+ "$(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)")
+ .arg(fixedTarget)
+ .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 << 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;
+ t << endl;
+}
+
+void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t)
+{
+ t << "dodistclean:" << endl;
+ const QStringList &subdirs = project->values("SUBDIRS");
+ foreach(QString item, 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;
+}
diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h
new file mode 100644
index 000000000..2e78c4600
--- /dev/null
+++ b/qmake/generators/symbian/symmake.h
@@ -0,0 +1,158 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SYMMAKEFILE_H
+#define SYMMAKEFILE_H
+
+#include <makefile.h>
+
+QT_BEGIN_NAMESPACE
+
+#define BLD_INF_FILENAME "bld.inf"
+#define MAKEFILE_DEPENDENCY_SEPARATOR " \\\n\t"
+
+#define QT_EXTRA_INCLUDE_DIR "tmp"
+#define MAKE_CACHE_NAME ".make.cache"
+
+class SymbianMakefileGenerator : public MakefileGenerator
+{
+protected:
+ enum TargetType {
+ TypeExe,
+ TypeDll,
+ TypeLib,
+ TypePlugin,
+ TypeSubdirs
+ };
+
+ QString platform;
+ QString uid2;
+ QString uid3;
+ QString privateDirUid;
+ TargetType targetType;
+ QMap<QString, QStringList> sources;
+ QMap<QString, QStringList> systeminclude;
+ QMap<QString, QStringList> library;
+ // (output file) (source , command)
+ QMap<QString, QStringList> makmakeCommands;
+ QStringList overriddenMmpKeywords;
+
+ QStringList generatedFiles;
+ QStringList generatedDirs;
+ QHash<QString, QString> qt2S60LangMapTable;
+
+ QString fixedTarget;
+
+ void removeSpecialCharacters(QString& str);
+ QString fixPathForMmp(const QString& origPath, const QDir& parentDir);
+ QString canonizePath(const QString& origPath);
+
+ virtual bool writeMakefile(QTextStream &t);
+ void generatePkgFile(const QString &iconFile);
+ bool containsStartWithItem(const QChar &c, const QStringList& src);
+
+ virtual void init();
+
+ QString getTargetExtension();
+
+ QString generateUID3();
+
+ void initMmpVariables();
+ void checkOverridability(QStringList &overridableKeywords, QString &checkString);
+
+ void writeHeader(QTextStream &t);
+ void writeBldInfContent(QTextStream& t, bool addDeploymentExtension, const QString &iconFile);
+
+ static bool removeDuplicatedStrings(QStringList& stringList);
+
+ void writeMmpFileHeader(QTextStream &t);
+ void writeMmpFile(QString &filename, QStringList &symbianLangCodes);
+ void writeMmpFileMacrosPart(QTextStream& t);
+ void addMacro(QTextStream& t, const QString& value);
+ void writeMmpFileTargetPart(QTextStream& t);
+ void writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes);
+ void writeMmpFileSystemIncludePart(QTextStream& t);
+ void writeMmpFileIncludePart(QTextStream& t);
+ void writeMmpFileLibraryPart(QTextStream& t);
+ void writeMmpFileCapabilityPart(QTextStream& t);
+ void writeMmpFileCompilerOptionPart(QTextStream& t);
+ void writeMmpFileBinaryVersionPart(QTextStream& t);
+ void writeMmpFileRulesPart(QTextStream& t);
+
+ void writeCustomDefFile();
+
+ void writeRegRssFile(QStringList &useritems);
+ void writeRssFile(QString &numberOfIcons, QString &iconfile);
+ void writeLocFile(QStringList &symbianLangCodes);
+ void readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules);
+
+ QStringList symbianLangCodesFromTsFiles();
+ void fillQt2S60LangMapTable();
+
+ void appendIfnotExist(QStringList &list, QString value);
+ void appendIfnotExist(QStringList &list, QStringList values);
+
+ QString removePathSeparators(QString &file);
+ QString removeTrailingPathSeparators(QString &file);
+ void generateCleanCommands(QTextStream& t,
+ const QStringList& toClean,
+ const QString& cmd,
+ const QString& cmdOptions,
+ const QString& itemPrefix,
+ const QString& itemSuffix);
+
+ void writeSisTargets(QTextStream &t);
+ void generateDistcleanTargets(QTextStream& t);
+
+ // Subclass implements
+ virtual void writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) = 0;
+ virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) = 0;
+ virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly) = 0;
+ virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) = 0;
+ virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath) = 0;
+
+public:
+
+ SymbianMakefileGenerator();
+ ~SymbianMakefileGenerator();
+};
+
+#endif // SYMMAKEFILE_H
diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp
new file mode 100644
index 000000000..6225720f5
--- /dev/null
+++ b/qmake/generators/symbian/symmake_abld.cpp
@@ -0,0 +1,467 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "symmake_abld.h"
+#include "initprojectdeploy_symbian.h"
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qdir.h>
+#include <qdatetime.h>
+#include <qdebug.h>
+
+#define DO_NOTHING_TARGET "do_nothing"
+#define CREATE_TEMPS_TARGET "create_temps"
+#define EXTENSION_CLEAN "extension_clean"
+#define PRE_TARGETDEPS_TARGET "pre_targetdeps"
+#define COMPILER_CLEAN_TARGET "compiler_clean"
+#define FINALIZE_TARGET "finalize"
+#define GENERATED_SOURCES_TARGET "generated_sources"
+#define ALL_SOURCE_DEPS_TARGET "all_source_deps"
+#define WINSCW_DEPLOYMENT_TARGET "winscw_deployment"
+#define WINSCW_DEPLOYMENT_CLEAN_TARGET "winscw_deployment_clean"
+#define STORE_BUILD_TARGET "store_build"
+
+SymbianAbldMakefileGenerator::SymbianAbldMakefileGenerator() : SymbianMakefileGenerator() { }
+SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { }
+
+void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly)
+{
+ QString gnuMakefileName = QLatin1String("Makefile_") + uid3;
+ removeSpecialCharacters(gnuMakefileName);
+ gnuMakefileName.append(".mk");
+
+ QFile ft(gnuMakefileName);
+ if (ft.open(QIODevice::WriteOnly)) {
+ generatedFiles << ft.fileName();
+ QTextStream t(&ft);
+
+ t << "# ==============================================================================" << endl;
+ t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << QDateTime::currentDateTime().toString() << endl;
+ t << "# This file is generated by qmake and should not be modified by the" << endl;
+ t << "# user." << endl;
+ t << "# Name : " << gnuMakefileName << endl;
+ t << "# Part of : " << project->values("TARGET").join(" ") << endl;
+ t << "# Description : This file is used to call necessary targets on wrapper makefile" << endl;
+ t << "# during normal Symbian build process." << endl;
+ t << "# Version : " << endl;
+ t << "#" << endl;
+ t << "# ==============================================================================" << "\n" << endl;
+
+ t << endl << endl;
+
+ t << "MAKE = make" << endl;
+ t << endl;
+
+ t << "VISUAL_CFG = RELEASE" << endl;
+ t << "ifeq \"$(CFG)\" \"UDEB\"" << endl;
+ t << "VISUAL_CFG = DEBUG" << endl;
+ t << "endif" << endl;
+ t << endl;
+
+ t << DO_NOTHING_TARGET " :" << endl;
+ t << "\t" << "@rem " DO_NOTHING_TARGET << endl << endl;
+
+ QString buildDeps;
+ QString cleanDeps;
+ QString finalDeps;
+ QString cleanDepsWinscw;
+ QString finalDepsWinscw;
+ QStringList wrapperTargets;
+ if (deploymentOnly) {
+ buildDeps.append(STORE_BUILD_TARGET);
+ cleanDeps.append(DO_NOTHING_TARGET);
+ cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET);
+ finalDeps.append(DO_NOTHING_TARGET);
+ finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET);
+ wrapperTargets << WINSCW_DEPLOYMENT_TARGET
+ << WINSCW_DEPLOYMENT_CLEAN_TARGET
+ << STORE_BUILD_TARGET;
+ } else {
+ buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET " " STORE_BUILD_TARGET);
+ cleanDeps.append(EXTENSION_CLEAN);
+ cleanDepsWinscw.append(EXTENSION_CLEAN " " WINSCW_DEPLOYMENT_CLEAN_TARGET);
+ finalDeps.append(FINALIZE_TARGET);
+ finalDepsWinscw.append(FINALIZE_TARGET " " WINSCW_DEPLOYMENT_TARGET);
+ wrapperTargets << PRE_TARGETDEPS_TARGET
+ << CREATE_TEMPS_TARGET
+ << EXTENSION_CLEAN
+ << FINALIZE_TARGET
+ << WINSCW_DEPLOYMENT_CLEAN_TARGET
+ << WINSCW_DEPLOYMENT_TARGET
+ << STORE_BUILD_TARGET;
+ }
+
+ t << "MAKMAKE: " << buildDeps << endl << endl;
+ t << "LIB: " << buildDeps << endl << endl;
+ t << "BLD: " << buildDeps << endl << endl;
+ t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl;
+ t << "CLEAN: " << cleanDepsWinscw << endl;
+ t << "else" << endl;
+ t << "CLEAN: " << cleanDeps << endl;
+ t << "endif" << endl << endl;
+ t << "CLEANLIB: " DO_NOTHING_TARGET << endl << endl;
+ t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl;
+ t << "FREEZE: " DO_NOTHING_TARGET << endl << endl;
+ t << "SAVESPACE: " DO_NOTHING_TARGET << endl << endl;
+ t << "RELEASABLES: " DO_NOTHING_TARGET << endl << endl;
+ t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl;
+ t << "FINAL: " << finalDepsWinscw << endl;
+ t << "else" << endl;
+ t << "FINAL: " << finalDeps << endl;
+ t << "endif" << endl << endl;
+
+ QString makefile(Option::fixPathToTargetOS(fileInfo(wrapperFileName).canonicalFilePath()));
+ foreach(QString target, wrapperTargets) {
+ t << target << " : " << makefile << endl;
+ t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << " QT_SIS_TARGET=$(VISUAL_CFG)-$(PLATFORM)" << endl << endl;
+ }
+
+ t << endl;
+ } // if(ft.open(QIODevice::WriteOnly))
+}
+
+void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile)
+{
+ QStringList allPlatforms;
+ foreach(QString platform, project->values("SYMBIAN_PLATFORMS")) {
+ allPlatforms << platform.toLower();
+ }
+
+ QStringList debugPlatforms = allPlatforms;
+ QStringList releasePlatforms = allPlatforms;
+ releasePlatforms.removeAll("winscw"); // No release for emulator
+
+ QString testClause;
+ if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive))
+ testClause = QLatin1String(" test");
+ else
+ testClause = QLatin1String("");
+
+ QTextStream t(&wrapperFile);
+
+ t << "# ==============================================================================" << endl;
+ t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << QDateTime::currentDateTime().toString() << endl;
+ t << "# This file is generated by qmake and should not be modified by the" << endl;
+ t << "# user." << endl;
+ t << "# Name : " << wrapperFile.fileName() << endl;
+ t << "# Description : Wrapper Makefile for calling Symbian build tools" << endl;
+ t << "#" << endl;
+ t << "# ==============================================================================" << "\n" << endl;
+ t << endl;
+
+ t << "MAKEFILE = " << wrapperFile.fileName() << endl;
+ t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;
+ t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
+ t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
+ t << "MOVE = " << var("QMAKE_MOVE") << endl;
+ t << "XCOPY = xcopy /d /f /h /r /y /i" << endl;
+ t << "ABLD = ABLD.BAT" << endl;
+ t << "DEBUG_PLATFORMS = " << debugPlatforms.join(" ") << endl;
+ t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl;
+ t << "MAKE = make" << endl;
+ t << endl;
+ t << "ifeq (WINS,$(findstring WINS, $(PLATFORM)))" << endl;
+ t << "ZDIR=$(EPOCROOT)epoc32\\release\\$(PLATFORM)\\$(CFG)\\Z" << endl;
+ t << "else" << endl;
+ t << "ZDIR=$(EPOCROOT)epoc32\\data\\z" << endl;
+ t << "endif" << endl;
+ t << endl;
+ t << "DEFINES" << '\t' << " = "
+ << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
+ << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ")
+ << varGlue("DEFINES","-D"," -D","") << endl;
+
+ t << "INCPATH" << '\t' << " = ";
+
+ 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 << " -I\"" << values.at(i) << "\"";
+ }
+ }
+ t << endl;
+ t << "first: default" << endl;
+ if (debugPlatforms.contains("winscw"))
+ t << "default: debug-winscw";
+ else if (debugPlatforms.contains("armv5"))
+ t << "default: debug-armv5";
+ else if (debugPlatforms.size())
+ t << "default: debug-" << debugPlatforms.first();
+ else
+ t << "default: all";
+
+ t << endl;
+ if (!isPrimaryMakefile) {
+ t << "all:" << endl;
+ } else {
+ t << "all: debug release" << endl;
+ t << endl;
+ t << "qmake:" << endl;
+ t << "\t$(QMAKE) -spec symbian-abld -o \"" << fileInfo(Option::output.fileName()).fileName()
+ << "\" \"" << project->projectFile() << "\"" << endl;
+ t << endl;
+ t << BLD_INF_FILENAME ":" << endl;
+ t << "\t$(QMAKE)" << endl;
+ t << endl;
+ t << "$(ABLD): " BLD_INF_FILENAME << endl;
+ t << "\tbldmake bldfiles" << endl;
+ t << endl;
+
+ t << "debug: $(ABLD)" << endl;
+ foreach(QString item, debugPlatforms) {
+ t << "\t$(ABLD)" << testClause << " build " << item << " udeb" << endl;
+ }
+ t << endl;
+ t << "release: $(ABLD)" << endl;
+ foreach(QString item, releasePlatforms) {
+ t << "\t$(ABLD)" << testClause << " build " << item << " urel" << endl;
+ }
+ t << endl;
+
+ // For more specific builds, targets are in this form: build-platform, e.g. release-armv5
+ foreach(QString item, debugPlatforms) {
+ t << "debug-" << item << ": $(ABLD)" << endl;
+ t << "\t$(ABLD)" << testClause << " build " << item << " udeb" << endl;
+ }
+
+ foreach(QString item, releasePlatforms) {
+ t << "release-" << item << ": $(ABLD)" << endl;
+ t << "\t$(ABLD)" << testClause << " build " << item << " urel" << endl;
+ }
+
+ t << endl;
+ t << "export: $(ABLD)" << endl;
+ t << "\t$(ABLD)" << testClause << " export" << endl;
+ t << endl;
+
+ t << "cleanexport: $(ABLD)" << endl;
+ t << "\t$(ABLD)" << testClause << " cleanexport" << endl;
+ t << endl;
+
+ }
+
+ // pre_targetdeps target depends on:
+ // - all targets specified in PRE_TARGETDEPS
+ // - the GENERATED_SOURCES sources (so that they get generated)
+ // - all dependencies of sources targeted for compilation
+ // (mainly to ensure that any included UNUSED_SOURCES that need to be generated get generated)
+ //
+ // Unfortunately, Symbian build chain doesn't support linking generated objects to target,
+ // so supporting generating sources is the best we can do. This is enough for mocs.
+
+ if (targetType != TypeSubdirs) {
+ writeExtraTargets(t);
+ writeExtraCompilerTargets(t);
+
+ 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) {
+ 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;
+
+ // 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;
+ generateCleanCommands(t, dirsToClean, var("QMAKE_DEL_DIR"), " /S /Q ", "", "");
+ t << endl;
+
+ t << PRE_TARGETDEPS_TARGET ":"
+ << MAKEFILE_DEPENDENCY_SEPARATOR GENERATED_SOURCES_TARGET
+ << MAKEFILE_DEPENDENCY_SEPARATOR ALL_SOURCE_DEPS_TARGET;
+ if (project->values("PRE_TARGETDEPS").size())
+ t << MAKEFILE_DEPENDENCY_SEPARATOR << project->values("PRE_TARGETDEPS").join(MAKEFILE_DEPENDENCY_SEPARATOR);
+ t << endl << endl;
+ t << GENERATED_SOURCES_TARGET ":";
+ if (project->values("GENERATED_SOURCES").size())
+ t << MAKEFILE_DEPENDENCY_SEPARATOR << project->values("GENERATED_SOURCES").join(MAKEFILE_DEPENDENCY_SEPARATOR);
+ t << endl << endl;
+ t << ALL_SOURCE_DEPS_TARGET ":";
+
+ QStringList allDeps;
+ for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) {
+ QString currentSourcePath = it.key();
+ QStringList values = it.value();
+ for (int i = 0; i < values.size(); ++i) {
+ // we need additional check
+ QString sourceFile = currentSourcePath + "/" + values.at(i);
+ QStringList deps = findDependencies(QDir::toNativeSeparators(sourceFile));
+ appendIfnotExist(allDeps, deps);
+ }
+ }
+
+ foreach(QString item, allDeps) {
+ t << MAKEFILE_DEPENDENCY_SEPARATOR << item;
+ }
+ t << endl << endl;
+
+ // Post link operations
+ t << FINALIZE_TARGET ":" << endl;
+ if (!project->isEmpty("QMAKE_POST_LINK")) {
+ t << '\t' << var("QMAKE_POST_LINK");
+ t << endl;
+ }
+ t << endl;
+ } else {
+ QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets();
+ writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables | SubTargetSkipDefaultTargets);
+ qDeleteAll(subtargets);
+ }
+
+ writeDeploymentTargets(t);
+
+ writeSisTargets(t);
+
+ writeStoreBuildTarget(t);
+
+ generateDistcleanTargets(t);
+
+ t << "clean: $(ABLD)" << endl;
+ t << "\t-$(ABLD)" << testClause << " reallyclean" << endl;
+ t << "\t-bldmake clean" << endl;
+ t << endl;
+
+ // Create execution target
+ if (debugPlatforms.contains("winscw") && targetType == TypeExe) {
+ t << "run:" << endl;
+ t << "\t-call " << epocRoot() << "epoc32\\release\\winscw\\udeb\\" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl;
+ }
+}
+
+void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile)
+{
+ // We don't use extensions for anything in abld
+ Q_UNUSED(t);
+ Q_UNUSED(iconTargetFile);
+}
+
+bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t)
+{
+ t << WINSCW_DEPLOYMENT_TARGET ":" << endl;
+
+ QString remoteTestPath = epocRoot() + QLatin1String("epoc32\\winscw\\c\\private\\") + privateDirUid; // default 4 OpenC; 4 all Symbian too
+ DeploymentList depList;
+ initProjectDeploySymbian(project, depList, remoteTestPath, false, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles);
+
+ if (depList.size())
+ t << "\t-echo Deploying changed files..." << endl;
+
+ for (int i = 0; i < depList.size(); ++i) {
+ // Xcopy prompts for selecting file or directory if target doesn't exist,
+ // and doesn't provide switch to force file selection. It does provide dir forcing, though,
+ // so strip the last part of the destination.
+ t << "\t-$(XCOPY) \"" << depList.at(i).from << "\" \"" << depList.at(i).to.left(depList.at(i).to.lastIndexOf("\\") + 1) << "\"" << endl;
+ }
+
+ t << endl;
+
+ t << WINSCW_DEPLOYMENT_CLEAN_TARGET ":" << endl;
+ QStringList cleanList;
+ for (int i = 0; i < depList.size(); ++i) {
+ cleanList.append(depList.at(i).to);
+ }
+ generateCleanCommands(t, cleanList, "$(DEL_FILE)", "", "", "");
+
+ // Note: If deployment creates any directories, they will not get deleted after cleanup.
+ // To do this in robust fashion could be quite complex.
+
+ t << endl;
+
+ return true;
+}
+
+void SymbianAbldMakefileGenerator::writeStoreBuildTarget(QTextStream &t)
+{
+ t << STORE_BUILD_TARGET ":" << endl;
+ t << "\t@echo # ============================================================================== > " MAKE_CACHE_NAME << endl;
+ t << "\t@echo # This file is generated by make and should not be modified by the user >> " MAKE_CACHE_NAME << endl;
+ t << "\t@echo # Name : " << MAKE_CACHE_NAME << " >> " MAKE_CACHE_NAME << endl;
+ t << "\t@echo # Part of : " << project->values("TARGET").join(" ") << " >> " MAKE_CACHE_NAME << endl;
+ t << "\t@echo # Description : This file is used to cache last build target for >> " MAKE_CACHE_NAME << endl;
+ t << "\t@echo # make sis target. >> " MAKE_CACHE_NAME << endl;
+ t << "\t@echo # Version : >> " MAKE_CACHE_NAME << endl;
+ t << "\t@echo # >> " MAKE_CACHE_NAME << endl;
+ t << "\t@echo # ============================================================================== >> " MAKE_CACHE_NAME << endl;
+ t << "\t@echo. >> " MAKE_CACHE_NAME << endl;
+ t << "\t@echo QT_SIS_TARGET ?= $(QT_SIS_TARGET) >> " MAKE_CACHE_NAME << endl;
+ t << endl;
+
+ generatedFiles << MAKE_CACHE_NAME;
+}
+
+void SymbianAbldMakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension)
+{
+ // Normally emulator deployment gets done via regular makefile, but since subdirs
+ // do not get that, special deployment only makefile is generated for them if needed.
+ if (targetType != TypeSubdirs || addDeploymentExtension) {
+ QString gnuMakefileName = QLatin1String("Makefile_") + uid3;
+ removeSpecialCharacters(gnuMakefileName);
+ gnuMakefileName.append(".mk");
+ t << "gnumakefile " << gnuMakefileName << endl;
+ }
+}
+
+void SymbianAbldMakefileGenerator::appendAbldTempDirs(QStringList& sysincspaths, QString 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.
+ QString epocPath("epoc32");
+ if (!includepath.contains(epocPath)) // No temp dirs for epoc includes
+ appendIfnotExist(sysincspaths, includepath + QString("/" QT_EXTRA_INCLUDE_DIR));
+}
diff --git a/qmake/generators/symbian/symmake_abld.h b/qmake/generators/symbian/symmake_abld.h
new file mode 100644
index 000000000..56d31e1e4
--- /dev/null
+++ b/qmake/generators/symbian/symmake_abld.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SYMMAKE_ABLD_H
+#define SYMMAKE_ABLD_H
+
+#include <symmake.h>
+
+QT_BEGIN_NAMESPACE
+
+class SymbianAbldMakefileGenerator : public SymbianMakefileGenerator
+{
+protected:
+
+ // Inherited from parent
+ virtual void writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile);
+ virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension);
+ virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly);
+ virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile);
+ virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath);
+
+ void writeStoreBuildTarget(QTextStream &t);
+ bool writeDeploymentTargets(QTextStream &t);
+
+public:
+
+ SymbianAbldMakefileGenerator();
+ ~SymbianAbldMakefileGenerator();
+};
+
+#endif // SYMMAKE_ABLD_H
diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp
new file mode 100644
index 000000000..c7eae646b
--- /dev/null
+++ b/qmake/generators/symbian/symmake_sbsv2.cpp
@@ -0,0 +1,414 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "symmake_sbsv2.h"
+#include "initprojectdeploy_symbian.h"
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qdir.h>
+#include <qdatetime.h>
+#include <qdebug.h>
+
+SymbianSbsv2MakefileGenerator::SymbianSbsv2MakefileGenerator() : SymbianMakefileGenerator() { }
+SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { }
+
+#define FLM_DEST_DIR "epoc32/tools/makefile_templates/qt"
+#define FLM_SOURCE_DIR "/mkspecs/symbian-sbsv2/flm/qt"
+
+// Copies Qt FLMs to correct location under epocroot.
+// This is not done by configure as it is possible to change epocroot after configure.
+void SymbianSbsv2MakefileGenerator::exportFlm()
+{
+ static bool flmExportDone = false;
+
+ if (!flmExportDone) {
+ QDir sourceDir = QDir(QLibraryInfo::location(QLibraryInfo::PrefixPath) + FLM_SOURCE_DIR);
+ QFileInfoList sourceInfos = sourceDir.entryInfoList(QDir::Files);
+
+ QDir destDir(epocRoot() + FLM_DEST_DIR);
+ if (!destDir.exists()) {
+ if (destDir.mkpath(destDir.absolutePath()))
+ generatedDirs << destDir.absolutePath();
+ }
+
+ foreach(QFileInfo item, sourceInfos) {
+ QFileInfo destInfo = QFileInfo(destDir.absolutePath() + "/" + item.fileName());
+ if (!destInfo.exists() || destInfo.lastModified() < item.lastModified()) {
+ if (destInfo.exists())
+ QFile::remove(destInfo.absoluteFilePath());
+ if (QFile::copy(item.absoluteFilePath(), destInfo.absoluteFilePath()))
+ generatedFiles << destInfo.absoluteFilePath();
+ else
+ fprintf(stderr, "Error: Could not copy '%s' -> '%s'\n",
+ qPrintable(item.absoluteFilePath()),
+ qPrintable(destInfo.absoluteFilePath()));
+ }
+ }
+ flmExportDone = true;
+ }
+}
+
+void SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly)
+{
+ // Can't use extension makefile with sbsv2
+ Q_UNUSED(wrapperFileName);
+ Q_UNUSED(deploymentOnly);
+}
+
+void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile)
+{
+ QStringList allPlatforms;
+ foreach(QString platform, project->values("SYMBIAN_PLATFORMS")) {
+ allPlatforms << platform.toLower();
+ }
+
+ QStringList debugPlatforms = allPlatforms;
+ QStringList releasePlatforms = allPlatforms;
+ releasePlatforms.removeAll("winscw"); // No release for emulator
+
+ QString testClause;
+ if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive))
+ testClause = QLatin1String(".test");
+ else
+ testClause = QLatin1String("");
+
+ QTextStream t(&wrapperFile);
+
+ t << "# ==============================================================================" << endl;
+ t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << QDateTime::currentDateTime().toString() << endl;
+ t << "# This file is generated by qmake and should not be modified by the" << endl;
+ t << "# user." << endl;
+ t << "# Name : " << wrapperFile.fileName() << endl;
+ t << "# Description : Wrapper Makefile for calling Symbian build tools" << endl;
+ t << "#" << endl;
+ t << "# ==============================================================================" << "\n" << endl;
+ t << endl;
+ t << "MAKEFILE = " << wrapperFile.fileName() << endl;
+ t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;
+ t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
+ t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
+ t << "MOVE = " << var("QMAKE_MOVE") << endl;
+ t << "DEBUG_PLATFORMS = " << debugPlatforms.join(" ") << endl;
+ t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl;
+ t << "MAKE = make" << endl;
+ t << "SBS = sbs" << endl;
+ t << endl;
+ t << "DEFINES" << '\t' << " = "
+ << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
+ << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ")
+ << varGlue("DEFINES","-D"," -D","") << endl;
+
+ t << "INCPATH" << '\t' << " = ";
+
+ 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 << " -I\"" << values.at(i) << "\" ";
+ }
+ }
+ t << endl;
+ t << "first: default" << endl;
+ if (debugPlatforms.contains("winscw"))
+ t << "default: debug-winscw";
+ else if (debugPlatforms.contains("armv5"))
+ t << "default: debug-armv5";
+ else if (debugPlatforms.size())
+ t << "default: debug-" << debugPlatforms.first();
+ else
+ t << "default: all";
+
+ t << endl;
+ if (!isPrimaryMakefile) {
+ t << "all:" << endl;
+ } else {
+ t << "all: debug release" << endl;
+ t << endl;
+ t << "qmake:" << endl;
+ t << "\t$(QMAKE) -spec symbian-sbsv2 -o \"" << fileInfo(Option::output.fileName()).fileName()
+ << "\" \"" << project->projectFile() << "\"" << endl;
+ t << endl;
+ t << BLD_INF_FILENAME ":" << endl;
+ t << "\t$(QMAKE)" << endl;
+ t << endl;
+
+ t << "debug: " << BLD_INF_FILENAME << endl;
+ foreach(QString item, debugPlatforms) {
+ t << "\t$(SBS) -c " << item << "_udeb" << testClause << endl;
+ }
+ t << endl;
+ t << "release: " << BLD_INF_FILENAME << endl;
+ foreach(QString item, releasePlatforms) {
+ t << "\t$(SBS) -c " << item << "_urel" << testClause << endl;
+ }
+ t << endl;
+
+ QString winscw("winscw");
+ // For more specific builds, targets are in this form: build-platform, e.g. release-armv5
+ foreach(QString item, debugPlatforms) {
+ t << "debug-" << item << ": " << BLD_INF_FILENAME << endl;
+ if(QString::compare(item, winscw) == 0)
+ t << "\t$(SBS) -c " << item << "_udeb.mwccinc" << testClause << endl;
+ else
+ t << "\t$(SBS) -c " << item << "_udeb" << testClause << endl;
+ }
+
+ foreach(QString item, releasePlatforms) {
+ t << "release-" << item << ": " << BLD_INF_FILENAME << endl;
+ if(QString::compare(item, winscw) == 0)
+ t << "\t$(SBS) -c " << item << "_urel.mwccinc" << testClause << endl;
+ else
+ t << "\t$(SBS) -c " << item << "_urel" << testClause << endl;
+ }
+
+ t << endl;
+ t << "export: " << BLD_INF_FILENAME << endl;
+ t << "\t$(SBS) export" << endl;
+ t << endl;
+
+ t << "cleanexport: " << BLD_INF_FILENAME << endl;
+ t << "\t$(SBS) cleanexport" << endl;
+ t << endl;
+
+ }
+
+ // Add all extra targets including extra compiler targest also to wrapper makefile,
+ // even though many of them may have already been added to bld.inf as FLMs.
+ // This is to enable use of targets like 'mocables', which call targets generated by extra compilers.
+ if (targetType != TypeSubdirs) {
+ t << extraTargetsCache;
+ t << extraCompilersCache;
+ } else {
+ QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets();
+ writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables|SubTargetSkipDefaultTargets);
+ qDeleteAll(subtargets);
+ }
+
+ writeSisTargets(t);
+
+ generateDistcleanTargets(t);
+
+ t << "clean: " << BLD_INF_FILENAME << endl;
+ t << "\t-$(SBS) reallyclean" << endl;
+ t << endl;
+
+ // create execution target
+ if (debugPlatforms.contains("winscw") && targetType == TypeExe) {
+ t << "run:" << endl;
+ t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl;
+ }
+}
+
+void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile)
+{
+ // Makes sure we have needed FLMs in place.
+ exportFlm();
+
+ // Parse extra compilers data
+ QStringList defines;
+ QStringList incPath;
+
+ defines << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
+ << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ")
+ << varGlue("DEFINES","-D"," -D","");
+ for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) {
+ QStringList values = it.value();
+ for (int i = 0; i < values.size(); ++i) {
+ incPath << QLatin1String(" -I\"") + values.at(i) + "\"";
+ }
+ }
+
+ // Write extra compilers and targets to initialize QMAKE_ET_* variables
+ // Cache results to avoid duplicate calls when creating wrapper makefile
+ QTextStream extraCompilerStream(&extraCompilersCache);
+ QTextStream extraTargetStream(&extraTargetsCache);
+ writeExtraCompilerTargets(extraCompilerStream);
+ writeExtraTargets(extraTargetStream);
+
+ // Figure out everything the target depends on as we don't want to run extra targets that
+ // are not necessary.
+ QStringList allPreDeps;
+ foreach(QString item, project->values("PRE_TARGETDEPS")) {
+ // Predeps get mangled in windows, so fix them to more sbsv2 friendly format
+#if defined(Q_OS_WIN)
+ if (item.mid(1, 1) == ":")
+ item = item.mid(0, 1).toUpper().append(item.mid(1)); // Fix drive to uppercase
+#endif
+ item.replace("\\", "/");
+ allPreDeps << escapeDependencyPath(item);
+ }
+
+ foreach (QString item, project->values("GENERATED_SOURCES")) {
+ allPreDeps.append(fileInfo(item).absoluteFilePath());
+ }
+
+ for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) {
+ QString currentSourcePath = it.key();
+ QStringList values = it.value();
+ for (int i = 0; i < values.size(); ++i) {
+ QString sourceFile = currentSourcePath + "/" + values.at(i);
+ QStringList deps = findDependencies(QDir::toNativeSeparators(sourceFile));
+ foreach(QString depItem, deps) {
+ appendIfnotExist(allPreDeps, fileInfo(depItem).absoluteFilePath());
+ }
+ }
+ }
+
+ // Write FLM rules for all extra targets and compilers that we depend on to build the target.
+ QStringList extraTargets;
+ extraTargets << project->values("QMAKE_EXTRA_TARGETS") << project->values("QMAKE_EXTRA_COMPILERS");
+ foreach(QString item, extraTargets) {
+ foreach(QString targetItem, project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_TARGETS.") + item)) {
+ // Make sure targetpath is absolute
+ QString absoluteTarget = fileInfo(targetItem).absoluteFilePath();
+ if (allPreDeps.contains(absoluteTarget)) {
+ QStringList deps = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_DEPS.") + item + targetItem);
+ QString commandItem = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_CMD.") + item + targetItem).join(" ");
+
+
+ // Make sure all deps paths are absolute
+ QString absoluteDeps;
+ foreach (QString depItem, deps) {
+ if (!depItem.isEmpty()) {
+ absoluteDeps.append(fileInfo(depItem).absoluteFilePath());
+ absoluteDeps.append(" ");
+ }
+ }
+
+ t << "START EXTENSION qt/qmake_extra_pre_targetdep" << endl;
+ t << "OPTION PREDEP_TARGET " << absoluteTarget << endl;
+ t << "OPTION DEPS " << absoluteDeps << endl;
+
+ if (commandItem.indexOf("$(INCPATH)") != -1)
+ commandItem.replace("$(INCPATH)", incPath.join(" "));
+ if (commandItem.indexOf("$(DEFINES)") != -1)
+ commandItem.replace("$(DEFINES)", defines.join(" "));
+
+ // Sbsv2 strips all backslashes (even doubles ones) from option parameters, so just replace them with slashes
+ // Problem: If some command actually needs backslashes for something else than dir separator, we are out of luck...
+ commandItem.replace("\\", "/");
+ t << "OPTION COMMAND " << commandItem << endl;
+ t << "END" << endl;
+ }
+ }
+ }
+
+ t << endl;
+
+ // Write winscw deployment rules
+ QString remoteTestPath = epocRoot() + QLatin1String("epoc32/winscw/c/private/") + privateDirUid;
+ DeploymentList depList;
+ initProjectDeploySymbian(project, depList, remoteTestPath, false, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles);
+
+ t << "#if defined(WINSCW)" << endl;
+ for (int i = 0; i < depList.size(); ++i) {
+ t << "START EXTENSION qt/qmake_emulator_deployment" << endl;
+ QString fromItem = depList.at(i).from;
+ QString toItem = depList.at(i).to;
+ fromItem.replace("\\", "/");
+ toItem.replace("\\", "/");
+#if defined(Q_OS_WIN)
+ toItem.prepend(QDir::current().absolutePath().left(2)); // add drive
+#endif
+ t << "OPTION DEPLOY_SOURCE " << fromItem << endl;
+ t << "OPTION DEPLOY_TARGET " << toItem << endl;
+ t << "END" << endl;
+ }
+ t << "#endif" << endl;
+
+ t << endl;
+
+ // Write post link rules
+ if (!project->isEmpty("QMAKE_POST_LINK")) {
+ t << "START EXTENSION qt/qmake_post_link" << endl;
+ t << "OPTION POST_LINK_CMD " << var("QMAKE_POST_LINK") << endl;
+ t << "OPTION LINK_TARGET " << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".").append(getTargetExtension())) << endl;
+ t << "END" << endl;
+ t << endl;
+ }
+
+ // Application icon generation
+ QStringList icons = project->values("ICON");
+ if (icons.size()) {
+ QString icon = icons.first();
+ if (icons.size() > 1)
+ fprintf(stderr, "Warning: Only first icon specified in ICON variable is used: '%s'.", qPrintable(icon));
+
+ t << "START EXTENSION s60/mifconv" << endl;
+
+ QFileInfo iconInfo = fileInfo(icon);
+
+ QFileInfo bldinf(project->values("MAKEFILE").first());
+ QString iconPath = bldinf.dir().relativeFilePath(iconInfo.path());
+
+ QString iconFile = iconInfo.baseName();
+
+ QFileInfo iconTargetInfo = fileInfo(iconTargetFile);
+ QString iconTarget = iconTargetInfo.fileName();
+
+ t << "OPTION SOURCES -c32 " << iconFile << endl;
+ t << "OPTION SOURCEDIR " << iconPath << endl;
+ t << "OPTION TARGETFILE " << iconTarget << endl;
+ t << "OPTION SVGENCODINGVERSION 3" << endl; // Compatibility with S60 3.1 devices and up
+ t << "END" << endl;
+ }
+
+ t << "START EXTENSION qt/qmake_store_build" << endl;
+ t << "END" << endl;
+ t << endl;
+
+ t << endl;
+}
+
+void SymbianSbsv2MakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension)
+{
+ // We don't generate extension makefile in sbsb2
+ Q_UNUSED(t);
+ Q_UNUSED(addDeploymentExtension);
+}
+
+void SymbianSbsv2MakefileGenerator::appendAbldTempDirs(QStringList& sysincspaths, QString includepath)
+{
+ //Do nothing
+ Q_UNUSED(sysincspaths);
+ Q_UNUSED(includepath);
+}
diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h
new file mode 100644
index 000000000..339490840
--- /dev/null
+++ b/qmake/generators/symbian/symmake_sbsv2.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SYMMAKE_SBSV2_H
+#define SYMMAKE_SBSV2_H
+
+#include <symmake.h>
+
+QT_BEGIN_NAMESPACE
+
+class SymbianSbsv2MakefileGenerator : public SymbianMakefileGenerator
+{
+protected:
+
+ // Inherited from parent
+ virtual void writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile);
+ virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension);
+ virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly);
+ virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile);
+ virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath);
+
+public:
+
+ SymbianSbsv2MakefileGenerator();
+ ~SymbianSbsv2MakefileGenerator();
+
+private:
+ void exportFlm();
+
+ QString extraTargetsCache;
+ QString extraCompilersCache;
+};
+
+#endif // SYMMAKE_SBSV2_H