qmake/generators/symbian/symmake_abld.cpp
changeset 18 2f34d5167611
parent 3 41300fa6a67c
child 19 fcece45ef507
equal deleted inserted replaced
3:41300fa6a67c 18:2f34d5167611
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the qmake application of the Qt Toolkit.
     7 ** This file is part of the qmake application of the Qt Toolkit.
     8 **
     8 **
    45 #include <qstring.h>
    45 #include <qstring.h>
    46 #include <qstringlist.h>
    46 #include <qstringlist.h>
    47 #include <qdir.h>
    47 #include <qdir.h>
    48 #include <qdatetime.h>
    48 #include <qdatetime.h>
    49 #include <qdebug.h>
    49 #include <qdebug.h>
       
    50 
       
    51 // Included from tools/shared
       
    52 #include <symbian/epocroot.h>
    50 
    53 
    51 #define DO_NOTHING_TARGET "do_nothing"
    54 #define DO_NOTHING_TARGET "do_nothing"
    52 #define CREATE_TEMPS_TARGET "create_temps"
    55 #define CREATE_TEMPS_TARGET "create_temps"
    53 #define EXTENSION_CLEAN "extension_clean"
    56 #define EXTENSION_CLEAN "extension_clean"
    54 #define PRE_TARGETDEPS_TARGET "pre_targetdeps"
    57 #define PRE_TARGETDEPS_TARGET "pre_targetdeps"
   153         t << "else" << endl;
   156         t << "else" << endl;
   154         t << "CLEAN: " << cleanDeps << endl;
   157         t << "CLEAN: " << cleanDeps << endl;
   155         t << "endif" << endl << endl;
   158         t << "endif" << endl << endl;
   156         t << "CLEANLIB: " DO_NOTHING_TARGET << endl << endl;
   159         t << "CLEANLIB: " DO_NOTHING_TARGET << endl << endl;
   157 
   160 
   158         QStringList qmFileNames;
   161         QStringList trFileNames;
   159         QString translationFilename = project->first("TRANSLATIONS");
   162         if (!project->values("SYMBIANTRANSLATIONS").isEmpty()) {
   160         if (!project->values("SYMBIANTRANSLATIONS").isEmpty() && !translationFilename.isEmpty()) {
   163             QString translationFilename = project->first("TRANSLATIONS");
   161             QStringList symbianTranslations = project->values("SYMBIANTRANSLATIONS");
   164             if (!translationFilename.isEmpty()) {
   162             QString symbianTrPath = project->first("SYMBIANTRANSLATIONDIR");
   165                 QStringList symbianTranslations = project->values("SYMBIANTRANSLATIONS");
   163             t << "RESOURCE: create_qm" << endl << endl;
   166                 QString symbianTrPath = project->first("SYMBIANTRANSLATIONDIR");
   164             t << "create_qm : " << endl;
   167                 QString symbianTrSrcPath = project->first("SYMBIANTRANSLATIONSRCDIR");    	
   165             foreach (const QString &symbianTrans, symbianTranslations) {
   168                 QString symbianWinscwUdebQmPath = project->first("SYMBIANWINSCWUDEBTRANSLATIONDIR");  
   166                 QString translationTsFilename(translationFilename);
   169                 QString symbianWinscwUrelQmPath = project->first("SYMBIANWINSCWURELTRANSLATIONDIR");  
   167                 translationTsFilename.chop(3);
   170                 t << "RESOURCE: create_qm" << endl << endl;
   168                 translationTsFilename.insert(0,symbianTrPath);
   171                 t << "create_qm : " << endl;
   169                 translationTsFilename.append(QString::fromLatin1("_"));
   172                 foreach (const QString &symbianTrans, symbianTranslations) {
   170                 translationTsFilename.append(symbianTrans);
   173                     QString translationTsFilename(translationFilename);
   171                 QString translationQmFilename(translationTsFilename);
   174                     translationTsFilename.chop(3);
   172                 translationTsFilename.append(QString::fromLatin1(".ts"));
   175                     translationTsFilename.insert(0,symbianTrPath);
   173                 translationQmFilename.append(QString::fromLatin1(".qm"));
   176                     translationTsFilename.append(QString::fromLatin1("_"));
   174                 t << "\t$(EPOCROOT)epoc32\\tools\\qt\\lrelease -silent -idbased " << translationTsFilename << " -qm " << translationQmFilename << endl;
   177                     translationTsFilename.append(symbianTrans);
   175                 // qmFileNames are needed in RELEASABLES: part
   178                     QString translationQmFilename(translationTsFilename);
   176                 qmFileNames.append(translationQmFilename);
   179 
       
   180                     translationTsFilename.append(QString::fromLatin1(".ts"));
       
   181                     // output path for armv5 qm files./epoc32/data/z/resource/qt/translations/
       
   182                     translationQmFilename.append(QString::fromLatin1(".qm"));
       
   183 
       
   184 										// input path for ts files. /epoc32/include/platform/qt/translations/
       
   185                     QString translationTsSrcFilename(translationFilename);
       
   186                     translationTsSrcFilename.chop(3);
       
   187                     translationTsSrcFilename.insert(0,symbianTrSrcPath);
       
   188                     translationTsSrcFilename.append(QString::fromLatin1("_"));
       
   189                     translationTsSrcFilename.append(symbianTrans);	
       
   190                     translationTsSrcFilename.append(QString::fromLatin1(".ts"));
       
   191                     	
       
   192 										// output path for winscw qm files. /epoc32/release/winscw/udeb/z/resource/qt/translations/
       
   193                     QString translationQmWinscwUdebFilename(translationFilename);
       
   194                     translationQmWinscwUdebFilename.chop(3);
       
   195                     translationQmWinscwUdebFilename.insert(0,symbianWinscwUdebQmPath);
       
   196                     translationQmWinscwUdebFilename.append(QString::fromLatin1("_"));
       
   197                     translationQmWinscwUdebFilename.append(symbianTrans);
       
   198                     translationQmWinscwUdebFilename.append(QString::fromLatin1(".qm"));                    	
       
   199 
       
   200 										// output path for winscw qm files. /epoc32/release/winscw/urel/z/resource/qt/translations/
       
   201                     QString translationQmWinscwUrelFilename(translationFilename);
       
   202                     translationQmWinscwUrelFilename.chop(3);
       
   203                     translationQmWinscwUrelFilename.insert(0,symbianWinscwUrelQmPath);
       
   204                     translationQmWinscwUrelFilename.append(QString::fromLatin1("_"));
       
   205                     translationQmWinscwUrelFilename.append(symbianTrans);	
       
   206                     translationQmWinscwUrelFilename.append(QString::fromLatin1(".qm"));  
       
   207                     
       
   208                     //these get generated to component mk file.	 
       
   209                     t << "\tlrelease -silent -idbased " << translationTsSrcFilename << " -qm " << translationQmFilename << endl;
       
   210                     t << "\tlrelease -silent -idbased " << translationTsSrcFilename << " -qm " << translationQmWinscwUdebFilename << endl;
       
   211                     t << "\tlrelease -silent -idbased " << translationTsSrcFilename << " -qm " << translationQmWinscwUrelFilename << endl;
       
   212                     
       
   213                     // trFileNames QStringList needed in RELEASABLES part
       
   214                     trFileNames.append(translationQmFilename);
       
   215                     trFileNames.append(translationQmWinscwUdebFilename);
       
   216                     trFileNames.append(translationQmWinscwUrelFilename);
       
   217                 }
       
   218                 t << endl;
   177             }
   219             }
   178             t << endl;
   220             else
       
   221             t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl;
   179         } else {
   222         } else {
   180             t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl;
   223             t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl;
   181         }
   224         }
   182         t << "FREEZE: " DO_NOTHING_TARGET << endl << endl;
   225         t << "FREEZE: " DO_NOTHING_TARGET << endl << endl;
   183         t << "SAVESPACE: " DO_NOTHING_TARGET << endl << endl;
   226         t << "SAVESPACE: " DO_NOTHING_TARGET << endl << endl;
   184 
   227 
   185         if (!project->values("SYMBIANTRANSLATIONS").isEmpty() && !qmFileNames.isEmpty()) {
   228         if (!project->values("SYMBIANTRANSLATIONS").isEmpty()) {
   186             t << "RELEASABLES: list_qm" << endl << endl;
   229             t << "RELEASABLES: list_qm" << endl << endl;
   187             t << "list_qm : " << endl;
   230             t << "list_qm : " << endl;
   188             foreach (const QString &qmFilename, qmFileNames) {
   231             foreach (const QString &trFilename, trFileNames) {
   189                 t << "\t@echo " << qmFilename << endl;
   232                 t << "\t@echo " << trFilename << endl;
   190             }
   233               }
   191             t << endl;
   234             t << endl;
   192         } else {
   235         } else {
   193             t << "RELEASABLES: " DO_NOTHING_TARGET << endl << endl;
   236             t << "RELEASABLES: " DO_NOTHING_TARGET << endl << endl;
   194         }
   237         }
   195         t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl;
   238         t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl;
   218     QStringList debugPlatforms = allPlatforms;
   261     QStringList debugPlatforms = allPlatforms;
   219     QStringList releasePlatforms = allPlatforms;
   262     QStringList releasePlatforms = allPlatforms;
   220     releasePlatforms.removeAll("winscw"); // No release for emulator
   263     releasePlatforms.removeAll("winscw"); // No release for emulator
   221 
   264 
   222     QString testClause;
   265     QString testClause;
   223     if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive))
   266     if (project->isActiveConfig("symbian_test"))
   224         testClause = QLatin1String(" test");
   267         testClause = QLatin1String(" test");
   225     else
   268     else
   226         testClause = QLatin1String("");
   269         testClause = QLatin1String("");
   227 
   270 
   228     QTextStream t(&wrapperFile);
   271     QTextStream t(&wrapperFile);
   423     t << "clean: $(ABLD)" << endl;
   466     t << "clean: $(ABLD)" << endl;
   424     t << "\t-$(ABLD)" << testClause << " reallyclean" << endl;
   467     t << "\t-$(ABLD)" << testClause << " reallyclean" << endl;
   425     t << "\t-bldmake clean" << endl;
   468     t << "\t-bldmake clean" << endl;
   426     t << endl;
   469     t << endl;
   427 
   470 
   428     // Create execution target
   471     t << "clean-debug: $(ABLD)" << endl;
   429     if (debugPlatforms.contains("winscw") && targetType == TypeExe) {
   472     foreach(QString item, debugPlatforms) {
   430         t << "run:" << endl;
   473         t << "\t$(ABLD)" << testClause << " reallyclean " << item << " udeb" << endl;
   431         t << "\t-call " << epocRoot() << "epoc32\\release\\winscw\\udeb\\" << fixedTarget << ".exe" << endl << endl;
   474     }
   432     }
   475     t << endl;
       
   476     t << "clean-release: $(ABLD)" << endl;
       
   477     foreach(QString item, releasePlatforms) {
       
   478         t << "\t$(ABLD)" << testClause << " reallyclean " << item << " urel" << endl;
       
   479     }
       
   480     t << endl;
       
   481 
       
   482     // For more specific builds, targets are in this form: clean-build-platform, e.g. clean-release-armv5
       
   483     foreach(QString item, debugPlatforms) {
       
   484         t << "clean-debug-" << item << ": $(ABLD)" << endl;
       
   485         t << "\t$(ABLD)" << testClause << " reallyclean " << item << " udeb" << endl;
       
   486     }
       
   487     foreach(QString item, releasePlatforms) {
       
   488         t << "clean-release-" << item << ": $(ABLD)" << endl;
       
   489         t << "\t$(ABLD)" << testClause << " reallyclean " << item << " urel" << endl;
       
   490     }
       
   491     t << endl;
       
   492 
       
   493     generateExecutionTargets(t, debugPlatforms);
   433 }
   494 }
   434 
   495 
   435 void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile)
   496 void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile)
   436 {
   497 {
   437     // We don't use extensions for anything in abld
   498     // We don't use extensions for anything in abld