author | zecke <zecke> | 2004-07-15 17:36:57 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-15 17:36:57 (UTC) |
commit | 323e9a7472a110b4befba7320540263147505bae (patch) (side-by-side diff) | |
tree | 14c810bdb9c0603a30356b17b4bdf9ccb72741c6 /qmake/generators/makefile.cpp | |
parent | aa292b322f1ecb43dd8f4e3cd295855730dd9f59 (diff) | |
download | opie-323e9a7472a110b4befba7320540263147505bae.zip opie-323e9a7472a110b4befba7320540263147505bae.tar.gz opie-323e9a7472a110b4befba7320540263147505bae.tar.bz2 |
Manually updatet to qmake1.06a which includes support for precompiled
headers.
Opies 'PRO' keyword was already reintroduced
Diffstat (limited to 'qmake/generators/makefile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/makefile.cpp | 656 |
1 files changed, 445 insertions, 211 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index c12375d..5ce387f 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1,11 +1,9 @@ /**************************************************************************** -** $Id$ +** ** -** Definition of ________ class. +** Implementation of MakefileGenerator class. ** -** Created : 970521 +** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. ** -** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. -** -** This file is part of the network module of the Qt GUI Toolkit. +** This file is part of qmake. ** @@ -39,2 +37,3 @@ #include "option.h" +#include "meta.h" #include <qdir.h> @@ -60,4 +59,5 @@ #endif +#define QMAKE_EOL(x) (x == '\r' || x == '\n') -static QString mkdir_p_asstring(const QString &dir) +QString mkdir_p_asstring(const QString &dir) { @@ -76,3 +76,2 @@ static bool createDir(const QString& fullPath) return FALSE; - QDir dirTmp; @@ -144,3 +143,3 @@ MakefileGenerator::generateMocList(const QString &fn_target) if(*(big_buffer + x) == '/') { //c++ style comment - for( ;x < total_size_read && *(big_buffer + x) != '\n'; x++); + for( ;x < total_size_read && !QMAKE_EOL(*(big_buffer + x)); x++); line_count++; @@ -162,3 +161,3 @@ MakefileGenerator::generateMocList(const QString &fn_target) } - } else if(*(big_buffer + x) == '\n') { + } else if(QMAKE_EOL(*(big_buffer + x))) { line_count++; @@ -189,3 +188,3 @@ MakefileGenerator::generateMocList(const QString &fn_target) *(big_buffer+x+len) = '\0'; - debug_msg(2, "Mocgen: %s:%d Found MOC symbol %s", fn_target.latin1(), + debug_msg(2, "Mocgen: %s:%d Found MOC symbol %s", fn_target.latin1(), line_count, big_buffer+x); @@ -202,3 +201,3 @@ MakefileGenerator::generateMocList(const QString &fn_target) bool cpp_ext = FALSE; - for(QStringList::Iterator cppit = Option::cpp_ext.begin(); + for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { @@ -208,10 +207,10 @@ MakefileGenerator::generateMocList(const QString &fn_target) if(cpp_ext) { - mocFile += fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + Option::moc_ext; + mocFile += Option::cpp_moc_mod + fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + Option::cpp_moc_ext; project->variables()["_SRCMOC"].append(mocFile); } else if(project->variables()["HEADERS"].findIndex(fn_target) != -1) { - for(QStringList::Iterator hit = Option::h_ext.begin(); + for(QStringList::Iterator hit = Option::h_ext.begin(); hit != Option::h_ext.end(); ++hit) { if((fn_target.right(ext_len) == (*hit))) { - mocFile += Option::moc_mod + fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + - Option::cpp_ext.first(); + mocFile += Option::h_moc_mod + fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + + Option::h_moc_ext; logicWarn(mocFile, "SOURCES"); @@ -234,3 +233,3 @@ MakefileGenerator::generateMocList(const QString &fn_target) x++; - if(*(big_buffer+x) == '\n') + if(QMAKE_EOL(*(big_buffer+x))) line_count++; @@ -245,5 +244,7 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const { - QStringList &fndeps = findDependencies(f); - if(!fndeps.isEmpty()) + if(processedDependencies(f)) return TRUE; + setProcessedDependencies(f, TRUE); + + QStringList &fndeps = findDependencies(f); QString fn = fileFixify(f, QDir::currentDirPath(), Option::output_dir); @@ -285,3 +286,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const if(*(big_buffer + x) == '/') { //c++ style comment - for( ; x < total_size_read && *(big_buffer + x) != '\n'; x++); + for( ; x < total_size_read && !QMAKE_EOL(*(big_buffer + x)); x++); } else if(*(big_buffer + x) == '*') { //c style comment @@ -293,3 +294,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const } - } else if(*(big_buffer + x) == '\n') { + } else if(QMAKE_EOL(*(big_buffer + x))) { line_count++; @@ -300,2 +301,5 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const } + while(x < total_size_read && //Skip spaces + (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) + x++; if(*(big_buffer + x) == '#') { @@ -320,3 +324,4 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const int inc_len; - for(inc_len = 0; *(big_buffer + x + inc_len) != term; inc_len++); + for(inc_len = 0; *(big_buffer + x + inc_len) != term && + !QMAKE_EOL(*(big_buffer + x + inc_len)); inc_len++); *(big_buffer + x + inc_len) = '\0'; @@ -327,3 +332,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const x++); - char term = '\n'; + char term = 0; if(*(big_buffer + x) == '"') @@ -332,3 +337,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const term = '\''; - if(term != '\n') + if(term) x++; @@ -336,3 +341,5 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const int msg_len; - for(msg_len = 0; *(big_buffer + x + msg_len) != term; msg_len++); + for(msg_len = 0; (term && *(big_buffer + x + msg_len) != term) && + !QMAKE_EOL(*(big_buffer + x + msg_len)); msg_len++); + const char saved_term = *(big_buffer + x + msg_len); *(big_buffer + x + msg_len) = '\0'; @@ -341,3 +348,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const line_count, msg.latin1()); - *(big_buffer + x + msg_len) = term; //put it back + *(big_buffer + x + msg_len) = saved_term; //put it back } @@ -353,3 +360,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const (*(big_buffer + x + 11) == ' ' || *(big_buffer + x + 11) == '>')) { - for(x += 12; *(big_buffer + x) != '>'; x++); + for(x += 11; *(big_buffer + x) != '>'; x++); int inc_len = 0; @@ -358,2 +365,22 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const inc = big_buffer + x; + } else if(total_size_read >= x + 13 && !strncmp(big_buffer + x, "customwidget", 12) && + (*(big_buffer + x + 12) == ' ' || *(big_buffer + x + 12) == '>')) { + for(x += 13; *(big_buffer + x) != '>'; x++); //skip up to > + while(x < total_size_read) { + for(x++; *(big_buffer + x) != '<'; x++); //skip up to < + x++; + if(total_size_read >= x + 7 && !strncmp(big_buffer+x, "header", 6) && + (*(big_buffer + x + 6) == ' ' || *(big_buffer + x + 6) == '>')) { + for(x += 7; *(big_buffer + x) != '>'; x++); //skip up to > + int inc_len = 0; + for(x += 1 ; *(big_buffer + x + inc_len) != '<'; inc_len++); + *(big_buffer + x + inc_len) = '\0'; + inc = big_buffer + x; + break; + } else if(total_size_read >= x + 14 && !strncmp(big_buffer+x, "/customwidget", 13) && + (*(big_buffer + x + 13) == ' ' || *(big_buffer + x + 13) == '>')) { + x += 14; + break; + } + } } else if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include", 7) && @@ -419,3 +446,2 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const } - QString fqn; @@ -425,2 +451,6 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const goto handle_fqn; + } else if(project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH") && + !stat(inc, &fst) && !S_ISDIR(fst.st_mode)) { + fqn = inc; + goto handle_fqn; } else { @@ -448,2 +478,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const fqn = depHeuristics[inc]; + from_source_dir = FALSE; } else if(Option::mkfile::do_dep_heuristics) { //some heuristics.. @@ -468,5 +499,5 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const fqn += inc_file; - from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) + from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) fqn = fileFixify(fqn, QDir::currentDirPath(), Option::output_dir); - goto handle_fqn; + goto cache_fqn; } @@ -490,3 +521,5 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const fqn = d + inc; - goto handle_fqn; + from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) + fqn = fileFixify(fqn, QDir::currentDirPath(), Option::output_dir); + goto cache_fqn; } @@ -511,3 +544,5 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const fqn = d + inc; - goto handle_fqn; + from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) + fqn = fileFixify(fqn, QDir::currentDirPath(), Option::output_dir); + goto cache_fqn; } @@ -516,4 +551,5 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const } - if(mocAware() && //is it a moc file? - (inc.endsWith(Option::cpp_ext.first()) || inc.endsWith(Option::moc_ext))) { + if( mocAware() && //is it a moc file? + ( inc.endsWith(Option::cpp_ext.first()) || inc.endsWith(Option::cpp_moc_ext) ) + || ( (Option::cpp_ext.first() != Option::h_moc_ext) && inc.endsWith(Option::h_moc_ext) )) { QString mocs[] = { QString("_HDRMOC"), QString("_SRCMOC"), QString::null }; @@ -529,4 +565,4 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const l.remove(it); - } else if(!findMocSource(fqn).endsWith(fn)) { - /* Not really a very good test, but this will at least avoid + } else if(!findMocSource(fqn).endsWith(fileFixify(fn))) { + /* Not really a very good test, but this will at least avoid confusion if it really does happen (since tmake/qmake @@ -538,3 +574,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const from_source_dir = FALSE; //mocs go in the output_dir (so don't fix them) - goto handle_fqn; + goto cache_fqn; } @@ -543,2 +579,8 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const } + fqn = findDependency(inc); //all else fails.. + cache_fqn: + if(from_source_dir) { + fqn = fileFixify(fqn); + from_source_dir = FALSE; + } depHeuristics.insert(inc, fqn); @@ -557,3 +599,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const //read past new line now.. - for( ; x < total_size_read && (*(big_buffer + x) != '\n'); x++); + for( ; x < total_size_read && !QMAKE_EOL(*(big_buffer + x)); x++); line_count++; @@ -565,4 +607,4 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const QStringList &deplist = findDependencies((*fnit)); - for(QStringList::Iterator it = deplist.begin(); it != deplist.end(); ++it) - if(fndeps.findIndex((*it)) == -1) + for(QStringList::Iterator it = deplist.begin(); it != deplist.end(); ++it) + if(fndeps.findIndex((*it)) == -1 && (*it) != fn) fndeps.append((*it)); @@ -608,3 +650,3 @@ MakefileGenerator::initOutPaths() QString("UI_SOURCES_DIR"), QString("UI_DIR"), QString("DESTDIR"), - QString("SUBLIBS_DIR"), QString::null }; + QString("SUBLIBS_DIR"), QString("DLLDESTDIR"), QString::null }; for(int x = 0; dirs[x] != QString::null; x++) { @@ -612,2 +654,6 @@ MakefileGenerator::initOutPaths() QString orig_path = v[dirs[x]].first(); +#ifdef Q_WS_WIN + // We don't want to add a separator for DLLDESTDIR on Windows + if (!(dirs[x] == "DLLDESTDIR")) +#endif { @@ -663,2 +709,7 @@ MakefileGenerator::initOutPaths() } + if ( !v["DESTDIR"].isEmpty() ) { + QDir d(v["DESTDIR"].first()); + if(Option::fixPathToLocalOS(d.absPath()) == Option::fixPathToLocalOS(Option::output_dir)) + v.remove("DESTDIR"); + } QDir::current().cd( currentDir ); @@ -676,8 +727,13 @@ MakefileGenerator::init() QString paths[] = { QString("SOURCES"), QString("FORMS"), QString("YACCSOURCES"), QString("INCLUDEPATH"), - QString("HEADERS"), QString("HEADERS_ORIG"), - QString("LEXSOURCES"), QString("QMAKE_INTERNAL_INCLUDED_FILES"), QString::null }; + QString("HEADERS"), QString("HEADERS_ORIG"), QString("LEXSOURCES"), + QString("QMAKE_INTERNAL_INCLUDED_FILES"), + QString("PRECOMPILED_HEADER"), QString::null }; for(int y = 0; paths[y] != QString::null; y++) { QStringList &l = v[paths[y]]; - if(!l.isEmpty()) - l = fileFixify(l); + for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + if ((*it).isEmpty()) + continue; + if(QFile::exists((*it))) + (*it) = fileFixify((*it)); + } } @@ -763,2 +819,3 @@ MakefileGenerator::init() findDependencies(file) = files; + setProcessedDependencies(file, TRUE); } @@ -811,7 +868,8 @@ MakefileGenerator::init() QString sources[] = { QString("OBJECTS"), QString("LEXSOURCES"), QString("YACCSOURCES"), - QString("HEADERS"), QString("SOURCES"), QString("FORMS"), - QString::null }; + QString("HEADERS"), QString("SOURCES"), QString("FORMS"), + QString("PRECOMPILED_HEADER"), QString::null }; depHeuristics.clear(); bool write_cache = FALSE, read_cache = QFile::exists(cache_file); - for(int x = 0; sources[x] != QString::null; x++) { + int x; + for(x = 0; sources[x] != QString::null; x++) { QStringList vpath, &l = v[sources[x]]; @@ -819,7 +877,6 @@ MakefileGenerator::init() if(!(*val_it).isEmpty()) { - QString file = Option::fixPathToLocalOS((*val_it)); - QStringList file_list(file); + QString file = fileFixify((*val_it), QDir::currentDirPath(), Option::output_dir); if(!QFile::exists(file)) { bool found = FALSE; - if(QDir::isRelativePath(file)) { + if(QDir::isRelativePath((*val_it))) { if(vpath.isEmpty()) @@ -860,9 +917,8 @@ MakefileGenerator::init() } else { - file_list.clear(); for(int i = 0; i < (int)d.count(); i++) { - file_list.append(dir + d[i]); + QString file = fileFixify(dir + d[i]); if(i == (int)d.count() - 1) - (*val_it) = dir + d[i]; + (*val_it) = file; else - l.insert(val_it, dir + d[i]); + l.insert(val_it, file); } @@ -878,40 +934,42 @@ MakefileGenerator::init() } - for(QStringList::Iterator file_it = file_list.begin(); - file_it != file_list.end(); ++file_it) { - QString file_list_file = fileFixify((*file_it)); - bool found_cache_moc = FALSE, found_cache_dep = FALSE; - if(read_cache && Option::output.name() != "-" && - project->isActiveConfig("qmake_cache")) { - if(!findDependencies(file_list_file).isEmpty()) - found_cache_dep = TRUE; - if(cache_found_files[(*file_it)] == (void *)2) - found_cache_moc = TRUE; - if(!found_cache_moc || !found_cache_dep) - write_cache = TRUE; - } - /* Do moc before dependency checking since some includes can come from - moc_*.cpp files */ - if(found_cache_moc) { - QString moc = findMocDestination(file_list_file); - if(!moc.isEmpty()) { - for(QStringList::Iterator cppit = Option::cpp_ext.begin(); - cppit != Option::cpp_ext.end(); ++cppit) { - if(file_list_file.endsWith((*cppit))) { - QStringList &deps = findDependencies(file_list_file); - if(!deps.contains(moc)) - deps.append(moc); - break; - } - } + } + } + } + for(x = 0; sources[x] != QString::null; x++) { + QStringList &l = v[sources[x]]; + for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { + bool found_cache_moc = FALSE, found_cache_dep = FALSE; + if(read_cache && Option::output.name() != "-" && + project->isActiveConfig("qmake_cache")) { + if(processedDependencies((*val_it))) + found_cache_dep = TRUE; + if(cache_found_files[(*val_it)] == (void *)2) + found_cache_moc = TRUE; + if(!found_cache_moc || !found_cache_dep) + write_cache = TRUE; + } + /* Do moc before dependency checking since some includes can come from + moc_*.cpp files */ + if(found_cache_moc) { + QString fixed_file(fileFixify((*val_it), QDir::currentDirPath(), Option::output_dir)); + QString moc = findMocDestination(fixed_file); + if(!moc.isEmpty()) { + for(QStringList::Iterator cppit = Option::cpp_ext.begin(); + cppit != Option::cpp_ext.end(); ++cppit) { + if(fixed_file.endsWith((*cppit))) { + QStringList &deps = findDependencies(fixed_file); + if(!deps.contains(moc)) + deps.append(moc); + break; } - } else if(mocAware() && (sources[x] == "SOURCES" || sources[x] == "HEADERS") && - (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || - Option::mkfile::do_mocs)) { - generateMocList((*file_it)); - } - if(!found_cache_dep && sources[x] != "OBJECTS") { - debug_msg(5, "Looking for dependencies for %s", (*file_it).latin1()); - generateDependencies(deplist, (*file_it), doDepends()); } } + } else if(mocAware() && (sources[x] == "SOURCES" || sources[x] == "HEADERS") && + (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || + Option::mkfile::do_mocs)) { + generateMocList((*val_it)); + } + if(!found_cache_dep && sources[x] != "OBJECTS") { + debug_msg(5, "Looking for dependencies for %s", (*val_it).latin1()); + generateDependencies(deplist, (*val_it), doDepends()); } @@ -934,3 +992,3 @@ MakefileGenerator::init() it != depends.end(); ++it) - cachet << depKeyMap[it.key()] << " = " << it.data().join(" ") << endl; + cachet << dependencyKey(it.key()) << " = " << it.data().join(" ") << endl; cachet << "[mocable]" << endl; @@ -1055,3 +1113,3 @@ MakefileGenerator::init() decl = project->first("UI_HEADERS_DIR"); - if(!decl.isEmpty() || (project->isEmpty("UI_HEADERS_DIR") && + if(!decl.isEmpty() || (project->isEmpty("UI_HEADERS_DIR") && !project->isEmpty("UI_SOURCES_DIR")) ) { @@ -1074,6 +1132,6 @@ MakefileGenerator::init() impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); - if(!impl.isEmpty()) + if(!impl.isEmpty() && !impl.endsWith(Option::dir_sep)) impl += Option::dir_sep; impl += fi.baseName(TRUE) + Option::cpp_ext.first(); - if(Option::output_dir != QDir::currentDirPath() && + if(Option::output_dir != QDir::currentDirPath() && project->isEmpty("UI_DIR") && project->isEmpty("UI_HEADERS_DIR")) { @@ -1086,3 +1144,3 @@ MakefileGenerator::init() decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); - if(!decl.isEmpty()) + if(!decl.isEmpty() && !decl.endsWith(Option::dir_sep)) decl += Option::dir_sep; @@ -1095,3 +1153,3 @@ MakefileGenerator::init() - QString mocable = Option::moc_mod + fi.baseName(TRUE) + Option::cpp_ext.first(); + QString mocable = Option::h_moc_mod + fi.baseName(TRUE) + Option::h_moc_ext; if(!v["MOC_DIR"].isEmpty()) @@ -1108,2 +1166,10 @@ MakefileGenerator::init() + //Translation files + if(!project->isEmpty("TRANSLATIONS")) { + QStringList &trf = project->variables()["TRANSLATIONS"]; + for(QStringList::Iterator it = trf.begin(); it != trf.end(); ++it) { + (*it) = Option::fixPathToLocalOS((*it)); + } + } + //Image files @@ -1134,3 +1200,3 @@ MakefileGenerator::init() } - if(Option::output_dir != QDir::currentDirPath()) + if(Option::output_dir != QDir::currentDirPath()) project->variables()["INCLUDEPATH"].append(fileFixify(Option::output_dir, Option::output_dir, @@ -1142,3 +1208,4 @@ MakefileGenerator::init() project->variables()["INCLUDEPATH"].append(project->first("MOC_DIR")); - v["OBJMOC"] = createObjectList("_HDRMOC") + createObjectList("_UIMOC"); + if ( Option::h_moc_ext == Option::cpp_ext.first() ) + v["OBJMOC"] = createObjectList("_HDRMOC") + createObjectList("_UIMOC"); @@ -1151,2 +1218,20 @@ MakefileGenerator::init() } + + QString fixpaths[] = { QString("PRE_TARGETDEPS"), QString("POST_TARGETDEPS"), QString::null }; + for(int path = 0; !fixpaths[path].isNull(); path++) { + QStringList &l = v[fixpaths[path]]; + for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { + if(!(*val_it).isEmpty()) + (*val_it) = Option::fixPathToTargetOS((*val_it), FALSE); + } + } + + // Make sure the INCLUDEPATH doesn't contain any empty(/null) entries + QStringList &ipl = project->variables()["INCLUDEPATH"]; + for(QStringList::Iterator ipl_it = ipl.begin(); ipl_it != ipl.end();) { + if ((*ipl_it).isEmpty()) + ipl_it = ipl.remove(ipl_it); + else + ++ipl_it; + } } @@ -1157,6 +1242,6 @@ MakefileGenerator::processPrlFile(QString &file) bool ret = FALSE, try_replace_file=FALSE; - QString prl_file; - if(file.endsWith(Option::prl_ext)) { + QString meta_file, orig_file = file; + if(QMakeMetaInfo::libExists(file)) { try_replace_file = TRUE; - prl_file = file; + meta_file = file; file = ""; @@ -1167,8 +1252,8 @@ MakefileGenerator::processPrlFile(QString &file) tmp = tmp.left(ext); - prl_file = tmp + Option::prl_ext; + meta_file = tmp; } - prl_file = fileFixify(prl_file); - if(!QFile::exists(fileFixify(prl_file, QDir::currentDirPath(), Option::output_dir)) && + meta_file = fileFixify(meta_file); + if(!QMakeMetaInfo::libExists(fileFixify(meta_file, QDir::currentDirPath(), Option::output_dir)) && project->isActiveConfig("qt")) { - QString stem = prl_file, dir, extn; + QString stem = meta_file, dir, extn; int slsh = stem.findRev('/'), hadlib = 0; @@ -1192,6 +1277,6 @@ MakefileGenerator::processPrlFile(QString &file) stem += "-mt"; //try the thread case - prl_file = dir; + meta_file = dir; if(hadlib) - prl_file += "lib"; - prl_file += stem + extn; + meta_file += "lib"; + meta_file += stem + extn; try_replace_file = TRUE; @@ -1199,28 +1284,42 @@ MakefileGenerator::processPrlFile(QString &file) } - QString real_prl_file = Option::fixPathToLocalOS(prl_file); - if(project->variables()["QMAKE_PRL_INTERNAL_FILES"].findIndex(prl_file) != -1) { + QString real_meta_file = Option::fixPathToLocalOS(meta_file); + if(project->variables()["QMAKE_PRL_INTERNAL_FILES"].findIndex(QMakeMetaInfo::findLib(meta_file)) != -1) { ret = TRUE; - } else if(!real_prl_file.isEmpty() && - QFile::exists(fileFixify(real_prl_file, QDir::currentDirPath(), Option::output_dir))) { - project->variables()["QMAKE_PRL_INTERNAL_FILES"].append(prl_file); - QMakeProject proj; - debug_msg(1, "Processing PRL file: %s", real_prl_file.latin1()); - if(!proj.read(fileFixify(real_prl_file, QDir::currentDirPath(), Option::output_dir), - QDir::currentDirPath(), TRUE)) { - fprintf(stderr, "Error processing prl file: %s\n", real_prl_file.latin1()); - } else { - ret = TRUE; - QMap<QString, QStringList> &vars = proj.variables(); - for( QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) - processPrlVariable(it.key(), it.data()); - if(try_replace_file && !proj.isEmpty("QMAKE_PRL_TARGET")) { - QString dir; - int slsh = real_prl_file.findRev(Option::dir_sep); - if(slsh != -1) - dir = real_prl_file.left(slsh+1); - file = dir + proj.first("QMAKE_PRL_TARGET"); + } else if(!meta_file.isEmpty()) { + QString f = fileFixify(real_meta_file, QDir::currentDirPath(), Option::output_dir); + if(QMakeMetaInfo::libExists(f)) { + QMakeMetaInfo libinfo; + debug_msg(1, "Processing PRL file: %s", real_meta_file.latin1()); + if(!libinfo.readLib(f)) { + fprintf(stderr, "Error processing meta file: %s\n", real_meta_file.latin1()); + } else if(project->isActiveConfig("no_read_prl_" + libinfo.type().lower())) { + debug_msg(2, "Ignored meta file %s [%s]", real_meta_file.latin1(), libinfo.type().latin1()); + } else { + ret = TRUE; + QMap<QString, QStringList> &vars = libinfo.variables(); + for( QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) + processPrlVariable(it.key(), it.data()); + if(try_replace_file && !libinfo.isEmpty("QMAKE_PRL_TARGET")) { + QString dir; + int slsh = real_meta_file.findRev(Option::dir_sep); + if(slsh != -1) + dir = real_meta_file.left(slsh+1); + file = libinfo.first("QMAKE_PRL_TARGET"); + if(QDir::isRelativePath(file)) + file.prepend(dir); + } } } - if(ret) - project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].append(prl_file); + if(ret) { + QString mf = QMakeMetaInfo::findLib(meta_file); + project->variables()["QMAKE_PRL_INTERNAL_FILES"].append(mf); + project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].append(mf); + } + } + if(try_replace_file && file.isEmpty()) { +#if 0 + warn_msg(WarnLogic, "Found prl [%s] file with no target [%s]!", meta_file.latin1(), + orig_file.latin1()); +#endif + file = orig_file; } @@ -1298,2 +1397,6 @@ MakefileGenerator::writePrlFile(QTextStream &t) t << "QMAKE_PRL_DEFINES = " << project->variables()["PRL_EXPORT_DEFINES"].join(" ") << endl; + if(!project->isEmpty("PRL_EXPORT_CFLAGS")) + t << "QMAKE_PRL_CFLAGS = " << project->variables()["PRL_EXPORT_CFLAGS"].join(" ") << endl; + if(!project->isEmpty("PRL_EXPORT_CXXFLAGS")) + t << "QMAKE_PRL_CXXFLAGS = " << project->variables()["PRL_EXPORT_CXXFLAGS"].join(" ") << endl; if(!project->isEmpty("CONFIG")) @@ -1318,2 +1421,3 @@ MakefileGenerator::write() { + usePlatformDir(); init(); @@ -1322,2 +1426,3 @@ MakefileGenerator::write() Option::qmake_mode == Option::QMAKE_GENERATE_PRL) && + project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty() && project->isActiveConfig("create_prl") && project->first("TEMPLATE") == "lib" && @@ -1348,3 +1453,3 @@ MakefileGenerator::write() - if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || + if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || //write prl file Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { @@ -1356,2 +1461,57 @@ MakefileGenerator::write() +// Manipulate directories, so it's possible to build +// several cross-platform targets concurrently +void +MakefileGenerator::usePlatformDir() +{ + QString pltDir(project->first("QMAKE_PLATFORM_DIR")); + if(pltDir.isEmpty()) + return; + char sep = QDir::separator(); + QString slashPltDir = sep + pltDir; + + QString filePath = project->first("DESTDIR"); + project->variables()["DESTDIR"] = filePath + + (filePath.isEmpty() ? pltDir : slashPltDir); + + filePath = project->first("DLLDESTDIR"); + project->variables()["DLLDESTDIR"] = filePath + + (filePath.isEmpty() ? pltDir : slashPltDir); + + filePath = project->first("OBJECTS_DIR"); + project->variables()["OBJECTS_DIR"] = filePath + + (filePath.isEmpty() ? pltDir : slashPltDir); + + filePath = project->first("QMAKE_LIBDIR_QT"); + project->variables()["QMAKE_LIBDIR_QT"] = filePath + + (filePath.isEmpty() ? pltDir : slashPltDir); + + filePath = project->first("QMAKE_LIBS_QT"); + int fpi = filePath.findRev(sep); + if (fpi == -1) + project->variables()["QMAKE_LIBS_QT"].prepend(pltDir + sep); + else + project->variables()["QMAKE_LIBS_QT"] = filePath.left(fpi) + + slashPltDir + + filePath.mid(fpi); + + filePath = project->first("QMAKE_LIBS_QT_THREAD"); + fpi = filePath.findRev(sep); + if (fpi == -1) + project->variables()["QMAKE_LIBS_QT_THREAD"].prepend(pltDir + sep); + else + project->variables()["QMAKE_LIBS_QT_THREAD"] = filePath.left(fpi) + + slashPltDir + + filePath.mid(fpi); + + filePath = project->first("QMAKE_LIBS_QT_ENTRY"); + fpi = filePath.findRev(sep); + if (fpi == -1) + project->variables()["QMAKE_LIBS_QT_ENTRY"].prepend(pltDir + sep); + else + project->variables()["QMAKE_LIBS_QT_ENTRY"] = filePath.left(fpi) + + slashPltDir + + filePath.mid(fpi); +} + void @@ -1374,3 +1534,3 @@ MakefileGenerator::writeObj(QTextStream &t, const QString &obj, const QString &s for(QStringList::Iterator dit = deps.begin(); dit != deps.end(); dit++) { - if((*dit).endsWith(Option::moc_ext)) + if((*dit).endsWith(Option::cpp_moc_ext)) odep += (*dit) + " "; @@ -1408,4 +1568,4 @@ MakefileGenerator::writeObj(QTextStream &t, const QString &obj, const QString &s if (!use_implicit_rule && !project->isEmpty(comp)) { - QString p = var(comp); - p.replace(stringSrc, (*sit)); + QString p = var(comp), srcf(*sit); + p.replace(stringSrc, srcf); p.replace(stringObj, (*oit)); @@ -1423,3 +1583,3 @@ MakefileGenerator::writeUicSrc(QTextStream &t, const QString &ui) for(QStringList::Iterator it = uil.begin(); it != uil.end(); it++) { - QString deps = findDependencies((*it)).join(" \\\n\t\t"), decl, impl; + QString decl, impl; { @@ -1427,8 +1587,6 @@ MakefileGenerator::writeUicSrc(QTextStream &t, const QString &ui) decl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::h_ext.first()); - decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); - int dlen = decl.findRev(Option::dir_sep) + 1; + int dlen = decl.findRev(Option::dir_sep) + 1; tmp = (*it); impl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::cpp_ext.first()); - impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); - int ilen = decl.findRev(Option::dir_sep) + 1; + int ilen = decl.findRev(Option::dir_sep) + 1; if(!project->isEmpty("UI_DIR")) { @@ -1446,13 +1604,19 @@ MakefileGenerator::writeUicSrc(QTextStream &t, const QString &ui) } - } - if(decl_dir.isEmpty()) - decl_dir = decl.left(dlen); - if(impl_dir.isEmpty()) - impl_dir = impl.left(ilen); - if(!impl_dir.isEmpty()) - createDir(Option::output_dir + Option::dir_sep + impl_dir); - if(!decl_dir.isEmpty() && decl_dir != impl_dir) - createDir(Option::output_dir + Option::dir_sep + decl_dir); - } - t << decl << ": " << (*it) << " " << deps << "\n\t" + } + impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); + decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); + if(decl_dir.isEmpty()) + decl_dir = decl.section(Option::dir_sep,0,-2); + if(impl_dir.isEmpty()) + impl_dir = impl.section(Option::dir_sep,0,-2); + if (QDir::isRelativePath(impl_dir)) + impl_dir.prepend(Option::output_dir + Option::dir_sep); + if (QDir::isRelativePath(decl_dir)) + decl_dir.prepend(Option::output_dir + Option::dir_sep); + createDir(impl_dir); + createDir(decl_dir); + } + QStringList deps = findDependencies((*it)); + deps.remove(decl); //avoid circular dependencies.. + t << decl << ": " << (*it) << " " << deps.join(" \\\n\t\t") << "\n\t" << "$(UIC) " << (*it) << " -o " << decl << endl << endl; @@ -1460,8 +1624,8 @@ MakefileGenerator::writeUicSrc(QTextStream &t, const QString &ui) QString mildDecl = decl; - int k = mildDecl.findRev( Option::dir_sep ); + int k = mildDecl.findRev(Option::dir_sep); if ( k != -1 ) mildDecl = mildDecl.mid( k + 1 ); - - t << impl << ": " << decl << " " << (*it) << " " << deps << "\n\t" - << "$(UIC) " << (*it) << " -i " << mildDecl << " -o " << impl << endl << endl; + t << impl << ": " << decl << " " << (*it) << " " << deps.join(" \\\n\t\t") << "\n\t" + << "$(UIC)"; + t << " " << (*it) << " -i " << mildDecl << " -o " << impl << endl << endl; } @@ -1479,3 +1643,4 @@ MakefileGenerator::writeMocObj(QTextStream &t, const QString &obj, const QString QString hdr = findMocSource((*sit)); - t << (*oit) << ": " << (*sit) << " " + t << (*oit) << ": " + << (*sit) << " " << findDependencies((*sit)).join(" \\\n\t\t") << " " << hdr << " " << findDependencies(hdr).join(" \\\n\t\t"); @@ -1492,4 +1657,4 @@ MakefileGenerator::writeMocObj(QTextStream &t, const QString &obj, const QString if (!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { - QString p = var("QMAKE_RUN_CXX"); - p.replace(stringSrc, (*sit)); + QString p = var("QMAKE_RUN_CXX"), srcf(*sit); + p.replace(stringSrc, srcf); p.replace(stringObj, (*oit)); @@ -1514,3 +1679,4 @@ MakefileGenerator::writeMocSrc(QTextStream &t, const QString &src) t << m << ": " << deps << "\n\t" - << "$(MOC) " << (*it) << " -o " << m << endl << endl; + << "$(MOC)"; + t << " " << (*it) << " -o " << m << endl << endl; } @@ -1547,3 +1713,6 @@ MakefileGenerator::writeYaccSrc(QTextStream &t, const QString &src) mangle = fi.baseName(TRUE); - yaccflags += " -p " + mangle; + if(!project->isEmpty("QMAKE_YACCFLAGS_MANGLE")) + yaccflags += " " + var("QMAKE_YACCFLAGS_MANGLE").replace(stringBase, mangle); + else + yaccflags += " -p " + mangle; } @@ -1623,5 +1792,5 @@ MakefileGenerator::writeImageObj(QTextStream &t, const QString &obj) if(!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { - QString p = var("QMAKE_RUN_CXX"); - p.replace( stringSrc, src); - p.replace( stringObj, (*oit)); + QString p = var("QMAKE_RUN_CXX"), srcf(src); + p.replace(stringSrc, srcf); + p.replace(stringObj, (*oit)); t << "\n\t" << p; @@ -1663,3 +1832,4 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) QString pvar = (*it) + ".path"; - if(project->variables()[pvar].isEmpty()) { + if(project->variables()[(*it) + ".CONFIG"].findIndex("no_path") == -1 && + project->variables()[pvar].isEmpty()) { warn_msg(WarnLogic, "%s is not defined: install target not created\n", pvar.latin1()); @@ -1671,9 +1841,9 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) QString target, dst= fileFixify(project->variables()[pvar].first()); -#ifndef Q_WS_WIN if(dst.right(1) != Option::dir_sep) dst += Option::dir_sep; -#endif - QStringList tmp, &uninst = project->variables()[(*it) + ".uninstall"]; + QStringList tmp, uninst = project->variables()[(*it) + ".uninstall"]; //other tmp = project->variables()[(*it) + ".extra"]; + if(tmp.isEmpty()) + tmp = project->variables()[(*it) + ".commands"]; //to allow compatible name if(!tmp.isEmpty()) { @@ -1705,7 +1875,12 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) target += "\t"; - target += QString(fi.isDir() ? "-$(COPY_DIR)" : "-$(COPY_FILE)") + " \"" + - Option::fixPathToTargetOS(fileFixify(wild), FALSE) + "\" \"" + root + dst + "\"\n"; + QString cmd = QString(fi.isDir() ? "-$(INSTALL_DIR)" : "-$(INSTALL_FILE)") + " \"" + + Option::fixPathToTargetOS(fileFixify(wild, QString::null, + QString::null, FALSE, FALSE), FALSE) + + "\" \"" + root + dst + "\"\n"; + target += cmd; if(!project->isActiveConfig("debug") && !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) - target += QString("\t-") + var("QMAKE_STRIP") + " \"" + root + fileFixify(dst + filestr) + "\"\n"; + target += QString("\t-") + var("QMAKE_STRIP") + " \"" + + root + fileFixify(dst + filestr, QString::null, QString::null, FALSE, FALSE) + + "\"\n"; if(!uninst.isEmpty()) @@ -1718,5 +1893,6 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) #endif - + " \"" + root + fileFixify(dst + filestr) + "\""); + + " \"" + root + fileFixify(dst + filestr, QString::null, QString::null, FALSE, FALSE) + "\""); continue; } + fixEnvVariables(dirstr); QDir dir(dirstr, filestr); //wild @@ -1734,12 +1910,17 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) #endif - + " \"" + root + fileFixify(dst + file) + "\""); - QFileInfo fi(file); + + " \"" + root + fileFixify(dst + file, QString::null, QString::null, FALSE, FALSE) + + "\""); + QFileInfo fi(Option::fixPathToTargetOS(fileFixify(dirstr + file), TRUE)); if(!target.isEmpty()) target += "\t"; - target += QString(fi.isDir() ? "-$(COPY_DIR)" : "-$(COPY_FILE)") + " \"" + - Option::fixPathToTargetOS(fileFixify(dirstr + file), FALSE) + - "\" \"" + root + fileFixify(dst) + "\"\n"; + QString cmd = QString(fi.isDir() ? "-$(INSTALL_DIR)" : "-$(INSTALL_FILE)") + " \"" + + Option::fixPathToTargetOS(fileFixify(dirstr + file, QString::null, + QString::null, FALSE, FALSE), FALSE) + + "\" \"" + root + dst + "\"\n"; + target += cmd; if(!project->isActiveConfig("debug") && !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) - target += QString("\t-") + var("QMAKE_STRIP") + " \"" + root + fileFixify(dst + file) + "\"\n"; + target += QString("\t-") + var("QMAKE_STRIP") + " \"" + + root + fileFixify(dst + file, QString::null, QString::null, FALSE, FALSE) + + "\"\n"; } @@ -1748,7 +1929,19 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) //default? - if(do_default) + if(do_default) { target = defaultInstall((*it)); + uninst = project->variables()[(*it) + ".uninstall"]; + } if(!target.isEmpty()) { - t << "install_" << (*it) << ": " << "\n\t"; + t << "install_" << (*it) << ": all "; + const QStringList &deps = project->variables()[(*it) + ".depends"]; + if(!deps.isEmpty()) { + for(QStringList::ConstIterator dep_it = deps.begin(); dep_it != deps.end(); ++dep_it) { + QString targ = var((*dep_it) + ".target"); + if(targ.isEmpty()) + targ = (*dep_it); + t << targ; + } + } + t << "\n\t"; const QStringList &dirs = project->variables()[pvar]; @@ -1763,3 +1956,2 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) t << target << endl << endl; - all_installs += QString("install_") + (*it) + " "; if(!uninst.isEmpty()) { @@ -1768,5 +1960,10 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) << "-$(DEL_DIR) \"" << ( root + dst ) << "\"" << endl << endl; - all_uninstalls += "uninstall_" + (*it) + " "; } t << endl; + + if(project->variables()[(*it) + ".CONFIG"].findIndex("no_default_install") == -1) { + all_installs += QString("install_") + (*it) + " "; + if(!uninst.isEmpty()) + all_uninstalls += "uninstall_" + (*it) + " "; + } } else { @@ -1775,4 +1972,4 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) } - t << "install: all " << all_installs << "\n\n"; - t << "uninstall: " << all_uninstalls << "\n\n"; + t << "install: " << all_installs << " " << var("INSTALLDEPS") << "\n\n"; + t << "uninstall: " << all_uninstalls << " " << var("UNINSTALLDEPS") << "\n\n"; } @@ -1973,4 +2170,8 @@ MakefileGenerator::writeMakeQmake(QTextStream &t) t << fileFixify(Option::mkfile::cachefile) << " "; - if(!specdir().isEmpty()) - t << specdir() << Option::dir_sep << "qmake.conf" << " "; + if(!specdir().isEmpty()) { + if (QFile::exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"qmake.conf"))) + t << specdir() << Option::dir_sep << "qmake.conf" << " "; + else if (QFile::exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"tmake.conf"))) + t << specdir() << Option::dir_sep << "tmake.conf" << " "; + } t << project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].join(" \\\n\t\t") << "\n\t" @@ -1988,3 +2189,4 @@ MakefileGenerator::writeMakeQmake(QTextStream &t) QStringList -MakefileGenerator::fileFixify(const QStringList& files, const QString &out_dir, const QString &in_dir, bool force_fix) const +MakefileGenerator::fileFixify(const QStringList& files, const QString &out_dir, const QString &in_dir, + bool force_fix, bool canon) const { @@ -1995,3 +2197,3 @@ MakefileGenerator::fileFixify(const QStringList& files, const QString &out_dir, if(!(*it).isEmpty()) - ret << fileFixify((*it), out_dir, in_dir, force_fix); + ret << fileFixify((*it), out_dir, in_dir, force_fix, canon); } @@ -2001,10 +2203,14 @@ MakefileGenerator::fileFixify(const QStringList& files, const QString &out_dir, QString -MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const QString &in_d, bool force_fix) const +MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, + const QString &in_d, bool force_fix, bool canon) const { - if(file0.isEmpty()) + if(file0.isEmpty()) return file0; QString key = file0; - if(!in_d.isEmpty() || !out_d.isEmpty() || force_fix) - key.prepend(in_d + "--" + out_d + "--" + QString::number((int)force_fix) + "-"); - if(fileFixed.contains(key)) + if(QDir::isRelativePath(file0)) + key.prepend(QDir::currentDirPath() + "--"); + if(!in_d.isEmpty() || !out_d.isEmpty() || force_fix || !canon) + key.prepend(in_d + "--" + out_d + "--" + QString::number((int)force_fix) + "--" + + QString::number((int)canon) + "-"); + if(fileFixed.contains(key)) return fileFixed[key]; @@ -2029,3 +2235,3 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) { //absoluteify it - QString qfile = Option::fixPathToLocalOS(file); + QString qfile = Option::fixPathToLocalOS(file, TRUE, canon); if(QDir::isRelativePath(file)) { //already absolute @@ -2037,10 +2243,13 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const } else { //fix it.. - QString qfile(Option::fixPathToLocalOS(file, TRUE)), in_dir(in_d), out_dir(out_d); + QString qfile(Option::fixPathToLocalOS(file, TRUE, canon)), in_dir(in_d), out_dir(out_d); { - if(out_dir.isNull()) - out_dir = Option::output_dir; + if(out_dir.isNull() || QDir::isRelativePath(out_dir)) + out_dir.prepend(Option::output_dir + QDir::separator()); if(out_dir == ".") out_dir = QDir::currentDirPath(); - if(in_dir.isEmpty() || in_dir == ".") + if(in_dir.isEmpty() || QDir::isRelativePath(in_dir)) + in_dir.prepend(QDir::currentDirPath() + QDir::separator()); + if(in_dir == ".") in_dir = QDir::currentDirPath(); + if(!QDir::isRelativePath(in_dir) || !QDir::isRelativePath(out_dir)) { @@ -2067,4 +2276,4 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const } - file = Option::fixPathToTargetOS(file, FALSE); - if(QFile::exists(file) && file == Option::fixPathToTargetOS(file, TRUE)) { + file = Option::fixPathToTargetOS(file, FALSE, canon); + if(canon && QFile::exists(file) && file == Option::fixPathToTargetOS(file, TRUE, canon)) { QString real_file = QDir(file).canonicalPath(); @@ -2073,3 +2282,3 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const } - QString match_dir = Option::fixPathToTargetOS(out_dir, FALSE); + QString match_dir = Option::fixPathToTargetOS(out_dir, FALSE, canon); if(file == match_dir) { @@ -2102,3 +2311,3 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const } - file = Option::fixPathToTargetOS(file, FALSE); + file = Option::fixPathToTargetOS(file, FALSE, canon); if(file.isEmpty()) @@ -2107,3 +2316,4 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const file = quote + file + quote; - debug_msg(3, "Fixed %s :: to :: %s (%d)", orig_file.latin1(), file.latin1(), depth); + debug_msg(3, "Fixed %s :: to :: %s (%d) [%s::%s]", orig_file.latin1(), file.latin1(), depth, + in_d.latin1(), out_d.latin1()); ((MakefileGenerator*)this)->fileFixed.insert(key, file); @@ -2140,2 +2350,27 @@ void MakefileGenerator::logicWarn(const QString &f, const QString &w) +QString +MakefileGenerator::dependencyKey(const QString &file) const +{ + QString key = file; + Option::fixPathToTargetOS(key); + if(key.find(Option::dir_sep)) + key = key.right(key.length() - key.findRev(Option::dir_sep) - 1); + return key; +} + +void +MakefileGenerator::setProcessedDependencies(const QString &file, bool b) +{ + depProcessed[dependencyKey(file)] = b; +} + +bool +MakefileGenerator::processedDependencies(const QString &file) +{ + QString key = dependencyKey(file); + if(!depProcessed.contains(key)) + return FALSE; + return depProcessed[key]; +} + QStringList @@ -2143,9 +2378,3 @@ QStringList { - QString key = file; - Option::fixPathToTargetOS(key); - if(key.find(Option::dir_sep)) - key = key.right(key.length() - key.findRev(Option::dir_sep) - 1); - if(!depKeyMap.contains(key)) - depKeyMap.insert(key, file); - return depends[key]; + return depends[dependencyKey(file)]; } @@ -2159,4 +2388,4 @@ MakefileGenerator::specdir() spec = Option::mkfile::qmakespec; - const char *d = getenv("QTDIR"); - if(d) { +#if 0 + if(const char *d = getenv("QTDIR")) { QString qdir = Option::fixPathToTargetOS(QString(d)); @@ -2174,2 +2403,5 @@ MakefileGenerator::specdir() } +#else + spec = Option::fixPathToTargetOS(spec); +#endif return spec; @@ -2183,2 +2415,4 @@ MakefileGenerator::openOutput(QFile &file) const if(!file.name().isEmpty()) { + if(QDir::isRelativePath(file.name())) + file.setName(Option::output_dir + file.name()); //pwd when qmake was run QFileInfo fi(file); |