Changeset 769 for trunk/qmake/generators


Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/qmake/generators/makefile.cpp

    r651 r769  
    12671267            do_default = false;
    12681268            for(QStringList::Iterator wild_it = tmp.begin(); wild_it != tmp.end(); ++wild_it) {
    1269                 QString wild = Option::fixPathToLocalOS((*wild_it), false, false);
     1269                QString wild = Option::fixPathToTargetOS((*wild_it), false, false);
    12701270                QString dirstr = qmake_getpwd(), filestr = wild;
    12711271                int slsh = filestr.lastIndexOf(Option::dir_sep);
     
    13071307                QString local_dirstr = Option::fixPathToLocalOS(dirstr, true);
    13081308                QStringList files = QDir(local_dirstr).entryList(QStringList(filestr));
    1309                 if(project->values((*it) + ".CONFIG").indexOf("no_check_exist") != -1 && files.isEmpty()) {
     1309                const QStringList &installConfigValues = project->values((*it) + ".CONFIG");
     1310                if (installConfigValues.contains("no_check_exist") && files.isEmpty()) {
    13101311                    if(!target.isEmpty())
    13111312                        target += "\t";
    13121313                    QString dst_file = filePrefixRoot(root, dst);
    13131314                    QFileInfo fi(fileInfo(wild));
    1314                     QString cmd = inst_prefix + QString(fi.isExecutable() ? "$(INSTALL_PROGRAM)" : "$(INSTALL_FILE)") + " " +
    1315                                    wild + " " + dst_file + "\n";
     1315                    QString cmd;
     1316                    if (installConfigValues.contains("directory")) {
     1317                        cmd = QLatin1String(inst_prefix + "$(INSTALL_DIR)");
     1318                        if (!dst_file.endsWith(Option::dir_sep))
     1319                            dst_file += Option::dir_sep;
     1320                        dst_file += fi.fileName();
     1321                    } else if (installConfigValues.contains("executable")) {
     1322                        cmd = QLatin1String(inst_prefix + "$(INSTALL_PROGRAM)");
     1323                    } else if (installConfigValues.contains("data")) {
     1324                        cmd = QLatin1String(inst_prefix + "$(INSTALL_FILE)");
     1325                    } else {
     1326                        cmd = inst_prefix + QString(fi.isExecutable() ? "$(INSTALL_PROGRAM)" : "$(INSTALL_FILE)");
     1327                    }
     1328                    cmd += " " + wild + " " + dst_file + "\n";
    13161329                    target += cmd;
    13171330                    if(!uninst.isEmpty())
     
    18781891                    }
    18791892                }
    1880                 if(!cleans.isEmpty())
     1893                if(!cleans.isEmpty()) {
    18811894                    t << valGlue(cleans, "\n\t" + del_statement, del_suffix + "\n\t" + del_statement, del_suffix);
     1895                }
    18821896                if(!wrote_clean_cmds) {
    18831897                    for(QStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
     
    25922606            if(!ofile.isEmpty())
    25932607                t << "\t-$(DEL_FILE) " << ofile << del_suffix << endl;
     2608            t << varGlue("QMAKE_DISTCLEAN","\t-$(DEL_FILE) "," ","\n");
    25942609        } else if(project->isActiveConfig("no_empty_targets")) {
    25952610            t << "\t" << "@cd ." << endl;
  • trunk/qmake/generators/makefiledeps.cpp

    r651 r769  
    398398        for(int have_read = 0;
    399399            (have_read = QT_READ(fd, buffer + buffer_len, fst.st_size - buffer_len));
    400             buffer_len += have_read);
     400            buffer_len += have_read) ;
    401401        QT_CLOSE(fd);
    402402    }
     
    419419                if(buffer_len >= x + 12 && !strncmp(buffer + x, "includehint", 11) &&
    420420                   (*(buffer + x + 11) == ' ' || *(buffer + x + 11) == '>')) {
    421                     for(x += 11; *(buffer + x) != '>'; ++x);
     421                    for(x += 11; *(buffer + x) != '>'; ++x) ;
    422422                    int inc_len = 0;
    423                     for(x += 1 ; *(buffer + x + inc_len) != '<'; ++inc_len);
     423                    for(x += 1 ; *(buffer + x + inc_len) != '<'; ++inc_len) ;
    424424                    *(buffer + x + inc_len) = '\0';
    425425                    inc = buffer + x;
    426426                } else if(buffer_len >= x + 13 && !strncmp(buffer + x, "customwidget", 12) &&
    427427                          (*(buffer + x + 12) == ' ' || *(buffer + x + 12) == '>')) {
    428                     for(x += 13; *(buffer + x) != '>'; ++x); //skip up to >
     428                    for(x += 13; *(buffer + x) != '>'; ++x) ; //skip up to >
    429429                    while(x < buffer_len) {
    430                         for(x++; *(buffer + x) != '<'; ++x); //skip up to <
     430                        for(x++; *(buffer + x) != '<'; ++x) ; //skip up to <
    431431                        x++;
    432432                        if(buffer_len >= x + 7 && !strncmp(buffer+x, "header", 6) &&
    433433                           (*(buffer + x + 6) == ' ' || *(buffer + x + 6) == '>')) {
    434                             for(x += 7; *(buffer + x) != '>'; ++x); //skip up to >
     434                            for(x += 7; *(buffer + x) != '>'; ++x) ; //skip up to >
    435435                            int inc_len = 0;
    436                             for(x += 1 ; *(buffer + x + inc_len) != '<'; ++inc_len);
     436                            for(x += 1 ; *(buffer + x + inc_len) != '<'; ++inc_len) ;
    437437                            *(buffer + x + inc_len) = '\0';
    438438                            inc = buffer + x;
     
    449449                        if(buffer_len >= x + 9 && *(buffer + x) == 'i' &&
    450450                           !strncmp(buffer + x, "impldecl", 8)) {
    451                             for(x += 8; *(buffer + x) != '='; ++x);
     451                            for(x += 8; *(buffer + x) != '='; ++x) ;
    452452                            if(*(buffer + x) != '=')
    453453                                continue;
    454                             for(++x; *(buffer+x) == '\t' || *(buffer+x) == ' '; ++x);
     454                            for(++x; *(buffer+x) == '\t' || *(buffer+x) == ' '; ++x) ;
    455455                            char quote = 0;
    456456                            if(*(buffer+x) == '\'' || *(buffer+x) == '"') {
     
    476476                    }
    477477                    int inc_len = 0;
    478                     for(x += 1 ; *(buffer + x + inc_len) != '<'; ++inc_len);
     478                    for(x += 1 ; *(buffer + x + inc_len) != '<'; ++inc_len) ;
    479479                    *(buffer + x + inc_len) = '\0';
    480480                    inc = buffer + x;
     
    482482            }
    483483            //read past new line now..
    484             for(; x < buffer_len && !qmake_endOfLine(*(buffer + x)); ++x);
     484            for(; x < buffer_len && !qmake_endOfLine(*(buffer + x)); ++x) ;
    485485            ++line_count;
    486486        } else if(file->type == QMakeSourceFileInfo::TYPE_QRC) {
     
    495495                        if(buffer_len >= x) {
    496496                            if(*(buffer+x) == '/') { //c++ style comment
    497                                 for(; x < buffer_len && !qmake_endOfLine(*(buffer + x)); ++x);
     497                                for(; x < buffer_len && !qmake_endOfLine(*(buffer + x)); ++x) ;
    498498                                beginning = 1;
    499499                            } else if(*(buffer+x) == '*') { //c style comment
     
    559559                    for(x+=keyword_len; //skip spaces after keyword
    560560                        x < buffer_len && (*(buffer+x) == ' ' || *(buffer+x) == '\t');
    561                         x++);
     561                        x++) ;
    562562                    break;
    563563                } else if(qmake_endOfLine(*(buffer+x+keyword_len))) {
     
    580580
    581581                int inc_len;
    582                 for(inc_len = 0; *(buffer + x + inc_len) != term && !qmake_endOfLine(*(buffer + x + inc_len)); ++inc_len);
     582                for(inc_len = 0; *(buffer + x + inc_len) != term && !qmake_endOfLine(*(buffer + x + inc_len)); ++inc_len) ;
    583583                *(buffer + x + inc_len) = '\0';
    584584                inc = buffer + x;
     
    595595                int msg_len;
    596596                for(msg_len = 0; (term && *(buffer + x + msg_len) != term) &&
    597                               !qmake_endOfLine(*(buffer + x + msg_len)); ++msg_len);
     597                              !qmake_endOfLine(*(buffer + x + msg_len)); ++msg_len) ;
    598598                *(buffer + x + msg_len) = '\0';
    599599                debug_msg(0, "%s:%d %s -- %s", file->file.local().toLatin1().constData(), line_count, keyword, buffer+x);
     
    707707        for(int have_read = buffer_len = 0;
    708708            (have_read = QT_READ(fd, buffer + buffer_len, fst.st_size - buffer_len));
    709             buffer_len += have_read);
     709            buffer_len += have_read) ;
    710710        QT_CLOSE(fd);
    711711    }
     
    721721            if(buffer_len >= x) {
    722722                if(*(buffer + x) == '/') { //c++ style comment
    723                     for(;x < buffer_len && !qmake_endOfLine(*(buffer + x)); ++x);
     723                    for(;x < buffer_len && !qmake_endOfLine(*(buffer + x)); ++x) ;
    724724                } else if(*(buffer + x) == '*') { //c style comment
    725725                    for(++x; x < buffer_len; ++x) {
  • trunk/qmake/generators/symbian/initprojectdeploy_symbian.cpp

    r651 r769  
    4747#include <qdebug.h>
    4848
    49 #define SYSBIN_DIR "\\sys\\bin"
     49// Included from tools/shared
     50#include <symbian/epocroot.h>
     51
     52#define SYSBIN_DIR "/sys/bin"
    5053
    5154#define SUFFIX_DLL "dll"
     
    5356#define SUFFIX_QTPLUGIN "qtplugin"
    5457
    55 static void fixEpocRootStr(QString& path)
    56 {
    57     path.replace("\\", "/");
    58 
    59     if (path.size() > 1 && path[1] == QChar(':')) {
    60         path = path.mid(2);
    61     }
    62 
    63     if (!path.size() || path[path.size()-1] != QChar('/')) {
    64         path += QChar('/');
    65     }
    66 }
    67 
    68 #define SYMBIAN_SDKS_KEY "HKEY_LOCAL_MACHINE\\Software\\Symbian\\EPOC SDKs"
    69 
    70 static QString epocRootStr;
    71 
    72 QString epocRoot()
    73 {
    74     if (!epocRootStr.isEmpty()) {
    75         return epocRootStr;
    76     }
    77 
    78     // First, check the env variable
    79     epocRootStr = qgetenv("EPOCROOT");
    80 
    81     if (epocRootStr.isEmpty()) {
    82         // No EPOCROOT set, check the default device
    83         // First check EPOCDEVICE env variable
    84         QString defaultDevice = qgetenv("EPOCDEVICE");
    85 
    86         // Check the windows registry via QSettings for devices.xml path
    87         QSettings settings(SYMBIAN_SDKS_KEY, QSettings::NativeFormat);
    88         QString devicesXmlPath = settings.value("CommonPath").toString();
    89 
    90         if (!devicesXmlPath.isEmpty()) {
    91             // Parse xml for correct device
    92             devicesXmlPath += "/devices.xml";
    93             QFile devicesFile(devicesXmlPath);
    94             if (devicesFile.open(QIODevice::ReadOnly)) {
    95                 QXmlStreamReader xml(&devicesFile);
    96                 while (!xml.atEnd()) {
    97                     xml.readNext();
    98                     if (xml.isStartElement() && xml.name() == "devices") {
    99                         if (xml.attributes().value("version") == "1.0") {
    100                             // Look for correct device
    101                             while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) {
    102                                 xml.readNext();
    103                                 if (xml.isStartElement() && xml.name() == "device") {
    104                                     if ((defaultDevice.isEmpty() && xml.attributes().value("default") == "yes") ||
    105                                         (!defaultDevice.isEmpty() && (xml.attributes().value("id").toString() + QString(":") + xml.attributes().value("name").toString()) == defaultDevice)) {
    106                                         // Found the correct device
    107                                         while (!(xml.isEndElement() && xml.name() == "device") && !xml.atEnd()) {
    108                                             xml.readNext();
    109                                             if (xml.isStartElement() && xml.name() == "epocroot") {
    110                                                 epocRootStr = xml.readElementText();
    111                                                 fixEpocRootStr(epocRootStr);
    112                                                 return epocRootStr;
    113                                             }
    114                                         }
    115                                         xml.raiseError("No epocroot element found");
    116                                     }
    117                                 }
    118                             }
    119                         } else {
    120                             xml.raiseError("Invalid 'devices' element version");
    121                         }
    122                     }
    123                 }
    124                 if (xml.hasError()) {
    125                     fprintf(stderr, "ERROR: \"%s\" when parsing devices.xml\n", qPrintable(xml.errorString()));
    126                 }
    127             } else {
    128                 fprintf(stderr, "Could not open devices.xml (%s)\n", qPrintable(devicesXmlPath));
    129             }
    130         } else {
    131             fprintf(stderr, "Could not retrieve " SYMBIAN_SDKS_KEY " setting\n");
    132         }
    133 
    134         fprintf(stderr, "Failed to determine epoc root.\n");
    135         if (!defaultDevice.isEmpty())
    136             fprintf(stderr, "The device indicated by EPOCDEVICE environment variable (%s) could not be found.\n", qPrintable(defaultDevice));
    137         fprintf(stderr, "Either set EPOCROOT or EPOCDEVICE environment variable to a valid value, or provide a default Symbian device.\n");
    138 
    139         // No valid device found; set epocroot to "/"
    140         epocRootStr = QLatin1String("/");
    141     }
    142 
    143     fixEpocRootStr(epocRootStr);
    144     return epocRootStr;
    145 }
    146 
     58static QString fixPathToEpocOS(const QString &src)
     59{
     60    QString ret = Option::fixPathToTargetOS(src);
     61    return ret.replace('/', '\\');
     62}
    14763
    14864static bool isPlugin(const QFileInfo& info, const QString& devicePath)
     
    17692                             QStringList& generatedFiles)
    17793{
    178     QDir().mkpath(QLatin1String(PLUGIN_STUB_DIR "\\"));
     94    QDir().mkpath(QLatin1String(PLUGIN_STUB_DIR));
    17995    if (!generatedDirs.contains(PLUGIN_STUB_DIR))
    18096        generatedDirs << PLUGIN_STUB_DIR;
    18197    // Plugin stubs must have different name from the actual plugins, because
    18298    // the toolchain for creating ROM images cannot handle non-binary .dll files properly.
    183     QFile stubFile(QLatin1String(PLUGIN_STUB_DIR "\\") + info.completeBaseName() + "." SUFFIX_QTPLUGIN);
     99    QFile stubFile(QLatin1String(PLUGIN_STUB_DIR "/") + info.completeBaseName() + "." SUFFIX_QTPLUGIN);
    184100    if (stubFile.open(QIODevice::WriteOnly)) {
    185101        if (!generatedFiles.contains(stubFile.fileName()))
     
    195111    QFileInfo stubInfo(stubFile);
    196112    deploymentList.append(CopyItem(Option::fixPathToLocalOS(stubInfo.absoluteFilePath()),
    197                                    Option::fixPathToLocalOS(devicePath + "\\" + stubInfo.fileName())));
     113                                   fixPathToEpocOS(devicePath + "/" + stubInfo.fileName())));
    198114}
    199115
     
    208124    }
    209125
    210     unsigned long hash = 5381;
     126    quint32 hash = 5381;
    211127    int c;
    212128
     
    259175    foreach(QString item, project->values("DEPLOYMENT")) {
    260176        QString devicePath = project->first(item + ".path");
     177        QString devicePathWithoutDrive = devicePath;
     178
     179        bool devicePathHasDriveLetter = false;
     180        if (devicePath.size() > 1) {
     181            devicePathHasDriveLetter = devicePath.at(1) == QLatin1Char(':');
     182        }
     183
     184        // Sometimes devicePath can contain disk but APP_RESOURCE_DIR does not,
     185        // so remove the drive letter for comparison purposes.
     186        if (devicePathHasDriveLetter)
     187        {
     188            devicePathWithoutDrive.remove(0,2);
     189        }
    261190        if (!deployBinaries
    262                 && !devicePath.isEmpty()
    263                 && (0 == devicePath.compare(project->values("APP_RESOURCE_DIR").join(""), Qt::CaseInsensitive)
    264                     || 0 == devicePath.compare(project->values("REG_RESOURCE_IMPORT_DIR").join(""), Qt::CaseInsensitive))) {
     191                && !devicePathWithoutDrive.isEmpty()
     192                && (0 == devicePathWithoutDrive.compare(project->values("APP_RESOURCE_DIR").join(""), Qt::CaseInsensitive)
     193                    || 0 == devicePathWithoutDrive.compare(project->values("REG_RESOURCE_IMPORT_DIR").join(""), Qt::CaseInsensitive))) {
    265194            // Do not deploy resources in emulator builds, as that seems to cause conflicts
    266195            // If there is ever a real need to deploy pre-built resources for emulator,
     
    269198        }
    270199
    271         bool devicePathHasDriveLetter = false;
    272         if (devicePath.size() > 1) {
    273             devicePathHasDriveLetter = devicePath.at(1) == QLatin1Char(':');
    274         }
    275 
    276200        if (devicePath.isEmpty() || devicePath == QLatin1String(".")) {
    277201            devicePath = targetPath;
     
    281205                   || devicePath.at(0) == QLatin1Char('\\')
    282206                   || devicePathHasDriveLetter)) {
    283             // create output path
    284             devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('\\') + devicePath));
     207            // Create output path
     208            devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('/') + devicePath));
    285209        } else {
    286             if (0 == platform.compare(QLatin1String("winscw"), Qt::CaseInsensitive)) {
     210            if (!platform.compare(QLatin1String(EMULATOR_DEPLOYMENT_PLATFORM))) {
    287211                if (devicePathHasDriveLetter) {
    288                     devicePath = epocRoot() + "epoc32\\winscw\\" + devicePath.remove(1, 1);
     212                    devicePath = epocRoot() + "epoc32/winscw/" + devicePath.remove(1, 1);
    289213                } else {
    290                     devicePath = epocRoot() + "epoc32\\winscw\\c" + devicePath;
     214                    devicePath = epocRoot() + "epoc32/winscw/c" + devicePath;
    291215                }
    292216            } else {
    293                 // Drive letter needed if targetpath contains one and it is not already in
    294                 if (targetPathHasDriveLetter && !devicePathHasDriveLetter) {
    295                     devicePath = deploymentDrive + devicePath;
     217                if (!devicePathHasDriveLetter) {
     218                    if (!platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM))) {
     219                        //For plugin deployment under ARM no needed drive letter
     220                        devicePath = epocRoot() + "epoc32/data/z" + devicePath;
     221                    } else if (targetPathHasDriveLetter) {
     222                        // Drive letter needed if targetpath contains one and it is not already in
     223                        devicePath = deploymentDrive + devicePath;
     224                    }
     225                } else {
     226                    //it is necessary to delete drive letter for ARM deployment
     227                    if (!platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM))) {
     228                        devicePath.remove(0,2);
     229                        devicePath = epocRoot() + "epoc32/data/z" + devicePath;
     230                    }
    296231                }
    297232            }
    298233        }
    299234
    300         devicePath.replace(QLatin1String("/"), QLatin1String("\\"));
     235        devicePath.replace(QLatin1String("\\"), QLatin1String("/"));
    301236
    302237        if (!deployBinaries &&
     
    322257            } else {
    323258                if (info.exists() || source.indexOf('*') != -1) {
    324                     nameFilter = source.split('\\').last();
     259                    nameFilter = source.split(QDir::separator()).last();
    325260                    searchPath = info.absolutePath();
    326261                } else {
     
    330265                        if (deployBinaries) {
    331266                            // Executables and libraries are deployed to \sys\bin
    332                             QFileInfo releasePath(epocRoot() + "epoc32\\release\\" + platform + "\\" + build + "\\");
     267                            QFileInfo targetPath(epocRoot() + "epoc32/release/" + platform + "/" + build + "/");
    333268                            if(devicePathHasDriveLetter) {
    334                                 deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "\\" + info.fileName(), false, true),
    335                                                                Option::fixPathToLocalOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "\\") + info.fileName())));
     269                                deploymentList.append(CopyItem(
     270                                    Option::fixPathToLocalOS(targetPath.absolutePath() + "/" + info.fileName(),
     271                                    false, true),
     272                                    fixPathToEpocOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "/")
     273                                    + info.fileName())));
    336274                            } else {
    337                                 deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "\\" + info.fileName(), false, true),
    338                                                                Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + info.fileName())));
     275                                deploymentList.append(CopyItem(
     276                                    Option::fixPathToLocalOS(targetPath.absolutePath() + "/" + info.fileName(),
     277                                    false, true),
     278                                    fixPathToEpocOS(deploymentDrive + QLatin1String(SYSBIN_DIR "/")
     279                                    + info.fileName())));
    339280                            }
    340281                        }
     
    347288                        // when generating .pkg files.
    348289                        deploymentList.append(CopyItem(Option::fixPathToLocalOS(info.absoluteFilePath()),
    349                                                        Option::fixPathToLocalOS(devicePath + "\\" + info.fileName())));
     290                                                       fixPathToEpocOS(devicePath + "/" + info.fileName())));
    350291                        continue;
    351292                    }
     
    369310                        // as they have SYSBIN_DIR target path.
    370311                        if (deployBinaries) {
    371                             deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()),
    372                                                            Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + iterator.fileName())));
     312                            if (devicePathHasDriveLetter) {
     313                                deploymentList.append(CopyItem(
     314                                    Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()),
     315                                    fixPathToEpocOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "/")
     316                                    + iterator.fileName())));
     317                            } else {
     318                                deploymentList.append(CopyItem(
     319                                    Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()),
     320                                    fixPathToEpocOS(deploymentDrive + QLatin1String(SYSBIN_DIR "/")
     321                                    + iterator.fileName())));
     322                            }
    373323                        }
    374                         createPluginStub(info, devicePath + "\\" + absoluteItemPath.right(diffSize), deploymentList, generatedDirs, generatedFiles);
     324                        createPluginStub(info, devicePath + "/" + absoluteItemPath.right(diffSize),
     325                            deploymentList, generatedDirs, generatedFiles);
    375326                        continue;
    376327                    } else {
    377                         deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()),
    378                                                        Option::fixPathToLocalOS(devicePath + "\\" + absoluteItemPath.right(diffSize) + "\\" + iterator.fileName())));
     328                        deploymentList.append(CopyItem(
     329                            Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()),
     330                            fixPathToEpocOS(devicePath + "/" + absoluteItemPath.right(diffSize)
     331                            + "/" + iterator.fileName())));
    379332                    }
    380333                }
  • trunk/qmake/generators/symbian/initprojectdeploy_symbian.h

    r651 r769  
    5151#include <stdlib.h>
    5252
    53 #include "epocroot.h"
    54 
    5553#define PLUGIN_STUB_DIR "qmakepluginstubs"
     54#define ROM_DEPLOYMENT_PLATFORM "rom"
     55#define EMULATOR_DEPLOYMENT_PLATFORM "emulator"
    5656
    5757struct CopyItem
  • trunk/qmake/generators/symbian/symmake.cpp

    r651 r769  
    5050#include <qdebug.h>
    5151
     52// Included from tools/shared
     53#include <symbian/epocroot.h>
     54
    5255#define RESOURCE_DIRECTORY_MMP "/resource/apps"
    5356#define RESOURCE_DIRECTORY_RESOURCE "\\\\resource\\\\apps\\\\"
     
    5558#define PLUGIN_COMMON_DEF_FILE_FOR_MMP "./plugin_common.def"
    5659#define PLUGIN_COMMON_DEF_FILE_ACTUAL "plugin_commonU.def"
    57 #define BLD_INF_FILENAME_LEN (sizeof(BLD_INF_FILENAME) - 1)
    5860
    5961#define BLD_INF_RULES_BASE "BLD_INF_RULES."
     
    6264#define BLD_INF_TAG_TESTMMPFILES "prj_testmmpfiles"
    6365#define BLD_INF_TAG_EXTENSIONS "prj_extensions"
    64 #define BLD_INF_TAG_EXPORTS "prj_exports"
     66#define BLD_INF_TAG_TESTEXTENSIONS "prj_testextensions"
    6567
    6668#define RSS_RULES "RSS_RULES"
     
    6870#define RSS_TAG_NBROFICONS "number_of_icons"
    6971#define RSS_TAG_ICONFILE "icon_file"
     72#define RSS_TAG_HEADER "header"
     73#define RSS_TAG_SERVICE_LIST "service_list"
     74#define RSS_TAG_FILE_OWNERSHIP_LIST "file_ownership_list"
     75#define RSS_TAG_DATATYPE_LIST "datatype_list"
     76#define RSS_TAG_FOOTER "footer"
     77#define RSS_TAG_DEFAULT "default_rules" // Same as just giving rules without tag
    7078
    7179#define MMP_TARGET "TARGET"
    7280#define MMP_TARGETTYPE "TARGETTYPE"
    7381#define MMP_SECUREID "SECUREID"
    74 #define MMP_OPTION_CW "OPTION CW"
    75 #define MMP_OPTION_ARMCC "OPTION ARMCC"
    76 #define MMP_OPTION_GCCE "OPTION GCCE"
    77 #define MMP_LINKEROPTION_CW "LINKEROPTION CW"
    78 #define MMP_LINKEROPTION_ARMCC "LINKEROPTION ARMCC"
    79 #define MMP_LINKEROPTION_GCCE "LINKEROPTION GCCE"
     82#define MMP_OPTION "OPTION"
     83#define MMP_LINKEROPTION "LINKEROPTION"
    8084#define MMP_CAPABILITY "CAPABILITY"
    8185#define MMP_EPOCALLOWDLLDATA "EPOCALLOWDLLDATA"
     
    8892#define MMP_END_RESOURCE "END"
    8993
     94#define VAR_CXXFLAGS "QMAKE_CXXFLAGS"
     95#define VAR_CFLAGS "QMAKE_CFLAGS"
     96#define VAR_LFLAGS "QMAKE_LFLAGS"
     97
    9098#define SIS_TARGET "sis"
    9199#define INSTALLER_SIS_TARGET "installer_sis"
     100#define ROM_STUB_SIS_TARGET "stub_sis"
    92101#define OK_SIS_TARGET "ok_sis"
    93102#define OK_INSTALLER_SIS_TARGET "ok_installer_sis"
     103#define OK_ROM_STUB_SIS_TARGET "ok_stub_sis"
    94104#define FAIL_SIS_NOPKG_TARGET "fail_sis_nopkg"
    95105#define FAIL_SIS_NOCACHE_TARGET "fail_sis_nocache"
     
    106116    static QString epocRootStr;
    107117    if (epocRootStr.isEmpty()) {
    108         QFileInfo efi(epocRoot());
    109         epocRootStr = efi.canonicalFilePath();
    110         if (epocRootStr.isEmpty()) {
     118        epocRootStr = epocRoot();
     119        QFileInfo efi(epocRootStr);
     120        if (!efi.exists() || epocRootStr.isEmpty()) {
    111121            fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(epocRoot()));
    112122            epocRootStr = "/";
     123        } else {
     124            epocRootStr = efi.absoluteFilePath();
    113125        }
    114126        if (!epocRootStr.endsWith("/"))
     
    134146}
    135147
    136 QString SymbianMakefileGenerator::canonizePath(const QString& origPath)
    137 {
    138     // Since current path gets appended almost always anyway, use it as default
    139     // for nonexisting paths.
    140     static QString defaultPath;
    141     if (defaultPath.isEmpty()) {
    142         QFileInfo fi(".");
    143         defaultPath = fi.canonicalFilePath();
    144     }
    145 
     148QString SymbianMakefileGenerator::absolutizePath(const QString& origPath)
     149{
    146150    // Prepend epocroot to any paths beginning with "/epoc32/"
    147151    QString resultPath = QDir::fromNativeSeparators(origPath);
     
    150154
    151155    QFileInfo fi(fileInfo(resultPath));
    152     if (fi.isDir()) {
    153         resultPath = fi.canonicalFilePath();
     156
     157    // Since origPath can be something given in HEADERS, we need to check if we are dealing
     158    // with a file or a directory. In case the origPath doesn't yet exist, isFile() returns
     159    // false and we default to assuming it is a dir.
     160    if (fi.isFile()) {
     161        resultPath = fi.absolutePath();
    154162    } else {
    155         resultPath = fi.canonicalPath();
     163        resultPath = fi.absoluteFilePath();
    156164    }
    157165
    158166    resultPath = QDir::cleanPath(resultPath);
    159 
    160     if (resultPath.isEmpty())
    161         resultPath = defaultPath;
    162167
    163168    return resultPath;
     
    202207    QString numberOfIcons;
    203208    QString iconFile;
    204     QStringList userRssRules;
     209    QMap<QString, QStringList> userRssRules;
    205210    readRssRules(numberOfIcons, iconFile, userRssRules);
    206211
     
    235240    QString outputFileName = fileInfo(Option::output.fileName()).fileName();
    236241    if (outputFileName != BLD_INF_FILENAME) {
    237         wrapperFileName.append(".").append((outputFileName.size() > BLD_INF_FILENAME_LEN && outputFileName.left(BLD_INF_FILENAME_LEN) == BLD_INF_FILENAME) ? outputFileName.mid(8) : outputFileName);
     242        wrapperFileName.append(".").append(outputFileName.startsWith(BLD_INF_FILENAME)
     243                                           ? outputFileName.mid(sizeof(BLD_INF_FILENAME))
     244                                           : outputFileName);
    238245        isPrimaryMakefile = false;
    239246    }
     
    269276
    270277    if (targetType == TypeExe) {
    271         if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) {
     278        if (!project->isActiveConfig("no_icon")) {
    272279            writeRegRssFile(userRssRules);
    273280            writeRssFile(numberOfIcons, iconFile);
     
    316323
    317324    // Construct QStringList from pkg_prerules since we need search it before printed to file
     325    // Note: Though there can't be more than one language or header line, use stringlists
     326    // in case user wants comments to go with the rules.
    318327    QStringList rawPkgPreRules;
     328    QStringList languageRules;
     329    QStringList headerRules;
    319330    foreach(QString deploymentItem, project->values("DEPLOYMENT")) {
    320331        foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_prerules")) {
     
    323334            // This is convenience for defining single line mmp statements
    324335            if (pkgrulesValue.isEmpty()) {
    325                 rawPkgPreRules << pkgrulesItem;
     336                if (pkgrulesItem.startsWith("&"))
     337                    languageRules << pkgrulesItem;
     338                else if (pkgrulesItem.startsWith("#"))
     339                    headerRules << pkgrulesItem;
     340                else
     341                    rawPkgPreRules << pkgrulesItem;
    326342            } else {
    327                 foreach(QString pkgrule, pkgrulesValue) {
    328                     rawPkgPreRules << pkgrule;
     343                if (containsStartWithItem('&', pkgrulesValue)) {
     344                    foreach(QString pkgrule, pkgrulesValue) {
     345                        languageRules << pkgrule;
     346                    }
     347                } else if (containsStartWithItem('#', pkgrulesValue)) {
     348                    foreach(QString pkgrule, pkgrulesValue) {
     349                        headerRules << pkgrule;
     350                    }
     351                } else {
     352                    foreach(QString pkgrule, pkgrulesValue) {
     353                        rawPkgPreRules << pkgrule;
     354                    }
    329355                }
    330356            }
     
    334360    // Apply some defaults if specific data does not exist in PKG pre-rules
    335361
    336     if (!containsStartWithItem('&', rawPkgPreRules)) {
     362    if (languageRules.isEmpty()) {
    337363        // language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS)
    338         QString languageCode = "; Language\n&EN\n\n";
    339         t << languageCode;
    340         tw << languageCode;
    341     } else {
     364        languageRules << "; Language\n&EN\n\n";
     365    } else if (headerRules.isEmpty()) {
    342366        // In case user defines langs, he must take care also about SIS header
    343         if (!containsStartWithItem('#', rawPkgPreRules))
    344             fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n");
    345     }
     367        fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n");
     368    }
     369
     370    t << languageRules.join("\n") << endl;
     371    tw << languageRules.join("\n") << endl;
    346372
    347373    // name of application, UID and version
     
    358384    }
    359385
    360     if (!containsStartWithItem('#', rawPkgPreRules)) {
     386    if (headerRules.isEmpty())
    361387        t << sisHeader.arg(visualTarget).arg(uid3).arg(applicationVersion);
    362     }
     388    else
     389        t << headerRules.join("\n") << endl;
    363390
    364391    // Localized vendor name
     
    425452
    426453        // deploy rsc & reg_rsc file
    427         if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) {
     454        if (!project->isActiveConfig("no_icon")) {
    428455            t << QString("\"%1epoc32/data/z/resource/apps/%2\"    - \"%3\\%4\"")
    429456                 .arg(epocRoot())
     
    450477    QString remoteTestPath;
    451478    remoteTestPath = QString("!:\\private\\%1").arg(privateDirUid);
     479    QString zDir = epocRoot() + QLatin1String("epoc32/data/z");
    452480
    453481    initProjectDeploySymbian(project, depList, remoteTestPath, true, "$(PLATFORM)", "$(TARGET)", generatedDirs, generatedFiles);
     
    455483        t << "; DEPLOYMENT" << endl;
    456484    for (int i = 0; i < depList.size(); ++i)  {
    457         t << QString("\"%1\"    - \"%2\"")
    458              .arg(QString(depList.at(i).from).replace('\\','/'))
    459              .arg(depList.at(i).to) << endl;
     485        QString from = depList.at(i).from;
     486        QString to = depList.at(i).to;
     487
     488        // Deploy anything not already deployed from under epoc32 instead from under
     489        // \epoc32\data\z\ to enable using pkg file without rebuilding
     490        // the project, which can be useful for some binary only distributions.
     491        if (!from.contains(QLatin1String("epoc32"), Qt::CaseInsensitive)) {
     492            from = to;
     493            if (from.size() > 1 && from.at(1) == QLatin1Char(':'))
     494                from = from.mid(2);
     495            from.prepend(zDir);
     496        } else {
     497            if (from.size() > 1 && from.at(1) == QLatin1Char(':'))
     498                from = from.mid(2);
     499        }
     500
     501        t << QString("\"%1\"    - \"%2\"").arg(from.replace('\\','/')).arg(to) << endl;
    460502    }
    461503    t << endl;
     
    542584void SymbianMakefileGenerator::writeCustomDefFile()
    543585{
    544     if (targetType == TypePlugin && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) {
     586    if (targetType == TypePlugin && !project->isActiveConfig("stdbinary")) {
    545587        // Create custom def file for plugin
    546588        QFile ft(QLatin1String(PLUGIN_COMMON_DEF_FILE_ACTUAL));
     
    607649    else if ((project->values("TEMPLATE")).contains("lib")) {
    608650        // Check CONFIG to see if we are to build staticlib or dll
    609         if (project->values("CONFIG").contains("staticlib") || project->values("CONFIG").contains("static"))
     651        if (project->isActiveConfig("staticlib") || project->isActiveConfig("static"))
    610652            targetType = TypeLib;
    611         else if (project->values("CONFIG").contains("plugin"))
     653        else if (project->isActiveConfig("plugin"))
    612654            targetType = TypePlugin;
    613655        else
     
    619661    if (0 != project->values("TARGET.UID2").size()) {
    620662        uid2 = project->first("TARGET.UID2");
    621     } else if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) {
     663    } else if (project->isActiveConfig("stdbinary")) {
    622664        uid2 = "0x20004C45";
    623665    } else {
     
    690732
    691733    QDir current = QDir::current();
    692     QString canonizedCurrent = canonizePath(".");
     734    QString absolutizedCurrent = absolutizePath(".");
    693735
    694736    for (int j = 0; j < srcpaths.size(); ++j) {
     
    698740            if (fi.filePath().length() > fi.fileName().length()) {
    699741                appendIfnotExist(srcincpaths, fi.path());
    700                 sources[canonizePath(fi.path())] += fi.fileName();
     742                sources[absolutizePath(fi.path())] += fi.fileName();
    701743            } else {
    702                 sources[canonizedCurrent] += fi.fileName();
    703                 appendIfnotExist(srcincpaths, canonizedCurrent);
     744                sources[absolutizedCurrent] += fi.fileName();
     745                appendIfnotExist(srcincpaths, absolutizedCurrent);
    704746            }
    705747        }
     
    715757
    716758    for (int j = 0; j < incpaths.size(); ++j) {
    717         QString includepath = canonizePath(incpaths.at(j));
     759        QString includepath = absolutizePath(incpaths.at(j));
    718760        appendIfnotExist(sysincspaths, includepath);
    719761        appendAbldTempDirs(sysincspaths, includepath);
     
    757799    bool inResourceBlock = false;
    758800
    759     overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE);
     801    overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE) << QLatin1String(MMP_EPOCHEAPSIZE);
    760802    restrictableMmpKeywords << QLatin1String(MMP_TARGET) << QLatin1String(MMP_SECUREID)
    761        << QLatin1String(MMP_OPTION_CW) << QLatin1String(MMP_OPTION_ARMCC)
    762        << QLatin1String(MMP_OPTION_GCCE) << QLatin1String(MMP_LINKEROPTION_CW)
    763        << QLatin1String(MMP_LINKEROPTION_ARMCC) << QLatin1String(MMP_LINKEROPTION_GCCE)
     803       << QLatin1String(MMP_OPTION) << QLatin1String(MMP_LINKEROPTION)
    764804       << QLatin1String(MMP_CAPABILITY) << QLatin1String(MMP_EPOCALLOWDLLDATA)
    765        << QLatin1String(MMP_EPOCHEAPSIZE) << QLatin1String(MMP_EPOCSTACKSIZE)
    766        << QLatin1String(MMP_UID) << QLatin1String(MMP_VENDORID)
    767        << QLatin1String(MMP_VERSION);
     805       << QLatin1String(MMP_EPOCSTACKSIZE) << QLatin1String(MMP_UID)
     806       << QLatin1String(MMP_VENDORID) << QLatin1String(MMP_VERSION);
    768807
    769808    foreach (QString item, project->values("MMP_RULES")) {
     
    886925        t << endl;
    887926
    888         if (!project->values("CONFIG").contains("static") && !project->values("CONFIG").contains("staticlib")) {
     927        if (!project->isActiveConfig("static") && !project->isActiveConfig("staticlib")) {
    889928            writeMmpFileLibraryPart(t);
    890929        }
     
    935974{
    936975    bool skipTargetType = overriddenMmpKeywords.contains(MMP_TARGETTYPE);
     976    bool skipEpocHeapSize = overriddenMmpKeywords.contains(MMP_EPOCHEAPSIZE);
    937977
    938978    if (targetType == TypeExe) {
    939979        t << MMP_TARGET "\t\t" << fixedTarget << ".exe" << endl;
    940980        if (!skipTargetType) {
    941             if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
     981            if (project->isActiveConfig("stdbinary"))
    942982                t << MMP_TARGETTYPE "\t\tSTDEXE" << endl;
    943983            else
     
    947987        t << MMP_TARGET "\t\t" << fixedTarget << ".dll" << endl;
    948988        if (!skipTargetType) {
    949             if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
     989            if (project->isActiveConfig("stdbinary"))
    950990                t << MMP_TARGETTYPE "\t\tSTDDLL" << endl;
    951991            else
     
    955995        t << MMP_TARGET "\t\t" << fixedTarget << ".lib" << endl;
    956996        if (!skipTargetType) {
    957             if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
     997            if (project->isActiveConfig("stdbinary"))
    958998                t << MMP_TARGETTYPE "\t\tSTDLIB" << endl;
    959999            else
     
    9861026    if (0 != project->first("TARGET.EPOCSTACKSIZE").size())
    9871027        t << MMP_EPOCSTACKSIZE "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl;
    988     if (0 != project->values("TARGET.EPOCHEAPSIZE").size())
     1028    if (!skipEpocHeapSize && 0 != project->values("TARGET.EPOCHEAPSIZE").size())
    9891029        t << MMP_EPOCHEAPSIZE "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl;
    9901030    if (0 != project->values("TARGET.EPOCALLOWDLLDATA").size())
    9911031        t << MMP_EPOCALLOWDLLDATA << endl;
    9921032
    993     if (targetType == TypePlugin && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) {
     1033    if (targetType == TypePlugin && !project->isActiveConfig("stdbinary")) {
    9941034        // Use custom def file for Qt plugins
    9951035        t << "DEFFILE " PLUGIN_COMMON_DEF_FILE_FOR_MMP << endl;
     
    10071047{
    10081048    if ((targetType == TypeExe) &&
    1009             !project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) {
     1049            !project->isActiveConfig("no_icon")) {
    10101050
    10111051        QString locTarget = fixedTarget;
     
    11111151}
    11121152
     1153void SymbianMakefileGenerator::writeMmpFileConditionalOptions(QTextStream& t,
     1154                                                              const QString &optionType,
     1155                                                              const QString &optionTag,
     1156                                                              const QString &variableBase)
     1157{
     1158    foreach(QString compilerVersion, project->values("VERSION_FLAGS." + optionTag)) {
     1159        QStringList currentValues = project->values(variableBase + "." + compilerVersion);
     1160        if (currentValues.size()) {
     1161            t << "#if defined(" << compilerVersion << ")" << endl;
     1162            t << optionType << " " << optionTag << " " << currentValues.join(" ") <<  endl;
     1163            t << "#endif" << endl;
     1164        }
     1165    }
     1166}
     1167
     1168void SymbianMakefileGenerator::writeMmpFileSimpleOption(QTextStream& t,
     1169                                                        const QString &optionType,
     1170                                                        const QString &optionTag,
     1171                                                        const QString &options)
     1172{
     1173    QString trimmedOptions = options.trimmed();
     1174    if (!trimmedOptions.isEmpty())
     1175        t << optionType << " " << optionTag << " " << trimmedOptions << endl;
     1176}
     1177
     1178void SymbianMakefileGenerator::appendMmpFileOptions(QString &options, const QStringList &list)
     1179{
     1180    if (list.size()) {
     1181        options.append(list.join(" "));
     1182        options.append(" ");
     1183    }
     1184}
     1185
    11131186void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t)
    11141187{
    1115     QString cw, armcc, gcce;
    1116     QString cwlink, armlink, gccelink;
    1117 
    1118     if (0 != project->values("QMAKE_CXXFLAGS.CW").size()) {
    1119         cw.append(project->values("QMAKE_CXXFLAGS.CW").join(" "));
    1120         cw.append(" ");
    1121     }
    1122 
    1123     if (0 != project->values("QMAKE_CXXFLAGS.ARMCC").size()) {
    1124         armcc.append(project->values("QMAKE_CXXFLAGS.ARMCC").join(" "));
    1125         armcc.append(" ");
    1126     }
    1127 
    1128     if (0 != project->values("QMAKE_CXXFLAGS.GCCE").size()) {
    1129         gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" "));
    1130         gcce.append(" ");
    1131     }
    1132 
    1133     if (0 != project->values("QMAKE_CFLAGS.CW").size()) {
    1134         cw.append(project->values("QMAKE_CFLAGS.CW").join(" "));
    1135         cw.append(" ");
    1136     }
    1137 
    1138     if (0 != project->values("QMAKE_CFLAGS.ARMCC").size()) {
    1139         armcc.append(project->values("QMAKE_CFLAGS.ARMCC").join(" "));
    1140         armcc.append(" ");
    1141     }
    1142 
    1143     if (0 != project->values("QMAKE_CFLAGS.GCCE").size()) {
    1144         gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" "));
    1145         gcce.append(" ");
    1146     }
    1147 
    1148     if (0 != project->values("QMAKE_CXXFLAGS").size()) {
    1149         cw.append(project->values("QMAKE_CXXFLAGS").join(" "));
    1150         cw.append(" ");
    1151         armcc.append(project->values("QMAKE_CXXFLAGS").join(" "));
    1152         armcc.append(" ");
    1153         gcce.append(project->values("QMAKE_CXXFLAGS").join(" "));
    1154         gcce.append(" ");
    1155     }
    1156 
    1157     if (0 != project->values("QMAKE_CFLAGS").size()) {
    1158         cw.append(project->values("QMAKE_CFLAGS").join(" "));
    1159         cw.append(" ");
    1160         armcc.append(project->values("QMAKE_CFLAGS").join(" "));
    1161         armcc.append(" ");
    1162         gcce.append(project->values("QMAKE_CFLAGS").join(" "));
    1163         gcce.append(" ");
    1164     }
    1165 
    1166     if (0 != project->values("QMAKE_LFLAGS.CW").size()) {
    1167         cwlink.append(project->values("QMAKE_LFLAGS.CW").join(" "));
    1168         cwlink.append(" ");
    1169     }
    1170 
    1171     if (0 != project->values("QMAKE_LFLAGS.ARMCC").size()) {
    1172         armlink.append(project->values("QMAKE_LFLAGS.ARMCC").join(" "));
    1173         armlink.append(" ");
    1174     }
    1175 
    1176     if (0 != project->values("QMAKE_LFLAGS.GCCE").size()) {
    1177         gccelink.append(project->values("QMAKE_LFLAGS.GCCE").join(" "));
    1178         gccelink.append(" ");
    1179     }
    1180 
    1181     if (0 != project->values("QMAKE_LFLAGS").size()) {
    1182         cwlink.append(project->values("QMAKE_LFLAGS").join(" "));
    1183         cwlink.append(" ");
    1184         armlink.append(project->values("QMAKE_LFLAGS").join(" "));
    1185         armlink.append(" ");
    1186         gccelink.append(project->values("QMAKE_LFLAGS").join(" "));
    1187         gccelink.append(" ");
    1188     }
    1189 
    1190     if (!cw.isEmpty() && cw[cw.size()-1] == ' ')
    1191         cw.chop(1);
    1192     if (!armcc.isEmpty() && armcc[armcc.size()-1] == ' ')
    1193         armcc.chop(1);
    1194     if (!gcce.isEmpty() && gcce[gcce.size()-1] == ' ')
    1195         gcce.chop(1);
    1196     if (!cwlink.isEmpty() && cwlink[cwlink.size()-1] == ' ')
    1197         cwlink.chop(1);
    1198     if (!armlink.isEmpty() && armlink[armlink.size()-1] == ' ')
    1199         armlink.chop(1);
    1200     if (!gccelink.isEmpty() && gccelink[gccelink.size()-1] == ' ')
    1201         gccelink.chop(1);
    1202 
    1203     if (!cw.isEmpty())
    1204         t << MMP_OPTION_CW " " << cw <<  endl;
    1205     if (!armcc.isEmpty())
    1206         t << MMP_OPTION_ARMCC " " << armcc <<  endl;
    1207     if (!gcce.isEmpty())
    1208         t << MMP_OPTION_GCCE " " << gcce <<  endl;
    1209 
    1210     if (!cwlink.isEmpty())
    1211         t << MMP_LINKEROPTION_CW " " << cwlink <<  endl;
    1212     if (!armlink.isEmpty())
    1213         t << MMP_LINKEROPTION_ARMCC " " << armlink <<  endl;
    1214     if (!gccelink.isEmpty())
    1215         t << MMP_LINKEROPTION_GCCE " " << gccelink <<  endl;
     1188    QStringList keywords =  project->values("MMP_OPTION_KEYWORDS");
     1189    QStringList commonCxxFlags = project->values(VAR_CXXFLAGS);
     1190    QStringList commonCFlags = project->values(VAR_CFLAGS);
     1191    QStringList commonLFlags = project->values(VAR_LFLAGS);
     1192
     1193    foreach(QString item, keywords) {
     1194        QString compilerOption;
     1195        QString linkerOption;
     1196
     1197        appendMmpFileOptions(compilerOption, project->values(VAR_CXXFLAGS "." + item));
     1198        appendMmpFileOptions(compilerOption, project->values(VAR_CFLAGS "." + item));
     1199        appendMmpFileOptions(compilerOption, commonCxxFlags);
     1200        appendMmpFileOptions(compilerOption, commonCFlags);
     1201
     1202        appendMmpFileOptions(linkerOption, project->values(VAR_LFLAGS "."  + item));
     1203        appendMmpFileOptions(linkerOption, commonLFlags);
     1204
     1205        writeMmpFileSimpleOption(t, MMP_OPTION, item, compilerOption);
     1206        writeMmpFileSimpleOption(t, MMP_LINKEROPTION, item, linkerOption);
     1207
     1208        writeMmpFileConditionalOptions(t, MMP_OPTION, item, VAR_CXXFLAGS);
     1209        writeMmpFileConditionalOptions(t, MMP_LINKEROPTION, item, VAR_LFLAGS);
     1210    }
    12161211
    12171212    t << endl;
     
    13171312        }
    13181313
     1314        QString condition;
     1315        if (!project->isEmpty(item + ".condition"))
     1316            condition = project->first(item + ".condition");
     1317
    13191318        QFileInfo subdir(fileInfo(fixedItem));
    13201319        QString relativePath = directory.relativeFilePath(fixedItem);
     
    13451344        removeSpecialCharacters(bldinfDefine);
    13461345
     1346        if (!condition.isEmpty())
     1347            t << "#if defined(" << condition << ")" << endl;
     1348
    13471349        t << "#ifndef " << bldinfDefine << endl;
    1348         t << "\t#include \"" << QDir::toNativeSeparators(bldinfFilename) << "\"" << endl;
    1349         t << "#endif // " << bldinfDefine << endl;
     1350        t << "\t#include \"" << bldinfFilename << "\"" << endl;
     1351        t << "#endif" << endl;
     1352
     1353        if (!condition.isEmpty())
     1354            t << "#endif" << endl;
     1355
    13501356    }
    13511357
     
    13651371
    13661372    QString mmpTag;
    1367     if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive))
     1373    if (project->isActiveConfig(SYMBIAN_TEST_CONFIG))
    13681374        mmpTag = QLatin1String(BLD_INF_TAG_TESTMMPFILES);
    13691375    else
     
    13881394    userBldInfRules.remove(mmpTag);
    13891395
    1390     t << endl << BLD_INF_TAG_EXTENSIONS << endl << endl;
     1396    QString extensionTag;
     1397    if (project->isActiveConfig(SYMBIAN_TEST_CONFIG))
     1398        extensionTag = QLatin1String(BLD_INF_TAG_TESTEXTENSIONS);
     1399    else
     1400        extensionTag = QLatin1String(BLD_INF_TAG_EXTENSIONS);
     1401
     1402    t << endl << extensionTag << endl << endl;
    13911403
    13921404    // Generate extension rules
     
    13941406    writeBldInfExtensionRulesPart(t, iconFile);
    13951407
    1396     userItems = userBldInfRules.value(BLD_INF_TAG_EXTENSIONS);
     1408    userItems = userBldInfRules.value(extensionTag);
    13971409    foreach(QString item, userItems)
    13981410        t << item << endl;
    1399     userBldInfRules.remove(BLD_INF_TAG_EXTENSIONS);
    1400 
    1401     t << endl << BLD_INF_TAG_EXPORTS << endl << endl;
    1402 
    1403     // Generate export rules
    1404 
    1405     // Export any deployed plugin stubs under /epoc32/data/z to support ROM builds
    1406     for (int i = 0; i < depList.size(); ++i)  {
    1407         int index = depList.at(i).from.indexOf(PLUGIN_STUB_DIR);
    1408         if (index != -1) {
    1409             t << QString("%1 /epoc32/data/z%2")
    1410                 .arg(QString(depList.at(i).from).mid(index).replace('\\','/'))
    1411                 .arg(QString(depList.at(i).to).mid(2).replace('\\','/')) << endl;
    1412         }
    1413     }
    1414 
    1415     userItems = userBldInfRules.value(BLD_INF_TAG_EXPORTS);
    1416     foreach(QString item, userItems)
    1417         t << item << endl;
    1418     userBldInfRules.remove(BLD_INF_TAG_EXPORTS);
     1411    userBldInfRules.remove(extensionTag);
    14191412
    14201413    // Add rest of the user defined content
     
    14281421}
    14291422
    1430 void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems)
     1423void SymbianMakefileGenerator::writeRegRssFile(QMap<QString, QStringList> &userItems)
    14311424{
    14321425    QString filename(fixedTarget);
     
    14451438        t << "#include <" << fixedTarget << ".rsg>" << endl;
    14461439        t << "#include <appinfo.rh>" << endl;
     1440        foreach(QString item, userItems[RSS_TAG_HEADER])
     1441            t << item << endl;
    14471442        t << endl;
    14481443        t << "UID2 KUidAppRegistrationResourceFile" << endl;
     
    14521447        t << "\tapp_file=\"" << fixedTarget << "\";" << endl;
    14531448        t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << fixedTarget << "\";" << endl;
     1449
     1450        writeRegRssList(t, userItems[RSS_TAG_SERVICE_LIST],
     1451                        QLatin1String(RSS_TAG_SERVICE_LIST),
     1452                        QLatin1String("SERVICE_INFO"));
     1453        writeRegRssList(t, userItems[RSS_TAG_FILE_OWNERSHIP_LIST],
     1454                        QLatin1String(RSS_TAG_FILE_OWNERSHIP_LIST),
     1455                        QLatin1String("FILE_OWNERSHIP_INFO"));
     1456        writeRegRssList(t, userItems[RSS_TAG_DATATYPE_LIST],
     1457                        QLatin1String(RSS_TAG_DATATYPE_LIST),
     1458                        QLatin1String("DATATYPE"));
    14541459        t << endl;
    14551460
    1456         foreach(QString item, userItems)
    1457             t << "\t" << item << endl;
     1461        foreach(QString item, userItems[RSS_TAG_DEFAULT])
     1462            t << "\t" << item.replace("\n","\n\t") << endl;
    14581463        t << "\t}" << endl;
     1464
     1465        foreach(QString item, userItems[RSS_TAG_FOOTER])
     1466            t << item << endl;
    14591467    } else {
    14601468        PRINT_FILE_CREATE_ERROR(filename)
     1469    }
     1470}
     1471
     1472void SymbianMakefileGenerator::writeRegRssList(QTextStream &t,
     1473                                               QStringList &userList,
     1474                                               const QString &listTag,
     1475                                               const QString &listItem)
     1476{
     1477    int itemCount = userList.count();
     1478    if (itemCount) {
     1479        t << "\t" << listTag << " ="<< endl;
     1480        t << "\t\t{" << endl;
     1481        foreach(QString item, userList) {
     1482            t << "\t\t" << listItem << endl;
     1483            t << "\t\t\t{" << endl;
     1484            t << "\t\t\t" << item.replace("\n","\n\t\t\t") << endl;
     1485            t << "\t\t\t}";
     1486            if (--itemCount)
     1487                t << ",";
     1488            t << endl;
     1489        }
     1490        t << "\t\t}; "<< endl;
    14611491    }
    14621492}
     
    15401570}
    15411571
    1542 void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules)
     1572void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons,
     1573                                            QString &iconFile, QMap<QString,
     1574                                            QStringList> &userRssRules)
    15431575{
    15441576    for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) {
     
    15521584            QStringList values = it.value();
    15531585            foreach(QString item, values) {
    1554                 // If there is no stringlist defined for a rule, use rule name directly
     1586                // If there is no stringlist defined for a rule, use rule value directly
    15551587                // This is convenience for defining single line statements
    15561588                if (project->values(item).isEmpty()) {
    15571589                    newValues << item;
    15581590                } else {
     1591                    QStringList itemList;
    15591592                    foreach(QString itemRow, project->values(item)) {
    1560                         newValues << itemRow;
     1593                        itemList << itemRow;
    15611594                    }
     1595                    newValues << itemList.join("\n");
    15621596                }
    15631597            }
     
    15801614                    continue;
    15811615                }
     1616            } else if (newKey == RSS_TAG_HEADER
     1617                       || newKey == RSS_TAG_SERVICE_LIST
     1618                       || newKey == RSS_TAG_FILE_OWNERSHIP_LIST
     1619                       || newKey == RSS_TAG_DATATYPE_LIST
     1620                       || newKey == RSS_TAG_FOOTER
     1621                       || newKey == RSS_TAG_DEFAULT) {
     1622                userRssRules[newKey] = newValues;
     1623                continue;
    15821624            } else {
    15831625                fprintf(stderr, "Warning: Unsupported key:'%s%s'\n",
     
    15881630    }
    15891631
     1632    QStringList newValues;
    15901633    foreach(QString item, project->values(RSS_RULES)) {
    1591         // If there is no stringlist defined for a rule, use rule name directly
    1592         // This is convenience for defining single line mmp statements
     1634        // If there is no stringlist defined for a rule, use rule value directly
     1635        // This is convenience for defining single line statements
    15931636        if (project->values(item).isEmpty()) {
    1594             userRssRules << item;
     1637            newValues << item;
    15951638        } else {
    1596             userRssRules << project->values(item);
    1597         }
    1598     }
     1639            newValues << project->values(item);
     1640        }
     1641    }
     1642    userRssRules[RSS_TAG_DEFAULT] << newValues;
    15991643
    16001644    // Validate that either both RSS_TAG_NBROFICONS and RSS_TAG_ICONFILE keys exist
     
    16121656        bool ok;
    16131657        numberOfIcons = numberOfIcons.simplified();
    1614         int tmp = numberOfIcons.toInt(&ok);
     1658        numberOfIcons.toInt(&ok);
    16151659        if (!ok) {
    16161660            numberOfIcons.clear();
     
    18831927
    18841928    t << SIS_TARGET ":" << endl;
    1885     QString siscommand = QString("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \
     1929    QString siscommand = QString::fromLatin1("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \
    18861930                                  "$(MAKE) -s -f $(MAKEFILE) %4," \
    18871931                                  "$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) %4," \
     
    18991943    t << OK_SIS_TARGET ":" << endl;
    19001944
    1901     QString pkgcommand = QString("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_template.%2 $(QT_SIS_TARGET) " \
     1945    QString pkgcommand = QString::fromLatin1("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_template.%2 $(QT_SIS_TARGET) " \
    19021946                                 "$(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)")
    19031947                          .arg(fixedTarget)
     
    19121956    t << "\t$(MAKE) -s -f $(MAKEFILE) " SIS_TARGET << endl << endl;
    19131957
     1958    t << ROM_STUB_SIS_TARGET ":" << endl;
     1959    QString stubsiscommand = QString::fromLatin1("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \
     1960                                  "$(MAKE) -s -f $(MAKEFILE) %4," \
     1961                                  "$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) %4," \
     1962                                  "$(MAKE) -s -f $(MAKEFILE) %5))," \
     1963                                  "$(MAKE) -s -f $(MAKEFILE) %6)")
     1964                          .arg(fixedTarget)
     1965                          .arg("pkg")
     1966                          .arg(MAKE_CACHE_NAME)
     1967                          .arg(OK_ROM_STUB_SIS_TARGET)
     1968                          .arg(FAIL_SIS_NOCACHE_TARGET)
     1969                          .arg(FAIL_SIS_NOPKG_TARGET);
     1970    t << stubsiscommand << endl;
     1971    t << endl;
     1972
     1973    t << OK_ROM_STUB_SIS_TARGET ":" << endl;
     1974
     1975    QString stubpkgcommand = QString::fromLatin1("\tcreatepackage.bat -s $(QT_SIS_OPTIONS) %1_template.%2 $(QT_SIS_TARGET) " \
     1976                                 "$(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)")
     1977                          .arg(fixedTarget)
     1978                          .arg("pkg");
     1979    t << stubpkgcommand << endl;
     1980    t << endl;
     1981
    19141982    t << INSTALLER_SIS_TARGET ": " << sisName << endl;
    1915     siscommand = QString("\t$(if $(wildcard %1_installer.%2)," \
     1983    siscommand = QString::fromLatin1("\t$(if $(wildcard %1_installer.%2)," \
    19161984                                  "$(MAKE) -s -f $(MAKEFILE) %3," \
    19171985                                  "$(MAKE) -s -f $(MAKEFILE) %4)")
     
    19251993    t << OK_INSTALLER_SIS_TARGET ": " << endl;
    19261994
    1927     pkgcommand = QString("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_installer.%2 - " \
     1995    pkgcommand = QString::fromLatin1("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_installer.%2 - " \
    19281996                         "$(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)")
    19291997                  .arg(fixedTarget)
     
    20052073        }
    20062074        t << "runonphone: sis" << endl;
    2007         t << "\trunonphone $(QT_RUN_ON_PHONE_OPTIONS) --sis " << fixedTarget << "_$(QT_SIS_TARGET).sis " << fixedTarget << ".exe " << "$(QT_RUN_OPTIONS)" << endl;
     2075        t << "\trunonphone $(QT_RUN_ON_PHONE_OPTIONS) --sis " << fixedTarget << ".sis " << fixedTarget << ".exe " << "$(QT_RUN_OPTIONS)" << endl;
    20082076        t << endl;
    20092077    }
  • trunk/qmake/generators/symbian/symmake.h

    r651 r769  
    5050#define BLD_INF_FILENAME "bld.inf"
    5151#define MAKEFILE_DEPENDENCY_SEPARATOR " \\\n\t"
    52 
    5352#define QT_EXTRA_INCLUDE_DIR "tmp"
    5453#define MAKE_CACHE_NAME ".make.cache"
     54#define SYMBIAN_TEST_CONFIG "symbian_test"
    5555
    5656class SymbianMakefileGenerator : public MakefileGenerator
     
    8585    void removeSpecialCharacters(QString& str);
    8686    QString fixPathForMmp(const QString& origPath, const QDir& parentDir);
    87     QString canonizePath(const QString& origPath);
     87    QString absolutizePath(const QString& origPath);
    8888
    8989    virtual bool writeMakefile(QTextStream &t);
     
    108108
    109109    void writeHeader(QTextStream &t);
    110     void writeBldInfContent(QTextStream& t, bool addDeploymentExtension, const QString &iconFile, DeploymentList &depList);
     110    void writeBldInfContent(QTextStream& t,
     111                            bool addDeploymentExtension,
     112                            const QString &iconFile,
     113                            DeploymentList &depList);
    111114
    112115    static bool removeDuplicatedStrings(QStringList& stringList);
     
    122125    void writeMmpFileLibraryPart(QTextStream& t);
    123126    void writeMmpFileCapabilityPart(QTextStream& t);
     127    void writeMmpFileConditionalOptions(QTextStream& t,
     128                                        const QString &optionType,
     129                                        const QString &optionTag,
     130                                        const QString &variableBase);
     131    void writeMmpFileSimpleOption(QTextStream& t,
     132                                  const QString &optionType,
     133                                  const QString &optionTag,
     134                                  const QString &options);
     135    void appendMmpFileOptions(QString &options, const QStringList &list);
    124136    void writeMmpFileCompilerOptionPart(QTextStream& t);
    125137    void writeMmpFileBinaryVersionPart(QTextStream& t);
     
    128140    void writeCustomDefFile();
    129141
    130     void writeRegRssFile(QStringList &useritems);
     142    void writeRegRssFile(QMap<QString, QStringList> &useritems);
     143    void writeRegRssList(QTextStream &t, QStringList &userList,
     144                         const QString &listTag,
     145                         const QString &listItem);
    131146    void writeRssFile(QString &numberOfIcons, QString &iconfile);
    132147    void writeLocFile(QStringList &symbianLangCodes);
    133     void readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules);
     148    void readRssRules(QString &numberOfIcons,
     149                      QString &iconFile,
     150                      QMap<QString, QStringList> &userRssRules);
    134151
    135152    QStringList symbianLangCodesFromTsFiles();
  • trunk/qmake/generators/symbian/symmake_abld.cpp

    r651 r769  
    4848#include <qdatetime.h>
    4949#include <qdebug.h>
     50
     51// Included from tools/shared
     52#include <symbian/epocroot.h>
    5053
    5154#define DO_NOTHING_TARGET "do_nothing"
     
    5760#define GENERATED_SOURCES_TARGET "generated_sources"
    5861#define ALL_SOURCE_DEPS_TARGET "all_source_deps"
     62#define DEPLOYMENT_TARGET "deployment"
     63#define DEPLOYMENT_CLEAN_TARGET "deployment_clean"
    5964#define WINSCW_DEPLOYMENT_TARGET "winscw_deployment"
    6065#define WINSCW_DEPLOYMENT_CLEAN_TARGET "winscw_deployment_clean"
     
    110115        if (deploymentOnly) {
    111116            buildDeps.append(STORE_BUILD_TARGET);
    112             cleanDeps.append(DO_NOTHING_TARGET);
    113             cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET);
    114             finalDeps.append(DO_NOTHING_TARGET);
    115             finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET);
     117            cleanDeps.append(DEPLOYMENT_CLEAN_TARGET);
     118            cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET " " DEPLOYMENT_CLEAN_TARGET);
     119            finalDeps.append(DEPLOYMENT_TARGET);
     120            finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET " " DEPLOYMENT_TARGET);
    116121            wrapperTargets << WINSCW_DEPLOYMENT_TARGET
    117122                << WINSCW_DEPLOYMENT_CLEAN_TARGET
     123                << DEPLOYMENT_TARGET
     124                << DEPLOYMENT_CLEAN_TARGET
    118125                << STORE_BUILD_TARGET;
    119126        } else {
    120127            buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET " " STORE_BUILD_TARGET);
    121             cleanDeps.append(EXTENSION_CLEAN);
    122             cleanDepsWinscw.append(EXTENSION_CLEAN " " WINSCW_DEPLOYMENT_CLEAN_TARGET);
    123             finalDeps.append(FINALIZE_TARGET);
    124             finalDepsWinscw.append(FINALIZE_TARGET " " WINSCW_DEPLOYMENT_TARGET);
     128            cleanDeps.append(EXTENSION_CLEAN " " DEPLOYMENT_CLEAN_TARGET);
     129            cleanDepsWinscw.append(EXTENSION_CLEAN " " WINSCW_DEPLOYMENT_CLEAN_TARGET " " DEPLOYMENT_CLEAN_TARGET);
     130            finalDeps.append(FINALIZE_TARGET " " DEPLOYMENT_TARGET);
     131            finalDepsWinscw.append(FINALIZE_TARGET " " WINSCW_DEPLOYMENT_TARGET " " DEPLOYMENT_TARGET);
    125132            wrapperTargets << PRE_TARGETDEPS_TARGET
    126133                << CREATE_TEMPS_TARGET
     
    129136                << WINSCW_DEPLOYMENT_CLEAN_TARGET
    130137                << WINSCW_DEPLOYMENT_TARGET
     138                << DEPLOYMENT_CLEAN_TARGET
     139                << DEPLOYMENT_TARGET
    131140                << STORE_BUILD_TARGET;
    132141        }
     
    173182
    174183    QString testClause;
    175     if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive))
     184    if (project->isActiveConfig(SYMBIAN_TEST_CONFIG))
    176185        testClause = QLatin1String(" test");
    177186    else
     
    196205    t << "DEL_DIR           = " << var("QMAKE_DEL_DIR") << endl;
    197206    t << "MOVE              = " << var("QMAKE_MOVE") << endl;
     207    t << "CHK_DIR_EXISTS    = " << var("QMAKE_CHK_DIR_EXISTS") << endl;
     208    t << "MKDIR             = " << var("QMAKE_MKDIR") << endl;
    198209    t << "XCOPY             = xcopy /d /f /h /r /y /i" << endl;
    199210    t << "ABLD              = ABLD.BAT" << endl;
     
    360371    }
    361372
    362     writeDeploymentTargets(t);
     373    // Deploymend targets for both emulator and rom deployment
     374    writeDeploymentTargets(t, false);
     375    writeDeploymentTargets(t, true);
    363376
    364377    writeSisTargets(t);
     
    405418}
    406419
    407 bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t)
    408 {
    409     t << WINSCW_DEPLOYMENT_TARGET ":" << endl;
    410 
    411     QString remoteTestPath = epocRoot() + QLatin1String("epoc32\\winscw\\c\\private\\") + privateDirUid;   // default 4 OpenC; 4 all Symbian too
     420bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t, bool isRom)
     421{
     422    if (isRom)
     423        t << DEPLOYMENT_TARGET ":" << endl;
     424    else
     425        t << WINSCW_DEPLOYMENT_TARGET ":" << endl;
     426
     427    QString remoteTestPath = epocRoot()
     428        + QLatin1String(isRom ? "epoc32\\data\\z\\private\\" : "epoc32\\winscw\\c\\private\\")
     429        + privateDirUid;
    412430    DeploymentList depList;
    413     initProjectDeploySymbian(project, depList, remoteTestPath, false, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles);
     431
     432    initProjectDeploySymbian(project, depList, remoteTestPath, false,
     433        QLatin1String(isRom ? ROM_DEPLOYMENT_PLATFORM : EMULATOR_DEPLOYMENT_PLATFORM),
     434        QString(), generatedDirs, generatedFiles);
    414435
    415436    if (depList.size())
     
    420441        // and doesn't provide switch to force file selection. It does provide dir forcing, though,
    421442        // so strip the last part of the destination.
    422         t << "\t-$(XCOPY) \"" << depList.at(i).from << "\" \"" << depList.at(i).to.left(depList.at(i).to.lastIndexOf("\\") + 1) << "\"" << endl;
    423     }
    424 
    425     t << endl;
    426 
    427     t << WINSCW_DEPLOYMENT_CLEAN_TARGET ":" << endl;
     443        t << "\t-$(XCOPY) \"" << depList.at(i).from << "\" \""
     444          << depList.at(i).to.left(depList.at(i).to.lastIndexOf("\\") + 1) << "\"" << endl;
     445    }
     446
     447    t << endl;
     448
     449    if (isRom)
     450        t << DEPLOYMENT_CLEAN_TARGET ":" << endl;
     451    else
     452        t << WINSCW_DEPLOYMENT_CLEAN_TARGET ":" << endl;
     453
    428454    QStringList cleanList;
    429455    for (int i = 0; i < depList.size(); ++i) {
  • trunk/qmake/generators/symbian/symmake_abld.h

    r651 r769  
    5959
    6060    void writeStoreBuildTarget(QTextStream &t);
    61     bool writeDeploymentTargets(QTextStream &t);
     61    bool writeDeploymentTargets(QTextStream &t, bool isRom);
    6262
    6363public:
  • trunk/qmake/generators/symbian/symmake_sbsv2.cpp

    r651 r769  
    4949#include <qdebug.h>
    5050
     51// Included from tools/shared
     52#include <symbian/epocroot.h>
     53
    5154SymbianSbsv2MakefileGenerator::SymbianSbsv2MakefileGenerator() : SymbianMakefileGenerator() { }
    5255SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { }
     
    7376        foreach(QFileInfo item, sourceInfos) {
    7477            QFileInfo destInfo = QFileInfo(destDir.absolutePath() + "/" + item.fileName());
    75             if (!destInfo.exists() || destInfo.lastModified() < item.lastModified()) {
     78            if (!destInfo.exists() || destInfo.lastModified() != item.lastModified()) {
    7679                if (destInfo.exists())
    7780                    QFile::remove(destInfo.absoluteFilePath());
     
    8891}
    8992
    90 void SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly)
    91 {
    92     // Can't use extension makefile with sbsv2
    93     Q_UNUSED(wrapperFileName);
    94     Q_UNUSED(deploymentOnly);
    95 }
    96 
    97 void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile)
    98 {
    99     QStringList allPlatforms;
    100     foreach(QString platform, project->values("SYMBIAN_PLATFORMS")) {
    101         allPlatforms << platform.toLower();
    102     }
    103 
    104     QStringList debugPlatforms = allPlatforms;
    105     QStringList releasePlatforms = allPlatforms;
    106     releasePlatforms.removeAll("winscw"); // No release for emulator
    107 
    108     QString testClause;
    109     if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive))
    110         testClause = QLatin1String(".test");
    111     else
    112         testClause = QLatin1String("");
    113 
    114     QTextStream t(&wrapperFile);
    115 
    116     t << "# ==============================================================================" << endl;
    117     t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
    118     t << QDateTime::currentDateTime().toString() << endl;
    119     t << "# This file is generated by qmake and should not be modified by the" << endl;
    120     t << "# user." << endl;
    121     t << "#  Name        : " << wrapperFile.fileName() << endl;
    122     t << "#  Description : Wrapper Makefile for calling Symbian build tools" << endl;
    123     t << "#" << endl;
    124     t << "# ==============================================================================" << "\n" << endl;
    125     t << endl;
    126     t << "MAKEFILE          = " << wrapperFile.fileName() << endl;
    127     t << "QMAKE             = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;
    128     t << "DEL_FILE          = " << var("QMAKE_DEL_FILE") << endl;
    129     t << "DEL_DIR           = " << var("QMAKE_DEL_DIR") << endl;
    130     t << "MOVE              = " << var("QMAKE_MOVE") << endl;
    131     t << "DEBUG_PLATFORMS   = " << debugPlatforms.join(" ") << endl;
    132     t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl;
    133     t << "MAKE              = make" << endl;
    134     t << "SBS               = sbs" << endl;
    135     t << endl;
    136     t << "DEFINES" << '\t' << " = "
    137         << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
    138         << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ")
    139         << varGlue("DEFINES","-D"," -D","") << endl;
    140 
    141     t << "INCPATH" << '\t' << " = ";
    142 
    143     for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) {
    144         QStringList values = it.value();
    145         for (int i = 0; i < values.size(); ++i) {
    146             t << " -I\"" << values.at(i) << "\" ";
    147         }
    148     }
    149     t << endl;
    150     t << "first: default" << endl;
    151     if (debugPlatforms.contains("winscw"))
    152         t << "default: debug-winscw";
    153     else if (debugPlatforms.contains("armv5"))
    154         t << "default: debug-armv5";
    155     else if (debugPlatforms.size())
    156         t << "default: debug-" << debugPlatforms.first();
    157     else
    158         t << "default: all";
    159 
    160     t << endl;
    161     if (!isPrimaryMakefile) {
    162         t << "all:" << endl;
    163     } else {
    164         t << "all: debug release" << endl;
    165         t << endl;
    166         t << "qmake:" << endl;
    167         t << "\t$(QMAKE) -spec symbian-sbsv2 -o \"" << fileInfo(Option::output.fileName()).fileName()
    168           << "\" \"" << project->projectFile() << "\"" << endl;
    169         t << endl;
    170         t << BLD_INF_FILENAME ":" << endl;
    171         t << "\t$(QMAKE)" << endl;
    172         t << endl;
    173 
    174         QString winscw("winscw");
    175         t << "debug: " << BLD_INF_FILENAME << endl;
    176         t << "\t$(SBS)";
    177         foreach(QString item, debugPlatforms) {
    178             if(QString::compare(item, winscw) == 0)
    179                 t << " -c " << item << "_udeb.mwccinc" << testClause;
    180             else
    181                 t << " -c " << item << "_udeb" << testClause;
    182         }
    183         t << endl;
    184         t << "release: " << BLD_INF_FILENAME << endl;
    185         t << "\t$(SBS)";
    186         foreach(QString item, releasePlatforms) {
    187             if(QString::compare(item, winscw) == 0)
    188                 t << " -c " << item << "_urel.mwccinc" << testClause;
    189             else
    190                 t << " -c " << item << "_urel" << testClause;
    191         }
    192         t << endl;
    193 
    194         // For more specific builds, targets are in this form: build-platform, e.g. release-armv5
    195         foreach(QString item, debugPlatforms) {
    196             t << "debug-" << item << ": " << BLD_INF_FILENAME << endl;
    197             if(QString::compare(item, winscw) == 0)
    198                 t << "\t$(SBS) -c " << item << "_udeb.mwccinc" << testClause << endl;
    199             else
    200                 t << "\t$(SBS) -c " << item << "_udeb" << testClause << endl;
    201         }
    202 
    203         foreach(QString item, releasePlatforms) {
    204             t << "release-" << item << ": " << BLD_INF_FILENAME << endl;
    205             if(QString::compare(item, winscw) == 0)
    206                 t << "\t$(SBS) -c " << item << "_urel.mwccinc" << testClause << endl;
    207             else
    208                 t << "\t$(SBS) -c " << item << "_urel" << testClause << endl;
    209         }
    210 
    211         t << endl;
    212         t << "export: " << BLD_INF_FILENAME << endl;
    213         t << "\t$(SBS) export" << endl;
    214         t << endl;
    215 
    216         t << "cleanexport: " << BLD_INF_FILENAME << endl;
    217         t << "\t$(SBS) cleanexport" << endl;
    218         t << endl;
    219 
    220     }
    221 
    222     // Add all extra targets including extra compiler targest also to wrapper makefile,
    223     // even though many of them may have already been added to bld.inf as FLMs.
    224     // This is to enable use of targets like 'mocables', which call targets generated by extra compilers.
    225     if (targetType != TypeSubdirs) {
    226         t << extraTargetsCache;
    227         t << extraCompilersCache;
    228     } else {
    229         QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets();
    230         writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables|SubTargetSkipDefaultTargets);
    231         qDeleteAll(subtargets);
    232     }
    233 
    234     writeSisTargets(t);
    235 
    236     generateDistcleanTargets(t);
    237 
    238     t << "clean: " << BLD_INF_FILENAME << endl;
    239     t << "\t-$(SBS) reallyclean" << endl;
    240     t << endl;
    241 
    242     t << "clean-debug: " << BLD_INF_FILENAME << endl;
    243     t << "\t$(SBS) reallyclean";
    244     foreach(QString item, debugPlatforms) {
    245         t << " -c " << item << "_udeb" << testClause;
    246     }
    247     t << endl;
    248     t << "clean-release: " << BLD_INF_FILENAME << endl;
    249     t << "\t$(SBS) reallyclean";
    250     foreach(QString item, releasePlatforms) {
    251         t << " -c " << item << "_urel" << testClause;
    252     }
    253     t << endl;
    254 
    255     // For more specific builds, targets are in this form: clean-build-platform, e.g. clean-release-armv5
    256     foreach(QString item, debugPlatforms) {
    257         t << "clean-debug-" << item << ": " << BLD_INF_FILENAME << endl;
    258         t << "\t$(SBS) reallyclean -c " << item << "_udeb" << testClause << endl;
    259     }
    260     foreach(QString item, releasePlatforms) {
    261         t << "clean-release-" << item << ": " << BLD_INF_FILENAME << endl;
    262         t << "\t$(SBS) reallyclean -c " << item << "_urel" << testClause << endl;
    263     }
    264     t << endl;
    265 
    266     generateExecutionTargets(t, debugPlatforms);
    267 }
    268 
    269 void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile)
    270 {
    271     // Makes sure we have needed FLMs in place.
    272     exportFlm();
    273 
    274     // Parse extra compilers data
    275     QStringList defines;
    276     QStringList incPath;
    277 
    278     defines << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
    279             << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ")
    280             << varGlue("DEFINES","-D"," -D","");
    281     for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) {
    282         QStringList values = it.value();
    283         for (int i = 0; i < values.size(); ++i) {
    284             incPath << QLatin1String(" -I\"") + values.at(i) + "\"";
    285         }
    286     }
    287 
    288     // Write extra compilers and targets to initialize QMAKE_ET_* variables
    289     // Cache results to avoid duplicate calls when creating wrapper makefile
    290     QTextStream extraCompilerStream(&extraCompilersCache);
    291     QTextStream extraTargetStream(&extraTargetsCache);
    292     writeExtraCompilerTargets(extraCompilerStream);
    293     writeExtraTargets(extraTargetStream);
    294 
    295     // Figure out everything the target depends on as we don't want to run extra targets that
    296     // are not necessary.
    297     QStringList allPreDeps;
    298     foreach(QString item, project->values("PRE_TARGETDEPS")) {
    299         // Predeps get mangled in windows, so fix them to more sbsv2 friendly format
    300 #if defined(Q_OS_WIN)
    301         if (item.mid(1, 1) == ":")
    302             item = item.mid(0, 1).toUpper().append(item.mid(1)); // Fix drive to uppercase
    303 #endif
    304         item.replace("\\", "/");
    305         allPreDeps << escapeDependencyPath(item);
    306     }
    307 
    308     foreach (QString item, project->values("GENERATED_SOURCES")) {
    309         allPreDeps.append(fileInfo(item).absoluteFilePath());
    310     }
    311 
    312     for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) {
    313         QString currentSourcePath = it.key();
    314         QStringList values = it.value();
    315         for (int i = 0; i < values.size(); ++i) {
    316             QString sourceFile = currentSourcePath + "/" + values.at(i);
    317             QStringList deps = findDependencies(QDir::toNativeSeparators(sourceFile));
    318             foreach(QString depItem, deps) {
    319                 appendIfnotExist(allPreDeps, fileInfo(depItem).absoluteFilePath());
    320             }
    321         }
    322     }
    323 
    324     // Write FLM rules for all extra targets and compilers that we depend on to build the target.
    325     QStringList extraTargets;
    326     extraTargets << project->values("QMAKE_EXTRA_TARGETS") <<  project->values("QMAKE_EXTRA_COMPILERS");
    327     foreach(QString item, extraTargets) {
    328         foreach(QString targetItem, project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_TARGETS.") + item)) {
    329             // Make sure targetpath is absolute
    330             QString absoluteTarget = fileInfo(targetItem).absoluteFilePath();
    331             if (allPreDeps.contains(absoluteTarget)) {
    332                 QStringList deps = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_DEPS.") + item + targetItem);
    333                 QString commandItem =  project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_CMD.") + item + targetItem).join(" ");
    334 
    335 
    336                 // Make sure all deps paths are absolute
    337                 QString absoluteDeps;
    338                 foreach (QString depItem, deps) {
    339                     if (!depItem.isEmpty()) {
    340                         absoluteDeps.append(fileInfo(depItem).absoluteFilePath());
    341                         absoluteDeps.append(" ");
    342                     }
    343                 }
    344 
    345                 t << "START EXTENSION qt/qmake_extra_pre_targetdep" << endl;
    346                 t << "OPTION PREDEP_TARGET " << absoluteTarget << endl;
    347                 t << "OPTION DEPS " << absoluteDeps << endl;
    348 
    349                 if (commandItem.indexOf("$(INCPATH)") != -1)
    350                     commandItem.replace("$(INCPATH)", incPath.join(" "));
    351                 if (commandItem.indexOf("$(DEFINES)") != -1)
    352                     commandItem.replace("$(DEFINES)", defines.join(" "));
    353 
    354                 // Sbsv2 strips all backslashes (even doubles ones) from option parameters, so just replace them with slashes
    355                 // Problem: If some command actually needs backslashes for something else than dir separator, we are out of luck...
    356                 commandItem.replace("\\", "/");
    357                 t << "OPTION COMMAND " << commandItem << endl;
    358                 t << "END" << endl;
    359             }
    360         }
    361     }
    362 
    363     t << endl;
    364 
    365     // Write winscw deployment rules
    366     QString remoteTestPath = epocRoot() + QLatin1String("epoc32/winscw/c/private/") + privateDirUid;
    367     DeploymentList depList;
    368     initProjectDeploySymbian(project, depList, remoteTestPath, false, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles);
    369 
    370     t << "#if defined(WINSCW)" << endl;
     93void SymbianSbsv2MakefileGenerator::writeSbsDeploymentList(const DeploymentList& depList, QTextStream& t)
     94{
    37195    for (int i = 0; i < depList.size(); ++i) {
    37296        t << "START EXTENSION qt/qmake_emulator_deployment" << endl;
     
    382106        t << "END" << endl;
    383107    }
     108}
     109
     110void SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly)
     111{
     112    // Can't use extension makefile with sbsv2
     113    Q_UNUSED(wrapperFileName);
     114    Q_UNUSED(deploymentOnly);
     115}
     116
     117void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile)
     118{
     119    QStringList allPlatforms;
     120    foreach(QString platform, project->values("SYMBIAN_PLATFORMS")) {
     121        allPlatforms << platform.toLower();
     122    }
     123
     124    QStringList debugPlatforms = allPlatforms;
     125    QStringList releasePlatforms = allPlatforms;
     126    releasePlatforms.removeAll("winscw"); // No release for emulator
     127
     128    QString testClause;
     129    if (project->isActiveConfig(SYMBIAN_TEST_CONFIG))
     130        testClause = QLatin1String(".test");
     131    else
     132        testClause = QLatin1String("");
     133
     134    QTextStream t(&wrapperFile);
     135
     136    t << "# ==============================================================================" << endl;
     137    t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
     138    t << QDateTime::currentDateTime().toString() << endl;
     139    t << "# This file is generated by qmake and should not be modified by the" << endl;
     140    t << "# user." << endl;
     141    t << "#  Name        : " << wrapperFile.fileName() << endl;
     142    t << "#  Description : Wrapper Makefile for calling Symbian build tools" << endl;
     143    t << "#" << endl;
     144    t << "# ==============================================================================" << "\n" << endl;
     145    t << endl;
     146    t << "MAKEFILE          = " << wrapperFile.fileName() << endl;
     147    t << "QMAKE             = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;
     148    t << "DEL_FILE          = " << var("QMAKE_DEL_FILE") << endl;
     149    t << "DEL_DIR           = " << var("QMAKE_DEL_DIR") << endl;
     150    t << "CHK_DIR_EXISTS    = " << var("QMAKE_CHK_DIR_EXISTS") << endl;
     151    t << "MKDIR             = " << var("QMAKE_MKDIR") << endl;
     152    t << "MOVE              = " << var("QMAKE_MOVE") << endl;
     153    t << "DEBUG_PLATFORMS   = " << debugPlatforms.join(" ") << endl;
     154    t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl;
     155    t << "MAKE              = make" << endl;
     156    t << "SBS               = sbs" << endl;
     157    t << endl;
     158    t << "DEFINES" << '\t' << " = "
     159        << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
     160        << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ")
     161        << varGlue("DEFINES","-D"," -D","") << endl;
     162
     163    t << "INCPATH" << '\t' << " = ";
     164
     165    for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) {
     166        QStringList values = it.value();
     167        for (int i = 0; i < values.size(); ++i) {
     168            t << " -I\"" << values.at(i) << "\" ";
     169        }
     170    }
     171    t << endl;
     172    t << "first: default" << endl;
     173    if (debugPlatforms.contains("winscw"))
     174        t << "default: debug-winscw";
     175    else if (debugPlatforms.contains("armv5"))
     176        t << "default: debug-armv5";
     177    else if (debugPlatforms.size())
     178        t << "default: debug-" << debugPlatforms.first();
     179    else
     180        t << "default: all";
     181
     182    t << endl;
     183    if (!isPrimaryMakefile) {
     184        t << "all:" << endl;
     185    } else {
     186        t << "all: debug release" << endl;
     187        t << endl;
     188        t << "qmake:" << endl;
     189        t << "\t$(QMAKE) -spec symbian-sbsv2 -o \"" << fileInfo(Option::output.fileName()).fileName()
     190          << "\" \"" << project->projectFile() << "\"" << endl;
     191        t << endl;
     192        t << BLD_INF_FILENAME ":" << endl;
     193        t << "\t$(QMAKE)" << endl;
     194        t << endl;
     195
     196        QString winscw("winscw");
     197        t << "debug: " << BLD_INF_FILENAME << endl;
     198        t << "\t$(SBS)";
     199        foreach(QString item, debugPlatforms) {
     200            if(QString::compare(item, winscw) == 0)
     201                t << " -c " << item << "_udeb.mwccinc" << testClause;
     202            else
     203                t << " -c " << item << "_udeb" << testClause;
     204        }
     205        t << endl;
     206        t << "release: " << BLD_INF_FILENAME << endl;
     207        t << "\t$(SBS)";
     208        foreach(QString item, releasePlatforms) {
     209            if(QString::compare(item, winscw) == 0)
     210                t << " -c " << item << "_urel.mwccinc" << testClause;
     211            else
     212                t << " -c " << item << "_urel" << testClause;
     213        }
     214        t << endl;
     215
     216        // For more specific builds, targets are in this form: build-platform, e.g. release-armv5
     217        foreach(QString item, debugPlatforms) {
     218            t << "debug-" << item << ": " << BLD_INF_FILENAME << endl;
     219            if(QString::compare(item, winscw) == 0)
     220                t << "\t$(SBS) -c " << item << "_udeb.mwccinc" << testClause << endl;
     221            else
     222                t << "\t$(SBS) -c " << item << "_udeb" << testClause << endl;
     223        }
     224
     225        foreach(QString item, releasePlatforms) {
     226            t << "release-" << item << ": " << BLD_INF_FILENAME << endl;
     227            if(QString::compare(item, winscw) == 0)
     228                t << "\t$(SBS) -c " << item << "_urel.mwccinc" << testClause << endl;
     229            else
     230                t << "\t$(SBS) -c " << item << "_urel" << testClause << endl;
     231        }
     232
     233        t << endl;
     234        t << "export: " << BLD_INF_FILENAME << endl;
     235        t << "\t$(SBS) export" << endl;
     236        t << endl;
     237
     238        t << "cleanexport: " << BLD_INF_FILENAME << endl;
     239        t << "\t$(SBS) cleanexport" << endl;
     240        t << endl;
     241
     242    }
     243
     244    // Add all extra targets including extra compiler targest also to wrapper makefile,
     245    // even though many of them may have already been added to bld.inf as FLMs.
     246    // This is to enable use of targets like 'mocables', which call targets generated by extra compilers.
     247    if (targetType != TypeSubdirs) {
     248        t << extraTargetsCache;
     249        t << extraCompilersCache;
     250    } else {
     251        QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets();
     252        writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables|SubTargetSkipDefaultTargets);
     253        qDeleteAll(subtargets);
     254    }
     255
     256    writeSisTargets(t);
     257
     258    generateDistcleanTargets(t);
     259
     260    t << "clean: " << BLD_INF_FILENAME << endl;
     261    t << "\t-$(SBS) reallyclean" << endl;
     262    t << endl;
     263
     264    t << "clean-debug: " << BLD_INF_FILENAME << endl;
     265    t << "\t$(SBS) reallyclean";
     266    foreach(QString item, debugPlatforms) {
     267        t << " -c " << item << "_udeb" << testClause;
     268    }
     269    t << endl;
     270    t << "clean-release: " << BLD_INF_FILENAME << endl;
     271    t << "\t$(SBS) reallyclean";
     272    foreach(QString item, releasePlatforms) {
     273        t << " -c " << item << "_urel" << testClause;
     274    }
     275    t << endl;
     276
     277    // For more specific builds, targets are in this form: clean-build-platform, e.g. clean-release-armv5
     278    foreach(QString item, debugPlatforms) {
     279        t << "clean-debug-" << item << ": " << BLD_INF_FILENAME << endl;
     280        t << "\t$(SBS) reallyclean -c " << item << "_udeb" << testClause << endl;
     281    }
     282    foreach(QString item, releasePlatforms) {
     283        t << "clean-release-" << item << ": " << BLD_INF_FILENAME << endl;
     284        t << "\t$(SBS) reallyclean -c " << item << "_urel" << testClause << endl;
     285    }
     286    t << endl;
     287
     288    generateExecutionTargets(t, debugPlatforms);
     289}
     290
     291void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile)
     292{
     293    // Makes sure we have needed FLMs in place.
     294    exportFlm();
     295
     296    // Parse extra compilers data
     297    QStringList defines;
     298    QStringList incPath;
     299
     300    defines << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
     301            << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ")
     302            << varGlue("DEFINES","-D"," -D","");
     303    for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) {
     304        QStringList values = it.value();
     305        for (int i = 0; i < values.size(); ++i) {
     306            incPath << QLatin1String(" -I\"") + values.at(i) + "\"";
     307        }
     308    }
     309
     310    // Write extra compilers and targets to initialize QMAKE_ET_* variables
     311    // Cache results to avoid duplicate calls when creating wrapper makefile
     312    QTextStream extraCompilerStream(&extraCompilersCache);
     313    QTextStream extraTargetStream(&extraTargetsCache);
     314    writeExtraCompilerTargets(extraCompilerStream);
     315    writeExtraTargets(extraTargetStream);
     316
     317    // Figure out everything the target depends on as we don't want to run extra targets that
     318    // are not necessary.
     319    QStringList allPreDeps;
     320    foreach(QString item, project->values("PRE_TARGETDEPS")) {
     321        // Predeps get mangled in windows, so fix them to more sbsv2 friendly format
     322#if defined(Q_OS_WIN)
     323        if (item.mid(1, 1) == ":")
     324            item = item.mid(0, 1).toUpper().append(item.mid(1)); // Fix drive to uppercase
     325#endif
     326        item.replace("\\", "/");
     327        allPreDeps << escapeDependencyPath(item);
     328    }
     329
     330    foreach (QString item, project->values("GENERATED_SOURCES")) {
     331        allPreDeps.append(fileInfo(item).absoluteFilePath());
     332    }
     333
     334    for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) {
     335        QString currentSourcePath = it.key();
     336        QStringList values = it.value();
     337        for (int i = 0; i < values.size(); ++i) {
     338            QString sourceFile = currentSourcePath + "/" + values.at(i);
     339            QStringList deps = findDependencies(QDir::toNativeSeparators(sourceFile));
     340            foreach(QString depItem, deps) {
     341                appendIfnotExist(allPreDeps, fileInfo(depItem).absoluteFilePath());
     342            }
     343        }
     344    }
     345
     346    // Write FLM rules for all extra targets and compilers that we depend on to build the target.
     347    QStringList extraTargets;
     348    extraTargets << project->values("QMAKE_EXTRA_TARGETS") <<  project->values("QMAKE_EXTRA_COMPILERS");
     349    foreach(QString item, extraTargets) {
     350        foreach(QString targetItem, project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_TARGETS.") + item)) {
     351            // Make sure targetpath is absolute
     352            QString absoluteTarget = fileInfo(targetItem).absoluteFilePath();
     353            if (allPreDeps.contains(absoluteTarget)) {
     354                QStringList deps = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_DEPS.") + item + targetItem);
     355                QString commandItem =  project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_CMD.") + item + targetItem).join(" ");
     356
     357
     358                // Make sure all deps paths are absolute
     359                QString absoluteDeps;
     360                foreach (QString depItem, deps) {
     361                    if (!depItem.isEmpty()) {
     362                        absoluteDeps.append(fileInfo(depItem).absoluteFilePath());
     363                        absoluteDeps.append(" ");
     364                    }
     365                }
     366
     367                t << "START EXTENSION qt/qmake_extra_pre_targetdep.export" << endl;
     368                t << "OPTION PREDEP_TARGET " << absoluteTarget << endl;
     369                t << "OPTION DEPS " << absoluteDeps << endl;
     370
     371                if (commandItem.indexOf("$(INCPATH)") != -1)
     372                    commandItem.replace("$(INCPATH)", incPath.join(" "));
     373                if (commandItem.indexOf("$(DEFINES)") != -1)
     374                    commandItem.replace("$(DEFINES)", defines.join(" "));
     375
     376                // Sbsv2 strips all backslashes (even doubles ones) from option parameters, so just replace them with slashes
     377                // Problem: If some command actually needs backslashes for something else than dir separator, we are out of luck...
     378                commandItem.replace("\\", "/");
     379                t << "OPTION COMMAND " << commandItem << endl;
     380                t << "END" << endl;
     381            }
     382        }
     383    }
     384
     385    t << endl;
     386
     387    // Write deployment rules
     388    QString remoteTestPath = epocRoot() + QLatin1String("epoc32/winscw/c/private/") + privateDirUid;
     389    DeploymentList depList;
     390
     391    //write emulator deployment
     392    t << "#if defined(WINSCW)" << endl;
     393    initProjectDeploySymbian(project, depList, remoteTestPath, false,
     394        QLatin1String(EMULATOR_DEPLOYMENT_PLATFORM), QString(), generatedDirs, generatedFiles);
     395    writeSbsDeploymentList(depList, t);
    384396    t << "#endif" << endl;
    385397
     398    //write ROM deployment
     399    remoteTestPath = epocRoot() + QLatin1String("epoc32/data/z/private/") + privateDirUid;
     400    depList.clear();
     401    initProjectDeploySymbian(project, depList, remoteTestPath, false,
     402        QLatin1String(ROM_DEPLOYMENT_PLATFORM), QString(), generatedDirs, generatedFiles);
     403    writeSbsDeploymentList(depList, t);
    386404    t << endl;
    387405
  • trunk/qmake/generators/symbian/symmake_sbsv2.h

    r651 r769  
    6565private:
    6666    void exportFlm();
     67    void writeSbsDeploymentList(const DeploymentList& depList, QTextStream& t);
    6768
    6869    QString extraTargetsCache;
  • trunk/qmake/generators/win32/msvc_vcproj.cpp

    r651 r769  
    6868#ifdef Q_OS_WIN32
    6969#include <qt_windows.h>
     70#include <windows/registry.h>
    7071
    7172QT_BEGIN_NAMESPACE
     
    9495};
    9596
    96 static QString keyPath(const QString &rKey)
    97 {
    98     int idx = rKey.lastIndexOf(QLatin1Char('\\'));
    99     if (idx == -1)
    100         return QString();
    101     return rKey.left(idx + 1);
    102 }
    103 
    104 static QString keyName(const QString &rKey)
    105 {
    106     int idx = rKey.lastIndexOf(QLatin1Char('\\'));
    107     if (idx == -1)
    108         return rKey;
    109 
    110     QString res(rKey.mid(idx + 1));
    111     if (res == "Default" || res == ".")
    112         res = "";
    113     return res;
    114 }
    115 
    116 static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey)
    117 {
    118 
    119     QString rSubkeyName = keyName(rSubkey);
    120     QString rSubkeyPath = keyPath(rSubkey);
    121 
    122     HKEY handle = 0;
    123     LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle);
    124 
    125     if (res != ERROR_SUCCESS)
    126         return QString();
    127 
    128     // get the size and type of the value
    129     DWORD dataType;
    130     DWORD dataSize;
    131     res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize);
    132     if (res != ERROR_SUCCESS) {
    133         RegCloseKey(handle);
    134         return QString();
    135     }
    136 
    137     // get the value
    138     QByteArray data(dataSize, 0);
    139     res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0,
    140                           reinterpret_cast<unsigned char*>(data.data()), &dataSize);
    141     if (res != ERROR_SUCCESS) {
    142         RegCloseKey(handle);
    143         return QString();
    144     }
    145 
    146     QString result;
    147     switch (dataType) {
    148         case REG_EXPAND_SZ:
    149         case REG_SZ: {
    150             result = QString::fromWCharArray(((const wchar_t *)data.constData()));
    151             break;
    152         }
    153 
    154         case REG_MULTI_SZ: {
    155             QStringList l;
    156             int i = 0;
    157             for (;;) {
    158                 QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i);
    159                 i += s.length() + 1;
    160 
    161                 if (s.isEmpty())
    162                     break;
    163                 l.append(s);
    164             }
    165             result = l.join(", ");
    166             break;
    167         }
    168 
    169         case REG_NONE:
    170         case REG_BINARY: {
    171             result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2);
    172             break;
    173         }
    174 
    175         case REG_DWORD_BIG_ENDIAN:
    176         case REG_DWORD: {
    177             Q_ASSERT(data.size() == sizeof(int));
    178             int i;
    179             memcpy((char*)&i, data.constData(), sizeof(int));
    180             result = QString::number(i);
    181             break;
    182         }
    183 
    184         default:
    185             qWarning("QSettings: unknown data %d type in windows registry", dataType);
    186             break;
    187     }
    188 
    189     RegCloseKey(handle);
    190     return result;
    191 }
    19297QT_END_NAMESPACE
    19398#endif
  • trunk/qmake/generators/win32/winmakefile.cpp

    r682 r769  
    151151                       exists((*it).local() + Option::dir_sep + lib + extension)) {
    152152                        out = (*it).real() + Option::dir_sep + lib + extension;
     153                        if (out.contains(QLatin1Char(' '))) {
     154                            out.prepend(QLatin1Char('\"'));
     155                            out.append(QLatin1Char('\"'));
     156                        }
    153157                        break;
    154158                    }
Note: See TracChangeset for help on using the changeset viewer.