1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2015 The Qt Company Ltd. 4 ** Contact: http://www.qt.io/licensing/ 5 ** 6 ** This file is part of the qmake application of the Qt Toolkit. 7 ** 8 ** $QT_BEGIN_LICENSE:LGPL$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see http://www.qt.io/terms-conditions. For further 15 ** information use the contact form at http://www.qt.io/contact-us. 16 ** 17 ** GNU Lesser General Public License Usage 18 ** Alternatively, this file may be used under the terms of the GNU Lesser 19 ** General Public License version 2.1 or version 3 as published by the Free 20 ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 ** following information to ensure the GNU Lesser General Public License 23 ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 ** 26 ** As a special exception, The Qt Company gives you certain additional 27 ** rights. These rights are described in The Qt Company LGPL Exception 28 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 ** 30 ** GNU General Public License Usage 31 ** Alternatively, this file may be used under the terms of the GNU 32 ** General Public License version 3.0 as published by the Free Software 33 ** Foundation and appearing in the file LICENSE.GPL included in the 34 ** packaging of this file. Please review the following information to 35 ** ensure the GNU General Public License version 3.0 requirements will be 36 ** met: http://www.gnu.org/copyleft/gpl.html. 37 ** 38 ** $QT_END_LICENSE$ 39 ** 40 ****************************************************************************/ 41 42 #ifndef SYMMAKEFILE_H 43 #define SYMMAKEFILE_H 44 45 #include "initprojectdeploy_symbian.h" 46 #include "symbiancommon.h" 47 #include <makefile.h> 48 49 QT_BEGIN_NAMESPACE 50 51 #define BLD_INF_FILENAME "bld.inf" 52 #define MAKEFILE_DEPENDENCY_SEPARATOR " \\\n\t" 53 #define QT_EXTRA_INCLUDE_DIR "tmp" 54 #define MAKE_CACHE_NAME ".make.cache" 55 #define SYMBIAN_TEST_CONFIG "symbian_test" 56 57 class SymbianMakefileGenerator : public MakefileGenerator, public SymbianCommonGenerator 58 { 59 protected: 60 QString platform; 61 QString uid2; 62 QString mmpFileName; 63 QMap<QString, QStringList> sources; 64 QMap<QString, QStringList> systeminclude; 65 QMap<QString, QStringList> library; 66 // (output file) (source , command) 67 QMap<QString, QStringList> makmakeCommands; 68 QStringList overriddenMmpKeywords; 69 QDir outputDir; 70 71 QString fixPathForMmp(const QString& origPath, const QDir& parentDir); 72 QString absolutizePath(const QString& origPath); 73 74 virtual bool writeMakefile(QTextStream &t); 75 76 virtual void init(); 77 78 QString getTargetExtension(); 79 80 QString generateUID3(); 81 82 void initMmpVariables(); 83 void generateMmpFileName(); 84 void handleMmpRulesOverrides(QString &checkString, 85 bool &inResourceBlock, 86 QStringList &restrictedMmpKeywords, 87 const QStringList &restrictableMmpKeywords, 88 const QStringList &overridableMmpKeywords); 89 void appendKeywordIfMatchFound(QStringList &list, 90 const QStringList &keywordList, 91 QString &checkString); 92 93 void writeHeader(QTextStream &t); 94 void writeBldInfContent(QTextStream& t, 95 bool addDeploymentExtension, 96 const QString &iconFile); 97 98 static bool removeDuplicatedStrings(QStringList& stringList); 99 100 void writeMmpFileHeader(QTextStream &t); 101 void writeMmpFile(QString &filename, const SymbianLocalizationList &symbianLocalizationList); 102 void writeMmpFileMacrosPart(QTextStream& t); 103 void addMacro(QTextStream& t, const QString& value); 104 void writeMmpFileTargetPart(QTextStream& t); 105 void writeMmpFileResourcePart(QTextStream& t, const SymbianLocalizationList &symbianLocalizationList); 106 void writeMmpFileSystemIncludePart(QTextStream& t); 107 void writeMmpFileIncludePart(QTextStream& t); 108 void writeMmpFileLibraryPart(QTextStream& t); 109 void writeMmpFileCapabilityPart(QTextStream& t); 110 void writeMmpFileConditionalOptions(QTextStream& t, 111 const QString &optionType, 112 const QString &optionTag, 113 const QString &variableBase); 114 void writeMmpFileSimpleOption(QTextStream& t, 115 const QString &optionType, 116 const QString &optionTag, 117 const QString &options); 118 void appendMmpFileOptions(QString &options, const QStringList &list); 119 void writeMmpFileCompilerOptionPart(QTextStream& t); 120 void writeMmpFileBinaryVersionPart(QTextStream& t); 121 void writeMmpFileRulesPart(QTextStream& t); 122 123 void appendIfnotExist(QStringList &list, QString value); 124 void appendIfnotExist(QStringList &list, QStringList values); 125 126 QString removeTrailingPathSeparators(QString &file); 127 void generateCleanCommands(QTextStream& t, 128 const QStringList& toClean, 129 const QString& cmd, 130 const QString& cmdOptions, 131 const QString& itemPrefix, 132 const QString& itemSuffix); 133 134 void generateDistcleanTargets(QTextStream& t); 135 QString generateLocFileTarget(QTextStream& t, const QString& locCmd); 136 137 // Subclass implements 138 virtual void writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) = 0; 139 virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) = 0; 140 virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly) = 0; 141 virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) = 0; 142 virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath) = 0; 143 144 public: 145 146 SymbianMakefileGenerator(); 147 ~SymbianMakefileGenerator(); 148 }; 149 150 #endif // SYMMAKEFILE_H 151