Changeset 670


Ignore:
Timestamp:
Mar 10, 2010, 11:06:48 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

qmake: os2/gnumake: Be consistent and use q function for space escaping everywhere in target and dependency lists.

Location:
trunk/qmake/generators/os2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/qmake/generators/os2/gnumake.cpp

    r659 r670  
    9090    // dependency escaping is always done Unix-way since this is a requirement
    9191    // of GNU make which allows " and ' to be part of the file name.
    92     // Note that if the string is a make variable reference, we don't eascape!
     92    // Note that if the string is a make variable reference, we don't eascape
     93    // but instead use the q function defined in writeMakefile() that will do
     94    // it at runtime.
    9395    QString ret = path;
    9496    QString trimmed = path.trimmed();
     
    9698        ret.remove('\"');
    9799        ret.replace(' ', "\\ ");
     100
     101
    98102    }
    99103    return ret;
     
    522526{
    523527    t << "first: all" << endl;
    524     t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS"))," "," "," ") << escapeFileVars(" $(DESTDIR_TARGET)") << endl << endl;
    525     t << escapeFileVars("$(DESTDIR_TARGET): ") << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS");
     528    t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) << " "
     529                 << valGlue(escapeDependencyPaths(project->values("ALL_DEPS"))," "," "," ")
     530                 << escapeFileVars(" $(DESTDIR_TARGET)") << endl << endl;
     531    t << escapeFileVars("$(DESTDIR_TARGET): ") << escapeFileVars(var("PRE_TARGETDEPS"))
     532                                               << escapeFileVars(" $(OBJECTS) ")
     533                                               << escapeFileVars(var("POST_TARGETDEPS"));
    526534    if (!project->isEmpty("QMAKE_PRE_LINK"))
    527535        t << "\n\t" <<var("QMAKE_PRE_LINK");
     
    564572            if (!project->isEmpty("DEF_FILE_TEMPLATE")) {
    565573                t << "DEF_FILE_TEMPLATE = " << escapeFilePath(var("DEF_FILE_TEMPLATE")) << endl;
    566                 project->values("QMAKE_GENDEF_DEPS") += escapeFileVars("$(DEF_FILE_TEMPLATE)");
     574                project->values("QMAKE_GENDEF_DEPS") += ;
    567575            }
    568576            if (!project->isEmpty("DEF_FILE_MAP")) {
    569577                t << "DEF_FILE_MAP  = " << escapeFilePath(var("DEF_FILE_MAP")) << endl;
    570                 project->values("QMAKE_GENDEF_DEPS") += escapeFileVars("$(DEF_FILE_MAP)");
     578                project->values("QMAKE_GENDEF_DEPS") += ;
    571579            }
    572580        }
     
    578586        }
    579587        t << "DEF_FILE      = " << escapeFilePath(var("DEF_FILE")) << endl;
    580         project->values("POST_TARGETDEPS") += escapeFileVars("$(DEF_FILE)");
     588        project->values("POST_TARGETDEPS") += ;
    581589    }
    582590
     
    598606        if (project->isEmpty("DEF_FILE")) {
    599607            /* generate a DEF file for the DLL when not supplied */
    600             t << escapeFileVars("$(DEF_FILE): ") << var("QMAKE_GENDEF_DEPS");
     608            t << escapeFileVars("$(DEF_FILE): ") << );
    601609            t << valGlue(var("QMAKE_RUN_GENDEF").split(";;"), "\n\t", "\n\t", "") << endl;
    602610        }
     
    755763}
    756764
     765
    757766QString GNUMakefileGenerator::escapeFileVars(const QString &vars)
    758767{
    759768    /* In DOS environment, we escape spaces and other illegal characters in
    760      * filenames with double quotes. However, this is not appropriate for make
    761      * rule definitions (targets/dependencies) where Unix escaping is
     769     * filenames with double quotes. However, this is not appropriate for
     770     * rule definitions (targets/dependencies) where Unix escaping is
    762771     * expected. If we'd deal only with immediate strings, we could provide
    763772     * necessary escaping in place, but we often use make variables instead of
    764773     * direct file names so we must perform such escaping on the fly. This is
    765774     * what we do here using the q function that we define in writeMakefile().*/
    766     if (isDosLikeShell()) {
    767         QString ret = vars;
    768         QRegExp rx = QRegExp("\\$\\((.+)\\)");
    769         rx.setMinimal(true);
    770         ret.replace(rx, "$(call q,$(\\1))");
    771         return ret;
    772     }
    773     return vars;
     775    QString ret = vars;
     776    QRegExp rx = QRegExp("(?:\\$\\(call q,\\$\\((.+)\\)\\))|"
     777                         "(?:\\$\\(([^$)]+)\\))");
     778    rx.setMinimal(true);
     779    ret.replace(rx, "$(call q,$(\\1\\2))");
     780    return ret;
    774781}
    775782
  • trunk/qmake/generators/os2/gnumake.h

    r659 r670  
    8989    void createLinkerResponseFiles(QTextStream &t);
    9090    void createCompilerResponseFiles(QTextStream &t);
    91     QString escapeFileVars(const QString &base);
     91
     92    static QString escapeFileVars(const QString &base);
    9293
    9394    bool init_flag;
Note: See TracChangeset for help on using the changeset viewer.