qmake/generators/symbian/symmake_abld.cpp
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
child 33 3e2da88830cd
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
    69 SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { }
    69 SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { }
    70 
    70 
    71 void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly)
    71 void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly)
    72 {
    72 {
    73     QString gnuMakefileName = QLatin1String("Makefile_") + uid3;
    73     QString gnuMakefileName = QLatin1String("Makefile_") + uid3;
    74     removeSpecialCharacters(gnuMakefileName);
    74     removeEpocSpecialCharacters(gnuMakefileName);
    75     gnuMakefileName.append(".mk");
    75     gnuMakefileName.append(".mk");
    76 
    76 
    77     QFile ft(gnuMakefileName);
    77     QFile ft(gnuMakefileName);
    78     if (ft.open(QIODevice::WriteOnly)) {
    78     if (ft.open(QIODevice::WriteOnly)) {
    79         if (Option::mkfile::listgen) {
       
    80             generatePrint(fileInfo(ft.fileName()).absoluteFilePath());
       
    81         }
       
    82         generatedFiles << ft.fileName();
    79         generatedFiles << ft.fileName();
    83         QTextStream t(&ft);
    80         QTextStream t(&ft);
    84 
    81 
    85         t << "# ==============================================================================" << endl;
    82         t << "# ==============================================================================" << endl;
    86         t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
    83         t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
   150         t << "CLEAN: " << cleanDepsWinscw << endl;
   147         t << "CLEAN: " << cleanDepsWinscw << endl;
   151         t << "else" << endl;
   148         t << "else" << endl;
   152         t << "CLEAN: " << cleanDeps << endl;
   149         t << "CLEAN: " << cleanDeps << endl;
   153         t << "endif" << endl << endl;
   150         t << "endif" << endl << endl;
   154         t << "CLEANLIB: " DO_NOTHING_TARGET << endl << endl;
   151         t << "CLEANLIB: " DO_NOTHING_TARGET << endl << endl;
   155 
   152         
       
   153 		//QTP: org 47 start
       
   154 		/*t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl;
       
   155         t << "FREEZE: " DO_NOTHING_TARGET << endl << endl;
       
   156         t << "SAVESPACE: " DO_NOTHING_TARGET << endl << endl;
       
   157         t << "RELEASABLES: " DO_NOTHING_TARGET << endl << endl;*/
       
   158 		//QTP: org 47 end
       
   159 		
       
   160         //QTP: loc change start
   156         QStringList trFileNames;
   161         QStringList trFileNames;
   157         if (!project->values("SYMBIANTRANSLATIONS").isEmpty()) {
   162         if (!project->values("SYMBIANTRANSLATIONS").isEmpty()) {
   158             QString translationFilename = project->first("TRANSLATIONS");
   163             QString translationFilename = project->first("TRANSLATIONS");
   159             if (!translationFilename.isEmpty()) {
   164             if (!translationFilename.isEmpty()) {
   160                 QStringList symbianTranslations = project->values("SYMBIANTRANSLATIONS");
   165                 QStringList symbianTranslations = project->values("SYMBIANTRANSLATIONS");
   164                 QString symbianWinscwUrelQmPath = project->first("SYMBIANWINSCWURELTRANSLATIONDIR");  
   169                 QString symbianWinscwUrelQmPath = project->first("SYMBIANWINSCWURELTRANSLATIONDIR");  
   165                 t << "RESOURCE: create_qm" << endl << endl;
   170                 t << "RESOURCE: create_qm" << endl << endl;
   166                 t << "create_qm : " << endl;
   171                 t << "create_qm : " << endl;
   167                 foreach (const QString &symbianTrans, symbianTranslations) {
   172                 foreach (const QString &symbianTrans, symbianTranslations) {
   168                     QString translationTsFilename(translationFilename);
   173                     QString translationTsFilename(translationFilename);
   169                     translationTsFilename.chop(3);
   174                     translationFilename = fileInfo(translationFilename).completeBaseName();
   170                     translationTsFilename.insert(0,symbianTrPath);
   175                     translationTsFilename.insert(0, symbianTrPath);
   171                     translationTsFilename.append(QString::fromLatin1("_"));
   176                     translationTsFilename.append(QString::fromLatin1("_"));
   172                     translationTsFilename.append(symbianTrans);
   177                     translationTsFilename.append(symbianTrans);
   173                     QString translationQmFilename(translationTsFilename);
   178                     QString translationQmFilename(translationTsFilename);
   174 
   179 
   175                     translationTsFilename.append(QString::fromLatin1(".ts"));
   180                     translationTsFilename.append(QString::fromLatin1(".ts"));
   176                     // output path for armv5 qm files./epoc32/data/z/resource/qt/translations/
   181                     // output path for armv5 qm files./epoc32/data/z/resource/qt/translations/
   177                     translationQmFilename.append(QString::fromLatin1(".qm"));
   182                     translationQmFilename.append(QString::fromLatin1(".qm"));
   178 
   183 
   179 										// input path for ts files. /epoc32/include/platform/qt/translations/
   184 					// input path for ts files. /epoc32/include/platform/qt/translations/
   180                     QString translationTsSrcFilename(translationFilename);
   185                     QString translationTsSrcFilename(translationFilename);
   181                     translationTsSrcFilename.chop(3);
   186                     translationFilename = fileInfo(translationFilename).completeBaseName();
   182                     translationTsSrcFilename.insert(0,symbianTrSrcPath);
   187                     translationTsSrcFilename.insert(0, symbianTrSrcPath);
   183                     translationTsSrcFilename.append(QString::fromLatin1("_"));
   188                     translationTsSrcFilename.append(QString::fromLatin1("_"));
   184                     translationTsSrcFilename.append(symbianTrans);	
   189                     translationTsSrcFilename.append(symbianTrans);	
   185                     translationTsSrcFilename.append(QString::fromLatin1(".ts"));
   190                     translationTsSrcFilename.append(QString::fromLatin1(".ts"));
   186                     	
   191                     	
   187 										// output path for winscw qm files. /epoc32/release/winscw/udeb/z/resource/qt/translations/
   192 					// output path for winscw qm files. /epoc32/release/winscw/udeb/z/resource/qt/translations/
   188                     QString translationQmWinscwUdebFilename(translationFilename);
   193                     QString translationQmWinscwUdebFilename(translationFilename);
   189                     translationQmWinscwUdebFilename.chop(3);
   194                     translationFilename = fileInfo(translationFilename).completeBaseName();
   190                     translationQmWinscwUdebFilename.insert(0,symbianWinscwUdebQmPath);
   195                     translationQmWinscwUdebFilename.insert(0, symbianWinscwUdebQmPath);
   191                     translationQmWinscwUdebFilename.append(QString::fromLatin1("_"));
   196                     translationQmWinscwUdebFilename.append(QString::fromLatin1("_"));
   192                     translationQmWinscwUdebFilename.append(symbianTrans);
   197                     translationQmWinscwUdebFilename.append(symbianTrans);
   193                     translationQmWinscwUdebFilename.append(QString::fromLatin1(".qm"));                    	
   198                     translationQmWinscwUdebFilename.append(QString::fromLatin1(".qm"));                    	
   194 
   199 
   195 										// output path for winscw qm files. /epoc32/release/winscw/urel/z/resource/qt/translations/
   200 					// output path for winscw qm files. /epoc32/release/winscw/urel/z/resource/qt/translations/
   196                     QString translationQmWinscwUrelFilename(translationFilename);
   201                     QString translationQmWinscwUrelFilename(translationFilename);
   197                     translationQmWinscwUrelFilename.chop(3);
   202                     translationFilename = fileInfo(translationFilename).completeBaseName();
   198                     translationQmWinscwUrelFilename.insert(0,symbianWinscwUrelQmPath);
   203                     translationQmWinscwUrelFilename.insert(0, symbianWinscwUrelQmPath);
   199                     translationQmWinscwUrelFilename.append(QString::fromLatin1("_"));
   204                     translationQmWinscwUrelFilename.append(QString::fromLatin1("_"));
   200                     translationQmWinscwUrelFilename.append(symbianTrans);	
   205                     translationQmWinscwUrelFilename.append(symbianTrans);	
   201                     translationQmWinscwUrelFilename.append(QString::fromLatin1(".qm"));  
   206                     translationQmWinscwUrelFilename.append(QString::fromLatin1(".qm"));  
   202                     
   207                     
   203                     //these get generated to component mk file.	 
   208                     //these get generated to component mk file.	 
   209                     trFileNames.append(translationQmFilename);
   214                     trFileNames.append(translationQmFilename);
   210                     trFileNames.append(translationQmWinscwUdebFilename);
   215                     trFileNames.append(translationQmWinscwUdebFilename);
   211                     trFileNames.append(translationQmWinscwUrelFilename);
   216                     trFileNames.append(translationQmWinscwUrelFilename);
   212                 }
   217                 }
   213                 t << endl;
   218                 t << endl;
   214             }
   219             } else { 
   215             else
   220                 t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl;
   216             t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl;
   221 			}   	
   217         } else {
   222         } else {
   218             t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl;
   223             t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl;
   219         }
   224         }
       
   225        
       
   226         
   220         t << "FREEZE: " DO_NOTHING_TARGET << endl << endl;
   227         t << "FREEZE: " DO_NOTHING_TARGET << endl << endl;
   221         t << "SAVESPACE: " DO_NOTHING_TARGET << endl << endl;
   228         t << "SAVESPACE: " DO_NOTHING_TARGET << endl << endl;
   222 
   229         
   223         if (!project->values("SYMBIANTRANSLATIONS").isEmpty()) {
   230          if (!project->values("SYMBIANTRANSLATIONS").isEmpty()) {
   224             t << "RELEASABLES: list_qm" << endl << endl;
   231             t << "RELEASABLES: list_qm" << endl << endl;
   225             t << "list_qm : " << endl;
   232             t << "list_qm : " << endl;
   226             foreach (const QString &trFilename, trFileNames) {
   233             foreach (const QString &trFilename, trFileNames) {
   227                 t << "\t@echo " << trFilename << endl;
   234                 t << "\t@echo " << trFilename << endl;
   228               }
   235             }
   229             t << endl;
   236             t << endl;
   230         } else {
   237         } else {
   231             t << "RELEASABLES: " DO_NOTHING_TARGET << endl << endl;
   238             t << "RELEASABLES: " DO_NOTHING_TARGET << endl << endl;
   232         }
   239         }
       
   240         //QTP: loc change end
       
   241         
   233         t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl;
   242         t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl;
   234         t << "FINAL: " << finalDepsWinscw << endl;
   243         t << "FINAL: " << finalDepsWinscw << endl;
   235         t << "else" << endl;
   244         t << "else" << endl;
   236         t << "FINAL: " << finalDeps << endl;
   245         t << "FINAL: " << finalDeps << endl;
   237         t << "endif" << endl << endl;
   246         t << "endif" << endl << endl;
   274     t << "#  Description : Wrapper Makefile for calling Symbian build tools" << endl;
   283     t << "#  Description : Wrapper Makefile for calling Symbian build tools" << endl;
   275     t << "#" << endl;
   284     t << "#" << endl;
   276     t << "# ==============================================================================" << "\n" << endl;
   285     t << "# ==============================================================================" << "\n" << endl;
   277     t << endl;
   286     t << endl;
   278 
   287 
   279     t << "MAKEFILE          = " << wrapperFile.fileName() << endl;
   288     t << "MAKEFILE          = " << fileInfo(wrapperFile.fileName()).fileName() << endl;
   280     t << "QMAKE             = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;
   289     t << "QMAKE             = " << var("QMAKE_QMAKE") << endl;
   281     t << "DEL_FILE          = " << var("QMAKE_DEL_FILE") << endl;
   290     t << "DEL_FILE          = " << var("QMAKE_DEL_FILE") << endl;
   282     t << "DEL_DIR           = " << var("QMAKE_DEL_DIR") << endl;
   291     t << "DEL_DIR           = " << var("QMAKE_DEL_DIR") << endl;
   283     t << "MOVE              = " << var("QMAKE_MOVE") << endl;
   292     t << "MOVE              = " << var("QMAKE_MOVE") << endl;
   284     t << "CHK_DIR_EXISTS    = " << var("QMAKE_CHK_DIR_EXISTS") << endl;
   293     t << "CHK_DIR_EXISTS    = " << var("QMAKE_CHK_DIR_EXISTS") << endl;
   285     t << "MKDIR             = " << var("QMAKE_MKDIR") << endl;
   294     t << "MKDIR             = " << var("QMAKE_MKDIR") << endl;
       
   295 #ifdef Q_OS_WIN32
   286     t << "XCOPY             = xcopy /d /f /h /r /y /i" << endl;
   296     t << "XCOPY             = xcopy /d /f /h /r /y /i" << endl;
   287     t << "ABLD              = ABLD.BAT" << endl;
   297     t << "ABLD              = ABLD.BAT" << endl;
       
   298 #else
       
   299     t << "XCOPY             = cp -u -v" << endl;
       
   300     t << "ABLD              = abld" << endl;
       
   301 #endif
   288     t << "DEBUG_PLATFORMS   = " << debugPlatforms.join(" ") << endl;
   302     t << "DEBUG_PLATFORMS   = " << debugPlatforms.join(" ") << endl;
   289     t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl;
   303     t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl;
   290     t << "MAKE              = make" << endl;
   304     t << "MAKE              = make" << endl;
   291     t << endl;
   305     t << endl;
   292     t << "ifeq (WINS,$(findstring WINS, $(PLATFORM)))" << endl;
   306     t << "ifeq (WINS,$(findstring WINS, $(PLATFORM)))" << endl;
   293     t << "ZDIR=$(EPOCROOT)epoc32\\release\\$(PLATFORM)\\$(CFG)\\Z" << endl;
   307     t << "ZDIR=$(EPOCROOT)" << QDir::toNativeSeparators("epoc32/release/$(PLATFORM)/$(CFG)/z") << endl;
   294     t << "else" << endl;
   308     t << "else" << endl;
   295     t << "ZDIR=$(EPOCROOT)epoc32\\data\\z" << endl;
   309     t << "ZDIR=$(EPOCROOT)" << QDir::toNativeSeparators("epoc32/data/z") << endl;
   296     t << "endif" << endl;
   310     t << "endif" << endl;
   297     t << endl;
   311     t << endl;
   298     t << "DEFINES" << '\t' << " = "
   312     t << "DEFINES" << '\t' << " = "
   299       << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
   313       << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
   300       << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ")
   314       << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ")
   384 
   398 
   385         t << CREATE_TEMPS_TARGET ":" << endl;
   399         t << CREATE_TEMPS_TARGET ":" << endl;
   386         // generate command lines like this ...
   400         // generate command lines like this ...
   387         // -@ if NOT EXIST  ".\somedir"         mkdir ".\somedir"
   401         // -@ if NOT EXIST  ".\somedir"         mkdir ".\somedir"
   388         QStringList dirsToClean;
   402         QStringList dirsToClean;
       
   403         QString dirExists = var("QMAKE_CHK_DIR_EXISTS");
       
   404         QString mkdir = var("QMAKE_MKDIR");
   389         for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) {
   405         for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) {
   390             QStringList values = it.value();
   406             QStringList values = it.value();
   391             for (int i = 0; i < values.size(); ++i) {
   407             for (int i = 0; i < values.size(); ++i) {
   392                 if (values.at(i).endsWith("/" QT_EXTRA_INCLUDE_DIR)) {
   408                 if (values.at(i).endsWith("/" QT_EXTRA_INCLUDE_DIR)) {
   393                     QString fixedValue(QDir::toNativeSeparators(values.at(i)));
   409                     QString fixedValue(QDir::toNativeSeparators(values.at(i)));
   394                     dirsToClean << fixedValue;
   410                     dirsToClean << fixedValue;
   395                     t << "\t-@ if NOT EXIST \""  << fixedValue << "\" mkdir \""
   411                     t << "\t-@ " << dirExists << " \""  << fixedValue << "\" "
   396                       << fixedValue << "\"" << endl;
   412                       << mkdir << " \"" << fixedValue << "\"" << endl;
   397                 }
   413                 }
   398             }
   414             }
   399         }
   415         }
   400         t << endl;
   416         t << endl;
   401 
   417 
   402         // Note: EXTENSION_CLEAN will get called many times when doing reallyclean
   418         // Note: EXTENSION_CLEAN will get called many times when doing reallyclean
   403         //       This is why the "2> NUL" gets appended to generated clean targets in makefile.cpp.
   419         //       This is why the "2> NUL" gets appended to generated clean targets in makefile.cpp.
   404         t << EXTENSION_CLEAN ": " COMPILER_CLEAN_TARGET << endl;
   420         t << EXTENSION_CLEAN ": " COMPILER_CLEAN_TARGET << endl;
   405         generateCleanCommands(t, dirsToClean, var("QMAKE_DEL_DIR"), " /S /Q ", "", "");
   421         generateCleanCommands(t, dirsToClean, var("QMAKE_DEL_TREE"), "", "", "");
   406         t << endl;
   422         t << endl;
   407 
   423 
   408         t << PRE_TARGETDEPS_TARGET ":"
   424         t << PRE_TARGETDEPS_TARGET ":"
   409           << MAKEFILE_DEPENDENCY_SEPARATOR GENERATED_SOURCES_TARGET
   425           << MAKEFILE_DEPENDENCY_SEPARATOR GENERATED_SOURCES_TARGET
   410           << MAKEFILE_DEPENDENCY_SEPARATOR ALL_SOURCE_DEPS_TARGET;
   426           << MAKEFILE_DEPENDENCY_SEPARATOR ALL_SOURCE_DEPS_TARGET;
   449 
   465 
   450     // Deploymend targets for both emulator and rom deployment
   466     // Deploymend targets for both emulator and rom deployment
   451     writeDeploymentTargets(t, false);
   467     writeDeploymentTargets(t, false);
   452     writeDeploymentTargets(t, true);
   468     writeDeploymentTargets(t, true);
   453 
   469 
   454     writeSisTargets(t);
       
   455 
       
   456     writeStoreBuildTarget(t);
       
   457 
       
   458     generateDistcleanTargets(t);
   470     generateDistcleanTargets(t);
   459 
   471 
   460     t << "clean: $(ABLD)" << endl;
   472     t << "clean: $(ABLD)" << endl;
   461     t << "\t-$(ABLD)" << testClause << " reallyclean" << endl;
   473     t << "\t-$(ABLD)" << testClause << " reallyclean" << endl;
   462     t << "\t-bldmake clean" << endl;
   474     t << "\t-bldmake clean" << endl;
   504     QString remoteTestPath = epocRoot()
   516     QString remoteTestPath = epocRoot()
   505         + QLatin1String(isRom ? "epoc32\\data\\z\\private\\" : "epoc32\\winscw\\c\\private\\")
   517         + QLatin1String(isRom ? "epoc32\\data\\z\\private\\" : "epoc32\\winscw\\c\\private\\")
   506         + privateDirUid;
   518         + privateDirUid;
   507     DeploymentList depList;
   519     DeploymentList depList;
   508 
   520 
   509     initProjectDeploySymbian(project, depList, remoteTestPath, false,
   521     initProjectDeploySymbian(project, depList, remoteTestPath, false, true,
   510         QLatin1String(isRom ? ROM_DEPLOYMENT_PLATFORM : EMULATOR_DEPLOYMENT_PLATFORM),
   522         QLatin1String(isRom ? ROM_DEPLOYMENT_PLATFORM : EMULATOR_DEPLOYMENT_PLATFORM),
   511         QString(), generatedDirs, generatedFiles);
   523         QString(), generatedDirs, generatedFiles);
   512 
   524 
   513     if (depList.size())
   525     if (depList.size())
   514         t << "\t-echo Deploying changed files..." << endl;
   526         t << "\t-echo Deploying changed files..." << endl;
   540     t << endl;
   552     t << endl;
   541 
   553 
   542     return true;
   554     return true;
   543 }
   555 }
   544 
   556 
   545 void SymbianAbldMakefileGenerator::writeStoreBuildTarget(QTextStream &t)
       
   546 {
       
   547     t << STORE_BUILD_TARGET ":" << endl;
       
   548     t << "\t@echo # ============================================================================== > " MAKE_CACHE_NAME << endl;
       
   549     t << "\t@echo # This file is generated by make and should not be modified by the user >> " MAKE_CACHE_NAME << endl;
       
   550     t << "\t@echo #  Name        : " << MAKE_CACHE_NAME << " >> " MAKE_CACHE_NAME << endl;
       
   551     t << "\t@echo #  Part of     : " << project->values("TARGET").join(" ") << " >> " MAKE_CACHE_NAME << endl;
       
   552     t << "\t@echo #  Description : This file is used to cache last build target for >> " MAKE_CACHE_NAME << endl;
       
   553     t << "\t@echo #                make sis target. >> " MAKE_CACHE_NAME << endl;
       
   554     t << "\t@echo #  Version     :  >> " MAKE_CACHE_NAME << endl;
       
   555     t << "\t@echo # >> " MAKE_CACHE_NAME << endl;
       
   556     t << "\t@echo # ============================================================================== >> " MAKE_CACHE_NAME <<  endl;
       
   557     t << "\t@echo. >> " MAKE_CACHE_NAME <<  endl;
       
   558     t << "\t@echo QT_SIS_TARGET ?= $(QT_SIS_TARGET) >> " MAKE_CACHE_NAME << endl;
       
   559     t << endl;
       
   560 
       
   561     generatedFiles << MAKE_CACHE_NAME;
       
   562 }
       
   563 
       
   564 void SymbianAbldMakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension)
   557 void SymbianAbldMakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension)
   565 {
   558 {
   566     // Normally emulator deployment gets done via regular makefile, but since subdirs
   559     // Normally emulator deployment gets done via regular makefile, but since subdirs
   567     // do not get that, special deployment only makefile is generated for them if needed.
   560     // do not get that, special deployment only makefile is generated for them if needed.
   568     if (targetType != TypeSubdirs || addDeploymentExtension) {
   561     if (targetType != TypeSubdirs || addDeploymentExtension) {
   569         QString gnuMakefileName = QLatin1String("Makefile_") + uid3;
   562         QString gnuMakefileName = QLatin1String("Makefile_") + uid3;
   570         removeSpecialCharacters(gnuMakefileName);
   563         removeEpocSpecialCharacters(gnuMakefileName);
   571         gnuMakefileName.append(".mk");
   564         gnuMakefileName.append(".mk");
   572         t << "gnumakefile " << gnuMakefileName << endl;
   565         t << "gnumakefile " << gnuMakefileName << endl;
   573     }
   566     }
   574 }
   567 }
   575 
   568