author | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
commit | 155d68c1e7d7dc0fed2534ac43d6d77ce2781f55 (patch) (unidiff) | |
tree | e6edaa5a7040fe6c224c3943d1094dcf02e4f74c /qmake/generators/projectgenerator.cpp | |
parent | 86703e8a5527ef114facd02c005b6b3a7e62e263 (diff) | |
download | opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.zip opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.gz opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.bz2 |
update qmake to 1.05a
Diffstat (limited to 'qmake/generators/projectgenerator.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/projectgenerator.cpp | 64 |
1 files changed, 42 insertions, 22 deletions
diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index 5ff6250..1515216 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp | |||
@@ -42,6 +42,22 @@ | |||
42 | #include <qfileinfo.h> | 42 | #include <qfileinfo.h> |
43 | #include <qregexp.h> | 43 | #include <qregexp.h> |
44 | 44 | ||
45 | QString project_builtin_regx() //calculate the builtin regular expression.. | ||
46 | { | ||
47 | QString ret; | ||
48 | QStringList builtin_exts(".c"); | ||
49 | builtin_exts << Option::ui_ext << Option::yacc_ext << Option::lex_ext << ".ts"; | ||
50 | builtin_exts += Option::h_ext + Option::cpp_ext; | ||
51 | for(QStringList::Iterator ext_it = builtin_exts.begin(); | ||
52 | ext_it != builtin_exts.end(); ++ext_it) { | ||
53 | if(!ret.isEmpty()) | ||
54 | ret += "; "; | ||
55 | ret += QString("*") + (*ext_it); | ||
56 | } | ||
57 | return ret; | ||
58 | } | ||
59 | |||
60 | |||
45 | 61 | ||
46 | ProjectGenerator::ProjectGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE) | 62 | ProjectGenerator::ProjectGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE) |
47 | { | 63 | { |
@@ -67,21 +83,13 @@ ProjectGenerator::init() | |||
67 | 83 | ||
68 | //the scary stuff | 84 | //the scary stuff |
69 | if(project->first("TEMPLATE_ASSIGN") != "subdirs") { | 85 | if(project->first("TEMPLATE_ASSIGN") != "subdirs") { |
70 | QString builtin_regex; | 86 | QString builtin_regex = project_builtin_regx(); |
71 | { //calculate the builtin regular expression.. | ||
72 | QStringList builtin_exts(".c"); | ||
73 | builtin_exts << Option::ui_ext << Option::yacc_ext << Option::lex_ext; | ||
74 | builtin_exts += Option::h_ext + Option::cpp_ext; | ||
75 | for(QStringList::Iterator ext_it = builtin_exts.begin(); | ||
76 | ext_it != builtin_exts.end(); ++ext_it) { | ||
77 | if(!builtin_regex.isEmpty()) | ||
78 | builtin_regex += "; "; | ||
79 | builtin_regex += QString("*") + (*ext_it); | ||
80 | } | ||
81 | } | ||
82 | QStringList dirs = Option::projfile::project_dirs; | 87 | QStringList dirs = Option::projfile::project_dirs; |
83 | if(Option::projfile::do_pwd) | 88 | if(Option::projfile::do_pwd) { |
89 | if(!v["INCLUDEPATH"].contains(".")) | ||
90 | v["INCLUDEPATH"] += "."; | ||
84 | dirs.prepend(QDir::currentDirPath()); | 91 | dirs.prepend(QDir::currentDirPath()); |
92 | } | ||
85 | 93 | ||
86 | for(QStringList::Iterator pd = dirs.begin(); pd != dirs.end(); pd++) { | 94 | for(QStringList::Iterator pd = dirs.begin(); pd != dirs.end(); pd++) { |
87 | QString dir, regex; | 95 | QString dir, regex; |
@@ -140,9 +148,8 @@ ProjectGenerator::init() | |||
140 | } | 148 | } |
141 | if(add_depend && !dir.isEmpty() && !v["DEPENDPATH"].contains(dir)) { | 149 | if(add_depend && !dir.isEmpty() && !v["DEPENDPATH"].contains(dir)) { |
142 | QFileInfo fi(dir); | 150 | QFileInfo fi(dir); |
143 | if(fi.absFilePath() != QDir::currentDirPath()) { | 151 | if(fi.absFilePath() != QDir::currentDirPath()) |
144 | v["DEPENDPATH"] += fileFixify(dir); | 152 | v["DEPENDPATH"] += fileFixify(dir); |
145 | } | ||
146 | } | 153 | } |
147 | } | 154 | } |
148 | } | 155 | } |
@@ -241,12 +248,19 @@ ProjectGenerator::init() | |||
241 | QStringList &tmp = findDependencies((*val_it)); | 248 | QStringList &tmp = findDependencies((*val_it)); |
242 | if(!tmp.isEmpty()) { | 249 | if(!tmp.isEmpty()) { |
243 | for(QStringList::Iterator dep_it = tmp.begin(); dep_it != tmp.end(); ++dep_it) { | 250 | for(QStringList::Iterator dep_it = tmp.begin(); dep_it != tmp.end(); ++dep_it) { |
244 | QString file_no_path = (*dep_it).right( | 251 | QString file_dir = (*dep_it).section(Option::dir_sep, 0, -2), |
245 | (*dep_it).length() - ((*dep_it).findRev(Option::dir_sep)+1)); | 252 | file_no_path = (*dep_it).section(Option::dir_sep, -1); |
253 | if(!file_dir.isEmpty()) { | ||
254 | for(MakefileDependDir *mdd = deplist.first(); mdd; mdd = deplist.next()) { | ||
255 | if(mdd->local_dir == file_dir && !v["INCLUDEPATH"].contains(mdd->real_dir)) | ||
256 | v["INCLUDEPATH"] += mdd->real_dir; | ||
257 | } | ||
258 | } | ||
246 | if(no_qt_files && file_no_path.find(QRegExp("^q[a-z_0-9].h$")) != -1) | 259 | if(no_qt_files && file_no_path.find(QRegExp("^q[a-z_0-9].h$")) != -1) |
247 | no_qt_files = FALSE; | 260 | no_qt_files = FALSE; |
248 | QString h_ext; | 261 | QString h_ext; |
249 | for(QStringList::Iterator hit = Option::h_ext.begin(); hit != Option::h_ext.end(); ++hit) { | 262 | for(QStringList::Iterator hit = Option::h_ext.begin(); |
263 | hit != Option::h_ext.end(); ++hit) { | ||
250 | if((*dep_it).endsWith((*hit))) { | 264 | if((*dep_it).endsWith((*hit))) { |
251 | h_ext = (*hit); | 265 | h_ext = (*hit); |
252 | break; | 266 | break; |
@@ -260,11 +274,13 @@ ProjectGenerator::init() | |||
260 | } | 274 | } |
261 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); | 275 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
262 | cppit != Option::cpp_ext.end(); ++cppit) { | 276 | cppit != Option::cpp_ext.end(); ++cppit) { |
263 | QString src((*dep_it).left((*dep_it).length() - h_ext.length()) + (*cppit)); | 277 | QString src((*dep_it).left((*dep_it).length() - h_ext.length()) + |
278 | (*cppit)); | ||
264 | if(QFile::exists(src)) { | 279 | if(QFile::exists(src)) { |
265 | bool exists = FALSE; | 280 | bool exists = FALSE; |
266 | QStringList &srcl = v["SOURCES"]; | 281 | QStringList &srcl = v["SOURCES"]; |
267 | for(QStringList::Iterator src_it = srcl.begin(); src_it != srcl.end(); ++src_it) { | 282 | for(QStringList::Iterator src_it = srcl.begin(); |
283 | src_it != srcl.end(); ++src_it) { | ||
268 | if((*src_it).lower() == src.lower()) { | 284 | if((*src_it).lower() == src.lower()) { |
269 | exists = TRUE; | 285 | exists = TRUE; |
270 | break; | 286 | break; |
@@ -337,14 +353,16 @@ ProjectGenerator::writeMakefile(QTextStream &t) | |||
337 | t << getWritableVar("TARGET") | 353 | t << getWritableVar("TARGET") |
338 | << getWritableVar("CONFIG", FALSE) | 354 | << getWritableVar("CONFIG", FALSE) |
339 | << getWritableVar("CONFIG_REMOVE", FALSE) | 355 | << getWritableVar("CONFIG_REMOVE", FALSE) |
340 | << getWritableVar("DEPENDPATH") << endl; | 356 | << getWritableVar("DEPENDPATH") |
357 | << getWritableVar("INCLUDEPATH") << endl; | ||
341 | 358 | ||
342 | t << "# Input" << "\n"; | 359 | t << "# Input" << "\n"; |
343 | t << getWritableVar("HEADERS") | 360 | t << getWritableVar("HEADERS") |
344 | << getWritableVar("INTERFACES") | 361 | << getWritableVar("INTERFACES") |
345 | << getWritableVar("LEXSOURCES") | 362 | << getWritableVar("LEXSOURCES") |
346 | << getWritableVar("YACCSOURCES") | 363 | << getWritableVar("YACCSOURCES") |
347 | << getWritableVar("SOURCES"); | 364 | << getWritableVar("SOURCES") |
365 | << getWritableVar("TRANSLATIONS"); | ||
348 | } | 366 | } |
349 | for(it = Option::after_user_vars.begin(); it != Option::after_user_vars.end(); ++it) | 367 | for(it = Option::after_user_vars.begin(); it != Option::after_user_vars.end(); ++it) |
350 | t << (*it) << endl; | 368 | t << (*it) << endl; |
@@ -403,6 +421,8 @@ ProjectGenerator::addFile(QString file) | |||
403 | where = "LEXSOURCES"; | 421 | where = "LEXSOURCES"; |
404 | else if(file.endsWith(Option::yacc_ext)) | 422 | else if(file.endsWith(Option::yacc_ext)) |
405 | where = "YACCSOURCES"; | 423 | where = "YACCSOURCES"; |
424 | else if(file.endsWith(".ts")) | ||
425 | where = "TRANSLATIONS"; | ||
406 | } | 426 | } |
407 | 427 | ||
408 | QString newfile = fileFixify(file); | 428 | QString newfile = fileFixify(file); |