Ignore:
Timestamp:
Jun 22, 2009, 12:20:37 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

qmake: os2/GNUMAKE: Escape make variables that refer to file names with a special function call to convert DOS-like to Unix-like space char escaping (expected by GNU make in the target and dependencies parts of build rules, #1).

File:
1 edited

Legend:

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

    r42 r44  
    8080        if (ret.contains(QRegExp("[ +&;%]")))
    8181            ret = quote + ret + quote;
    82         /* @todo exclude $(var) constructs from quoting like this:
    83          *     $(OBJECTS_DIR)\my file.obj = > $(OBJECTS_DIR)\"my file.obj"
    84          */
    8582    }
    8683    return ret;
    8784}
    8885
    89 QString GNUMakefileGenerator::getLibTarget()
    90 {
    91     return QString("lib" + project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".lib");
     86QString GNUMakefileGenerator::escapeDependencyPath(const QString &path) const
     87{
     88    /* dependency escaping is always done Unix-way since this is a requirement
     89     * of GNU make which allows " and ' to be part of the file name */
     90    QString ret = path;
     91    ret.remove('\"');
     92    ret.replace(' ', "\\ ");
     93    return ret;
    9294}
    9395
     
    137139bool GNUMakefileGenerator::writeMakefile(QTextStream &t)
    138140{
     141
     142
     143
     144
     145
    139146    writeHeader(t);
     147
    140148    if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
    141149        t << "all clean:" << "\n\t"
     
    351359{
    352360    t << "first: all" << endl;
    353     t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS"))," "," "," ") << " $(DESTDIR_TARGET)" << endl << endl;
    354     t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS");
     361    t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS"))," "," "," ") << << endl << endl;
     362    t << << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS");
    355363    if (!project->isEmpty("QMAKE_PRE_LINK"))
    356364        t << "\n\t" <<var("QMAKE_PRE_LINK");
     
    391399            t << "DEF_FILE      = $(basename $(DESTDIR_TARGET)).def" << endl;
    392400            project->values("QMAKE_CLEAN").append("$(DEF_FILE)");
    393             project->values("POST_TARGETDEPS") += "$(DEF_FILE)";
     401            project->values("POST_TARGETDEPS") += ;
    394402            if (!project->isEmpty("DEF_FILE_TEMPLATE")) {
    395403                t << "DEF_FILE_TEMPLATE = " << escapeFilePath(var("DEF_FILE_TEMPLATE")) << endl;
    396                 project->values("QMAKE_GENDEF_DEPS") += "$(DEF_FILE_TEMPLATE)";
     404                project->values("QMAKE_GENDEF_DEPS") += ;
    397405            }
    398406            if (!project->isEmpty("DEF_FILE_MAP")) {
    399407                t << "DEF_FILE_MAP  = " << escapeFilePath(var("DEF_FILE_MAP")) << endl;
    400                 project->values("QMAKE_GENDEF_DEPS") += "$(DEF_FILE_MAP)";
     408                project->values("QMAKE_GENDEF_DEPS") += ;
    401409            }
    402410        }
     
    408416        }
    409417        t << "DEF_FILE      = " << escapeFilePath(var("DEF_FILE")) << endl;
    410         project->values("POST_TARGETDEPS") += "$(DEF_FILE)";
     418        project->values("POST_TARGETDEPS") += ;
    411419    }
    412420}
     
    416424    if (!project->isEmpty("RC_FILE") && !project->isEmpty("RES_FILE") &&
    417425        !project->isEmpty("QMAKE_RUN_RC2RES")) {
    418         t << "$(RES_FILE): $(RC_FILE)\n\t";
     426        t << ;
    419427        t << var("QMAKE_RUN_RC2RES") << endl;
    420428    }
     
    422430    if (project->isEmpty("DEF_FILE") && mode == DLL) {
    423431        /* generate a DEF file for the DLL when not supplied */
    424         t << "$(DEF_FILE): " << var("QMAKE_GENDEF_DEPS");
     432        t << << var("QMAKE_GENDEF_DEPS");
    425433        t << valGlue(var("QMAKE_RUN_GENDEF").split(";;"), "\n\t", "\n\t", "") << endl;
    426434    }
     
    446454
    447455    if (!project->isEmpty("RES_FILE"))
    448         project->values("POST_TARGETDEPS") += "$(RES_FILE)";
     456        project->values("POST_TARGETDEPS") += ;
    449457}
    450458
     
    567575}
    568576
     577
     578
     579
     580
     581
     582
     583
     584
     585
     586
     587
     588
     589
     590
     591
    569592QT_END_NAMESPACE
Note: See TracChangeset for help on using the changeset viewer.