Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/qmake/generators/makefile.cpp

    r773 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    467467        const QStringList &subs = v["QMAKE_SUBSTITUTES"];
    468468        for(int i = 0; i < subs.size(); ++i) {
    469             if(!subs.at(i).endsWith(".in")) {
    470                 warn_msg(WarnLogic, "Substitute '%s' does not end with '.in'",
    471                          subs.at(i).toLatin1().constData());
    472                 continue;
    473             }
    474             QFile in(fileFixify(subs.at(i))), out(fileInfo(subs.at(i)).fileName());
    475             if(out.fileName().endsWith(".in"))
    476                 out.setFileName(out.fileName().left(out.fileName().length()-3));
     469            QString inn = subs.at(i) + ".input", outn = subs.at(i) + ".output";
     470            if (v.contains(inn) || v.contains(outn)) {
     471                if (!v.contains(inn) || !v.contains(outn)) {
     472                    warn_msg(WarnLogic, "Substitute '%s' has only one of .input and .output",
     473                             subs.at(i).toLatin1().constData());
     474                    continue;
     475                }
     476                const QStringList &tinn = v[inn], &toutn = v[outn];
     477                if (tinn.length() != 1) {
     478                    warn_msg(WarnLogic, "Substitute '%s.input' does not have exactly one value",
     479                             subs.at(i).toLatin1().constData());
     480                    continue;
     481                }
     482                if (toutn.length() != 1) {
     483                    warn_msg(WarnLogic, "Substitute '%s.output' does not have exactly one value",
     484                             subs.at(i).toLatin1().constData());
     485                    continue;
     486                }
     487                inn = tinn.first();
     488                outn = toutn.first();
     489            } else {
     490                inn = subs.at(i);
     491                if(!inn.endsWith(".in")) {
     492                    warn_msg(WarnLogic, "Substitute '%s' does not end with '.in'",
     493                             inn.toLatin1().constData());
     494                    continue;
     495                }
     496                outn = inn.left(inn.length()-3);
     497            }
     498            QFile in(fileFixify(inn));
     499            QFile out(fileFixify(outn, qmake_getpwd(), Option::output_dir));
    477500            if(in.open(QFile::ReadOnly)) {
    478501                QString contents;
     
    529552                    QString old = QString::fromUtf8(out.readAll());
    530553                    if(contents == old) {
    531                         v["QMAKE_INTERNAL_INCLUDED_FILES"].append(subs.at(i));
     554                        v["QMAKE_INTERNAL_INCLUDED_FILES"].append(in.fileName());
    532555                        continue;
    533556                    }
     
    539562                    }
    540563                }
     564                mkdir(QFileInfo(out).absolutePath());
    541565                if(out.open(QFile::WriteOnly)) {
    542                     v["QMAKE_INTERNAL_INCLUDED_FILES"].append(subs.at(i));
     566                    v["QMAKE_INTERNAL_INCLUDED_FILES"].append(in.fileName());
    543567                    out.write(contents.toUtf8());
    544568                } else {
     
    807831
    808832    // escape qmake command
    809     if (!project->isEmpty("QMAKE_QMAKE")) {
    810         project->values("QMAKE_QMAKE") = escapeFilePaths(project->values("QMAKE_QMAKE"));
    811     }
     833    QStringList &qmk = project->values("QMAKE_QMAKE");
     834    qmk = escapeFilePaths(qmk);
    812835}
    813836
     
    9821005                libs << "QMAKE_LIBS_PRIVATE";
    9831006            for(QStringList::Iterator it = libs.begin(); it != libs.end(); ++it)
    984                 t << project->values((*it)).join(" ") << " ";
     1007                t << project->values((*it)).join(" ").replace('\\', "\\\\") << " ";
    9851008        }
    9861009        t << endl;
     
    12761299                if(!dirstr.endsWith(Option::dir_sep))
    12771300                    dirstr += Option::dir_sep;
    1278                 if(exists(wild)) { //real file
     1301                bool is_target = (wild == fileFixify(var("TARGET"), FileFixifyAbsolute));
     1302                if(is_target || exists(wild)) { //real file or target
    12791303                    QString file = wild;
    12801304                    QFileInfo fi(fileInfo(wild));
     
    12901314                    if (fi.isDir())
    12911315                       cmd = inst_prefix + "$(INSTALL_DIR)";
    1292                     else if (fi.isExecutable())
     1316                    else if (is_target || fi.isExecutable())
    12931317                       cmd = inst_prefix + "$(INSTALL_PROGRAM)";
    12941318                    else
     
    17861810        QStringList tmp_dep = project->values((*it) + ".depends");
    17871811        QString tmp_dep_cmd;
     1812        QString dep_cd_cmd;
    17881813        if(!project->isEmpty((*it) + ".depend_command")) {
    17891814            int argv0 = -1;
     
    17991824                if(exists(c)) {
    18001825                    cmdline[argv0] = escapeFilePath(Option::fixPathToLocalOS(cmdline.at(argv0), false));
    1801                     tmp_dep_cmd = cmdline.join(" ");
    18021826                } else {
    18031827                    cmdline[argv0] = escapeFilePath(cmdline.at(argv0));
    18041828                }
    1805             }
     1829                QFileInfo cmdFileInfo(cmdline[argv0]);
     1830                if (!cmdFileInfo.isAbsolute() || cmdFileInfo.exists())
     1831                    tmp_dep_cmd = cmdline.join(" ");
     1832            }
     1833            dep_cd_cmd = QLatin1String("cd ")
     1834                 + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false))
     1835                 + QLatin1String(" && ");
    18061836        }
    18071837        QStringList &vars = project->values((*it) + ".variables");
     
    18601890            if(tmp_clean.indexOf("${QMAKE_") == -1) {
    18611891                t << "\n\t" << del_statement << " " << tmp_clean << del_suffix;
    1862                 if (isForSymbian())
    1863                     t << " 2> NUL"; // Eliminate unnecessary warnings
    18641892                wrote_clean = true;
    18651893            }
     
    19191947                    QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, (*input),
    19201948                                                                    tmp_out);
    1921                     dep_cmd = fixEnvVariables(dep_cmd);
     1949                    dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
    19221950                    if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) {
    19231951                        QString indeps;
     
    20172045                char buff[256];
    20182046                QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, (*input), out);
    2019                 dep_cmd = fixEnvVariables(dep_cmd);
     2047                dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
    20202048                if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) {
    20212049                    QString indeps;
     
    21542182MakefileGenerator::writeStubMakefile(QTextStream &t)
    21552183{
    2156     t << "QMAKE    = "        << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl;
     2184    t << "QMAKE    = " << var("QMAKE_QMAKE") << endl;
    21572185    QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
    21582186    for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
     
    22092237    if(!Option::mkfile::qmakespec_commandline.isEmpty())
    22102238        ret += " -spec " + specdir(outdir);
    2211     if(Option::target_mode == Option::TARG_MAC9_MODE)
    2212         ret += " -mac9";
    2213     else if(Option::target_mode == Option::TARG_MACX_MODE)
    2214         ret += " -macx";
    2215     else if(Option::target_mode == Option::TARG_UNIX_MODE)
    2216         ret += " -unix";
    2217     else if(Option::target_mode == Option::TARG_WIN_MODE)
    2218         ret += " -win32";
     2239    if (Option::target_mode_overridden) {
     2240        if (Option::target_mode == Option::TARG_MACX_MODE)
     2241            ret += " -macx";
     2242        else if (Option::target_mode == Option::TARG_UNIX_MODE)
     2243            ret += " -unix";
     2244        else if (Option::target_mode == Option::TARG_WIN_MODE)
     2245            ret += " -win32";
     2246    }
    22192247    else if(Option::target_mode == Option::TARG_OS2_MODE)
    22202248        ret += " -os2";
     
    22712299    t << "# Template: " << var("TEMPLATE") << endl;
    22722300    if(!project->isActiveConfig("build_pass"))
    2273         t << "# Command: " << build_args().replace("$(QMAKE)",
    2274                       (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE"))) << endl;
     2301        t << "# Command: " << build_args().replace("$(QMAKE)", var("QMAKE_QMAKE")) << endl;
    22752302    t << "#############################################################################" << endl;
    22762303    t << endl;
     
    24052432        /* Calling Option::fixPathToTargetOS() is necessary for MinGW/MSYS, which requires
    24062433         * back-slashes to be turned into slashes. */
    2407         t << "QMAKE         = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;
     2434        t << "QMAKE         = " << var("QMAKE_QMAKE") << endl;
    24082435        t << "DEL_FILE      = " << var("QMAKE_DEL_FILE") << endl;
    24092436        t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl;
     
    27332760                if(exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"qmake.conf")))
    27342761                    t << escapeDependencyPath(specdir() + Option::dir_sep + "qmake.conf") << " ";
    2735                 else if(exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"tmake.conf")))
    2736                     t << escapeDependencyPath(specdir() + Option::dir_sep + "tmake.conf") << " ";
    27372762            }
    27382763            const QStringList &included = project->values("QMAKE_INTERNAL_INCLUDED_FILES");
Note: See TracChangeset for help on using the changeset viewer.