qmake/generators/symbian/symmake.h
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the qmake application of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    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 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef SYMMAKEFILE_H
       
    43 #define SYMMAKEFILE_H
       
    44 
       
    45 #include <makefile.h>
       
    46 
       
    47 QT_BEGIN_NAMESPACE
       
    48 
       
    49 #define BLD_INF_FILENAME "bld.inf"
       
    50 #define MAKEFILE_DEPENDENCY_SEPARATOR " \\\n\t"
       
    51 
       
    52 #define QT_EXTRA_INCLUDE_DIR "tmp"
       
    53 #define MAKE_CACHE_NAME ".make.cache"
       
    54 
       
    55 class SymbianMakefileGenerator : public MakefileGenerator
       
    56 {
       
    57 protected:
       
    58     enum TargetType {
       
    59         TypeExe,
       
    60         TypeDll,
       
    61         TypeLib,
       
    62         TypePlugin,
       
    63         TypeSubdirs
       
    64     };
       
    65 
       
    66     QString platform;
       
    67     QString uid2;
       
    68     QString uid3;
       
    69     QString privateDirUid;
       
    70     TargetType targetType;
       
    71     QMap<QString, QStringList> sources;
       
    72     QMap<QString, QStringList> systeminclude;
       
    73     QMap<QString, QStringList> library;
       
    74     // (output file) (source , command)
       
    75     QMap<QString, QStringList> makmakeCommands;
       
    76     QStringList overriddenMmpKeywords;
       
    77 
       
    78     QStringList generatedFiles;
       
    79     QStringList generatedDirs;
       
    80     QHash<QString, QString> qt2S60LangMapTable;
       
    81 
       
    82     QString fixedTarget;
       
    83 
       
    84     void removeSpecialCharacters(QString& str);
       
    85     QString fixPathForMmp(const QString& origPath, const QDir& parentDir);
       
    86     QString canonizePath(const QString& origPath);
       
    87 
       
    88     virtual bool writeMakefile(QTextStream &t);
       
    89     void generatePkgFile(const QString &iconFile);
       
    90     bool containsStartWithItem(const QChar &c, const QStringList& src);
       
    91 
       
    92     virtual void init();
       
    93 
       
    94     QString getTargetExtension();
       
    95 
       
    96     QString generateUID3();
       
    97 
       
    98     void initMmpVariables();
       
    99     void checkOverridability(QStringList &overridableKeywords, QString &checkString);
       
   100 
       
   101     void writeHeader(QTextStream &t);
       
   102     void writeBldInfContent(QTextStream& t, bool addDeploymentExtension);
       
   103     void writeExportPart(QTextStream &t);
       
   104 
       
   105     static bool removeDuplicatedStrings(QStringList& stringList);
       
   106 
       
   107     void writeMmpFileHeader(QTextStream &t);
       
   108     void writeMmpFile(QString &filename, QStringList &symbianLangCodes);
       
   109     void writeMmpFileMacrosPart(QTextStream& t);
       
   110     void addMacro(QTextStream& t, const QString& value);
       
   111     void writeMmpFileTargetPart(QTextStream& t);
       
   112     void writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes);
       
   113     void writeMmpFileSystemIncludePart(QTextStream& t);
       
   114     void writeMmpFileIncludePart(QTextStream& t);
       
   115     void writeMmpFileLibraryPart(QTextStream& t);
       
   116     void writeMmpFileCapabilityPart(QTextStream& t);
       
   117     void writeMmpFileCompilerOptionPart(QTextStream& t);
       
   118     void writeMmpFileBinaryVersionPart(QTextStream& t);
       
   119     void writeMmpFileRulesPart(QTextStream& t);
       
   120 
       
   121     void writeCustomDefFile();
       
   122 
       
   123     void writeRegRssFile(QStringList &useritems);
       
   124     void writeRssFile(QString &numberOfIcons, QString &iconfile);
       
   125     void writeLocFile(QStringList &symbianLangCodes);
       
   126     void readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules);
       
   127 
       
   128     QStringList symbianLangCodesFromTsFiles();
       
   129     void fillQt2S60LangMapTable();
       
   130 
       
   131     void appendIfnotExist(QStringList &list, QString value);
       
   132     void appendIfnotExist(QStringList &list, QStringList values);
       
   133 
       
   134     QString removePathSeparators(QString &file);
       
   135     QString removeTrailingPathSeparators(QString &file);
       
   136     void generateCleanCommands(QTextStream& t,
       
   137                                const QStringList& toClean,
       
   138                                const QString& cmd,
       
   139                                const QString& cmdOptions,
       
   140                                const QString& itemPrefix,
       
   141                                const QString& itemSuffix);
       
   142 
       
   143     void writeSisTargets(QTextStream &t);
       
   144     void generateDistcleanTargets(QTextStream& t);
       
   145 
       
   146     // Subclass implements
       
   147     virtual void writeBldInfExtensionRulesPart(QTextStream& t) = 0;
       
   148     virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) = 0;
       
   149     virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly) = 0;
       
   150     virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) = 0;
       
   151 
       
   152 public:
       
   153 
       
   154     SymbianMakefileGenerator();
       
   155     ~SymbianMakefileGenerator();
       
   156 };
       
   157 
       
   158 #endif // SYMMAKEFILE_H