Ignore:
Timestamp:
Mar 16, 2006, 9:57:36 AM (19 years ago)
Author:
dmik
Message:

Added correct support for RC_FILE and RES_FILE qmake project variables to the GNUMAKE backend.

File:
1 edited

Legend:

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

    r8 r66  
    9999
    100100    t << "INCPATH       =       ";
    101     QStringList &incs = project->variables()["INCLUDEPATH"];
    102     for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
    103         QString inc = (*incit);
    104 //@@TODO (dmik): old, remove
    105 //      inc.replace(QRegExp("\\\\$"), "\\\\");
    106         inc.replace(QRegExp("\\\\$"), "");
    107         inc.replace(QRegExp("\""), "");
    108         t << " " << var ("QMAKE_CFLAGS_INCDIR") << "\"" << inc << "\"";
    109     }
    110     t << " " << var ("QMAKE_CFLAGS_INCDIR") << "\"$(QMAKESPECDIR)\"" << endl;
     101    {
     102        QStringList &incs = project->variables()["INCLUDEPATH"];
     103        QString incsSemicolon;
     104        for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
     105            QString inc = (*incit);
     106            inc.replace(QRegExp("\\\\$"), "");
     107            inc.replace(QRegExp("\""), "");
     108            if ( inc.contains( QRegExp("[ +&;$%()]") ) )
     109                inc = "\"" + inc + "\"";
     110            t << " " << var ("QMAKE_CFLAGS_INCDIR") << inc;
     111            incsSemicolon += inc + ";";
     112        }
     113        t << " " << var ("QMAKE_CFLAGS_INCDIR") << "\"$(QMAKESPECDIR)\"" << endl;
     114        incsSemicolon += "\"$(QMAKESPECDIR)\"";
     115        t << "INCLUDEPATH = " << incsSemicolon << endl;
     116    }
    111117    if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
    112118        t << "LINK      =       " << var("QMAKE_LINK") << endl;
    113119        t << "LFLAGS    =       " << var("QMAKE_LFLAGS") << endl;
    114120        t << "LIBS      =       ";
    115 //@@TODO (dmik): old, remove
    116 //      if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() )
    117 //          t << varGlue("QMAKE_LIBDIR","-L\"","\" -L\"","\"") << " ";
    118 //      t << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << endl;
    119121        QString flag = var ("QMAKE_LFLAGS_LIBDIR") + "\"";
    120122        if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() )
     
    134136    t << "IDC           =       " << (project->isEmpty("QMAKE_IDC") ? QString("idc") :
    135137                              Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl;
    136     t << "IDL           =       " << (project->isEmpty("QMAKE_IDL") ? QString("midl") :
     138    t << "IDL           =       " << (project->isEmpty("QMAKE_IDL") ? QString("") :
    137139                              Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl;
     140    t << "RC            =       " << (project->isEmpty("QMAKE_RC") ? QString("rc") :
     141                              Option::fixPathToTargetOS(var("QMAKE_RC"), FALSE)) << endl;
    138142    t << "ZIP           =       " << var("QMAKE_ZIP") << endl;
    139143    t << "COPY_FILE     =       " << var("QMAKE_COPY") << endl;
     
    205209        t << "DEF_FILE  =       " << var( "DEF_FILE" ) << endl;
    206210    }
     211
     212    if ( !project->isEmpty( "RC_FILE" ) ) {
     213        t << "RC_FILE   =       " << var("RC_FILE") << endl;
     214    }
     215    if ( !project->isEmpty( "RES_FILE" ) ) {
     216        t << "RES_FILE  =       " << var("RES_FILE") << endl;
     217    }
    207218   
    208219    if ( project->isActiveConfig("dll") && !project->isEmpty( "QMAKE_RUN_IMPLIB" ) ) {
     
    236247        else
    237248            t << "\n\t" << var( "QMAKE_RUN_LINK" );
     249        if ( !project->isEmpty( "RES_FILE" ) && !project->isEmpty( "QMAKE_RUN_RC_EXE" ) )
     250            t << "\n\t" << var("QMAKE_RUN_RC_EXE");
    238251        if ( project->isActiveConfig("dll") && !project->isEmpty( "QMAKE_RUN_IMPLIB" ) )
    239252            t << "\n\t" << var( "QMAKE_RUN_IMPLIB" );
     
    252265        }
    253266    }
    254     QString targetfilename = project->variables()["TARGET"].first();
    255     if(project->isActiveConfig("activeqt")) {
    256         QString version = project->variables()["VERSION"].first();
    257         if ( version.isEmpty() )
    258             version = "1.0";
    259 
    260         if ( project->isActiveConfig("dll")) {
    261             t << "\n\t" << ("-$(IDC) $(TARGET) /idl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version);
    262             t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
    263             t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
    264             t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" );
    265         } else {
    266             t << "\n\t" << ("-$(TARGET) -dumpidl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version);
    267             t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
    268             t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
    269             t << "\n\t" << "-$(TARGET) -regserver";
    270         }
    271     }
    272267    t << endl << endl;
    273268
     
    278273    }
    279274   
    280     if(!project->variables()["RC_FILE"].isEmpty()) {
    281         t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t"
    282           << var("QMAKE_RC") << " -i " << var("RC_FILE") << " -o " << var("RC_FILE").replace(QRegExp("\\.rc"),Option::obj_ext) << " --include-dir=" << QFileInfo(var("RC_FILE")).dirPath() << endl << endl;
    283     }
    284         project->variables()["RES_FILE"].first().replace(QRegExp("\\.rc"),Option::obj_ext);
     275    if ( !project->isEmpty( "RC_FILE" ) && !project->isEmpty( "QMAKE_RUN_RC_RES" ) ) {
     276        t << "$(RES_FILE): $(RC_FILE)\n\t";
     277        t << var("QMAKE_RUN_RC_RES") << endl << endl;
     278    }
    285279
    286280    t << "mocables: $(SRCMOC)" << endl << endl;
     
    303297        dist_files << fileFixify(*it);
    304298    }
    305 //@@TODO (dmik): guess we don't need to zip this   
     299/// @todo (dmik) guess we don't need to zip this   
    306300//    if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES"))
    307301//      dist_files += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"];
     
    329323      << varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","")
    330324      << varGlue("CLEAN_FILES","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","");
    331     if ( project->isActiveConfig("activeqt")) {
    332         t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".idl");
    333         t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".tlb");
    334     }
    335325    if(!project->isEmpty("IMAGES"))
    336326        t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", "");
     
    552542                    project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"];
    553543            } else {
    554 //@@TODO (dmik): old, remove           
    555 //          if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
    556544                if(project->isActiveConfig("thread"))
    557545                    project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD_DLL"];
     
    563551                if(hver != -1) {
    564552                    QString ver;
    565 //@@TODO (dmik): old, remove
    566 //                  ver.sprintf("libqt%s" QTDLL_POSTFIX "%d.a", (project->isActiveConfig("thread") ? "-mt" : ""), hver);
    567553                    ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver);
    568554                    QStringList &libs = project->variables()["QMAKE_LIBS"];
    569 //@@TODO (dmik): remove the comment below                   
    570 // @@@HGTODO maybe we must change the replace regexp if we understand what's going on
    571555                    for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit)
    572 //@@TODO (dmik): old, remove           
    573 //                      (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver);
    574 //                      (*libit).replace(QRegExp("-lqt(-mt)?"), ver);
    575556                        (*libit).replace(QRegExp("qt(-mt)?(\\.lib)?"), ver);
    576                 }
    577             }
    578             if ( project->isActiveConfig( "activeqt" ) ) {
    579                 project->variables().remove("QMAKE_LIBS_QT_ENTRY");
    580                 project->variables()["QMAKE_LIBS_QT_ENTRY"] = "-lqaxserver";
    581                 if ( project->isActiveConfig( "dll" ) ) {
    582                    project->variables()["QMAKE_LIBS"]  += project->variables()["QMAKE_LIBS_QT_ENTRY"];
    583557                }
    584558            }
     
    618592            project->variables()["TARGET_EXT"].append(".exe");
    619593        } else {
    620 //@@TODO (dmik): old, guess to remove
    621 //          project->variables()["TARGET_EXT"].append(".a");
    622 //          project->variables()["QMAKE_LFLAGS"].append("-static");
    623 //          if(project->variables()["TARGET"].first().left(3) != "lib")
    624 //              project->variables()["TARGET"].first().prepend("lib");
    625 //      }
    626594            project->variables()["TARGET_EXT"].append(".lib");
    627595        }
     
    676644
    677645    project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ',
    678         "HEADERS SOURCES DEF_FILE DEF_FILE_TEMPLATE DEF_FILE_MAP RC_FILE TARGET "
    679         "QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
     646        "HEADERS SOURCES DEF_FILE DEF_FILE_TEMPLATE DEF_FILE_MAP RC_FILE "
     647        "RES_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
    680648    QStringList &l = project->variables()["QMAKE_FILETAGS"];
    681649    QStringList::Iterator it;
     
    686654    }
    687655
    688 //@@TODO (dmik): old, remove   
    689 //    if ( project->isActiveConfig("dll") ) {
    690 //              QString destDir = "";
    691 //              if (!project->first("DESTDIR").isEmpty())
    692 //                      destDir = project->first("DESTDIR") + "\\";
    693 //              project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--out-implib,") +
    694 //                                        destDir + "lib" + project->first("TARGET") + ".a");
    695 //    }
    696    
    697 //    if(!project->isActiveConfig("incremental"))
    698 //      project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no"));
    699 
    700656    if ( !project->variables()["RC_FILE"].isEmpty()) {
    701657        if ( !project->variables()["RES_FILE"].isEmpty()) {
    702658            fprintf( stderr, "Both RC_FILE and RES_FILE are specified.\n" );
    703             fprintf( stderr, "Please specify one of them, not both." );
     659            fprintf( stderr, "Please specify one of them, not both.\n" );
    704660            exit( 666 );
    705661        }
    706         project->variables()["RES_FILE"] = project->variables()["RC_FILE"];
    707         project->variables()["RES_FILE"].first().replace(".rc",Option::obj_ext);
    708         project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
    709         project->variables()["CLEAN_FILES"] += project->variables()["RES_FILE"];
    710     }
    711    
     662        project->variables()["RES_FILE"] =
     663            Option::fixPathToLocalOS( var( "OBJECTS_DIR" ) + "/"
     664                                      + QFileInfo( var( "RC_FILE" ) ).baseName( TRUE )
     665                                      + ".res",
     666                                      FALSE );
     667        project->variables()["CLEAN_FILES"] += "$(RES_FILE)";
     668    }
     669
    712670    if ( !project->variables()["RES_FILE"].isEmpty())
    713         project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"];
    714 
     671        project->variables()["POST_TARGETDEPS"] += "$(RES_FILE)";
     672   
    715673    MakefileGenerator::init();
    716674   
     
    721679    }
    722680
    723 //@@TODO (dmik): old, remove   
    724 //    if(project->isActiveConfig("dll")) {
    725 //      project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") +"lib" + project->first("TARGET") + ".a");
    726 //    }
    727    
    728681    QStringList &quc = project->variables()["QMAKE_EXTRA_COMPILERS"];
    729682    for(it = quc.begin(); it != quc.end(); ++it) {
Note: See TracChangeset for help on using the changeset viewer.