Changeset 37


Ignore:
Timestamp:
Jun 18, 2009, 12:25:39 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

qmake: Obey OS/2 CMD.EXE cmd.line length restriction in $(DEL_FILE) statements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qmake/generators/win32/winmakefile.cpp

    r2 r37  
    486486void Win32MakefileGenerator::writeCleanParts(QTextStream &t)
    487487{
     488    const QString del_statement("-$(DEL_FILE)");
     489    const QString del_suffix =
     490        Option::target_mode == Option::TARG_OS2_MODE ?
     491        QString(" >nul 2>&1"): // reduce noise
     492        QString::null;
     493
     494    const int commandlineLimit =
     495        Option::target_mode == Option::TARG_OS2_MODE ?
     496        1024: // OS/2 CMD.EXE limit
     497        2047; // NT limit, expanded
     498
    488499    t << "clean: compiler_clean " << var("CLEAN_DEPS");
    489500    {
     
    491502        for(int i = 0; clean_targets[i]; ++i) {
    492503            const QStringList &list = project->values(clean_targets[i]);
    493             const QString del_statement("-$(DEL_FILE)");
    494504            if(project->isActiveConfig("no_delete_multiple_files")) {
    495505                for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
    496                     t << "\n\t" << del_statement << " " << escapeFilePath((*it));
     506                    t << "\n\t" << del_statement << " " << escapeFilePath((*it)) << del_suffix;
    497507            } else {
    498508                QString files, file;
    499                 const int commandlineLimit = 2047; // NT limit, expanded
    500509                for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
    501510                    file = " " + escapeFilePath((*it));
    502511                    if(del_statement.length() + files.length() +
    503                        qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
    504                         t << "\n\t" << del_statement << files;
     512                       qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit &&
     513                       !files.isEmpty()) {
     514                        t << "\n\t" << del_statement << files << del_suffix;
    505515                        files.clear();
    506516                    }
     
    508518                }
    509519                if(!files.isEmpty())
    510                     t << "\n\t" << del_statement << files;
     520                    t << "\n\t" << del_statement << files << del_suffix;
    511521            }
    512522        }
     
    519529        for(int i = 0; clean_targets[i]; ++i) {
    520530            const QStringList &list = project->values(clean_targets[i]);
    521             const QString del_statement("-$(DEL_FILE)");
    522531            if(project->isActiveConfig("no_delete_multiple_files")) {
    523532                for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
    524                     t << "\n\t" << del_statement << " " << escapeFilePath((*it));
     533                    t << "\n\t" << del_statement << " " << escapeFilePath((*it)) << del_suffix;
    525534            } else {
    526535                QString files, file;
    527                 const int commandlineLimit = 2047; // NT limit, expanded
    528536                for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
    529537                    file = " " + escapeFilePath((*it));
    530538                    if(del_statement.length() + files.length() +
    531                        qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
    532                         t << "\n\t" << del_statement << files;
     539                       qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit &&
     540                       !files.isEmpty()) {
     541                        t << "\n\t" << del_statement << files << del_suffix;
    533542                        files.clear();
    534543                    }
     
    536545                }
    537546                if(!files.isEmpty())
    538                     t << "\n\t" << del_statement << files;
     547                    t << "\n\t" << del_statement << files << del_suffix;
    539548            }
    540549        }
    541550    }
    542     t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET)" << endl;
     551    t << "\n\t" << del_statement << " $(DESTDIR_TARGET)" << del_suffix << endl;
    543552    {
    544553        QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName()));
    545554        if(!ofile.isEmpty())
    546             t << "\t-$(DEL_FILE) " << ofile << endl;
     555            t << "\t" << del_statement << " " << ofile << del_suffix << endl;
    547556    }
    548557    t << endl;
Note: See TracChangeset for help on using the changeset viewer.