| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the qmake application of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ** a written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 16 | ** GNU Lesser General Public License Usage
|
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 20 | ** packaging of this file. Please review the following information to
|
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 23 | **
|
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
|---|
| 37 | ** Nokia at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | #ifndef SYMMAKEFILE_H
|
|---|
| 43 | #define SYMMAKEFILE_H
|
|---|
| 44 |
|
|---|
| 45 | #include "initprojectdeploy_symbian.h"
|
|---|
| 46 | #include <makefile.h>
|
|---|
| 47 |
|
|---|
| 48 | QT_BEGIN_NAMESPACE
|
|---|
| 49 |
|
|---|
| 50 | #define BLD_INF_FILENAME "bld.inf"
|
|---|
| 51 | #define MAKEFILE_DEPENDENCY_SEPARATOR " \\\n\t"
|
|---|
| 52 |
|
|---|
| 53 | #define QT_EXTRA_INCLUDE_DIR "tmp"
|
|---|
| 54 | #define MAKE_CACHE_NAME ".make.cache"
|
|---|
| 55 |
|
|---|
| 56 | class SymbianMakefileGenerator : public MakefileGenerator
|
|---|
| 57 | {
|
|---|
| 58 | protected:
|
|---|
| 59 | enum TargetType {
|
|---|
| 60 | TypeExe,
|
|---|
| 61 | TypeDll,
|
|---|
| 62 | TypeLib,
|
|---|
| 63 | TypePlugin,
|
|---|
| 64 | TypeSubdirs
|
|---|
| 65 | };
|
|---|
| 66 |
|
|---|
| 67 | QString platform;
|
|---|
| 68 | QString uid2;
|
|---|
| 69 | QString uid3;
|
|---|
| 70 | QString privateDirUid;
|
|---|
| 71 | TargetType targetType;
|
|---|
| 72 | QMap<QString, QStringList> sources;
|
|---|
| 73 | QMap<QString, QStringList> systeminclude;
|
|---|
| 74 | QMap<QString, QStringList> library;
|
|---|
| 75 | // (output file) (source , command)
|
|---|
| 76 | QMap<QString, QStringList> makmakeCommands;
|
|---|
| 77 | QStringList overriddenMmpKeywords;
|
|---|
| 78 |
|
|---|
| 79 | QStringList generatedFiles;
|
|---|
| 80 | QStringList generatedDirs;
|
|---|
| 81 | QHash<QString, QString> qt2S60LangMapTable;
|
|---|
| 82 |
|
|---|
| 83 | QString fixedTarget;
|
|---|
| 84 |
|
|---|
| 85 | void removeSpecialCharacters(QString& str);
|
|---|
| 86 | QString fixPathForMmp(const QString& origPath, const QDir& parentDir);
|
|---|
| 87 | QString canonizePath(const QString& origPath);
|
|---|
| 88 |
|
|---|
| 89 | virtual bool writeMakefile(QTextStream &t);
|
|---|
| 90 | void generatePkgFile(const QString &iconFile, DeploymentList &depList);
|
|---|
| 91 | bool containsStartWithItem(const QChar &c, const QStringList& src);
|
|---|
| 92 |
|
|---|
| 93 | virtual void init();
|
|---|
| 94 |
|
|---|
| 95 | QString getTargetExtension();
|
|---|
| 96 |
|
|---|
| 97 | QString generateUID3();
|
|---|
| 98 |
|
|---|
| 99 | void initMmpVariables();
|
|---|
| 100 | void handleMmpRulesOverrides(QString &checkString,
|
|---|
| 101 | bool &inResourceBlock,
|
|---|
| 102 | QStringList &restrictedMmpKeywords,
|
|---|
| 103 | const QStringList &restrictableMmpKeywords,
|
|---|
| 104 | const QStringList &overridableMmpKeywords);
|
|---|
| 105 | void appendKeywordIfMatchFound(QStringList &list,
|
|---|
| 106 | const QStringList &keywordList,
|
|---|
| 107 | QString &checkString);
|
|---|
| 108 |
|
|---|
| 109 | void writeHeader(QTextStream &t);
|
|---|
| 110 | void writeBldInfContent(QTextStream& t, bool addDeploymentExtension, const QString &iconFile, DeploymentList &depList);
|
|---|
| 111 |
|
|---|
| 112 | static bool removeDuplicatedStrings(QStringList& stringList);
|
|---|
| 113 |
|
|---|
| 114 | void writeMmpFileHeader(QTextStream &t);
|
|---|
| 115 | void writeMmpFile(QString &filename, QStringList &symbianLangCodes);
|
|---|
| 116 | void writeMmpFileMacrosPart(QTextStream& t);
|
|---|
| 117 | void addMacro(QTextStream& t, const QString& value);
|
|---|
| 118 | void writeMmpFileTargetPart(QTextStream& t);
|
|---|
| 119 | void writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes);
|
|---|
| 120 | void writeMmpFileSystemIncludePart(QTextStream& t);
|
|---|
| 121 | void writeMmpFileIncludePart(QTextStream& t);
|
|---|
| 122 | void writeMmpFileLibraryPart(QTextStream& t);
|
|---|
| 123 | void writeMmpFileCapabilityPart(QTextStream& t);
|
|---|
| 124 | void writeMmpFileCompilerOptionPart(QTextStream& t);
|
|---|
| 125 | void writeMmpFileBinaryVersionPart(QTextStream& t);
|
|---|
| 126 | void writeMmpFileRulesPart(QTextStream& t);
|
|---|
| 127 |
|
|---|
| 128 | void writeCustomDefFile();
|
|---|
| 129 |
|
|---|
| 130 | void writeRegRssFile(QStringList &useritems);
|
|---|
| 131 | void writeRssFile(QString &numberOfIcons, QString &iconfile);
|
|---|
| 132 | void writeLocFile(QStringList &symbianLangCodes);
|
|---|
| 133 | void readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules);
|
|---|
| 134 |
|
|---|
| 135 | QStringList symbianLangCodesFromTsFiles();
|
|---|
| 136 | void fillQt2S60LangMapTable();
|
|---|
| 137 |
|
|---|
| 138 | void appendIfnotExist(QStringList &list, QString value);
|
|---|
| 139 | void appendIfnotExist(QStringList &list, QStringList values);
|
|---|
| 140 |
|
|---|
| 141 | QString removePathSeparators(QString &file);
|
|---|
| 142 | QString removeTrailingPathSeparators(QString &file);
|
|---|
| 143 | void generateCleanCommands(QTextStream& t,
|
|---|
| 144 | const QStringList& toClean,
|
|---|
| 145 | const QString& cmd,
|
|---|
| 146 | const QString& cmdOptions,
|
|---|
| 147 | const QString& itemPrefix,
|
|---|
| 148 | const QString& itemSuffix);
|
|---|
| 149 |
|
|---|
| 150 | void writeSisTargets(QTextStream &t);
|
|---|
| 151 | void generateDistcleanTargets(QTextStream& t);
|
|---|
| 152 | void generateExecutionTargets(QTextStream& t, const QStringList& platforms);
|
|---|
| 153 |
|
|---|
| 154 | // Subclass implements
|
|---|
| 155 | virtual void writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) = 0;
|
|---|
| 156 | virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) = 0;
|
|---|
| 157 | virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly) = 0;
|
|---|
| 158 | virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) = 0;
|
|---|
| 159 | virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath) = 0;
|
|---|
| 160 |
|
|---|
| 161 | public:
|
|---|
| 162 |
|
|---|
| 163 | SymbianMakefileGenerator();
|
|---|
| 164 | ~SymbianMakefileGenerator();
|
|---|
| 165 | };
|
|---|
| 166 |
|
|---|
| 167 | #endif // SYMMAKEFILE_H
|
|---|