author | zecke <zecke> | 2004-07-15 17:36:57 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-15 17:36:57 (UTC) |
commit | 323e9a7472a110b4befba7320540263147505bae (patch) (unidiff) | |
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,22 +1,20 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of MakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
@@ -28,62 +26,63 @@ | |||
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "makefile.h" | 36 | #include "makefile.h" |
39 | #include "option.h" | 37 | #include "option.h" |
38 | #include "meta.h" | ||
40 | #include <qdir.h> | 39 | #include <qdir.h> |
41 | #include <qfile.h> | 40 | #include <qfile.h> |
42 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
43 | #include <qregexp.h> | 42 | #include <qregexp.h> |
44 | #include <qdict.h> | 43 | #include <qdict.h> |
45 | #if defined(Q_OS_UNIX) | 44 | #if defined(Q_OS_UNIX) |
46 | #include <unistd.h> | 45 | #include <unistd.h> |
47 | #else | 46 | #else |
48 | #include <io.h> | 47 | #include <io.h> |
49 | #endif | 48 | #endif |
50 | #include <stdio.h> | 49 | #include <stdio.h> |
51 | #include <stdlib.h> | 50 | #include <stdlib.h> |
52 | #include <time.h> | 51 | #include <time.h> |
53 | #include <fcntl.h> | 52 | #include <fcntl.h> |
54 | #include <sys/types.h> | 53 | #include <sys/types.h> |
55 | #include <sys/stat.h> | 54 | #include <sys/stat.h> |
56 | 55 | ||
57 | // Well, Windows doesn't have this, so here's the macro | 56 | // Well, Windows doesn't have this, so here's the macro |
58 | #ifndef S_ISDIR | 57 | #ifndef S_ISDIR |
59 | #define S_ISDIR(m)(((m) & S_IFMT) == S_IFDIR) | 58 | #define S_ISDIR(m)(((m) & S_IFMT) == S_IFDIR) |
60 | #endif | 59 | #endif |
60 | #define QMAKE_EOL(x) (x == '\r' || x == '\n') | ||
61 | 61 | ||
62 | static QString mkdir_p_asstring(const QString &dir) | 62 | QString mkdir_p_asstring(const QString &dir) |
63 | { | 63 | { |
64 | QString ret = "@$(CHK_DIR_EXISTS) \"" + dir + "\" "; | 64 | QString ret = "@$(CHK_DIR_EXISTS) \"" + dir + "\" "; |
65 | if(Option::target_mode == Option::TARG_WIN_MODE) | 65 | if(Option::target_mode == Option::TARG_WIN_MODE) |
66 | ret += "$(MKDIR)"; | 66 | ret += "$(MKDIR)"; |
67 | else | 67 | else |
68 | ret += "|| $(MKDIR)"; | 68 | ret += "|| $(MKDIR)"; |
69 | ret += " \"" + dir + "\""; | 69 | ret += " \"" + dir + "\""; |
70 | return ret; | 70 | return ret; |
71 | } | 71 | } |
72 | 72 | ||
73 | static bool createDir(const QString& fullPath) | 73 | static bool createDir(const QString& fullPath) |
74 | { | 74 | { |
75 | if(QFile::exists(fullPath)) | 75 | if(QFile::exists(fullPath)) |
76 | return FALSE; | 76 | return FALSE; |
77 | |||
78 | QDir dirTmp; | 77 | QDir dirTmp; |
79 | bool ret = TRUE; | 78 | bool ret = TRUE; |
80 | QString pathComponent, tmpPath; | 79 | QString pathComponent, tmpPath; |
81 | QStringList hierarchy = QStringList::split(QString(Option::dir_sep), fullPath, TRUE); | 80 | QStringList hierarchy = QStringList::split(QString(Option::dir_sep), fullPath, TRUE); |
82 | for(QStringList::Iterator it = hierarchy.begin(); it != hierarchy.end(); ++it) { | 81 | for(QStringList::Iterator it = hierarchy.begin(); it != hierarchy.end(); ++it) { |
83 | pathComponent = *it + QDir::separator(); | 82 | pathComponent = *it + QDir::separator(); |
84 | tmpPath += pathComponent; | 83 | tmpPath += pathComponent; |
85 | if(!dirTmp.mkdir(tmpPath)) { | 84 | if(!dirTmp.mkdir(tmpPath)) { |
86 | ret = FALSE; | 85 | ret = FALSE; |
87 | // break; | 86 | // break; |
88 | } | 87 | } |
89 | } | 88 | } |
@@ -133,43 +132,43 @@ MakefileGenerator::generateMocList(const QString &fn_target) | |||
133 | bool ignore_qobject = FALSE; | 132 | bool ignore_qobject = FALSE; |
134 | int line_count = 1; | 133 | int line_count = 1; |
135 | /* qmake ignore Q_OBJECT */ | 134 | /* qmake ignore Q_OBJECT */ |
136 | #define COMP_LEN 8 //strlen("Q_OBJECT") | 135 | #define COMP_LEN 8 //strlen("Q_OBJECT") |
137 | #define OBJ_LEN 8 //strlen("Q_OBJECT") | 136 | #define OBJ_LEN 8 //strlen("Q_OBJECT") |
138 | #define DIS_LEN 10 //strlen("Q_DISPATCH") | 137 | #define DIS_LEN 10 //strlen("Q_DISPATCH") |
139 | int x; | 138 | int x; |
140 | for(x = 0; x < (total_size_read-COMP_LEN); x++) { | 139 | for(x = 0; x < (total_size_read-COMP_LEN); x++) { |
141 | if(*(big_buffer + x) == '/') { | 140 | if(*(big_buffer + x) == '/') { |
142 | x++; | 141 | x++; |
143 | if(total_size_read >= x) { | 142 | if(total_size_read >= x) { |
144 | if(*(big_buffer + x) == '/') { //c++ style comment | 143 | if(*(big_buffer + x) == '/') { //c++ style comment |
145 | for( ;x < total_size_read && *(big_buffer + x) != '\n'; x++); | 144 | for( ;x < total_size_read && !QMAKE_EOL(*(big_buffer + x)); x++); |
146 | line_count++; | 145 | line_count++; |
147 | } else if(*(big_buffer + x) == '*') { //c style comment | 146 | } else if(*(big_buffer + x) == '*') { //c style comment |
148 | for( ;x < total_size_read; x++) { | 147 | for( ;x < total_size_read; x++) { |
149 | if(*(big_buffer + x) == 't' || *(big_buffer + x) == 'q') { //ignore | 148 | if(*(big_buffer + x) == 't' || *(big_buffer + x) == 'q') { //ignore |
150 | if(total_size_read >= (x + 20)) { | 149 | if(total_size_read >= (x + 20)) { |
151 | if(!strncmp(big_buffer + x + 1, "make ignore Q_OBJECT", 20)) { | 150 | if(!strncmp(big_buffer + x + 1, "make ignore Q_OBJECT", 20)) { |
152 | debug_msg(2, "Mocgen: %s:%d Found \"qmake ignore Q_OBJECT\"", | 151 | debug_msg(2, "Mocgen: %s:%d Found \"qmake ignore Q_OBJECT\"", |
153 | fn_target.latin1(), line_count); | 152 | fn_target.latin1(), line_count); |
154 | x += 20; | 153 | x += 20; |
155 | ignore_qobject = TRUE; | 154 | ignore_qobject = TRUE; |
156 | } | 155 | } |
157 | } | 156 | } |
158 | } else if(*(big_buffer + x) == '*') { | 157 | } else if(*(big_buffer + x) == '*') { |
159 | if(total_size_read >= (x+1) && *(big_buffer + (x+1)) == '/') { | 158 | if(total_size_read >= (x+1) && *(big_buffer + (x+1)) == '/') { |
160 | x += 2; | 159 | x += 2; |
161 | break; | 160 | break; |
162 | } | 161 | } |
163 | } else if(*(big_buffer + x) == '\n') { | 162 | } else if(QMAKE_EOL(*(big_buffer + x))) { |
164 | line_count++; | 163 | line_count++; |
165 | } | 164 | } |
166 | } | 165 | } |
167 | } | 166 | } |
168 | } | 167 | } |
169 | } | 168 | } |
170 | #define SYMBOL_CHAR(x) ((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z') || \ | 169 | #define SYMBOL_CHAR(x) ((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z') || \ |
171 | (x <= '0' && x >= '9') || x == '_') | 170 | (x <= '0' && x >= '9') || x == '_') |
172 | 171 | ||
173 | bool interesting = *(big_buffer+x) == 'Q' && (!strncmp(big_buffer+x, "Q_OBJECT", OBJ_LEN) || | 172 | bool interesting = *(big_buffer+x) == 'Q' && (!strncmp(big_buffer+x, "Q_OBJECT", OBJ_LEN) || |
174 | !strncmp(big_buffer+x, "Q_DISPATCH", DIS_LEN)); | 173 | !strncmp(big_buffer+x, "Q_DISPATCH", DIS_LEN)); |
175 | if(interesting) { | 174 | if(interesting) { |
@@ -178,83 +177,85 @@ MakefileGenerator::generateMocList(const QString &fn_target) | |||
178 | if(ignore_qobject) { | 177 | if(ignore_qobject) { |
179 | debug_msg(2, "Mocgen: %s:%d Ignoring Q_OBJECT", fn_target.latin1(), line_count); | 178 | debug_msg(2, "Mocgen: %s:%d Ignoring Q_OBJECT", fn_target.latin1(), line_count); |
180 | interesting = FALSE; | 179 | interesting = FALSE; |
181 | } | 180 | } |
182 | len=OBJ_LEN; | 181 | len=OBJ_LEN; |
183 | } else if(!strncmp(big_buffer+x, "Q_DISPATCH", DIS_LEN)) { | 182 | } else if(!strncmp(big_buffer+x, "Q_DISPATCH", DIS_LEN)) { |
184 | len=DIS_LEN; | 183 | len=DIS_LEN; |
185 | } | 184 | } |
186 | if(SYMBOL_CHAR(*(big_buffer+x+len))) | 185 | if(SYMBOL_CHAR(*(big_buffer+x+len))) |
187 | interesting = FALSE; | 186 | interesting = FALSE; |
188 | if(interesting) { | 187 | if(interesting) { |
189 | *(big_buffer+x+len) = '\0'; | 188 | *(big_buffer+x+len) = '\0'; |
190 | debug_msg(2, "Mocgen: %s:%d Found MOC symbol %s", fn_target.latin1(), | 189 | debug_msg(2, "Mocgen: %s:%d Found MOC symbol %s", fn_target.latin1(), |
191 | line_count, big_buffer+x); | 190 | line_count, big_buffer+x); |
192 | 191 | ||
193 | int ext_pos = fn_target.findRev('.'); | 192 | int ext_pos = fn_target.findRev('.'); |
194 | int ext_len = fn_target.length() - ext_pos; | 193 | int ext_len = fn_target.length() - ext_pos; |
195 | int dir_pos = fn_target.findRev(Option::dir_sep, ext_pos); | 194 | int dir_pos = fn_target.findRev(Option::dir_sep, ext_pos); |
196 | QString mocFile; | 195 | QString mocFile; |
197 | if(!project->isEmpty("MOC_DIR")) | 196 | if(!project->isEmpty("MOC_DIR")) |
198 | mocFile = project->first("MOC_DIR"); | 197 | mocFile = project->first("MOC_DIR"); |
199 | else if(dir_pos != -1) | 198 | else if(dir_pos != -1) |
200 | mocFile = fn_target.left(dir_pos+1); | 199 | mocFile = fn_target.left(dir_pos+1); |
201 | 200 | ||
202 | bool cpp_ext = FALSE; | 201 | bool cpp_ext = FALSE; |
203 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); | 202 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
204 | cppit != Option::cpp_ext.end(); ++cppit) { | 203 | cppit != Option::cpp_ext.end(); ++cppit) { |
205 | if((cpp_ext = (fn_target.right(ext_len) == (*cppit)))) | 204 | if((cpp_ext = (fn_target.right(ext_len) == (*cppit)))) |
206 | break; | 205 | break; |
207 | } | 206 | } |
208 | if(cpp_ext) { | 207 | if(cpp_ext) { |
209 | mocFile += fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + Option::moc_ext; | 208 | mocFile += Option::cpp_moc_mod + fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + Option::cpp_moc_ext; |
210 | project->variables()["_SRCMOC"].append(mocFile); | 209 | project->variables()["_SRCMOC"].append(mocFile); |
211 | } else if(project->variables()["HEADERS"].findIndex(fn_target) != -1) { | 210 | } else if(project->variables()["HEADERS"].findIndex(fn_target) != -1) { |
212 | for(QStringList::Iterator hit = Option::h_ext.begin(); | 211 | for(QStringList::Iterator hit = Option::h_ext.begin(); |
213 | hit != Option::h_ext.end(); ++hit) { | 212 | hit != Option::h_ext.end(); ++hit) { |
214 | if((fn_target.right(ext_len) == (*hit))) { | 213 | if((fn_target.right(ext_len) == (*hit))) { |
215 | mocFile += Option::moc_mod + fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + | 214 | mocFile += Option::h_moc_mod + fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + |
216 | Option::cpp_ext.first(); | 215 | Option::h_moc_ext; |
217 | logicWarn(mocFile, "SOURCES"); | 216 | logicWarn(mocFile, "SOURCES"); |
218 | project->variables()["_HDRMOC"].append(mocFile); | 217 | project->variables()["_HDRMOC"].append(mocFile); |
219 | break; | 218 | break; |
220 | } | 219 | } |
221 | } | 220 | } |
222 | } | 221 | } |
223 | 222 | ||
224 | if(!mocFile.isEmpty()) { | 223 | if(!mocFile.isEmpty()) { |
225 | mocFile = Option::fixPathToTargetOS(mocFile); | 224 | mocFile = Option::fixPathToTargetOS(mocFile); |
226 | mocablesToMOC[cleanFilePath(fn_target)] = mocFile; | 225 | mocablesToMOC[cleanFilePath(fn_target)] = mocFile; |
227 | mocablesFromMOC[cleanFilePath(mocFile)] = fn_target; | 226 | mocablesFromMOC[cleanFilePath(mocFile)] = fn_target; |
228 | } | 227 | } |
229 | break; | 228 | break; |
230 | } | 229 | } |
231 | } | 230 | } |
232 | 231 | ||
233 | while(x < total_size_read && SYMBOL_CHAR(*(big_buffer+x))) | 232 | while(x < total_size_read && SYMBOL_CHAR(*(big_buffer+x))) |
234 | x++; | 233 | x++; |
235 | if(*(big_buffer+x) == '\n') | 234 | if(QMAKE_EOL(*(big_buffer+x))) |
236 | line_count++; | 235 | line_count++; |
237 | } | 236 | } |
238 | #undef OBJ_LEN | 237 | #undef OBJ_LEN |
239 | #undef DIS_LEN | 238 | #undef DIS_LEN |
240 | return TRUE; | 239 | return TRUE; |
241 | } | 240 | } |
242 | 241 | ||
243 | bool | 242 | bool |
244 | MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const QString &f, bool recurse) | 243 | MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const QString &f, bool recurse) |
245 | { | 244 | { |
246 | QStringList &fndeps = findDependencies(f); | 245 | if(processedDependencies(f)) |
247 | if(!fndeps.isEmpty()) | ||
248 | return TRUE; | 246 | return TRUE; |
247 | setProcessedDependencies(f, TRUE); | ||
248 | |||
249 | QStringList &fndeps = findDependencies(f); | ||
249 | QString fn = fileFixify(f, QDir::currentDirPath(), Option::output_dir); | 250 | QString fn = fileFixify(f, QDir::currentDirPath(), Option::output_dir); |
250 | fn = Option::fixPathToLocalOS(fn, FALSE); | 251 | fn = Option::fixPathToLocalOS(fn, FALSE); |
251 | QString fix_env_fn = Option::fixPathToLocalOS(fn); | 252 | QString fix_env_fn = Option::fixPathToLocalOS(fn); |
252 | int file = open(fix_env_fn.latin1(), O_RDONLY); | 253 | int file = open(fix_env_fn.latin1(), O_RDONLY); |
253 | if(file == -1) | 254 | if(file == -1) |
254 | return FALSE; | 255 | return FALSE; |
255 | struct stat fst; | 256 | struct stat fst; |
256 | if(fstat(file, &fst) || S_ISDIR(fst.st_mode)) | 257 | if(fstat(file, &fst) || S_ISDIR(fst.st_mode)) |
257 | return FALSE; //shouldn't happen | 258 | return FALSE; //shouldn't happen |
258 | 259 | ||
259 | QString fndir, fix_env_fndir; | 260 | QString fndir, fix_env_fndir; |
260 | int dl = fn.findRev(Option::dir_sep); | 261 | int dl = fn.findRev(Option::dir_sep); |
@@ -274,97 +275,123 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const | |||
274 | total_size_read += have_read); | 275 | total_size_read += have_read); |
275 | close(file); | 276 | close(file); |
276 | 277 | ||
277 | bool ui_file = fn.endsWith(Option::ui_ext); | 278 | bool ui_file = fn.endsWith(Option::ui_ext); |
278 | for(int x = 0; x < total_size_read; x++) { | 279 | for(int x = 0; x < total_size_read; x++) { |
279 | QStringList *outdeps=&fndeps; | 280 | QStringList *outdeps=&fndeps; |
280 | QString inc; | 281 | QString inc; |
281 | if(!ui_file) { | 282 | if(!ui_file) { |
282 | if(*(big_buffer + x) == '/') { | 283 | if(*(big_buffer + x) == '/') { |
283 | x++; | 284 | x++; |
284 | if(total_size_read >= x) { | 285 | if(total_size_read >= x) { |
285 | if(*(big_buffer + x) == '/') { //c++ style comment | 286 | if(*(big_buffer + x) == '/') { //c++ style comment |
286 | for( ; x < total_size_read && *(big_buffer + x) != '\n'; x++); | 287 | for( ; x < total_size_read && !QMAKE_EOL(*(big_buffer + x)); x++); |
287 | } else if(*(big_buffer + x) == '*') { //c style comment | 288 | } else if(*(big_buffer + x) == '*') { //c style comment |
288 | for( ; x < total_size_read; x++) { | 289 | for( ; x < total_size_read; x++) { |
289 | if(*(big_buffer + x) == '*') { | 290 | if(*(big_buffer + x) == '*') { |
290 | if(total_size_read >= (x+1) && *(big_buffer + (x+1)) == '/') { | 291 | if(total_size_read >= (x+1) && *(big_buffer + (x+1)) == '/') { |
291 | x += 2; | 292 | x += 2; |
292 | break; | 293 | break; |
293 | } | 294 | } |
294 | } else if(*(big_buffer + x) == '\n') { | 295 | } else if(QMAKE_EOL(*(big_buffer + x))) { |
295 | line_count++; | 296 | line_count++; |
296 | } | 297 | } |
297 | } | 298 | } |
298 | } | 299 | } |
299 | } | 300 | } |
300 | } | 301 | } |
302 | while(x < total_size_read && //Skip spaces | ||
303 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) | ||
304 | x++; | ||
301 | if(*(big_buffer + x) == '#') { | 305 | if(*(big_buffer + x) == '#') { |
302 | x++; | 306 | x++; |
303 | while(x < total_size_read && //Skip spaces after hash | 307 | while(x < total_size_read && //Skip spaces after hash |
304 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) | 308 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) |
305 | x++; | 309 | x++; |
306 | if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include", 7) && | 310 | if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include", 7) && |
307 | (*(big_buffer + x + 7) == ' ' || *(big_buffer + x + 7) == '\t' || | 311 | (*(big_buffer + x + 7) == ' ' || *(big_buffer + x + 7) == '\t' || |
308 | *(big_buffer + x + 7) == '<' || *(big_buffer + x + 7) == '"')) { | 312 | *(big_buffer + x + 7) == '<' || *(big_buffer + x + 7) == '"')) { |
309 | for(x+=7; //skip spaces after keyword | 313 | for(x+=7; //skip spaces after keyword |
310 | x < total_size_read && (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t'); | 314 | x < total_size_read && (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t'); |
311 | x++); | 315 | x++); |
312 | char term = *(big_buffer + x); | 316 | char term = *(big_buffer + x); |
313 | if(term == '"'); | 317 | if(term == '"'); |
314 | else if(term == '<') | 318 | else if(term == '<') |
315 | term = '>'; | 319 | term = '>'; |
316 | else | 320 | else |
317 | continue; //wtf? | 321 | continue; //wtf? |
318 | x++; | 322 | x++; |
319 | 323 | ||
320 | int inc_len; | 324 | int inc_len; |
321 | for(inc_len = 0; *(big_buffer + x + inc_len) != term; inc_len++); | 325 | for(inc_len = 0; *(big_buffer + x + inc_len) != term && |
326 | !QMAKE_EOL(*(big_buffer + x + inc_len)); inc_len++); | ||
322 | *(big_buffer + x + inc_len) = '\0'; | 327 | *(big_buffer + x + inc_len) = '\0'; |
323 | inc = big_buffer + x; | 328 | inc = big_buffer + x; |
324 | } else if(total_size_read >= x + 14 && !strncmp(big_buffer + x, "qmake_warning ", 14)) { | 329 | } else if(total_size_read >= x + 14 && !strncmp(big_buffer + x, "qmake_warning ", 14)) { |
325 | for(x+=14; //skip spaces after keyword | 330 | for(x+=14; //skip spaces after keyword |
326 | x < total_size_read && (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t'); | 331 | x < total_size_read && (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t'); |
327 | x++); | 332 | x++); |
328 | char term = '\n'; | 333 | char term = 0; |
329 | if(*(big_buffer + x) == '"') | 334 | if(*(big_buffer + x) == '"') |
330 | term = '"'; | 335 | term = '"'; |
331 | if(*(big_buffer + x) == '\'') | 336 | if(*(big_buffer + x) == '\'') |
332 | term = '\''; | 337 | term = '\''; |
333 | if(term != '\n') | 338 | if(term) |
334 | x++; | 339 | x++; |
335 | 340 | ||
336 | int msg_len; | 341 | int msg_len; |
337 | for(msg_len = 0; *(big_buffer + x + msg_len) != term; msg_len++); | 342 | for(msg_len = 0; (term && *(big_buffer + x + msg_len) != term) && |
343 | !QMAKE_EOL(*(big_buffer + x + msg_len)); msg_len++); | ||
344 | const char saved_term = *(big_buffer + x + msg_len); | ||
338 | *(big_buffer + x + msg_len) = '\0'; | 345 | *(big_buffer + x + msg_len) = '\0'; |
339 | QString msg = big_buffer + x; | 346 | QString msg = big_buffer + x; |
340 | debug_msg(0, "%s:%d qmake_warning -- %s", fix_env_fn.latin1(), | 347 | debug_msg(0, "%s:%d qmake_warning -- %s", fix_env_fn.latin1(), |
341 | line_count, msg.latin1()); | 348 | line_count, msg.latin1()); |
342 | *(big_buffer + x + msg_len) = term; //put it back | 349 | *(big_buffer + x + msg_len) = saved_term; //put it back |
343 | } | 350 | } |
344 | } | 351 | } |
345 | } else if(ui_file) { | 352 | } else if(ui_file) { |
346 | // skip whitespaces | 353 | // skip whitespaces |
347 | while(x < total_size_read && | 354 | while(x < total_size_read && |
348 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) | 355 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) |
349 | x++; | 356 | x++; |
350 | if(*(big_buffer + x) == '<') { | 357 | if(*(big_buffer + x) == '<') { |
351 | x++; | 358 | x++; |
352 | if(total_size_read >= x + 12 && !strncmp(big_buffer + x, "includehint", 11) && | 359 | if(total_size_read >= x + 12 && !strncmp(big_buffer + x, "includehint", 11) && |
353 | (*(big_buffer + x + 11) == ' ' || *(big_buffer + x + 11) == '>')) { | 360 | (*(big_buffer + x + 11) == ' ' || *(big_buffer + x + 11) == '>')) { |
354 | for(x += 12; *(big_buffer + x) != '>'; x++); | 361 | for(x += 11; *(big_buffer + x) != '>'; x++); |
355 | int inc_len = 0; | 362 | int inc_len = 0; |
356 | for(x += 1 ; *(big_buffer + x + inc_len) != '<'; inc_len++); | 363 | for(x += 1 ; *(big_buffer + x + inc_len) != '<'; inc_len++); |
357 | *(big_buffer + x + inc_len) = '\0'; | 364 | *(big_buffer + x + inc_len) = '\0'; |
358 | inc = big_buffer + x; | 365 | inc = big_buffer + x; |
366 | } else if(total_size_read >= x + 13 && !strncmp(big_buffer + x, "customwidget", 12) && | ||
367 | (*(big_buffer + x + 12) == ' ' || *(big_buffer + x + 12) == '>')) { | ||
368 | for(x += 13; *(big_buffer + x) != '>'; x++); //skip up to > | ||
369 | while(x < total_size_read) { | ||
370 | for(x++; *(big_buffer + x) != '<'; x++); //skip up to < | ||
371 | x++; | ||
372 | if(total_size_read >= x + 7 && !strncmp(big_buffer+x, "header", 6) && | ||
373 | (*(big_buffer + x + 6) == ' ' || *(big_buffer + x + 6) == '>')) { | ||
374 | for(x += 7; *(big_buffer + x) != '>'; x++); //skip up to > | ||
375 | int inc_len = 0; | ||
376 | for(x += 1 ; *(big_buffer + x + inc_len) != '<'; inc_len++); | ||
377 | *(big_buffer + x + inc_len) = '\0'; | ||
378 | inc = big_buffer + x; | ||
379 | break; | ||
380 | } else if(total_size_read >= x + 14 && !strncmp(big_buffer+x, "/customwidget", 13) && | ||
381 | (*(big_buffer + x + 13) == ' ' || *(big_buffer + x + 13) == '>')) { | ||
382 | x += 14; | ||
383 | break; | ||
384 | } | ||
385 | } | ||
359 | } else if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include", 7) && | 386 | } else if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include", 7) && |
360 | (*(big_buffer + x + 7) == ' ' || *(big_buffer + x + 7) == '>')) { | 387 | (*(big_buffer + x + 7) == ' ' || *(big_buffer + x + 7) == '>')) { |
361 | for(x += 8; *(big_buffer + x) != '>'; x++) { | 388 | for(x += 8; *(big_buffer + x) != '>'; x++) { |
362 | if(total_size_read >= x + 9 && *(big_buffer + x) == 'i' && | 389 | if(total_size_read >= x + 9 && *(big_buffer + x) == 'i' && |
363 | !strncmp(big_buffer + x, "impldecl", 8)) { | 390 | !strncmp(big_buffer + x, "impldecl", 8)) { |
364 | for(x += 8; *(big_buffer + x) != '='; x++); | 391 | for(x += 8; *(big_buffer + x) != '='; x++); |
365 | if(*(big_buffer + x) != '=') | 392 | if(*(big_buffer + x) != '=') |
366 | continue; | 393 | continue; |
367 | for(x++; *(big_buffer+x) == '\t' || *(big_buffer+x) == ' '; x++); | 394 | for(x++; *(big_buffer+x) == '\t' || *(big_buffer+x) == ' '; x++); |
368 | char quote = 0; | 395 | char quote = 0; |
369 | if(*(big_buffer+x) == '\'' || *(big_buffer+x) == '"') { | 396 | if(*(big_buffer+x) == '\'' || *(big_buffer+x) == '"') { |
370 | quote = *(big_buffer + x); | 397 | quote = *(big_buffer + x); |
@@ -408,172 +435,187 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const | |||
408 | QStringList &nodeplist = project->values("SKIP_DEPENDS"); | 435 | QStringList &nodeplist = project->values("SKIP_DEPENDS"); |
409 | for(QStringList::Iterator it = nodeplist.begin(); | 436 | for(QStringList::Iterator it = nodeplist.begin(); |
410 | it != nodeplist.end(); ++it) { | 437 | it != nodeplist.end(); ++it) { |
411 | QRegExp regx((*it)); | 438 | QRegExp regx((*it)); |
412 | if(regx.search(inc) != -1) { | 439 | if(regx.search(inc) != -1) { |
413 | found = TRUE; | 440 | found = TRUE; |
414 | break; | 441 | break; |
415 | } | 442 | } |
416 | } | 443 | } |
417 | if(found) | 444 | if(found) |
418 | continue; | 445 | continue; |
419 | } | 446 | } |
420 | |||
421 | QString fqn; | 447 | QString fqn; |
422 | if(project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH") && | 448 | if(project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH") && |
423 | !stat(fix_env_fndir + inc, &fst) && !S_ISDIR(fst.st_mode)) { | 449 | !stat(fix_env_fndir + inc, &fst) && !S_ISDIR(fst.st_mode)) { |
424 | fqn = fndir + inc; | 450 | fqn = fndir + inc; |
425 | goto handle_fqn; | 451 | goto handle_fqn; |
452 | } else if(project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH") && | ||
453 | !stat(inc, &fst) && !S_ISDIR(fst.st_mode)) { | ||
454 | fqn = inc; | ||
455 | goto handle_fqn; | ||
426 | } else { | 456 | } else { |
427 | if((Option::target_mode == Option::TARG_MAC9_MODE && inc.find(':')) || | 457 | if((Option::target_mode == Option::TARG_MAC9_MODE && inc.find(':')) || |
428 | (Option::target_mode == Option::TARG_WIN_MODE && inc[1] != ':') || | 458 | (Option::target_mode == Option::TARG_WIN_MODE && inc[1] != ':') || |
429 | ((Option::target_mode == Option::TARG_UNIX_MODE || | 459 | ((Option::target_mode == Option::TARG_UNIX_MODE || |
430 | Option::target_mode == Option::TARG_QNX6_MODE || | 460 | Option::target_mode == Option::TARG_QNX6_MODE || |
431 | Option::target_mode == Option::TARG_MACX_MODE) && | 461 | Option::target_mode == Option::TARG_MACX_MODE) && |
432 | inc[0] != '/')) { | 462 | inc[0] != '/')) { |
433 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { | 463 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { |
434 | if(!stat(mdd->local_dir + QDir::separator() + inc, &fst) && | 464 | if(!stat(mdd->local_dir + QDir::separator() + inc, &fst) && |
435 | !S_ISDIR(fst.st_mode)) { | 465 | !S_ISDIR(fst.st_mode)) { |
436 | fqn = mdd->real_dir + QDir::separator() + inc; | 466 | fqn = mdd->real_dir + QDir::separator() + inc; |
437 | goto handle_fqn; | 467 | goto handle_fqn; |
438 | } | 468 | } |
439 | } | 469 | } |
440 | } | 470 | } |
441 | } | 471 | } |
442 | if(fqn.isEmpty() && Option::mkfile::do_dep_heuristics) { | 472 | if(fqn.isEmpty() && Option::mkfile::do_dep_heuristics) { |
443 | //these are some hacky heuristics it will try to do on an include | 473 | //these are some hacky heuristics it will try to do on an include |
444 | //however these can be turned off at runtime, I'm not sure how | 474 | //however these can be turned off at runtime, I'm not sure how |
445 | //reliable these will be, most likely when problems arise turn it off | 475 | //reliable these will be, most likely when problems arise turn it off |
446 | //and see if they go away.. | 476 | //and see if they go away.. |
447 | if(depHeuristics.contains(inc)) { | 477 | if(depHeuristics.contains(inc)) { |
448 | fqn = depHeuristics[inc]; | 478 | fqn = depHeuristics[inc]; |
479 | from_source_dir = FALSE; | ||
449 | } else if(Option::mkfile::do_dep_heuristics) { //some heuristics.. | 480 | } else if(Option::mkfile::do_dep_heuristics) { //some heuristics.. |
450 | //is it a file from a .ui? | 481 | //is it a file from a .ui? |
451 | QString inc_file = inc.section(Option::dir_sep, -1); | 482 | QString inc_file = inc.section(Option::dir_sep, -1); |
452 | int extn = inc_file.findRev('.'); | 483 | int extn = inc_file.findRev('.'); |
453 | if(extn != -1 && | 484 | if(extn != -1 && |
454 | (inc_file.right(inc_file.length()-extn) == Option::cpp_ext.first() || | 485 | (inc_file.right(inc_file.length()-extn) == Option::cpp_ext.first() || |
455 | inc_file.right(inc_file.length()-extn) == Option::h_ext.first())) { | 486 | inc_file.right(inc_file.length()-extn) == Option::h_ext.first())) { |
456 | QString uip = inc_file.left(extn) + Option::ui_ext; | 487 | QString uip = inc_file.left(extn) + Option::ui_ext; |
457 | QStringList uil = project->variables()["FORMS"]; | 488 | QStringList uil = project->variables()["FORMS"]; |
458 | for(QStringList::Iterator it = uil.begin(); it != uil.end(); ++it) { | 489 | for(QStringList::Iterator it = uil.begin(); it != uil.end(); ++it) { |
459 | if((*it).section(Option::dir_sep, -1) == uip) { | 490 | if((*it).section(Option::dir_sep, -1) == uip) { |
460 | if(!project->isEmpty("UI_DIR")) | 491 | if(!project->isEmpty("UI_DIR")) |
461 | fqn = project->first("UI_DIR"); | 492 | fqn = project->first("UI_DIR"); |
462 | else if(!project->isEmpty("UI_HEADERS_DIR")) | 493 | else if(!project->isEmpty("UI_HEADERS_DIR")) |
463 | fqn = project->first("UI_HEADERS_DIR"); | 494 | fqn = project->first("UI_HEADERS_DIR"); |
464 | else | 495 | else |
465 | fqn = (*it).section(Option::dir_sep, 0, -2); | 496 | fqn = (*it).section(Option::dir_sep, 0, -2); |
466 | if(!fqn.isEmpty() && !fqn.endsWith(Option::dir_sep)) | 497 | if(!fqn.isEmpty() && !fqn.endsWith(Option::dir_sep)) |
467 | fqn += Option::dir_sep; | 498 | fqn += Option::dir_sep; |
468 | fqn += inc_file; | 499 | fqn += inc_file; |
469 | from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) | 500 | from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) |
470 | fqn = fileFixify(fqn, QDir::currentDirPath(), Option::output_dir); | 501 | fqn = fileFixify(fqn, QDir::currentDirPath(), Option::output_dir); |
471 | goto handle_fqn; | 502 | goto cache_fqn; |
472 | } | 503 | } |
473 | } | 504 | } |
474 | } | 505 | } |
475 | if(project->isActiveConfig("lex_included")) { //is this the lex file? | 506 | if(project->isActiveConfig("lex_included")) { //is this the lex file? |
476 | QString rhs = Option::lex_mod + Option::cpp_ext.first(); | 507 | QString rhs = Option::lex_mod + Option::cpp_ext.first(); |
477 | if(inc.endsWith(rhs)) { | 508 | if(inc.endsWith(rhs)) { |
478 | QString lhs = inc.left(inc.length() - rhs.length()) + Option::lex_ext; | 509 | QString lhs = inc.left(inc.length() - rhs.length()) + Option::lex_ext; |
479 | QStringList ll = project->variables()["LEXSOURCES"]; | 510 | QStringList ll = project->variables()["LEXSOURCES"]; |
480 | for(QStringList::Iterator it = ll.begin(); it != ll.end(); ++it) { | 511 | for(QStringList::Iterator it = ll.begin(); it != ll.end(); ++it) { |
481 | QString s = (*it), d; | 512 | QString s = (*it), d; |
482 | int slsh = s.findRev(Option::dir_sep); | 513 | int slsh = s.findRev(Option::dir_sep); |
483 | if(slsh != -1) { | 514 | if(slsh != -1) { |
484 | d = s.left(slsh + 1); | 515 | d = s.left(slsh + 1); |
485 | s = s.right(s.length() - slsh - 1); | 516 | s = s.right(s.length() - slsh - 1); |
486 | } | 517 | } |
487 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 518 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) |
488 | d = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); | 519 | d = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); |
489 | if(s == lhs) { | 520 | if(s == lhs) { |
490 | fqn = d + inc; | 521 | fqn = d + inc; |
491 | goto handle_fqn; | 522 | from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) |
523 | fqn = fileFixify(fqn, QDir::currentDirPath(), Option::output_dir); | ||
524 | goto cache_fqn; | ||
492 | } | 525 | } |
493 | } | 526 | } |
494 | } | 527 | } |
495 | } | 528 | } |
496 | { //is it from a .y? | 529 | { //is it from a .y? |
497 | QString rhs = Option::yacc_mod + Option::h_ext.first(); | 530 | QString rhs = Option::yacc_mod + Option::h_ext.first(); |
498 | if(inc.endsWith(rhs)) { | 531 | if(inc.endsWith(rhs)) { |
499 | QString lhs = inc.left(inc.length() - rhs.length()) + Option::yacc_ext; | 532 | QString lhs = inc.left(inc.length() - rhs.length()) + Option::yacc_ext; |
500 | QStringList yl = project->variables()["YACCSOURCES"]; | 533 | QStringList yl = project->variables()["YACCSOURCES"]; |
501 | for(QStringList::Iterator it = yl.begin(); it != yl.end(); ++it) { | 534 | for(QStringList::Iterator it = yl.begin(); it != yl.end(); ++it) { |
502 | QString s = (*it), d; | 535 | QString s = (*it), d; |
503 | int slsh = s.findRev(Option::dir_sep); | 536 | int slsh = s.findRev(Option::dir_sep); |
504 | if(slsh != -1) { | 537 | if(slsh != -1) { |
505 | d = s.left(slsh + 1); | 538 | d = s.left(slsh + 1); |
506 | s = s.right(s.length() - slsh - 1); | 539 | s = s.right(s.length() - slsh - 1); |
507 | } | 540 | } |
508 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 541 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) |
509 | d = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); | 542 | d = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); |
510 | if(s == lhs) { | 543 | if(s == lhs) { |
511 | fqn = d + inc; | 544 | fqn = d + inc; |
512 | goto handle_fqn; | 545 | from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) |
546 | fqn = fileFixify(fqn, QDir::currentDirPath(), Option::output_dir); | ||
547 | goto cache_fqn; | ||
513 | } | 548 | } |
514 | } | 549 | } |
515 | } | 550 | } |
516 | } | 551 | } |
517 | if(mocAware() && //is it a moc file? | 552 | if( mocAware() && //is it a moc file? |
518 | (inc.endsWith(Option::cpp_ext.first()) || inc.endsWith(Option::moc_ext))) { | 553 | ( inc.endsWith(Option::cpp_ext.first()) || inc.endsWith(Option::cpp_moc_ext) ) |
554 | || ( (Option::cpp_ext.first() != Option::h_moc_ext) && inc.endsWith(Option::h_moc_ext) )) { | ||
519 | QString mocs[] = { QString("_HDRMOC"), QString("_SRCMOC"), QString::null }; | 555 | QString mocs[] = { QString("_HDRMOC"), QString("_SRCMOC"), QString::null }; |
520 | for(int moc = 0; !mocs[moc].isNull(); moc++) { | 556 | for(int moc = 0; !mocs[moc].isNull(); moc++) { |
521 | QStringList &l = project->variables()[mocs[moc]]; | 557 | QStringList &l = project->variables()[mocs[moc]]; |
522 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 558 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
523 | QString file = Option::fixPathToTargetOS((*it)); | 559 | QString file = Option::fixPathToTargetOS((*it)); |
524 | if(file.section(Option::dir_sep, -(inc.contains('/')+1)) == inc) { | 560 | if(file.section(Option::dir_sep, -(inc.contains('/')+1)) == inc) { |
525 | fqn = (*it); | 561 | fqn = (*it); |
526 | if(mocs[moc] == "_HDRMOC") { | 562 | if(mocs[moc] == "_HDRMOC") { |
527 | //Since it is include, no need to link it in as well | 563 | //Since it is include, no need to link it in as well |
528 | project->variables()["_SRCMOC"].append((*it)); | 564 | project->variables()["_SRCMOC"].append((*it)); |
529 | l.remove(it); | 565 | l.remove(it); |
530 | } else if(!findMocSource(fqn).endsWith(fn)) { | 566 | } else if(!findMocSource(fqn).endsWith(fileFixify(fn))) { |
531 | /* Not really a very good test, but this will at least avoid | 567 | /* Not really a very good test, but this will at least avoid |
532 | confusion if it really does happen (since tmake/qmake | 568 | confusion if it really does happen (since tmake/qmake |
533 | previously didn't even allow this the test is mostly accurate) */ | 569 | previously didn't even allow this the test is mostly accurate) */ |
534 | warn_msg(WarnLogic, | 570 | warn_msg(WarnLogic, |
535 | "Found potential multiple MOC include %s (%s) in '%s'", | 571 | "Found potential multiple MOC include %s (%s) in '%s'", |
536 | inc.latin1(), fqn.latin1(), fix_env_fn.latin1()); | 572 | inc.latin1(), fqn.latin1(), fix_env_fn.latin1()); |
537 | } | 573 | } |
538 | from_source_dir = FALSE; //mocs go in the output_dir (so don't fix them) | 574 | from_source_dir = FALSE; //mocs go in the output_dir (so don't fix them) |
539 | goto handle_fqn; | 575 | goto cache_fqn; |
540 | } | 576 | } |
541 | } | 577 | } |
542 | } | 578 | } |
543 | } | 579 | } |
580 | fqn = findDependency(inc); //all else fails.. | ||
581 | cache_fqn: | ||
582 | if(from_source_dir) { | ||
583 | fqn = fileFixify(fqn); | ||
584 | from_source_dir = FALSE; | ||
585 | } | ||
544 | depHeuristics.insert(inc, fqn); | 586 | depHeuristics.insert(inc, fqn); |
545 | } | 587 | } |
546 | } | 588 | } |
547 | handle_fqn: | 589 | handle_fqn: |
548 | if(fqn.isEmpty()) //I give up | 590 | if(fqn.isEmpty()) //I give up |
549 | continue; | 591 | continue; |
550 | fqn = Option::fixPathToTargetOS(fqn, FALSE); | 592 | fqn = Option::fixPathToTargetOS(fqn, FALSE); |
551 | if(from_source_dir) | 593 | if(from_source_dir) |
552 | fqn = fileFixify(fqn); | 594 | fqn = fileFixify(fqn); |
553 | debug_msg(4, "Resolved dependency of %s to %s", inc.latin1(), fqn.latin1()); | 595 | debug_msg(4, "Resolved dependency of %s to %s", inc.latin1(), fqn.latin1()); |
554 | if(outdeps && outdeps->findIndex(fqn) == -1) | 596 | if(outdeps && outdeps->findIndex(fqn) == -1) |
555 | outdeps->append(fqn); | 597 | outdeps->append(fqn); |
556 | } | 598 | } |
557 | //read past new line now.. | 599 | //read past new line now.. |
558 | for( ; x < total_size_read && (*(big_buffer + x) != '\n'); x++); | 600 | for( ; x < total_size_read && !QMAKE_EOL(*(big_buffer + x)); x++); |
559 | line_count++; | 601 | line_count++; |
560 | } | 602 | } |
561 | 603 | ||
562 | if(recurse) { | 604 | if(recurse) { |
563 | for(QStringList::Iterator fnit = fndeps.begin(); fnit != fndeps.end(); ++fnit) { | 605 | for(QStringList::Iterator fnit = fndeps.begin(); fnit != fndeps.end(); ++fnit) { |
564 | generateDependencies(dirs, (*fnit), recurse); | 606 | generateDependencies(dirs, (*fnit), recurse); |
565 | QStringList &deplist = findDependencies((*fnit)); | 607 | QStringList &deplist = findDependencies((*fnit)); |
566 | for(QStringList::Iterator it = deplist.begin(); it != deplist.end(); ++it) | 608 | for(QStringList::Iterator it = deplist.begin(); it != deplist.end(); ++it) |
567 | if(fndeps.findIndex((*it)) == -1) | 609 | if(fndeps.findIndex((*it)) == -1 && (*it) != fn) |
568 | fndeps.append((*it)); | 610 | fndeps.append((*it)); |
569 | } | 611 | } |
570 | } | 612 | } |
571 | debug_msg(2, "Dependencies: %s -> %s", fn.latin1(), fndeps.join(" :: ").latin1()); | 613 | debug_msg(2, "Dependencies: %s -> %s", fn.latin1(), fndeps.join(" :: ").latin1()); |
572 | return TRUE; | 614 | return TRUE; |
573 | } | 615 | } |
574 | 616 | ||
575 | void | 617 | void |
576 | MakefileGenerator::initOutPaths() | 618 | MakefileGenerator::initOutPaths() |
577 | { | 619 | { |
578 | if(init_opath_already) | 620 | if(init_opath_already) |
579 | return; | 621 | return; |
@@ -597,28 +639,32 @@ MakefileGenerator::initOutPaths() | |||
597 | } | 639 | } |
598 | } | 640 | } |
599 | } | 641 | } |
600 | if(!v["QMAKE_ABSOLUTE_SOURCE_PATH"].isEmpty()) { | 642 | if(!v["QMAKE_ABSOLUTE_SOURCE_PATH"].isEmpty()) { |
601 | QString &asp = v["QMAKE_ABSOLUTE_SOURCE_PATH"].first(); | 643 | QString &asp = v["QMAKE_ABSOLUTE_SOURCE_PATH"].first(); |
602 | asp = Option::fixPathToTargetOS( asp ); | 644 | asp = Option::fixPathToTargetOS( asp ); |
603 | if(asp.isEmpty() || asp == Option::output_dir) //if they're the same, why bother? | 645 | if(asp.isEmpty() || asp == Option::output_dir) //if they're the same, why bother? |
604 | v["QMAKE_ABSOLUTE_SOURCE_PATH"].clear(); | 646 | v["QMAKE_ABSOLUTE_SOURCE_PATH"].clear(); |
605 | } | 647 | } |
606 | QString currentDir = QDir::currentDirPath(); | 648 | QString currentDir = QDir::currentDirPath(); |
607 | QString dirs[] = { QString("OBJECTS_DIR"), QString("MOC_DIR"), QString("UI_HEADERS_DIR"), | 649 | QString dirs[] = { QString("OBJECTS_DIR"), QString("MOC_DIR"), QString("UI_HEADERS_DIR"), |
608 | QString("UI_SOURCES_DIR"), QString("UI_DIR"), QString("DESTDIR"), | 650 | QString("UI_SOURCES_DIR"), QString("UI_DIR"), QString("DESTDIR"), |
609 | QString("SUBLIBS_DIR"), QString::null }; | 651 | QString("SUBLIBS_DIR"), QString("DLLDESTDIR"), QString::null }; |
610 | for(int x = 0; dirs[x] != QString::null; x++) { | 652 | for(int x = 0; dirs[x] != QString::null; x++) { |
611 | if ( !v[dirs[x]].isEmpty() ) { | 653 | if ( !v[dirs[x]].isEmpty() ) { |
612 | QString orig_path = v[dirs[x]].first(); | 654 | QString orig_path = v[dirs[x]].first(); |
655 | #ifdef Q_WS_WIN | ||
656 | // We don't want to add a separator for DLLDESTDIR on Windows | ||
657 | if (!(dirs[x] == "DLLDESTDIR")) | ||
658 | #endif | ||
613 | { | 659 | { |
614 | QString &path = v[dirs[x]].first(); | 660 | QString &path = v[dirs[x]].first(); |
615 | path = fileFixify(path, Option::output_dir, Option::output_dir); | 661 | path = fileFixify(path, Option::output_dir, Option::output_dir); |
616 | if(path.right(Option::dir_sep.length()) != Option::dir_sep) | 662 | if(path.right(Option::dir_sep.length()) != Option::dir_sep) |
617 | path += Option::dir_sep; | 663 | path += Option::dir_sep; |
618 | } | 664 | } |
619 | if(noIO()) | 665 | if(noIO()) |
620 | continue; | 666 | continue; |
621 | 667 | ||
622 | QString path = project->first(dirs[x]); //not to be changed any further | 668 | QString path = project->first(dirs[x]); //not to be changed any further |
623 | path = Option::fixPathToTargetOS(fileFixify(path, QDir::currentDirPath(), Option::output_dir)); | 669 | path = Option::fixPathToTargetOS(fileFixify(path, QDir::currentDirPath(), Option::output_dir)); |
624 | debug_msg(3, "Fixed output_dir %s (%s) into %s (%s)", dirs[x].latin1(), orig_path.latin1(), | 670 | debug_msg(3, "Fixed output_dir %s (%s) into %s (%s)", dirs[x].latin1(), orig_path.latin1(), |
@@ -652,43 +698,53 @@ MakefileGenerator::initOutPaths() | |||
652 | else { | 698 | else { |
653 | warn_msg(WarnLogic, "%s: Cannot access directory '%s' (%s)", dirs[x].latin1(), | 699 | warn_msg(WarnLogic, "%s: Cannot access directory '%s' (%s)", dirs[x].latin1(), |
654 | (*subit).latin1(), path.latin1() ); | 700 | (*subit).latin1(), path.latin1() ); |
655 | break; | 701 | break; |
656 | } | 702 | } |
657 | } | 703 | } |
658 | } | 704 | } |
659 | #ifdef Q_WS_WIN | 705 | #ifdef Q_WS_WIN |
660 | } | 706 | } |
661 | #endif | 707 | #endif |
662 | } | 708 | } |
663 | } | 709 | } |
710 | if ( !v["DESTDIR"].isEmpty() ) { | ||
711 | QDir d(v["DESTDIR"].first()); | ||
712 | if(Option::fixPathToLocalOS(d.absPath()) == Option::fixPathToLocalOS(Option::output_dir)) | ||
713 | v.remove("DESTDIR"); | ||
714 | } | ||
664 | QDir::current().cd( currentDir ); | 715 | QDir::current().cd( currentDir ); |
665 | } | 716 | } |
666 | 717 | ||
667 | void | 718 | void |
668 | MakefileGenerator::init() | 719 | MakefileGenerator::init() |
669 | { | 720 | { |
670 | initOutPaths(); | 721 | initOutPaths(); |
671 | if(init_already) | 722 | if(init_already) |
672 | return; | 723 | return; |
673 | init_already = TRUE; | 724 | init_already = TRUE; |
674 | 725 | ||
675 | QMap<QString, QStringList> &v = project->variables(); | 726 | QMap<QString, QStringList> &v = project->variables(); |
676 | QString paths[] = { QString("SOURCES"), QString("FORMS"), QString("YACCSOURCES"), QString("INCLUDEPATH"), | 727 | QString paths[] = { QString("SOURCES"), QString("FORMS"), QString("YACCSOURCES"), QString("INCLUDEPATH"), |
677 | QString("HEADERS"), QString("HEADERS_ORIG"), | 728 | QString("HEADERS"), QString("HEADERS_ORIG"), QString("LEXSOURCES"), |
678 | QString("LEXSOURCES"), QString("QMAKE_INTERNAL_INCLUDED_FILES"), QString::null }; | 729 | QString("QMAKE_INTERNAL_INCLUDED_FILES"), |
730 | QString("PRECOMPILED_HEADER"), QString::null }; | ||
679 | for(int y = 0; paths[y] != QString::null; y++) { | 731 | for(int y = 0; paths[y] != QString::null; y++) { |
680 | QStringList &l = v[paths[y]]; | 732 | QStringList &l = v[paths[y]]; |
681 | if(!l.isEmpty()) | 733 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
682 | l = fileFixify(l); | 734 | if ((*it).isEmpty()) |
735 | continue; | ||
736 | if(QFile::exists((*it))) | ||
737 | (*it) = fileFixify((*it)); | ||
738 | } | ||
683 | } | 739 | } |
684 | 740 | ||
685 | /* get deps and mocables */ | 741 | /* get deps and mocables */ |
686 | QDict<void> cache_found_files; | 742 | QDict<void> cache_found_files; |
687 | QString cache_file(".qmake.internal.cache"); | 743 | QString cache_file(".qmake.internal.cache"); |
688 | if(!project->isEmpty("QMAKE_INTERNAL_CACHE_FILE")) | 744 | if(!project->isEmpty("QMAKE_INTERNAL_CACHE_FILE")) |
689 | cache_file = Option::fixPathToLocalOS(project->first("QMAKE_INTERNAL_CACHE_FILE")); | 745 | cache_file = Option::fixPathToLocalOS(project->first("QMAKE_INTERNAL_CACHE_FILE")); |
690 | if(cache_file.find(QDir::separator()) == -1) //guess they know what they are doing.. | 746 | if(cache_file.find(QDir::separator()) == -1) //guess they know what they are doing.. |
691 | cache_file.prepend(Option::output_dir + QDir::separator()); | 747 | cache_file.prepend(Option::output_dir + QDir::separator()); |
692 | if((Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || | 748 | if((Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || |
693 | Option::mkfile::do_deps || Option::mkfile::do_mocs) && !noIO()) { | 749 | Option::mkfile::do_deps || Option::mkfile::do_mocs) && !noIO()) { |
694 | QPtrList<MakefileDependDir> deplist; | 750 | QPtrList<MakefileDependDir> deplist; |
@@ -752,24 +808,25 @@ MakefileGenerator::init() | |||
752 | fi.lastModified() < cachefi.lastModified()) { | 808 | fi.lastModified() < cachefi.lastModified()) { |
753 | cache_found_files.insert((*dep_it), (void *)1); | 809 | cache_found_files.insert((*dep_it), (void *)1); |
754 | } else { | 810 | } else { |
755 | found = FALSE; | 811 | found = FALSE; |
756 | break; | 812 | break; |
757 | } | 813 | } |
758 | } | 814 | } |
759 | } | 815 | } |
760 | if(found) { | 816 | if(found) { |
761 | debug_msg(2, "Dependencies (cached): %s -> %s", file.latin1(), | 817 | debug_msg(2, "Dependencies (cached): %s -> %s", file.latin1(), |
762 | files.join(" :: ").latin1()); | 818 | files.join(" :: ").latin1()); |
763 | findDependencies(file) = files; | 819 | findDependencies(file) = files; |
820 | setProcessedDependencies(file, TRUE); | ||
764 | } | 821 | } |
765 | } | 822 | } |
766 | } else { | 823 | } else { |
767 | void *found = cache_found_files[file]; | 824 | void *found = cache_found_files[file]; |
768 | if(found != (void *)2) { | 825 | if(found != (void *)2) { |
769 | if(found) { | 826 | if(found) { |
770 | cache_found_files.replace(file, (void *)2); | 827 | cache_found_files.replace(file, (void *)2); |
771 | } else { | 828 | } else { |
772 | QFileInfo fi(fileFixify(file, QDir::currentDirPath(), Option::output_dir)); | 829 | QFileInfo fi(fileFixify(file, QDir::currentDirPath(), Option::output_dir)); |
773 | if(fi.exists() && fi.lastModified() < cachefi.lastModified()) { | 830 | if(fi.exists() && fi.lastModified() < cachefi.lastModified()) { |
774 | cache_found_files.insert(file, (void *)2); | 831 | cache_found_files.insert(file, (void *)2); |
775 | found = (void*)1; | 832 | found = (void*)1; |
@@ -800,37 +857,37 @@ MakefileGenerator::init() | |||
800 | mocablesToMOC[file] = line; | 857 | mocablesToMOC[file] = line; |
801 | mocablesFromMOC[line] = file; | 858 | mocablesFromMOC[line] = file; |
802 | } | 859 | } |
803 | } | 860 | } |
804 | } | 861 | } |
805 | } | 862 | } |
806 | cachef.close(); | 863 | cachef.close(); |
807 | } | 864 | } |
808 | } | 865 | } |
809 | } | 866 | } |
810 | if(!noIO()) { | 867 | if(!noIO()) { |
811 | QString sources[] = { QString("OBJECTS"), QString("LEXSOURCES"), QString("YACCSOURCES"), | 868 | QString sources[] = { QString("OBJECTS"), QString("LEXSOURCES"), QString("YACCSOURCES"), |
812 | QString("HEADERS"), QString("SOURCES"), QString("FORMS"), | 869 | QString("HEADERS"), QString("SOURCES"), QString("FORMS"), |
813 | QString::null }; | 870 | QString("PRECOMPILED_HEADER"), QString::null }; |
814 | depHeuristics.clear(); | 871 | depHeuristics.clear(); |
815 | bool write_cache = FALSE, read_cache = QFile::exists(cache_file); | 872 | bool write_cache = FALSE, read_cache = QFile::exists(cache_file); |
816 | for(int x = 0; sources[x] != QString::null; x++) { | 873 | int x; |
874 | for(x = 0; sources[x] != QString::null; x++) { | ||
817 | QStringList vpath, &l = v[sources[x]]; | 875 | QStringList vpath, &l = v[sources[x]]; |
818 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 876 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
819 | if(!(*val_it).isEmpty()) { | 877 | if(!(*val_it).isEmpty()) { |
820 | QString file = Option::fixPathToLocalOS((*val_it)); | 878 | QString file = fileFixify((*val_it), QDir::currentDirPath(), Option::output_dir); |
821 | QStringList file_list(file); | ||
822 | if(!QFile::exists(file)) { | 879 | if(!QFile::exists(file)) { |
823 | bool found = FALSE; | 880 | bool found = FALSE; |
824 | if(QDir::isRelativePath(file)) { | 881 | if(QDir::isRelativePath((*val_it))) { |
825 | if(vpath.isEmpty()) | 882 | if(vpath.isEmpty()) |
826 | vpath = v["VPATH_" + sources[x]] + v["VPATH"] + | 883 | vpath = v["VPATH_" + sources[x]] + v["VPATH"] + |
827 | v["QMAKE_ABSOLUTE_SOURCE_PATH"] + v["DEPENDPATH"]; | 884 | v["QMAKE_ABSOLUTE_SOURCE_PATH"] + v["DEPENDPATH"]; |
828 | 885 | ||
829 | for(QStringList::Iterator vpath_it = vpath.begin(); | 886 | for(QStringList::Iterator vpath_it = vpath.begin(); |
830 | vpath_it != vpath.end(); ++vpath_it) { | 887 | vpath_it != vpath.end(); ++vpath_it) { |
831 | QString real_dir = Option::fixPathToLocalOS((*vpath_it)); | 888 | QString real_dir = Option::fixPathToLocalOS((*vpath_it)); |
832 | if(QFile::exists(real_dir + QDir::separator() + (*val_it))) { | 889 | if(QFile::exists(real_dir + QDir::separator() + (*val_it))) { |
833 | QString dir = (*vpath_it); | 890 | QString dir = (*vpath_it); |
834 | if(dir.right(Option::dir_sep.length()) != Option::dir_sep) | 891 | if(dir.right(Option::dir_sep.length()) != Option::dir_sep) |
835 | dir += Option::dir_sep; | 892 | dir += Option::dir_sep; |
836 | (*val_it) = fileFixify(dir + (*val_it)); | 893 | (*val_it) = fileFixify(dir + (*val_it)); |
@@ -849,99 +906,100 @@ MakefileGenerator::init() | |||
849 | QDir::currentDirPath(), Option::output_dir); | 906 | QDir::currentDirPath(), Option::output_dir); |
850 | regex = regex.right(regex.length() - dir.length()); | 907 | regex = regex.right(regex.length() - dir.length()); |
851 | } | 908 | } |
852 | if(real_dir.isEmpty() || QFile::exists(real_dir)) { | 909 | if(real_dir.isEmpty() || QFile::exists(real_dir)) { |
853 | QDir d(real_dir, regex); | 910 | QDir d(real_dir, regex); |
854 | if(!d.count()) { | 911 | if(!d.count()) { |
855 | debug_msg(1, "%s:%d Failure to find %s in vpath (%s)", | 912 | debug_msg(1, "%s:%d Failure to find %s in vpath (%s)", |
856 | __FILE__, __LINE__, | 913 | __FILE__, __LINE__, |
857 | (*val_it).latin1(), vpath.join("::").latin1()); | 914 | (*val_it).latin1(), vpath.join("::").latin1()); |
858 | warn_msg(WarnLogic, "Failure to find: %s", (*val_it).latin1()); | 915 | warn_msg(WarnLogic, "Failure to find: %s", (*val_it).latin1()); |
859 | continue; | 916 | continue; |
860 | } else { | 917 | } else { |
861 | file_list.clear(); | ||
862 | for(int i = 0; i < (int)d.count(); i++) { | 918 | for(int i = 0; i < (int)d.count(); i++) { |
863 | file_list.append(dir + d[i]); | 919 | QString file = fileFixify(dir + d[i]); |
864 | if(i == (int)d.count() - 1) | 920 | if(i == (int)d.count() - 1) |
865 | (*val_it) = dir + d[i]; | 921 | (*val_it) = file; |
866 | else | 922 | else |
867 | l.insert(val_it, dir + d[i]); | 923 | l.insert(val_it, file); |
868 | } | 924 | } |
869 | } | 925 | } |
870 | } else { | 926 | } else { |
871 | debug_msg(1, "%s:%d Cannot match %s%c%s, as %s does not exist.", | 927 | debug_msg(1, "%s:%d Cannot match %s%c%s, as %s does not exist.", |
872 | __FILE__, __LINE__, | 928 | __FILE__, __LINE__, |
873 | real_dir.latin1(), QDir::separator(), regex.latin1(), | 929 | real_dir.latin1(), QDir::separator(), regex.latin1(), |
874 | real_dir.latin1()); | 930 | real_dir.latin1()); |
875 | warn_msg(WarnLogic, "Failure to find: %s", (*val_it).latin1()); | 931 | warn_msg(WarnLogic, "Failure to find: %s", (*val_it).latin1()); |
876 | } | 932 | } |
877 | } | 933 | } |
878 | } | 934 | } |
879 | for(QStringList::Iterator file_it = file_list.begin(); | 935 | } |
880 | file_it != file_list.end(); ++file_it) { | 936 | } |
881 | QString file_list_file = fileFixify((*file_it)); | 937 | } |
882 | bool found_cache_moc = FALSE, found_cache_dep = FALSE; | 938 | for(x = 0; sources[x] != QString::null; x++) { |
883 | if(read_cache && Option::output.name() != "-" && | 939 | QStringList &l = v[sources[x]]; |
884 | project->isActiveConfig("qmake_cache")) { | 940 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
885 | if(!findDependencies(file_list_file).isEmpty()) | 941 | bool found_cache_moc = FALSE, found_cache_dep = FALSE; |
886 | found_cache_dep = TRUE; | 942 | if(read_cache && Option::output.name() != "-" && |
887 | if(cache_found_files[(*file_it)] == (void *)2) | 943 | project->isActiveConfig("qmake_cache")) { |
888 | found_cache_moc = TRUE; | 944 | if(processedDependencies((*val_it))) |
889 | if(!found_cache_moc || !found_cache_dep) | 945 | found_cache_dep = TRUE; |
890 | write_cache = TRUE; | 946 | if(cache_found_files[(*val_it)] == (void *)2) |
891 | } | 947 | found_cache_moc = TRUE; |
892 | /* Do moc before dependency checking since some includes can come from | 948 | if(!found_cache_moc || !found_cache_dep) |
893 | moc_*.cpp files */ | 949 | write_cache = TRUE; |
894 | if(found_cache_moc) { | 950 | } |
895 | QString moc = findMocDestination(file_list_file); | 951 | /* Do moc before dependency checking since some includes can come from |
896 | if(!moc.isEmpty()) { | 952 | moc_*.cpp files */ |
897 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); | 953 | if(found_cache_moc) { |
898 | cppit != Option::cpp_ext.end(); ++cppit) { | 954 | QString fixed_file(fileFixify((*val_it), QDir::currentDirPath(), Option::output_dir)); |
899 | if(file_list_file.endsWith((*cppit))) { | 955 | QString moc = findMocDestination(fixed_file); |
900 | QStringList &deps = findDependencies(file_list_file); | 956 | if(!moc.isEmpty()) { |
901 | if(!deps.contains(moc)) | 957 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
902 | deps.append(moc); | 958 | cppit != Option::cpp_ext.end(); ++cppit) { |
903 | break; | 959 | if(fixed_file.endsWith((*cppit))) { |
904 | } | 960 | QStringList &deps = findDependencies(fixed_file); |
905 | } | 961 | if(!deps.contains(moc)) |
962 | deps.append(moc); | ||
963 | break; | ||
906 | } | 964 | } |
907 | } else if(mocAware() && (sources[x] == "SOURCES" || sources[x] == "HEADERS") && | ||
908 | (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || | ||
909 | Option::mkfile::do_mocs)) { | ||
910 | generateMocList((*file_it)); | ||
911 | } | ||
912 | if(!found_cache_dep && sources[x] != "OBJECTS") { | ||
913 | debug_msg(5, "Looking for dependencies for %s", (*file_it).latin1()); | ||
914 | generateDependencies(deplist, (*file_it), doDepends()); | ||
915 | } | 965 | } |
916 | } | 966 | } |
967 | } else if(mocAware() && (sources[x] == "SOURCES" || sources[x] == "HEADERS") && | ||
968 | (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || | ||
969 | Option::mkfile::do_mocs)) { | ||
970 | generateMocList((*val_it)); | ||
971 | } | ||
972 | if(!found_cache_dep && sources[x] != "OBJECTS") { | ||
973 | debug_msg(5, "Looking for dependencies for %s", (*val_it).latin1()); | ||
974 | generateDependencies(deplist, (*val_it), doDepends()); | ||
917 | } | 975 | } |
918 | } | 976 | } |
919 | } | 977 | } |
920 | if(project->isActiveConfig("qmake_cache") && (write_cache || !read_cache)) { | 978 | if(project->isActiveConfig("qmake_cache") && (write_cache || !read_cache)) { |
921 | QFile cachef(cache_file); | 979 | QFile cachef(cache_file); |
922 | if(cachef.open(IO_WriteOnly | IO_Translate)) { | 980 | if(cachef.open(IO_WriteOnly | IO_Translate)) { |
923 | debug_msg(2, "Writing internal cache information: %s", cache_file.latin1()); | 981 | debug_msg(2, "Writing internal cache information: %s", cache_file.latin1()); |
924 | QTextStream cachet(&cachef); | 982 | QTextStream cachet(&cachef); |
925 | cachet << "[check]" << "\n" | 983 | cachet << "[check]" << "\n" |
926 | << "QMAKE_CACHE_VERSION = " << qmake_version() << "\n" | 984 | << "QMAKE_CACHE_VERSION = " << qmake_version() << "\n" |
927 | << "QMAKE_ABSOLUTE_SOURCE_PATH = " << var("QMAKE_ABSOLUTE_SOURCE_PATH") << "\n" | 985 | << "QMAKE_ABSOLUTE_SOURCE_PATH = " << var("QMAKE_ABSOLUTE_SOURCE_PATH") << "\n" |
928 | << "MOC_DIR = " << var("MOC_DIR") << "\n" | 986 | << "MOC_DIR = " << var("MOC_DIR") << "\n" |
929 | << "UI_DIR = " << var("UI_DIR") << "\n" | 987 | << "UI_DIR = " << var("UI_DIR") << "\n" |
930 | << "UI_HEADERS_DIR = " << var("UI_HEADERS_DIR") << "\n" | 988 | << "UI_HEADERS_DIR = " << var("UI_HEADERS_DIR") << "\n" |
931 | << "UI_SOURCES_DIR = " << var("UI_SOURCES_DIR") << "\n"; | 989 | << "UI_SOURCES_DIR = " << var("UI_SOURCES_DIR") << "\n"; |
932 | cachet << "[depend]" << endl; | 990 | cachet << "[depend]" << endl; |
933 | for(QMap<QString, QStringList>::Iterator it = depends.begin(); | 991 | for(QMap<QString, QStringList>::Iterator it = depends.begin(); |
934 | it != depends.end(); ++it) | 992 | it != depends.end(); ++it) |
935 | cachet << depKeyMap[it.key()] << " = " << it.data().join(" ") << endl; | 993 | cachet << dependencyKey(it.key()) << " = " << it.data().join(" ") << endl; |
936 | cachet << "[mocable]" << endl; | 994 | cachet << "[mocable]" << endl; |
937 | QString mc, moc_sources[] = { QString("HEADERS"), QString("SOURCES"), QString::null }; | 995 | QString mc, moc_sources[] = { QString("HEADERS"), QString("SOURCES"), QString::null }; |
938 | for(int x = 0; moc_sources[x] != QString::null; x++) { | 996 | for(int x = 0; moc_sources[x] != QString::null; x++) { |
939 | QStringList &l = v[moc_sources[x]]; | 997 | QStringList &l = v[moc_sources[x]]; |
940 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 998 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
941 | QString f = fileFixify((*val_it)); | 999 | QString f = fileFixify((*val_it)); |
942 | if(!f.isEmpty()) { | 1000 | if(!f.isEmpty()) { |
943 | mc = mocablesToMOC[f]; | 1001 | mc = mocablesToMOC[f]; |
944 | if(mc.isEmpty()) | 1002 | if(mc.isEmpty()) |
945 | mc = "*qmake_ignore*"; | 1003 | mc = "*qmake_ignore*"; |
946 | cachet << f << " = " << mc << endl; | 1004 | cachet << f << " = " << mc << endl; |
947 | } | 1005 | } |
@@ -1044,77 +1102,85 @@ MakefileGenerator::init() | |||
1044 | QFileInfo fi(Option::fixPathToLocalOS((*it))); | 1102 | QFileInfo fi(Option::fixPathToLocalOS((*it))); |
1045 | if ( !project->isEmpty("UI_DIR") ) { | 1103 | if ( !project->isEmpty("UI_DIR") ) { |
1046 | impl = decl = project->first("UI_DIR"); | 1104 | impl = decl = project->first("UI_DIR"); |
1047 | QString d = fi.dirPath(); | 1105 | QString d = fi.dirPath(); |
1048 | if( d == ".") | 1106 | if( d == ".") |
1049 | d = QDir::currentDirPath(); | 1107 | d = QDir::currentDirPath(); |
1050 | d = fileFixify(d, QDir::currentDirPath(), Option::output_dir); | 1108 | d = fileFixify(d, QDir::currentDirPath(), Option::output_dir); |
1051 | if(!includepath.contains(d)) | 1109 | if(!includepath.contains(d)) |
1052 | includepath.append(d); | 1110 | includepath.append(d); |
1053 | } else { | 1111 | } else { |
1054 | if(decl.isEmpty() && !project->isEmpty("UI_HEADERS_DIR")) | 1112 | if(decl.isEmpty() && !project->isEmpty("UI_HEADERS_DIR")) |
1055 | decl = project->first("UI_HEADERS_DIR"); | 1113 | decl = project->first("UI_HEADERS_DIR"); |
1056 | if(!decl.isEmpty() || (project->isEmpty("UI_HEADERS_DIR") && | 1114 | if(!decl.isEmpty() || (project->isEmpty("UI_HEADERS_DIR") && |
1057 | !project->isEmpty("UI_SOURCES_DIR")) ) { | 1115 | !project->isEmpty("UI_SOURCES_DIR")) ) { |
1058 | QString d = fi.dirPath(); | 1116 | QString d = fi.dirPath(); |
1059 | if( d == ".") | 1117 | if( d == ".") |
1060 | d = QDir::currentDirPath(); | 1118 | d = QDir::currentDirPath(); |
1061 | d = fileFixify(d, QDir::currentDirPath(), Option::output_dir); | 1119 | d = fileFixify(d, QDir::currentDirPath(), Option::output_dir); |
1062 | if(includepath.contains(d)) | 1120 | if(includepath.contains(d)) |
1063 | includepath.append(d); | 1121 | includepath.append(d); |
1064 | } | 1122 | } |
1065 | if(impl.isEmpty() && !project->isEmpty("UI_SOURCES_DIR")) | 1123 | if(impl.isEmpty() && !project->isEmpty("UI_SOURCES_DIR")) |
1066 | impl = project->first("UI_SOURCES_DIR"); | 1124 | impl = project->first("UI_SOURCES_DIR"); |
1067 | if(fi.dirPath() != ".") { | 1125 | if(fi.dirPath() != ".") { |
1068 | if(impl.isEmpty()) | 1126 | if(impl.isEmpty()) |
1069 | impl = fi.dirPath() + Option::dir_sep; | 1127 | impl = fi.dirPath() + Option::dir_sep; |
1070 | if(decl.isEmpty()) | 1128 | if(decl.isEmpty()) |
1071 | decl = fi.dirPath() + Option::dir_sep; | 1129 | decl = fi.dirPath() + Option::dir_sep; |
1072 | } | 1130 | } |
1073 | } | 1131 | } |
1074 | impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); | 1132 | impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); |
1075 | if(!impl.isEmpty()) | 1133 | if(!impl.isEmpty() && !impl.endsWith(Option::dir_sep)) |
1076 | impl += Option::dir_sep; | 1134 | impl += Option::dir_sep; |
1077 | impl += fi.baseName(TRUE) + Option::cpp_ext.first(); | 1135 | impl += fi.baseName(TRUE) + Option::cpp_ext.first(); |
1078 | if(Option::output_dir != QDir::currentDirPath() && | 1136 | if(Option::output_dir != QDir::currentDirPath() && |
1079 | project->isEmpty("UI_DIR") && project->isEmpty("UI_HEADERS_DIR")) { | 1137 | project->isEmpty("UI_DIR") && project->isEmpty("UI_HEADERS_DIR")) { |
1080 | QString decl_fixed = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); | 1138 | QString decl_fixed = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); |
1081 | if(!includepath.contains(decl_fixed)) | 1139 | if(!includepath.contains(decl_fixed)) |
1082 | includepath.append(decl_fixed); | 1140 | includepath.append(decl_fixed); |
1083 | if(!includepath.contains(decl)) | 1141 | if(!includepath.contains(decl)) |
1084 | project->variables()["INCLUDEPATH"].append(decl); | 1142 | project->variables()["INCLUDEPATH"].append(decl); |
1085 | } | 1143 | } |
1086 | decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); | 1144 | decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); |
1087 | if(!decl.isEmpty()) | 1145 | if(!decl.isEmpty() && !decl.endsWith(Option::dir_sep)) |
1088 | decl += Option::dir_sep; | 1146 | decl += Option::dir_sep; |
1089 | decl += fi.baseName(TRUE) + Option::h_ext.first(); | 1147 | decl += fi.baseName(TRUE) + Option::h_ext.first(); |
1090 | logicWarn(impl, "SOURCES"); | 1148 | logicWarn(impl, "SOURCES"); |
1091 | logicWarn(decl, "HEADERS"); | 1149 | logicWarn(decl, "HEADERS"); |
1092 | decls.append(decl); | 1150 | decls.append(decl); |
1093 | impls.append(impl); | 1151 | impls.append(impl); |
1094 | findDependencies(impl).append(decl); | 1152 | findDependencies(impl).append(decl); |
1095 | 1153 | ||
1096 | QString mocable = Option::moc_mod + fi.baseName(TRUE) + Option::cpp_ext.first(); | 1154 | QString mocable = Option::h_moc_mod + fi.baseName(TRUE) + Option::h_moc_ext; |
1097 | if(!v["MOC_DIR"].isEmpty()) | 1155 | if(!v["MOC_DIR"].isEmpty()) |
1098 | mocable.prepend(v["MOC_DIR"].first()); | 1156 | mocable.prepend(v["MOC_DIR"].first()); |
1099 | else if(fi.dirPath() != ".") | 1157 | else if(fi.dirPath() != ".") |
1100 | mocable.prepend(fi.dirPath() + Option::dir_sep); | 1158 | mocable.prepend(fi.dirPath() + Option::dir_sep); |
1101 | logicWarn(mocable, "SOURCES"); | 1159 | logicWarn(mocable, "SOURCES"); |
1102 | mocablesToMOC[cleanFilePath(decl)] = mocable; | 1160 | mocablesToMOC[cleanFilePath(decl)] = mocable; |
1103 | mocablesFromMOC[cleanFilePath(mocable)] = decl; | 1161 | mocablesFromMOC[cleanFilePath(mocable)] = decl; |
1104 | v["_UIMOC"].append(mocable); | 1162 | v["_UIMOC"].append(mocable); |
1105 | } | 1163 | } |
1106 | v["OBJECTS"] += (v["UICOBJECTS"] = createObjectList("UICDECLS")); | 1164 | v["OBJECTS"] += (v["UICOBJECTS"] = createObjectList("UICDECLS")); |
1107 | } | 1165 | } |
1108 | 1166 | ||
1167 | //Translation files | ||
1168 | if(!project->isEmpty("TRANSLATIONS")) { | ||
1169 | QStringList &trf = project->variables()["TRANSLATIONS"]; | ||
1170 | for(QStringList::Iterator it = trf.begin(); it != trf.end(); ++it) { | ||
1171 | (*it) = Option::fixPathToLocalOS((*it)); | ||
1172 | } | ||
1173 | } | ||
1174 | |||
1109 | //Image files | 1175 | //Image files |
1110 | if(!project->isEmpty("IMAGES")) { | 1176 | if(!project->isEmpty("IMAGES")) { |
1111 | if(project->isEmpty("QMAKE_IMAGE_COLLECTION")) | 1177 | if(project->isEmpty("QMAKE_IMAGE_COLLECTION")) |
1112 | v["QMAKE_IMAGE_COLLECTION"].append("qmake_image_collection" + Option::cpp_ext.first()); | 1178 | v["QMAKE_IMAGE_COLLECTION"].append("qmake_image_collection" + Option::cpp_ext.first()); |
1113 | QString imgfile = project->first("QMAKE_IMAGE_COLLECTION"); | 1179 | QString imgfile = project->first("QMAKE_IMAGE_COLLECTION"); |
1114 | Option::fixPathToTargetOS(imgfile); | 1180 | Option::fixPathToTargetOS(imgfile); |
1115 | if(!project->isEmpty("UI_DIR") || !project->isEmpty("UI_SOURCES_DIR")) { | 1181 | if(!project->isEmpty("UI_DIR") || !project->isEmpty("UI_SOURCES_DIR")) { |
1116 | if(imgfile.find(Option::dir_sep) != -1) | 1182 | if(imgfile.find(Option::dir_sep) != -1) |
1117 | imgfile = imgfile.right(imgfile.findRev(Option::dir_sep) + 1); | 1183 | imgfile = imgfile.right(imgfile.findRev(Option::dir_sep) + 1); |
1118 | imgfile.prepend( (project->isEmpty("UI_DIR") ? project->first("UI_SOURCES_DIR") : | 1184 | imgfile.prepend( (project->isEmpty("UI_DIR") ? project->first("UI_SOURCES_DIR") : |
1119 | project->first("UI_DIR")) ); | 1185 | project->first("UI_DIR")) ); |
1120 | v["QMAKE_IMAGE_COLLECTION"] = QStringList(imgfile); | 1186 | v["QMAKE_IMAGE_COLLECTION"] = QStringList(imgfile); |
@@ -1123,115 +1189,148 @@ MakefileGenerator::init() | |||
1123 | if(!noIO()) { | 1189 | if(!noIO()) { |
1124 | QStringList &l = v["IMAGES"]; | 1190 | QStringList &l = v["IMAGES"]; |
1125 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1191 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1126 | if(!QFile::exists((*it))) { | 1192 | if(!QFile::exists((*it))) { |
1127 | warn_msg(WarnLogic, "Failure to open: %s", (*it).latin1()); | 1193 | warn_msg(WarnLogic, "Failure to open: %s", (*it).latin1()); |
1128 | continue; | 1194 | continue; |
1129 | } | 1195 | } |
1130 | findDependencies(imgfile).append(fileFixify((*it))); | 1196 | findDependencies(imgfile).append(fileFixify((*it))); |
1131 | } | 1197 | } |
1132 | } | 1198 | } |
1133 | v["OBJECTS"] += (v["IMAGEOBJECTS"] = createObjectList("QMAKE_IMAGE_COLLECTION")); | 1199 | v["OBJECTS"] += (v["IMAGEOBJECTS"] = createObjectList("QMAKE_IMAGE_COLLECTION")); |
1134 | } | 1200 | } |
1135 | if(Option::output_dir != QDir::currentDirPath()) | 1201 | if(Option::output_dir != QDir::currentDirPath()) |
1136 | project->variables()["INCLUDEPATH"].append(fileFixify(Option::output_dir, Option::output_dir, | 1202 | project->variables()["INCLUDEPATH"].append(fileFixify(Option::output_dir, Option::output_dir, |
1137 | Option::output_dir)); | 1203 | Option::output_dir)); |
1138 | 1204 | ||
1139 | //moc files | 1205 | //moc files |
1140 | if ( mocAware() ) { | 1206 | if ( mocAware() ) { |
1141 | if(!project->isEmpty("MOC_DIR")) | 1207 | if(!project->isEmpty("MOC_DIR")) |
1142 | project->variables()["INCLUDEPATH"].append(project->first("MOC_DIR")); | 1208 | project->variables()["INCLUDEPATH"].append(project->first("MOC_DIR")); |
1143 | v["OBJMOC"] = createObjectList("_HDRMOC") + createObjectList("_UIMOC"); | 1209 | if ( Option::h_moc_ext == Option::cpp_ext.first() ) |
1210 | v["OBJMOC"] = createObjectList("_HDRMOC") + createObjectList("_UIMOC"); | ||
1144 | 1211 | ||
1145 | QStringList &l = v["SRCMOC"]; | 1212 | QStringList &l = v["SRCMOC"]; |
1146 | l = v["_HDRMOC"] + v["_UIMOC"] + v["_SRCMOC"]; | 1213 | l = v["_HDRMOC"] + v["_UIMOC"] + v["_SRCMOC"]; |
1147 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 1214 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
1148 | if(!(*val_it).isEmpty()) | 1215 | if(!(*val_it).isEmpty()) |
1149 | (*val_it) = Option::fixPathToTargetOS((*val_it), FALSE); | 1216 | (*val_it) = Option::fixPathToTargetOS((*val_it), FALSE); |
1150 | } | 1217 | } |
1151 | } | 1218 | } |
1219 | |||
1220 | QString fixpaths[] = { QString("PRE_TARGETDEPS"), QString("POST_TARGETDEPS"), QString::null }; | ||
1221 | for(int path = 0; !fixpaths[path].isNull(); path++) { | ||
1222 | QStringList &l = v[fixpaths[path]]; | ||
1223 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | ||
1224 | if(!(*val_it).isEmpty()) | ||
1225 | (*val_it) = Option::fixPathToTargetOS((*val_it), FALSE); | ||
1226 | } | ||
1227 | } | ||
1228 | |||
1229 | // Make sure the INCLUDEPATH doesn't contain any empty(/null) entries | ||
1230 | QStringList &ipl = project->variables()["INCLUDEPATH"]; | ||
1231 | for(QStringList::Iterator ipl_it = ipl.begin(); ipl_it != ipl.end();) { | ||
1232 | if ((*ipl_it).isEmpty()) | ||
1233 | ipl_it = ipl.remove(ipl_it); | ||
1234 | else | ||
1235 | ++ipl_it; | ||
1236 | } | ||
1152 | } | 1237 | } |
1153 | 1238 | ||
1154 | bool | 1239 | bool |
1155 | MakefileGenerator::processPrlFile(QString &file) | 1240 | MakefileGenerator::processPrlFile(QString &file) |
1156 | { | 1241 | { |
1157 | bool ret = FALSE, try_replace_file=FALSE; | 1242 | bool ret = FALSE, try_replace_file=FALSE; |
1158 | QString prl_file; | 1243 | QString meta_file, orig_file = file; |
1159 | if(file.endsWith(Option::prl_ext)) { | 1244 | if(QMakeMetaInfo::libExists(file)) { |
1160 | try_replace_file = TRUE; | 1245 | try_replace_file = TRUE; |
1161 | prl_file = file; | 1246 | meta_file = file; |
1162 | file = ""; | 1247 | file = ""; |
1163 | } else { | 1248 | } else { |
1164 | QString tmp = file; | 1249 | QString tmp = file; |
1165 | int ext = tmp.findRev('.'); | 1250 | int ext = tmp.findRev('.'); |
1166 | if(ext != -1) | 1251 | if(ext != -1) |
1167 | tmp = tmp.left(ext); | 1252 | tmp = tmp.left(ext); |
1168 | prl_file = tmp + Option::prl_ext; | 1253 | meta_file = tmp; |
1169 | } | 1254 | } |
1170 | prl_file = fileFixify(prl_file); | 1255 | meta_file = fileFixify(meta_file); |
1171 | if(!QFile::exists(fileFixify(prl_file, QDir::currentDirPath(), Option::output_dir)) && | 1256 | if(!QMakeMetaInfo::libExists(fileFixify(meta_file, QDir::currentDirPath(), Option::output_dir)) && |
1172 | project->isActiveConfig("qt")) { | 1257 | project->isActiveConfig("qt")) { |
1173 | QString stem = prl_file, dir, extn; | 1258 | QString stem = meta_file, dir, extn; |
1174 | int slsh = stem.findRev('/'), hadlib = 0; | 1259 | int slsh = stem.findRev('/'), hadlib = 0; |
1175 | if(slsh != -1) { | 1260 | if(slsh != -1) { |
1176 | dir = stem.left(slsh + 1); | 1261 | dir = stem.left(slsh + 1); |
1177 | stem = stem.right(stem.length() - slsh - 1); | 1262 | stem = stem.right(stem.length() - slsh - 1); |
1178 | } | 1263 | } |
1179 | if(stem.startsWith("lib")) { | 1264 | if(stem.startsWith("lib")) { |
1180 | hadlib = 1; | 1265 | hadlib = 1; |
1181 | stem = stem.right(stem.length() - 3); | 1266 | stem = stem.right(stem.length() - 3); |
1182 | } | 1267 | } |
1183 | int dot = stem.find('.'); | 1268 | int dot = stem.find('.'); |
1184 | if(dot != -1) { | 1269 | if(dot != -1) { |
1185 | extn = stem.right(stem.length() - dot); | 1270 | extn = stem.right(stem.length() - dot); |
1186 | stem = stem.left(dot); | 1271 | stem = stem.left(dot); |
1187 | } | 1272 | } |
1188 | if(stem == "qt" || stem == "qte" || stem == "qte-mt" || stem == "qt-mt") { | 1273 | if(stem == "qt" || stem == "qte" || stem == "qte-mt" || stem == "qt-mt") { |
1189 | if(stem.endsWith("-mt")) | 1274 | if(stem.endsWith("-mt")) |
1190 | stem = stem.left(stem.length() - 3); //lose the -mt | 1275 | stem = stem.left(stem.length() - 3); //lose the -mt |
1191 | else | 1276 | else |
1192 | stem += "-mt"; //try the thread case | 1277 | stem += "-mt"; //try the thread case |
1193 | prl_file = dir; | 1278 | meta_file = dir; |
1194 | if(hadlib) | 1279 | if(hadlib) |
1195 | prl_file += "lib"; | 1280 | meta_file += "lib"; |
1196 | prl_file += stem + extn; | 1281 | meta_file += stem + extn; |
1197 | try_replace_file = TRUE; | 1282 | try_replace_file = TRUE; |
1198 | } | 1283 | } |
1199 | } | 1284 | } |
1200 | QString real_prl_file = Option::fixPathToLocalOS(prl_file); | 1285 | QString real_meta_file = Option::fixPathToLocalOS(meta_file); |
1201 | if(project->variables()["QMAKE_PRL_INTERNAL_FILES"].findIndex(prl_file) != -1) { | 1286 | if(project->variables()["QMAKE_PRL_INTERNAL_FILES"].findIndex(QMakeMetaInfo::findLib(meta_file)) != -1) { |
1202 | ret = TRUE; | 1287 | ret = TRUE; |
1203 | } else if(!real_prl_file.isEmpty() && | 1288 | } else if(!meta_file.isEmpty()) { |
1204 | QFile::exists(fileFixify(real_prl_file, QDir::currentDirPath(), Option::output_dir))) { | 1289 | QString f = fileFixify(real_meta_file, QDir::currentDirPath(), Option::output_dir); |
1205 | project->variables()["QMAKE_PRL_INTERNAL_FILES"].append(prl_file); | 1290 | if(QMakeMetaInfo::libExists(f)) { |
1206 | QMakeProject proj; | 1291 | QMakeMetaInfo libinfo; |
1207 | debug_msg(1, "Processing PRL file: %s", real_prl_file.latin1()); | 1292 | debug_msg(1, "Processing PRL file: %s", real_meta_file.latin1()); |
1208 | if(!proj.read(fileFixify(real_prl_file, QDir::currentDirPath(), Option::output_dir), | 1293 | if(!libinfo.readLib(f)) { |
1209 | QDir::currentDirPath(), TRUE)) { | 1294 | fprintf(stderr, "Error processing meta file: %s\n", real_meta_file.latin1()); |
1210 | fprintf(stderr, "Error processing prl file: %s\n", real_prl_file.latin1()); | 1295 | } else if(project->isActiveConfig("no_read_prl_" + libinfo.type().lower())) { |
1211 | } else { | 1296 | debug_msg(2, "Ignored meta file %s [%s]", real_meta_file.latin1(), libinfo.type().latin1()); |
1212 | ret = TRUE; | 1297 | } else { |
1213 | QMap<QString, QStringList> &vars = proj.variables(); | 1298 | ret = TRUE; |
1214 | for( QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) | 1299 | QMap<QString, QStringList> &vars = libinfo.variables(); |
1215 | processPrlVariable(it.key(), it.data()); | 1300 | for( QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) |
1216 | if(try_replace_file && !proj.isEmpty("QMAKE_PRL_TARGET")) { | 1301 | processPrlVariable(it.key(), it.data()); |
1217 | QString dir; | 1302 | if(try_replace_file && !libinfo.isEmpty("QMAKE_PRL_TARGET")) { |
1218 | int slsh = real_prl_file.findRev(Option::dir_sep); | 1303 | QString dir; |
1219 | if(slsh != -1) | 1304 | int slsh = real_meta_file.findRev(Option::dir_sep); |
1220 | dir = real_prl_file.left(slsh+1); | 1305 | if(slsh != -1) |
1221 | file = dir + proj.first("QMAKE_PRL_TARGET"); | 1306 | dir = real_meta_file.left(slsh+1); |
1307 | file = libinfo.first("QMAKE_PRL_TARGET"); | ||
1308 | if(QDir::isRelativePath(file)) | ||
1309 | file.prepend(dir); | ||
1310 | } | ||
1222 | } | 1311 | } |
1223 | } | 1312 | } |
1224 | if(ret) | 1313 | if(ret) { |
1225 | project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].append(prl_file); | 1314 | QString mf = QMakeMetaInfo::findLib(meta_file); |
1315 | project->variables()["QMAKE_PRL_INTERNAL_FILES"].append(mf); | ||
1316 | project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].append(mf); | ||
1317 | } | ||
1318 | } | ||
1319 | if(try_replace_file && file.isEmpty()) { | ||
1320 | #if 0 | ||
1321 | warn_msg(WarnLogic, "Found prl [%s] file with no target [%s]!", meta_file.latin1(), | ||
1322 | orig_file.latin1()); | ||
1323 | #endif | ||
1324 | file = orig_file; | ||
1226 | } | 1325 | } |
1227 | return ret; | 1326 | return ret; |
1228 | } | 1327 | } |
1229 | 1328 | ||
1230 | void | 1329 | void |
1231 | MakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) | 1330 | MakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) |
1232 | { | 1331 | { |
1233 | if(var == "QMAKE_PRL_LIBS") { | 1332 | if(var == "QMAKE_PRL_LIBS") { |
1234 | QString where = "QMAKE_LIBS"; | 1333 | QString where = "QMAKE_LIBS"; |
1235 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | 1334 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) |
1236 | where = project->first("QMAKE_INTERNAL_PRL_LIBS"); | 1335 | where = project->first("QMAKE_INTERNAL_PRL_LIBS"); |
1237 | QStringList &out = project->variables()[where]; | 1336 | QStringList &out = project->variables()[where]; |
@@ -1287,48 +1386,54 @@ MakefileGenerator::writePrlFile(QTextStream &t) | |||
1287 | if(bdir.isEmpty()) | 1386 | if(bdir.isEmpty()) |
1288 | bdir = QDir::currentDirPath(); | 1387 | bdir = QDir::currentDirPath(); |
1289 | t << "QMAKE_PRL_BUILD_DIR = " << bdir << endl; | 1388 | t << "QMAKE_PRL_BUILD_DIR = " << bdir << endl; |
1290 | 1389 | ||
1291 | if(!project->projectFile().isEmpty() && project->projectFile() != "-") | 1390 | if(!project->projectFile().isEmpty() && project->projectFile() != "-") |
1292 | t << "QMAKE_PRO_INPUT = " << project->projectFile().section('/', -1) << endl; | 1391 | t << "QMAKE_PRO_INPUT = " << project->projectFile().section('/', -1) << endl; |
1293 | 1392 | ||
1294 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 1393 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) |
1295 | t << "QMAKE_PRL_SOURCE_DIR = " << project->first("QMAKE_ABSOLUTE_SOURCE_PATH") << endl; | 1394 | t << "QMAKE_PRL_SOURCE_DIR = " << project->first("QMAKE_ABSOLUTE_SOURCE_PATH") << endl; |
1296 | t << "QMAKE_PRL_TARGET = " << target << endl; | 1395 | t << "QMAKE_PRL_TARGET = " << target << endl; |
1297 | if(!project->isEmpty("PRL_EXPORT_DEFINES")) | 1396 | if(!project->isEmpty("PRL_EXPORT_DEFINES")) |
1298 | t << "QMAKE_PRL_DEFINES = " << project->variables()["PRL_EXPORT_DEFINES"].join(" ") << endl; | 1397 | t << "QMAKE_PRL_DEFINES = " << project->variables()["PRL_EXPORT_DEFINES"].join(" ") << endl; |
1398 | if(!project->isEmpty("PRL_EXPORT_CFLAGS")) | ||
1399 | t << "QMAKE_PRL_CFLAGS = " << project->variables()["PRL_EXPORT_CFLAGS"].join(" ") << endl; | ||
1400 | if(!project->isEmpty("PRL_EXPORT_CXXFLAGS")) | ||
1401 | t << "QMAKE_PRL_CXXFLAGS = " << project->variables()["PRL_EXPORT_CXXFLAGS"].join(" ") << endl; | ||
1299 | if(!project->isEmpty("CONFIG")) | 1402 | if(!project->isEmpty("CONFIG")) |
1300 | t << "QMAKE_PRL_CONFIG = " << project->variables()["CONFIG"].join(" ") << endl; | 1403 | t << "QMAKE_PRL_CONFIG = " << project->variables()["CONFIG"].join(" ") << endl; |
1301 | if(!project->isEmpty("VERSION")) | 1404 | if(!project->isEmpty("VERSION")) |
1302 | t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << endl; | 1405 | t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << endl; |
1303 | if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib")) { | 1406 | if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib")) { |
1304 | QStringList libs; | 1407 | QStringList libs; |
1305 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | 1408 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) |
1306 | libs = project->variables()["QMAKE_INTERNAL_PRL_LIBS"]; | 1409 | libs = project->variables()["QMAKE_INTERNAL_PRL_LIBS"]; |
1307 | else | 1410 | else |
1308 | libs << "QMAKE_LIBS"; //obvious one | 1411 | libs << "QMAKE_LIBS"; //obvious one |
1309 | t << "QMAKE_PRL_LIBS = "; | 1412 | t << "QMAKE_PRL_LIBS = "; |
1310 | for(QStringList::Iterator it = libs.begin(); it != libs.end(); ++it) | 1413 | for(QStringList::Iterator it = libs.begin(); it != libs.end(); ++it) |
1311 | t << project->variables()[(*it)].join(" ") << " "; | 1414 | t << project->variables()[(*it)].join(" ") << " "; |
1312 | t << endl; | 1415 | t << endl; |
1313 | } | 1416 | } |
1314 | } | 1417 | } |
1315 | 1418 | ||
1316 | bool | 1419 | bool |
1317 | MakefileGenerator::write() | 1420 | MakefileGenerator::write() |
1318 | { | 1421 | { |
1422 | usePlatformDir(); | ||
1319 | init(); | 1423 | init(); |
1320 | findLibraries(); | 1424 | findLibraries(); |
1321 | if((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || //write prl | 1425 | if((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || //write prl |
1322 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) && | 1426 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) && |
1427 | project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty() && | ||
1323 | project->isActiveConfig("create_prl") && project->first("TEMPLATE") == "lib" && | 1428 | project->isActiveConfig("create_prl") && project->first("TEMPLATE") == "lib" && |
1324 | !project->isActiveConfig("plugin")) { | 1429 | !project->isActiveConfig("plugin")) { |
1325 | QString prl = var("TARGET"); | 1430 | QString prl = var("TARGET"); |
1326 | int slsh = prl.findRev(Option::dir_sep); | 1431 | int slsh = prl.findRev(Option::dir_sep); |
1327 | if(slsh != -1) | 1432 | if(slsh != -1) |
1328 | prl = prl.right(prl.length() - slsh); | 1433 | prl = prl.right(prl.length() - slsh); |
1329 | int dot = prl.find('.'); | 1434 | int dot = prl.find('.'); |
1330 | if(dot != -1) | 1435 | if(dot != -1) |
1331 | prl = prl.left(dot); | 1436 | prl = prl.left(dot); |
1332 | prl += Option::prl_ext; | 1437 | prl += Option::prl_ext; |
1333 | if(!project->isEmpty("DESTDIR")) | 1438 | if(!project->isEmpty("DESTDIR")) |
1334 | prl.prepend(var("DESTDIR")); | 1439 | prl.prepend(var("DESTDIR")); |
@@ -1337,51 +1442,106 @@ MakefileGenerator::write() | |||
1337 | if(ft.open(IO_WriteOnly)) { | 1442 | if(ft.open(IO_WriteOnly)) { |
1338 | project->variables()["ALL_DEPS"].append(prl); | 1443 | project->variables()["ALL_DEPS"].append(prl); |
1339 | project->variables()["QMAKE_INTERNAL_PRL_FILE"].append(prl); | 1444 | project->variables()["QMAKE_INTERNAL_PRL_FILE"].append(prl); |
1340 | QTextStream t(&ft); | 1445 | QTextStream t(&ft); |
1341 | writePrlFile(t); | 1446 | writePrlFile(t); |
1342 | ft.close(); | 1447 | ft.close(); |
1343 | } | 1448 | } |
1344 | } | 1449 | } |
1345 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE && | 1450 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE && |
1346 | project->isActiveConfig("link_prl")) //load up prl's' | 1451 | project->isActiveConfig("link_prl")) //load up prl's' |
1347 | processPrlFiles(); | 1452 | processPrlFiles(); |
1348 | 1453 | ||
1349 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || | 1454 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || //write prl file |
1350 | Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { | 1455 | Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { |
1351 | QTextStream t(&Option::output); | 1456 | QTextStream t(&Option::output); |
1352 | writeMakefile(t); | 1457 | writeMakefile(t); |
1353 | } | 1458 | } |
1354 | return TRUE; | 1459 | return TRUE; |
1355 | } | 1460 | } |
1356 | 1461 | ||
1462 | // Manipulate directories, so it's possible to build | ||
1463 | // several cross-platform targets concurrently | ||
1464 | void | ||
1465 | MakefileGenerator::usePlatformDir() | ||
1466 | { | ||
1467 | QString pltDir(project->first("QMAKE_PLATFORM_DIR")); | ||
1468 | if(pltDir.isEmpty()) | ||
1469 | return; | ||
1470 | char sep = QDir::separator(); | ||
1471 | QString slashPltDir = sep + pltDir; | ||
1472 | |||
1473 | QString filePath = project->first("DESTDIR"); | ||
1474 | project->variables()["DESTDIR"] = filePath | ||
1475 | + (filePath.isEmpty() ? pltDir : slashPltDir); | ||
1476 | |||
1477 | filePath = project->first("DLLDESTDIR"); | ||
1478 | project->variables()["DLLDESTDIR"] = filePath | ||
1479 | + (filePath.isEmpty() ? pltDir : slashPltDir); | ||
1480 | |||
1481 | filePath = project->first("OBJECTS_DIR"); | ||
1482 | project->variables()["OBJECTS_DIR"] = filePath | ||
1483 | + (filePath.isEmpty() ? pltDir : slashPltDir); | ||
1484 | |||
1485 | filePath = project->first("QMAKE_LIBDIR_QT"); | ||
1486 | project->variables()["QMAKE_LIBDIR_QT"] = filePath | ||
1487 | + (filePath.isEmpty() ? pltDir : slashPltDir); | ||
1488 | |||
1489 | filePath = project->first("QMAKE_LIBS_QT"); | ||
1490 | int fpi = filePath.findRev(sep); | ||
1491 | if (fpi == -1) | ||
1492 | project->variables()["QMAKE_LIBS_QT"].prepend(pltDir + sep); | ||
1493 | else | ||
1494 | project->variables()["QMAKE_LIBS_QT"] = filePath.left(fpi) | ||
1495 | + slashPltDir | ||
1496 | + filePath.mid(fpi); | ||
1497 | |||
1498 | filePath = project->first("QMAKE_LIBS_QT_THREAD"); | ||
1499 | fpi = filePath.findRev(sep); | ||
1500 | if (fpi == -1) | ||
1501 | project->variables()["QMAKE_LIBS_QT_THREAD"].prepend(pltDir + sep); | ||
1502 | else | ||
1503 | project->variables()["QMAKE_LIBS_QT_THREAD"] = filePath.left(fpi) | ||
1504 | + slashPltDir | ||
1505 | + filePath.mid(fpi); | ||
1506 | |||
1507 | filePath = project->first("QMAKE_LIBS_QT_ENTRY"); | ||
1508 | fpi = filePath.findRev(sep); | ||
1509 | if (fpi == -1) | ||
1510 | project->variables()["QMAKE_LIBS_QT_ENTRY"].prepend(pltDir + sep); | ||
1511 | else | ||
1512 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = filePath.left(fpi) | ||
1513 | + slashPltDir | ||
1514 | + filePath.mid(fpi); | ||
1515 | } | ||
1516 | |||
1357 | void | 1517 | void |
1358 | MakefileGenerator::writeObj(QTextStream &t, const QString &obj, const QString &src) | 1518 | MakefileGenerator::writeObj(QTextStream &t, const QString &obj, const QString &src) |
1359 | { | 1519 | { |
1360 | QStringList &objl = project->variables()[obj]; | 1520 | QStringList &objl = project->variables()[obj]; |
1361 | QStringList &srcl = project->variables()[src]; | 1521 | QStringList &srcl = project->variables()[src]; |
1362 | 1522 | ||
1363 | QStringList::Iterator oit = objl.begin(); | 1523 | QStringList::Iterator oit = objl.begin(); |
1364 | QStringList::Iterator sit = srcl.begin(); | 1524 | QStringList::Iterator sit = srcl.begin(); |
1365 | QString stringSrc("$src"); | 1525 | QString stringSrc("$src"); |
1366 | QString stringObj("$obj"); | 1526 | QString stringObj("$obj"); |
1367 | for( ;sit != srcl.end() && oit != objl.end(); oit++, sit++) { | 1527 | for( ;sit != srcl.end() && oit != objl.end(); oit++, sit++) { |
1368 | if((*sit).isEmpty()) | 1528 | if((*sit).isEmpty()) |
1369 | continue; | 1529 | continue; |
1370 | 1530 | ||
1371 | if(!doDepends()) { | 1531 | if(!doDepends()) { |
1372 | QString sdep, odep = (*sit) + " "; | 1532 | QString sdep, odep = (*sit) + " "; |
1373 | QStringList deps = findDependencies((*sit)); | 1533 | QStringList deps = findDependencies((*sit)); |
1374 | for(QStringList::Iterator dit = deps.begin(); dit != deps.end(); dit++) { | 1534 | for(QStringList::Iterator dit = deps.begin(); dit != deps.end(); dit++) { |
1375 | if((*dit).endsWith(Option::moc_ext)) | 1535 | if((*dit).endsWith(Option::cpp_moc_ext)) |
1376 | odep += (*dit) + " "; | 1536 | odep += (*dit) + " "; |
1377 | else | 1537 | else |
1378 | sdep += (*dit) + " "; | 1538 | sdep += (*dit) + " "; |
1379 | } | 1539 | } |
1380 | t << (*sit) << ": " << sdep << endl | 1540 | t << (*sit) << ": " << sdep << endl |
1381 | << (*oit) << ": " << odep ; | 1541 | << (*oit) << ": " << odep ; |
1382 | } else { | 1542 | } else { |
1383 | t << (*oit) << ": " << (*sit) << " " << findDependencies((*sit)).join(" \\\n\t\t"); | 1543 | t << (*oit) << ": " << (*sit) << " " << findDependencies((*sit)).join(" \\\n\t\t"); |
1384 | } | 1544 | } |
1385 | 1545 | ||
1386 | QString comp, cimp; | 1546 | QString comp, cimp; |
1387 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { | 1547 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { |
@@ -1397,131 +1557,137 @@ MakefileGenerator::writeObj(QTextStream &t, const QString &obj, const QString &s | |||
1397 | } | 1557 | } |
1398 | bool use_implicit_rule = !project->isEmpty(cimp); | 1558 | bool use_implicit_rule = !project->isEmpty(cimp); |
1399 | if(use_implicit_rule) { | 1559 | if(use_implicit_rule) { |
1400 | if(!project->isEmpty("OBJECTS_DIR")) { | 1560 | if(!project->isEmpty("OBJECTS_DIR")) { |
1401 | use_implicit_rule = FALSE; | 1561 | use_implicit_rule = FALSE; |
1402 | } else { | 1562 | } else { |
1403 | int dot = (*sit).findRev('.'); | 1563 | int dot = (*sit).findRev('.'); |
1404 | if(dot == -1 || ((*sit).left(dot) + Option::obj_ext != (*oit))) | 1564 | if(dot == -1 || ((*sit).left(dot) + Option::obj_ext != (*oit))) |
1405 | use_implicit_rule = FALSE; | 1565 | use_implicit_rule = FALSE; |
1406 | } | 1566 | } |
1407 | } | 1567 | } |
1408 | if (!use_implicit_rule && !project->isEmpty(comp)) { | 1568 | if (!use_implicit_rule && !project->isEmpty(comp)) { |
1409 | QString p = var(comp); | 1569 | QString p = var(comp), srcf(*sit); |
1410 | p.replace(stringSrc, (*sit)); | 1570 | p.replace(stringSrc, srcf); |
1411 | p.replace(stringObj, (*oit)); | 1571 | p.replace(stringObj, (*oit)); |
1412 | t << "\n\t" << p; | 1572 | t << "\n\t" << p; |
1413 | } | 1573 | } |
1414 | t << endl << endl; | 1574 | t << endl << endl; |
1415 | } | 1575 | } |
1416 | } | 1576 | } |
1417 | 1577 | ||
1418 | 1578 | ||
1419 | void | 1579 | void |
1420 | MakefileGenerator::writeUicSrc(QTextStream &t, const QString &ui) | 1580 | MakefileGenerator::writeUicSrc(QTextStream &t, const QString &ui) |
1421 | { | 1581 | { |
1422 | QStringList &uil = project->variables()[ui]; | 1582 | QStringList &uil = project->variables()[ui]; |
1423 | for(QStringList::Iterator it = uil.begin(); it != uil.end(); it++) { | 1583 | for(QStringList::Iterator it = uil.begin(); it != uil.end(); it++) { |
1424 | QString deps = findDependencies((*it)).join(" \\\n\t\t"), decl, impl; | 1584 | QString decl, impl; |
1425 | { | 1585 | { |
1426 | QString tmp = (*it), impl_dir, decl_dir; | 1586 | QString tmp = (*it), impl_dir, decl_dir; |
1427 | decl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::h_ext.first()); | 1587 | decl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::h_ext.first()); |
1428 | decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); | 1588 | int dlen = decl.findRev(Option::dir_sep) + 1; |
1429 | int dlen = decl.findRev(Option::dir_sep) + 1; | ||
1430 | tmp = (*it); | 1589 | tmp = (*it); |
1431 | impl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::cpp_ext.first()); | 1590 | impl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::cpp_ext.first()); |
1432 | impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); | 1591 | int ilen = decl.findRev(Option::dir_sep) + 1; |
1433 | int ilen = decl.findRev(Option::dir_sep) + 1; | ||
1434 | if(!project->isEmpty("UI_DIR")) { | 1592 | if(!project->isEmpty("UI_DIR")) { |
1435 | impl_dir = project->first("UI_DIR"); | 1593 | impl_dir = project->first("UI_DIR"); |
1436 | decl = project->first("UI_DIR") + decl.right(decl.length() - dlen); | 1594 | decl = project->first("UI_DIR") + decl.right(decl.length() - dlen); |
1437 | impl = project->first("UI_DIR") + impl.right(impl.length() - ilen); | 1595 | impl = project->first("UI_DIR") + impl.right(impl.length() - ilen); |
1438 | } else { | 1596 | } else { |
1439 | if(!project->isEmpty("UI_HEADERS_DIR")) { | 1597 | if(!project->isEmpty("UI_HEADERS_DIR")) { |
1440 | decl_dir = project->first("UI_HEADERS_DIR"); | 1598 | decl_dir = project->first("UI_HEADERS_DIR"); |
1441 | decl = project->first("UI_HEADERS_DIR") + decl.right(decl.length() - dlen); | 1599 | decl = project->first("UI_HEADERS_DIR") + decl.right(decl.length() - dlen); |
1442 | } | 1600 | } |
1443 | if(!project->isEmpty("UI_SOURCES_DIR")) { | 1601 | if(!project->isEmpty("UI_SOURCES_DIR")) { |
1444 | impl_dir = project->first("UI_SOURCES_DIR"); | 1602 | impl_dir = project->first("UI_SOURCES_DIR"); |
1445 | impl = project->first("UI_SOURCES_DIR") + impl.right(impl.length() - ilen); | 1603 | impl = project->first("UI_SOURCES_DIR") + impl.right(impl.length() - ilen); |
1446 | } | 1604 | } |
1447 | } | 1605 | } |
1448 | if(decl_dir.isEmpty()) | 1606 | impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); |
1449 | decl_dir = decl.left(dlen); | 1607 | decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); |
1450 | if(impl_dir.isEmpty()) | 1608 | if(decl_dir.isEmpty()) |
1451 | impl_dir = impl.left(ilen); | 1609 | decl_dir = decl.section(Option::dir_sep,0,-2); |
1452 | if(!impl_dir.isEmpty()) | 1610 | if(impl_dir.isEmpty()) |
1453 | createDir(Option::output_dir + Option::dir_sep + impl_dir); | 1611 | impl_dir = impl.section(Option::dir_sep,0,-2); |
1454 | if(!decl_dir.isEmpty() && decl_dir != impl_dir) | 1612 | if (QDir::isRelativePath(impl_dir)) |
1455 | createDir(Option::output_dir + Option::dir_sep + decl_dir); | 1613 | impl_dir.prepend(Option::output_dir + Option::dir_sep); |
1456 | } | 1614 | if (QDir::isRelativePath(decl_dir)) |
1457 | t << decl << ": " << (*it) << " " << deps << "\n\t" | 1615 | decl_dir.prepend(Option::output_dir + Option::dir_sep); |
1616 | createDir(impl_dir); | ||
1617 | createDir(decl_dir); | ||
1618 | } | ||
1619 | QStringList deps = findDependencies((*it)); | ||
1620 | deps.remove(decl); //avoid circular dependencies.. | ||
1621 | t << decl << ": " << (*it) << " " << deps.join(" \\\n\t\t") << "\n\t" | ||
1458 | << "$(UIC) " << (*it) << " -o " << decl << endl << endl; | 1622 | << "$(UIC) " << (*it) << " -o " << decl << endl << endl; |
1459 | 1623 | ||
1460 | QString mildDecl = decl; | 1624 | QString mildDecl = decl; |
1461 | int k = mildDecl.findRev( Option::dir_sep ); | 1625 | int k = mildDecl.findRev(Option::dir_sep); |
1462 | if ( k != -1 ) | 1626 | if ( k != -1 ) |
1463 | mildDecl = mildDecl.mid( k + 1 ); | 1627 | mildDecl = mildDecl.mid( k + 1 ); |
1464 | 1628 | t << impl << ": " << decl << " " << (*it) << " " << deps.join(" \\\n\t\t") << "\n\t" | |
1465 | t << impl << ": " << decl << " " << (*it) << " " << deps << "\n\t" | 1629 | << "$(UIC)"; |
1466 | << "$(UIC) " << (*it) << " -i " << mildDecl << " -o " << impl << endl << endl; | 1630 | t << " " << (*it) << " -i " << mildDecl << " -o " << impl << endl << endl; |
1467 | } | 1631 | } |
1468 | } | 1632 | } |
1469 | 1633 | ||
1470 | 1634 | ||
1471 | void | 1635 | void |
1472 | MakefileGenerator::writeMocObj(QTextStream &t, const QString &obj, const QString &src) | 1636 | MakefileGenerator::writeMocObj(QTextStream &t, const QString &obj, const QString &src) |
1473 | { | 1637 | { |
1474 | QStringList &objl = project->variables()[obj], | 1638 | QStringList &objl = project->variables()[obj], |
1475 | &srcl = project->variables()[src]; | 1639 | &srcl = project->variables()[src]; |
1476 | QStringList::Iterator oit = objl.begin(), sit = srcl.begin(); | 1640 | QStringList::Iterator oit = objl.begin(), sit = srcl.begin(); |
1477 | QString stringSrc("$src"), stringObj("$obj"); | 1641 | QString stringSrc("$src"), stringObj("$obj"); |
1478 | for( ;sit != srcl.end() && oit != objl.end(); oit++, sit++) { | 1642 | for( ;sit != srcl.end() && oit != objl.end(); oit++, sit++) { |
1479 | QString hdr = findMocSource((*sit)); | 1643 | QString hdr = findMocSource((*sit)); |
1480 | t << (*oit) << ": " << (*sit) << " " | 1644 | t << (*oit) << ": " |
1645 | << (*sit) << " " << findDependencies((*sit)).join(" \\\n\t\t") << " " | ||
1481 | << hdr << " " << findDependencies(hdr).join(" \\\n\t\t"); | 1646 | << hdr << " " << findDependencies(hdr).join(" \\\n\t\t"); |
1482 | bool use_implicit_rule = !project->isEmpty("QMAKE_RUN_CXX_IMP"); | 1647 | bool use_implicit_rule = !project->isEmpty("QMAKE_RUN_CXX_IMP"); |
1483 | if(use_implicit_rule) { | 1648 | if(use_implicit_rule) { |
1484 | if(!project->isEmpty("OBJECTS_DIR") || !project->isEmpty("MOC_DIR")) { | 1649 | if(!project->isEmpty("OBJECTS_DIR") || !project->isEmpty("MOC_DIR")) { |
1485 | use_implicit_rule = FALSE; | 1650 | use_implicit_rule = FALSE; |
1486 | } else { | 1651 | } else { |
1487 | int dot = (*sit).findRev('.'); | 1652 | int dot = (*sit).findRev('.'); |
1488 | if(dot == -1 || ((*sit).left(dot) + Option::obj_ext != (*oit))) | 1653 | if(dot == -1 || ((*sit).left(dot) + Option::obj_ext != (*oit))) |
1489 | use_implicit_rule = FALSE; | 1654 | use_implicit_rule = FALSE; |
1490 | } | 1655 | } |
1491 | } | 1656 | } |
1492 | if (!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { | 1657 | if (!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { |
1493 | QString p = var("QMAKE_RUN_CXX"); | 1658 | QString p = var("QMAKE_RUN_CXX"), srcf(*sit); |
1494 | p.replace(stringSrc, (*sit)); | 1659 | p.replace(stringSrc, srcf); |
1495 | p.replace(stringObj, (*oit)); | 1660 | p.replace(stringObj, (*oit)); |
1496 | t << "\n\t" << p; | 1661 | t << "\n\t" << p; |
1497 | } | 1662 | } |
1498 | t << endl << endl; | 1663 | t << endl << endl; |
1499 | } | 1664 | } |
1500 | } | 1665 | } |
1501 | 1666 | ||
1502 | 1667 | ||
1503 | void | 1668 | void |
1504 | MakefileGenerator::writeMocSrc(QTextStream &t, const QString &src) | 1669 | MakefileGenerator::writeMocSrc(QTextStream &t, const QString &src) |
1505 | { | 1670 | { |
1506 | QStringList &l = project->variables()[src]; | 1671 | QStringList &l = project->variables()[src]; |
1507 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1672 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1508 | QString m = Option::fixPathToTargetOS(findMocDestination(*it)); | 1673 | QString m = Option::fixPathToTargetOS(findMocDestination(*it)); |
1509 | if ( !m.isEmpty()) { | 1674 | if ( !m.isEmpty()) { |
1510 | QString deps; | 1675 | QString deps; |
1511 | if(!project->isActiveConfig("no_mocdepend")) | 1676 | if(!project->isActiveConfig("no_mocdepend")) |
1512 | deps += "$(MOC) "; | 1677 | deps += "$(MOC) "; |
1513 | deps += (*it); | 1678 | deps += (*it); |
1514 | t << m << ": " << deps << "\n\t" | 1679 | t << m << ": " << deps << "\n\t" |
1515 | << "$(MOC) " << (*it) << " -o " << m << endl << endl; | 1680 | << "$(MOC)"; |
1681 | t << " " << (*it) << " -o " << m << endl << endl; | ||
1516 | } | 1682 | } |
1517 | } | 1683 | } |
1518 | } | 1684 | } |
1519 | 1685 | ||
1520 | void | 1686 | void |
1521 | MakefileGenerator::writeYaccSrc(QTextStream &t, const QString &src) | 1687 | MakefileGenerator::writeYaccSrc(QTextStream &t, const QString &src) |
1522 | { | 1688 | { |
1523 | QStringList &l = project->variables()[src]; | 1689 | QStringList &l = project->variables()[src]; |
1524 | if(project->isActiveConfig("yacc_no_name_mangle") && l.count() > 1) | 1690 | if(project->isActiveConfig("yacc_no_name_mangle") && l.count() > 1) |
1525 | warn_msg(WarnLogic, "yacc_no_name_mangle specified, but multiple parsers expected." | 1691 | warn_msg(WarnLogic, "yacc_no_name_mangle specified, but multiple parsers expected." |
1526 | "This can lead to link problems.\n"); | 1692 | "This can lead to link problems.\n"); |
1527 | QString default_out_h = "y.tab.h", default_out_c = "y.tab.c"; | 1693 | QString default_out_h = "y.tab.h", default_out_c = "y.tab.c"; |
@@ -1536,25 +1702,28 @@ MakefileGenerator::writeYaccSrc(QTextStream &t, const QString &src) | |||
1536 | if(fi.dirPath() != ".") | 1702 | if(fi.dirPath() != ".") |
1537 | dir = fi.dirPath() + Option::dir_sep; | 1703 | dir = fi.dirPath() + Option::dir_sep; |
1538 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | 1704 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); |
1539 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 1705 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
1540 | dir += Option::dir_sep; | 1706 | dir += Option::dir_sep; |
1541 | 1707 | ||
1542 | QString impl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); | 1708 | QString impl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); |
1543 | QString decl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); | 1709 | QString decl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); |
1544 | 1710 | ||
1545 | QString yaccflags = "$(YACCFLAGS)", mangle = "y"; | 1711 | QString yaccflags = "$(YACCFLAGS)", mangle = "y"; |
1546 | if(!project->isActiveConfig("yacc_no_name_mangle")) { | 1712 | if(!project->isActiveConfig("yacc_no_name_mangle")) { |
1547 | mangle = fi.baseName(TRUE); | 1713 | mangle = fi.baseName(TRUE); |
1548 | yaccflags += " -p " + mangle; | 1714 | if(!project->isEmpty("QMAKE_YACCFLAGS_MANGLE")) |
1715 | yaccflags += " " + var("QMAKE_YACCFLAGS_MANGLE").replace(stringBase, mangle); | ||
1716 | else | ||
1717 | yaccflags += " -p " + mangle; | ||
1549 | } | 1718 | } |
1550 | QString out_h = default_out_h, out_c = default_out_c; | 1719 | QString out_h = default_out_h, out_c = default_out_c; |
1551 | if(!mangle.isEmpty()) { | 1720 | if(!mangle.isEmpty()) { |
1552 | out_h.replace(stringBase, mangle); | 1721 | out_h.replace(stringBase, mangle); |
1553 | out_c.replace(stringBase, mangle); | 1722 | out_c.replace(stringBase, mangle); |
1554 | } | 1723 | } |
1555 | 1724 | ||
1556 | t << impl << ": " << (*it) << "\n\t" | 1725 | t << impl << ": " << (*it) << "\n\t" |
1557 | << "$(YACC) " << yaccflags << " " << (*it) << "\n\t" | 1726 | << "$(YACC) " << yaccflags << " " << (*it) << "\n\t" |
1558 | << "-$(DEL_FILE) " << impl << " " << decl << "\n\t" | 1727 | << "-$(DEL_FILE) " << impl << " " << decl << "\n\t" |
1559 | << "-$(MOVE) " << out_h << " " << decl << "\n\t" | 1728 | << "-$(MOVE) " << out_h << " " << decl << "\n\t" |
1560 | << "-$(MOVE) " << out_c << " " << impl << endl << endl; | 1729 | << "-$(MOVE) " << out_c << " " << impl << endl << endl; |
@@ -1612,27 +1781,27 @@ MakefileGenerator::writeImageObj(QTextStream &t, const QString &obj) | |||
1612 | t << (*oit) << ": " << src; | 1781 | t << (*oit) << ": " << src; |
1613 | bool use_implicit_rule = !project->isEmpty("QMAKE_RUN_CXX_IMP"); | 1782 | bool use_implicit_rule = !project->isEmpty("QMAKE_RUN_CXX_IMP"); |
1614 | if(use_implicit_rule) { | 1783 | if(use_implicit_rule) { |
1615 | if(!project->isEmpty("OBJECTS_DIR") || !project->isEmpty("UI_DIR") || !project->isEmpty("UI_SOURCES_DIR")) { | 1784 | if(!project->isEmpty("OBJECTS_DIR") || !project->isEmpty("UI_DIR") || !project->isEmpty("UI_SOURCES_DIR")) { |
1616 | use_implicit_rule = FALSE; | 1785 | use_implicit_rule = FALSE; |
1617 | } else { | 1786 | } else { |
1618 | int dot = src.findRev('.'); | 1787 | int dot = src.findRev('.'); |
1619 | if(dot == -1 || (src.left(dot) + Option::obj_ext != (*oit))) | 1788 | if(dot == -1 || (src.left(dot) + Option::obj_ext != (*oit))) |
1620 | use_implicit_rule = FALSE; | 1789 | use_implicit_rule = FALSE; |
1621 | } | 1790 | } |
1622 | } | 1791 | } |
1623 | if(!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { | 1792 | if(!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { |
1624 | QString p = var("QMAKE_RUN_CXX"); | 1793 | QString p = var("QMAKE_RUN_CXX"), srcf(src); |
1625 | p.replace( stringSrc, src); | 1794 | p.replace(stringSrc, srcf); |
1626 | p.replace( stringObj, (*oit)); | 1795 | p.replace(stringObj, (*oit)); |
1627 | t << "\n\t" << p; | 1796 | t << "\n\t" << p; |
1628 | } | 1797 | } |
1629 | t << endl << endl; | 1798 | t << endl << endl; |
1630 | } | 1799 | } |
1631 | } | 1800 | } |
1632 | 1801 | ||
1633 | 1802 | ||
1634 | void | 1803 | void |
1635 | MakefileGenerator::writeImageSrc(QTextStream &t, const QString &src) | 1804 | MakefileGenerator::writeImageSrc(QTextStream &t, const QString &src) |
1636 | { | 1805 | { |
1637 | QStringList &l = project->variables()[src]; | 1806 | QStringList &l = project->variables()[src]; |
1638 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1807 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
@@ -1652,39 +1821,40 @@ MakefileGenerator::writeImageSrc(QTextStream &t, const QString &src) | |||
1652 | } | 1821 | } |
1653 | } | 1822 | } |
1654 | } | 1823 | } |
1655 | 1824 | ||
1656 | 1825 | ||
1657 | void | 1826 | void |
1658 | MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) | 1827 | MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) |
1659 | { | 1828 | { |
1660 | QString all_installs, all_uninstalls; | 1829 | QString all_installs, all_uninstalls; |
1661 | QStringList &l = project->variables()[installs]; | 1830 | QStringList &l = project->variables()[installs]; |
1662 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1831 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1663 | QString pvar = (*it) + ".path"; | 1832 | QString pvar = (*it) + ".path"; |
1664 | if(project->variables()[pvar].isEmpty()) { | 1833 | if(project->variables()[(*it) + ".CONFIG"].findIndex("no_path") == -1 && |
1834 | project->variables()[pvar].isEmpty()) { | ||
1665 | warn_msg(WarnLogic, "%s is not defined: install target not created\n", pvar.latin1()); | 1835 | warn_msg(WarnLogic, "%s is not defined: install target not created\n", pvar.latin1()); |
1666 | continue; | 1836 | continue; |
1667 | } | 1837 | } |
1668 | 1838 | ||
1669 | bool do_default = TRUE; | 1839 | bool do_default = TRUE; |
1670 | const QString root = "$(INSTALL_ROOT)"; | 1840 | const QString root = "$(INSTALL_ROOT)"; |
1671 | QString target, dst= fileFixify(project->variables()[pvar].first()); | 1841 | QString target, dst= fileFixify(project->variables()[pvar].first()); |
1672 | #ifndef Q_WS_WIN | ||
1673 | if(dst.right(1) != Option::dir_sep) | 1842 | if(dst.right(1) != Option::dir_sep) |
1674 | dst += Option::dir_sep; | 1843 | dst += Option::dir_sep; |
1675 | #endif | 1844 | QStringList tmp, uninst = project->variables()[(*it) + ".uninstall"]; |
1676 | QStringList tmp, &uninst = project->variables()[(*it) + ".uninstall"]; | ||
1677 | //other | 1845 | //other |
1678 | tmp = project->variables()[(*it) + ".extra"]; | 1846 | tmp = project->variables()[(*it) + ".extra"]; |
1847 | if(tmp.isEmpty()) | ||
1848 | tmp = project->variables()[(*it) + ".commands"]; //to allow compatible name | ||
1679 | if(!tmp.isEmpty()) { | 1849 | if(!tmp.isEmpty()) { |
1680 | do_default = FALSE; | 1850 | do_default = FALSE; |
1681 | if(!target.isEmpty()) | 1851 | if(!target.isEmpty()) |
1682 | target += "\n\t"; | 1852 | target += "\n\t"; |
1683 | target += tmp.join(" "); | 1853 | target += tmp.join(" "); |
1684 | } | 1854 | } |
1685 | //masks | 1855 | //masks |
1686 | tmp = project->variables()[(*it) + ".files"]; | 1856 | tmp = project->variables()[(*it) + ".files"]; |
1687 | if(!tmp.isEmpty()) { | 1857 | if(!tmp.isEmpty()) { |
1688 | if(!target.isEmpty()) | 1858 | if(!target.isEmpty()) |
1689 | target += "\n"; | 1859 | target += "\n"; |
1690 | do_default = FALSE; | 1860 | do_default = FALSE; |
@@ -1694,96 +1864,123 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) | |||
1694 | int slsh = filestr.findRev(Option::dir_sep); | 1864 | int slsh = filestr.findRev(Option::dir_sep); |
1695 | if(slsh != -1) { | 1865 | if(slsh != -1) { |
1696 | dirstr = filestr.left(slsh+1); | 1866 | dirstr = filestr.left(slsh+1); |
1697 | filestr = filestr.right(filestr.length() - slsh - 1); | 1867 | filestr = filestr.right(filestr.length() - slsh - 1); |
1698 | } | 1868 | } |
1699 | if(dirstr.right(Option::dir_sep.length()) != Option::dir_sep) | 1869 | if(dirstr.right(Option::dir_sep.length()) != Option::dir_sep) |
1700 | dirstr += Option::dir_sep; | 1870 | dirstr += Option::dir_sep; |
1701 | if(QFile::exists(wild)) { //real file | 1871 | if(QFile::exists(wild)) { //real file |
1702 | QString file = wild; | 1872 | QString file = wild; |
1703 | QFileInfo fi(wild); | 1873 | QFileInfo fi(wild); |
1704 | if(!target.isEmpty()) | 1874 | if(!target.isEmpty()) |
1705 | target += "\t"; | 1875 | target += "\t"; |
1706 | target += QString(fi.isDir() ? "-$(COPY_DIR)" : "-$(COPY_FILE)") + " \"" + | 1876 | QString cmd = QString(fi.isDir() ? "-$(INSTALL_DIR)" : "-$(INSTALL_FILE)") + " \"" + |
1707 | Option::fixPathToTargetOS(fileFixify(wild), FALSE) + "\" \"" + root + dst + "\"\n"; | 1877 | Option::fixPathToTargetOS(fileFixify(wild, QString::null, |
1878 | QString::null, FALSE, FALSE), FALSE) + | ||
1879 | "\" \"" + root + dst + "\"\n"; | ||
1880 | target += cmd; | ||
1708 | if(!project->isActiveConfig("debug") && | 1881 | if(!project->isActiveConfig("debug") && |
1709 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) | 1882 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) |
1710 | target += QString("\t-") + var("QMAKE_STRIP") + " \"" + root + fileFixify(dst + filestr) + "\"\n"; | 1883 | target += QString("\t-") + var("QMAKE_STRIP") + " \"" + |
1884 | root + fileFixify(dst + filestr, QString::null, QString::null, FALSE, FALSE) + | ||
1885 | "\"\n"; | ||
1711 | if(!uninst.isEmpty()) | 1886 | if(!uninst.isEmpty()) |
1712 | uninst.append("\n\t"); | 1887 | uninst.append("\n\t"); |
1713 | uninst.append( | 1888 | uninst.append( |
1714 | #ifdef Q_WS_WIN | 1889 | #ifdef Q_WS_WIN |
1715 | QString("-$(DEL_FILE)") | 1890 | QString("-$(DEL_FILE)") |
1716 | #else | 1891 | #else |
1717 | QString("-$(DEL_FILE) -r") | 1892 | QString("-$(DEL_FILE) -r") |
1718 | #endif | 1893 | #endif |
1719 | + " \"" + root + fileFixify(dst + filestr) + "\""); | 1894 | + " \"" + root + fileFixify(dst + filestr, QString::null, QString::null, FALSE, FALSE) + "\""); |
1720 | continue; | 1895 | continue; |
1721 | } | 1896 | } |
1897 | fixEnvVariables(dirstr); | ||
1722 | QDir dir(dirstr, filestr); //wild | 1898 | QDir dir(dirstr, filestr); //wild |
1723 | for(uint x = 0; x < dir.count(); x++) { | 1899 | for(uint x = 0; x < dir.count(); x++) { |
1724 | QString file = dir[x]; | 1900 | QString file = dir[x]; |
1725 | if(file == "." || file == "..") //blah | 1901 | if(file == "." || file == "..") //blah |
1726 | continue; | 1902 | continue; |
1727 | if(!uninst.isEmpty()) | 1903 | if(!uninst.isEmpty()) |
1728 | uninst.append("\n\t"); | 1904 | uninst.append("\n\t"); |
1729 | uninst.append( | 1905 | uninst.append( |
1730 | #ifdef Q_WS_WIN | 1906 | #ifdef Q_WS_WIN |
1731 | QString("-$(DEL_FILE)") | 1907 | QString("-$(DEL_FILE)") |
1732 | #else | 1908 | #else |
1733 | QString("-$(DEL_FILE) -r") | 1909 | QString("-$(DEL_FILE) -r") |
1734 | #endif | 1910 | #endif |
1735 | + " \"" + root + fileFixify(dst + file) + "\""); | 1911 | + " \"" + root + fileFixify(dst + file, QString::null, QString::null, FALSE, FALSE) + |
1736 | QFileInfo fi(file); | 1912 | "\""); |
1913 | QFileInfo fi(Option::fixPathToTargetOS(fileFixify(dirstr + file), TRUE)); | ||
1737 | if(!target.isEmpty()) | 1914 | if(!target.isEmpty()) |
1738 | target += "\t"; | 1915 | target += "\t"; |
1739 | target += QString(fi.isDir() ? "-$(COPY_DIR)" : "-$(COPY_FILE)") + " \"" + | 1916 | QString cmd = QString(fi.isDir() ? "-$(INSTALL_DIR)" : "-$(INSTALL_FILE)") + " \"" + |
1740 | Option::fixPathToTargetOS(fileFixify(dirstr + file), FALSE) + | 1917 | Option::fixPathToTargetOS(fileFixify(dirstr + file, QString::null, |
1741 | "\" \"" + root + fileFixify(dst) + "\"\n"; | 1918 | QString::null, FALSE, FALSE), FALSE) + |
1919 | "\" \"" + root + dst + "\"\n"; | ||
1920 | target += cmd; | ||
1742 | if(!project->isActiveConfig("debug") && | 1921 | if(!project->isActiveConfig("debug") && |
1743 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) | 1922 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) |
1744 | target += QString("\t-") + var("QMAKE_STRIP") + " \"" + root + fileFixify(dst + file) + "\"\n"; | 1923 | target += QString("\t-") + var("QMAKE_STRIP") + " \"" + |
1924 | root + fileFixify(dst + file, QString::null, QString::null, FALSE, FALSE) + | ||
1925 | "\"\n"; | ||
1745 | } | 1926 | } |
1746 | } | 1927 | } |
1747 | } | 1928 | } |
1748 | //default? | 1929 | //default? |
1749 | if(do_default) | 1930 | if(do_default) { |
1750 | target = defaultInstall((*it)); | 1931 | target = defaultInstall((*it)); |
1932 | uninst = project->variables()[(*it) + ".uninstall"]; | ||
1933 | } | ||
1751 | 1934 | ||
1752 | if(!target.isEmpty()) { | 1935 | if(!target.isEmpty()) { |
1753 | t << "install_" << (*it) << ": " << "\n\t"; | 1936 | t << "install_" << (*it) << ": all "; |
1937 | const QStringList &deps = project->variables()[(*it) + ".depends"]; | ||
1938 | if(!deps.isEmpty()) { | ||
1939 | for(QStringList::ConstIterator dep_it = deps.begin(); dep_it != deps.end(); ++dep_it) { | ||
1940 | QString targ = var((*dep_it) + ".target"); | ||
1941 | if(targ.isEmpty()) | ||
1942 | targ = (*dep_it); | ||
1943 | t << targ; | ||
1944 | } | ||
1945 | } | ||
1946 | t << "\n\t"; | ||
1754 | const QStringList &dirs = project->variables()[pvar]; | 1947 | const QStringList &dirs = project->variables()[pvar]; |
1755 | for(QStringList::ConstIterator pit = dirs.begin(); pit != dirs.end(); ++pit) { | 1948 | for(QStringList::ConstIterator pit = dirs.begin(); pit != dirs.end(); ++pit) { |
1756 | QString tmp_dst = fileFixify((*pit)); | 1949 | QString tmp_dst = fileFixify((*pit)); |
1757 | #ifndef Q_WS_WIN | 1950 | #ifndef Q_WS_WIN |
1758 | if(tmp_dst.right(1) != Option::dir_sep) | 1951 | if(tmp_dst.right(1) != Option::dir_sep) |
1759 | tmp_dst += Option::dir_sep; | 1952 | tmp_dst += Option::dir_sep; |
1760 | #endif | 1953 | #endif |
1761 | t << mkdir_p_asstring(root+tmp_dst) << "\n\t"; | 1954 | t << mkdir_p_asstring(root+tmp_dst) << "\n\t"; |
1762 | } | 1955 | } |
1763 | t << target << endl << endl; | 1956 | t << target << endl << endl; |
1764 | all_installs += QString("install_") + (*it) + " "; | ||
1765 | if(!uninst.isEmpty()) { | 1957 | if(!uninst.isEmpty()) { |
1766 | t << "uninstall_" << (*it) << ": " << "\n\t" | 1958 | t << "uninstall_" << (*it) << ": " << "\n\t" |
1767 | << uninst.join("") << "\n\t" | 1959 | << uninst.join("") << "\n\t" |
1768 | << "-$(DEL_DIR) \"" << ( root + dst ) << "\"" << endl << endl; | 1960 | << "-$(DEL_DIR) \"" << ( root + dst ) << "\"" << endl << endl; |
1769 | all_uninstalls += "uninstall_" + (*it) + " "; | ||
1770 | } | 1961 | } |
1771 | t << endl; | 1962 | t << endl; |
1963 | |||
1964 | if(project->variables()[(*it) + ".CONFIG"].findIndex("no_default_install") == -1) { | ||
1965 | all_installs += QString("install_") + (*it) + " "; | ||
1966 | if(!uninst.isEmpty()) | ||
1967 | all_uninstalls += "uninstall_" + (*it) + " "; | ||
1968 | } | ||
1772 | } else { | 1969 | } else { |
1773 | debug_msg(1, "no definition for install %s: install target not created",(*it).latin1()); | 1970 | debug_msg(1, "no definition for install %s: install target not created",(*it).latin1()); |
1774 | } | 1971 | } |
1775 | } | 1972 | } |
1776 | t << "install: all " << all_installs << "\n\n"; | 1973 | t << "install: " << all_installs << " " << var("INSTALLDEPS") << "\n\n"; |
1777 | t << "uninstall: " << all_uninstalls << "\n\n"; | 1974 | t << "uninstall: " << all_uninstalls << " " << var("UNINSTALLDEPS") << "\n\n"; |
1778 | } | 1975 | } |
1779 | 1976 | ||
1780 | QString | 1977 | QString |
1781 | MakefileGenerator::var(const QString &var) | 1978 | MakefileGenerator::var(const QString &var) |
1782 | { | 1979 | { |
1783 | return val(project->variables()[var]); | 1980 | return val(project->variables()[var]); |
1784 | } | 1981 | } |
1785 | 1982 | ||
1786 | QString | 1983 | QString |
1787 | MakefileGenerator::val(const QStringList &varList) | 1984 | MakefileGenerator::val(const QStringList &varList) |
1788 | { | 1985 | { |
1789 | return valGlue(varList, "", " ", ""); | 1986 | return valGlue(varList, "", " ", ""); |
@@ -1962,125 +2159,137 @@ MakefileGenerator::writeMakeQmake(QTextStream &t) | |||
1962 | QStringList files = fileFixify(Option::mkfile::project_files); | 2159 | QStringList files = fileFixify(Option::mkfile::project_files); |
1963 | t << project->first("QMAKE_INTERNAL_PRL_FILE") << ": " << "\n\t" | 2160 | t << project->first("QMAKE_INTERNAL_PRL_FILE") << ": " << "\n\t" |
1964 | << "@$(QMAKE) -prl " << buildArgs() << " " << files.join(" ") << endl; | 2161 | << "@$(QMAKE) -prl " << buildArgs() << " " << files.join(" ") << endl; |
1965 | } | 2162 | } |
1966 | 2163 | ||
1967 | QString pfile = project->projectFile(); | 2164 | QString pfile = project->projectFile(); |
1968 | if(pfile != "(stdin)") { | 2165 | if(pfile != "(stdin)") { |
1969 | QString qmake = build_args(); | 2166 | QString qmake = build_args(); |
1970 | if(!ofile.isEmpty() && !project->isActiveConfig("no_autoqmake")) { | 2167 | if(!ofile.isEmpty() && !project->isActiveConfig("no_autoqmake")) { |
1971 | t << ofile << ": " << fileFixify(pfile) << " "; | 2168 | t << ofile << ": " << fileFixify(pfile) << " "; |
1972 | if(Option::mkfile::do_cache) | 2169 | if(Option::mkfile::do_cache) |
1973 | t << fileFixify(Option::mkfile::cachefile) << " "; | 2170 | t << fileFixify(Option::mkfile::cachefile) << " "; |
1974 | if(!specdir().isEmpty()) | 2171 | if(!specdir().isEmpty()) { |
1975 | t << specdir() << Option::dir_sep << "qmake.conf" << " "; | 2172 | if (QFile::exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"qmake.conf"))) |
2173 | t << specdir() << Option::dir_sep << "qmake.conf" << " "; | ||
2174 | else if (QFile::exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"tmake.conf"))) | ||
2175 | t << specdir() << Option::dir_sep << "tmake.conf" << " "; | ||
2176 | } | ||
1976 | t << project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].join(" \\\n\t\t") << "\n\t" | 2177 | t << project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].join(" \\\n\t\t") << "\n\t" |
1977 | << qmake <<endl; | 2178 | << qmake <<endl; |
1978 | } | 2179 | } |
1979 | if(project->first("QMAKE_ORIG_TARGET") != "qmake") { | 2180 | if(project->first("QMAKE_ORIG_TARGET") != "qmake") { |
1980 | t << "qmake: " << | 2181 | t << "qmake: " << |
1981 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].join(" \\\n\t\t") << "\n\t" | 2182 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].join(" \\\n\t\t") << "\n\t" |
1982 | << "@" << qmake << endl << endl; | 2183 | << "@" << qmake << endl << endl; |
1983 | } | 2184 | } |
1984 | } | 2185 | } |
1985 | return TRUE; | 2186 | return TRUE; |
1986 | } | 2187 | } |
1987 | 2188 | ||
1988 | QStringList | 2189 | QStringList |
1989 | MakefileGenerator::fileFixify(const QStringList& files, const QString &out_dir, const QString &in_dir, bool force_fix) const | 2190 | MakefileGenerator::fileFixify(const QStringList& files, const QString &out_dir, const QString &in_dir, |
2191 | bool force_fix, bool canon) const | ||
1990 | { | 2192 | { |
1991 | if(files.isEmpty()) | 2193 | if(files.isEmpty()) |
1992 | return files; | 2194 | return files; |
1993 | QStringList ret; | 2195 | QStringList ret; |
1994 | for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { | 2196 | for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { |
1995 | if(!(*it).isEmpty()) | 2197 | if(!(*it).isEmpty()) |
1996 | ret << fileFixify((*it), out_dir, in_dir, force_fix); | 2198 | ret << fileFixify((*it), out_dir, in_dir, force_fix, canon); |
1997 | } | 2199 | } |
1998 | return ret; | 2200 | return ret; |
1999 | } | 2201 | } |
2000 | 2202 | ||
2001 | QString | 2203 | QString |
2002 | MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const QString &in_d, bool force_fix) const | 2204 | MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, |
2205 | const QString &in_d, bool force_fix, bool canon) const | ||
2003 | { | 2206 | { |
2004 | if(file0.isEmpty()) | 2207 | if(file0.isEmpty()) |
2005 | return file0; | 2208 | return file0; |
2006 | QString key = file0; | 2209 | QString key = file0; |
2007 | if(!in_d.isEmpty() || !out_d.isEmpty() || force_fix) | 2210 | if(QDir::isRelativePath(file0)) |
2008 | key.prepend(in_d + "--" + out_d + "--" + QString::number((int)force_fix) + "-"); | 2211 | key.prepend(QDir::currentDirPath() + "--"); |
2009 | if(fileFixed.contains(key)) | 2212 | if(!in_d.isEmpty() || !out_d.isEmpty() || force_fix || !canon) |
2213 | key.prepend(in_d + "--" + out_d + "--" + QString::number((int)force_fix) + "--" + | ||
2214 | QString::number((int)canon) + "-"); | ||
2215 | if(fileFixed.contains(key)) | ||
2010 | return fileFixed[key]; | 2216 | return fileFixed[key]; |
2011 | 2217 | ||
2012 | QString file = file0; | 2218 | QString file = file0; |
2013 | int depth = 4; | 2219 | int depth = 4; |
2014 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || | 2220 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || |
2015 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { | 2221 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { |
2016 | if(project && !project->isEmpty("QMAKE_PROJECT_DEPTH")) | 2222 | if(project && !project->isEmpty("QMAKE_PROJECT_DEPTH")) |
2017 | depth = project->first("QMAKE_PROJECT_DEPTH").toInt(); | 2223 | depth = project->first("QMAKE_PROJECT_DEPTH").toInt(); |
2018 | else if(Option::mkfile::cachefile_depth != -1) | 2224 | else if(Option::mkfile::cachefile_depth != -1) |
2019 | depth = Option::mkfile::cachefile_depth; | 2225 | depth = Option::mkfile::cachefile_depth; |
2020 | } | 2226 | } |
2021 | 2227 | ||
2022 | QChar quote; | 2228 | QChar quote; |
2023 | if((file.startsWith("'") || file.startsWith("\"")) && file.startsWith(file.right(1))) { | 2229 | if((file.startsWith("'") || file.startsWith("\"")) && file.startsWith(file.right(1))) { |
2024 | quote = file.at(0); | 2230 | quote = file.at(0); |
2025 | file = file.mid(1, file.length() - 2); | 2231 | file = file.mid(1, file.length() - 2); |
2026 | } | 2232 | } |
2027 | QString orig_file = file; | 2233 | QString orig_file = file; |
2028 | if(!force_fix && project->isActiveConfig("no_fixpath")) { | 2234 | if(!force_fix && project->isActiveConfig("no_fixpath")) { |
2029 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) { //absoluteify it | 2235 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) { //absoluteify it |
2030 | QString qfile = Option::fixPathToLocalOS(file); | 2236 | QString qfile = Option::fixPathToLocalOS(file, TRUE, canon); |
2031 | if(QDir::isRelativePath(file)) { //already absolute | 2237 | if(QDir::isRelativePath(file)) { //already absolute |
2032 | QFileInfo fi(qfile); | 2238 | QFileInfo fi(qfile); |
2033 | if(!fi.convertToAbs()) //strange | 2239 | if(!fi.convertToAbs()) //strange |
2034 | file = fi.filePath(); | 2240 | file = fi.filePath(); |
2035 | } | 2241 | } |
2036 | } | 2242 | } |
2037 | } else { //fix it.. | 2243 | } else { //fix it.. |
2038 | QString qfile(Option::fixPathToLocalOS(file, TRUE)), in_dir(in_d), out_dir(out_d); | 2244 | QString qfile(Option::fixPathToLocalOS(file, TRUE, canon)), in_dir(in_d), out_dir(out_d); |
2039 | { | 2245 | { |
2040 | if(out_dir.isNull()) | 2246 | if(out_dir.isNull() || QDir::isRelativePath(out_dir)) |
2041 | out_dir = Option::output_dir; | 2247 | out_dir.prepend(Option::output_dir + QDir::separator()); |
2042 | if(out_dir == ".") | 2248 | if(out_dir == ".") |
2043 | out_dir = QDir::currentDirPath(); | 2249 | out_dir = QDir::currentDirPath(); |
2044 | if(in_dir.isEmpty() || in_dir == ".") | 2250 | if(in_dir.isEmpty() || QDir::isRelativePath(in_dir)) |
2251 | in_dir.prepend(QDir::currentDirPath() + QDir::separator()); | ||
2252 | if(in_dir == ".") | ||
2045 | in_dir = QDir::currentDirPath(); | 2253 | in_dir = QDir::currentDirPath(); |
2254 | |||
2046 | if(!QDir::isRelativePath(in_dir) || !QDir::isRelativePath(out_dir)) { | 2255 | if(!QDir::isRelativePath(in_dir) || !QDir::isRelativePath(out_dir)) { |
2047 | QFileInfo in_fi(in_dir); | 2256 | QFileInfo in_fi(in_dir); |
2048 | if(!in_fi.convertToAbs()) | 2257 | if(!in_fi.convertToAbs()) |
2049 | in_dir = in_fi.filePath(); | 2258 | in_dir = in_fi.filePath(); |
2050 | QFileInfo out_fi(out_dir); | 2259 | QFileInfo out_fi(out_dir); |
2051 | if(!out_fi.convertToAbs()) | 2260 | if(!out_fi.convertToAbs()) |
2052 | out_dir = out_fi.filePath(); | 2261 | out_dir = out_fi.filePath(); |
2053 | } | 2262 | } |
2054 | QString in_canonical_dir = QDir(in_dir).canonicalPath(), | 2263 | QString in_canonical_dir = QDir(in_dir).canonicalPath(), |
2055 | out_canonical_dir = QDir(out_dir).canonicalPath(); | 2264 | out_canonical_dir = QDir(out_dir).canonicalPath(); |
2056 | if(!in_canonical_dir.isEmpty()) | 2265 | if(!in_canonical_dir.isEmpty()) |
2057 | in_dir = in_canonical_dir; | 2266 | in_dir = in_canonical_dir; |
2058 | if(!out_canonical_dir.isEmpty()) | 2267 | if(!out_canonical_dir.isEmpty()) |
2059 | out_dir = out_canonical_dir; | 2268 | out_dir = out_canonical_dir; |
2060 | } | 2269 | } |
2061 | if(out_dir != in_dir || !QDir::isRelativePath(qfile)) { | 2270 | if(out_dir != in_dir || !QDir::isRelativePath(qfile)) { |
2062 | if(QDir::isRelativePath(qfile)) { | 2271 | if(QDir::isRelativePath(qfile)) { |
2063 | if(file.left(Option::dir_sep.length()) != Option::dir_sep && | 2272 | if(file.left(Option::dir_sep.length()) != Option::dir_sep && |
2064 | in_dir.right(Option::dir_sep.length()) != Option::dir_sep) | 2273 | in_dir.right(Option::dir_sep.length()) != Option::dir_sep) |
2065 | file.prepend(Option::dir_sep); | 2274 | file.prepend(Option::dir_sep); |
2066 | file.prepend(in_dir); | 2275 | file.prepend(in_dir); |
2067 | } | 2276 | } |
2068 | file = Option::fixPathToTargetOS(file, FALSE); | 2277 | file = Option::fixPathToTargetOS(file, FALSE, canon); |
2069 | if(QFile::exists(file) && file == Option::fixPathToTargetOS(file, TRUE)) { | 2278 | if(canon && QFile::exists(file) && file == Option::fixPathToTargetOS(file, TRUE, canon)) { |
2070 | QString real_file = QDir(file).canonicalPath(); | 2279 | QString real_file = QDir(file).canonicalPath(); |
2071 | if(!real_file.isEmpty()) | 2280 | if(!real_file.isEmpty()) |
2072 | file = real_file; | 2281 | file = real_file; |
2073 | } | 2282 | } |
2074 | QString match_dir = Option::fixPathToTargetOS(out_dir, FALSE); | 2283 | QString match_dir = Option::fixPathToTargetOS(out_dir, FALSE, canon); |
2075 | if(file == match_dir) { | 2284 | if(file == match_dir) { |
2076 | file = ""; | 2285 | file = ""; |
2077 | } else if(file.startsWith(match_dir) && | 2286 | } else if(file.startsWith(match_dir) && |
2078 | file.mid(match_dir.length(), Option::dir_sep.length()) == Option::dir_sep) { | 2287 | file.mid(match_dir.length(), Option::dir_sep.length()) == Option::dir_sep) { |
2079 | file = file.right(file.length() - (match_dir.length() + 1)); | 2288 | file = file.right(file.length() - (match_dir.length() + 1)); |
2080 | } else { | 2289 | } else { |
2081 | for(int i = 1; i <= depth; i++) { | 2290 | for(int i = 1; i <= depth; i++) { |
2082 | int sl = match_dir.findRev(Option::dir_sep); | 2291 | int sl = match_dir.findRev(Option::dir_sep); |
2083 | if(sl == -1) | 2292 | if(sl == -1) |
2084 | break; | 2293 | break; |
2085 | match_dir = match_dir.left(sl); | 2294 | match_dir = match_dir.left(sl); |
2086 | if(match_dir.isEmpty()) | 2295 | if(match_dir.isEmpty()) |
@@ -2091,30 +2300,31 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const | |||
2091 | int remlen = file.length() - (match_dir.length() + 1); | 2300 | int remlen = file.length() - (match_dir.length() + 1); |
2092 | if (remlen < 0) | 2301 | if (remlen < 0) |
2093 | remlen = 0; | 2302 | remlen = 0; |
2094 | file = file.right(remlen); | 2303 | file = file.right(remlen); |
2095 | //prepend | 2304 | //prepend |
2096 | for(int o = 0; o < i; o++) | 2305 | for(int o = 0; o < i; o++) |
2097 | file.prepend(".." + Option::dir_sep); | 2306 | file.prepend(".." + Option::dir_sep); |
2098 | } | 2307 | } |
2099 | } | 2308 | } |
2100 | } | 2309 | } |
2101 | } | 2310 | } |
2102 | } | 2311 | } |
2103 | file = Option::fixPathToTargetOS(file, FALSE); | 2312 | file = Option::fixPathToTargetOS(file, FALSE, canon); |
2104 | if(file.isEmpty()) | 2313 | if(file.isEmpty()) |
2105 | file = "."; | 2314 | file = "."; |
2106 | if(!quote.isNull()) | 2315 | if(!quote.isNull()) |
2107 | file = quote + file + quote; | 2316 | file = quote + file + quote; |
2108 | debug_msg(3, "Fixed %s :: to :: %s (%d)", orig_file.latin1(), file.latin1(), depth); | 2317 | debug_msg(3, "Fixed %s :: to :: %s (%d) [%s::%s]", orig_file.latin1(), file.latin1(), depth, |
2318 | in_d.latin1(), out_d.latin1()); | ||
2109 | ((MakefileGenerator*)this)->fileFixed.insert(key, file); | 2319 | ((MakefileGenerator*)this)->fileFixed.insert(key, file); |
2110 | return file; | 2320 | return file; |
2111 | } | 2321 | } |
2112 | 2322 | ||
2113 | QString | 2323 | QString |
2114 | MakefileGenerator::cleanFilePath(const QString &file) const | 2324 | MakefileGenerator::cleanFilePath(const QString &file) const |
2115 | { | 2325 | { |
2116 | return fileFixify(Option::fixPathToTargetOS(file)); | 2326 | return fileFixify(Option::fixPathToTargetOS(file)); |
2117 | } | 2327 | } |
2118 | 2328 | ||
2119 | void MakefileGenerator::logicWarn(const QString &f, const QString &w) | 2329 | void MakefileGenerator::logicWarn(const QString &f, const QString &w) |
2120 | { | 2330 | { |
@@ -2129,67 +2339,91 @@ void MakefileGenerator::logicWarn(const QString &f, const QString &w) | |||
2129 | QString file2((*val_it)); | 2339 | QString file2((*val_it)); |
2130 | slsh = file2.findRev(Option::dir_sep); | 2340 | slsh = file2.findRev(Option::dir_sep); |
2131 | if(slsh != -1) | 2341 | if(slsh != -1) |
2132 | file2 = file2.right(file2.length() - slsh - 1); | 2342 | file2 = file2.right(file2.length() - slsh - 1); |
2133 | if(file2 == file) { | 2343 | if(file2 == file) { |
2134 | warn_msg(WarnLogic, "Found potential symbol conflict of %s (%s) in %s", | 2344 | warn_msg(WarnLogic, "Found potential symbol conflict of %s (%s) in %s", |
2135 | file.latin1(), (*val_it).latin1(), w.latin1()); | 2345 | file.latin1(), (*val_it).latin1(), w.latin1()); |
2136 | break; | 2346 | break; |
2137 | } | 2347 | } |
2138 | } | 2348 | } |
2139 | } | 2349 | } |
2140 | 2350 | ||
2351 | QString | ||
2352 | MakefileGenerator::dependencyKey(const QString &file) const | ||
2353 | { | ||
2354 | QString key = file; | ||
2355 | Option::fixPathToTargetOS(key); | ||
2356 | if(key.find(Option::dir_sep)) | ||
2357 | key = key.right(key.length() - key.findRev(Option::dir_sep) - 1); | ||
2358 | return key; | ||
2359 | } | ||
2360 | |||
2361 | void | ||
2362 | MakefileGenerator::setProcessedDependencies(const QString &file, bool b) | ||
2363 | { | ||
2364 | depProcessed[dependencyKey(file)] = b; | ||
2365 | } | ||
2366 | |||
2367 | bool | ||
2368 | MakefileGenerator::processedDependencies(const QString &file) | ||
2369 | { | ||
2370 | QString key = dependencyKey(file); | ||
2371 | if(!depProcessed.contains(key)) | ||
2372 | return FALSE; | ||
2373 | return depProcessed[key]; | ||
2374 | } | ||
2375 | |||
2141 | QStringList | 2376 | QStringList |
2142 | &MakefileGenerator::findDependencies(const QString &file) | 2377 | &MakefileGenerator::findDependencies(const QString &file) |
2143 | { | 2378 | { |
2144 | QString key = file; | 2379 | return depends[dependencyKey(file)]; |
2145 | Option::fixPathToTargetOS(key); | ||
2146 | if(key.find(Option::dir_sep)) | ||
2147 | key = key.right(key.length() - key.findRev(Option::dir_sep) - 1); | ||
2148 | if(!depKeyMap.contains(key)) | ||
2149 | depKeyMap.insert(key, file); | ||
2150 | return depends[key]; | ||
2151 | } | 2380 | } |
2152 | 2381 | ||
2153 | 2382 | ||
2154 | QString | 2383 | QString |
2155 | MakefileGenerator::specdir() | 2384 | MakefileGenerator::specdir() |
2156 | { | 2385 | { |
2157 | if(!spec.isEmpty()) | 2386 | if(!spec.isEmpty()) |
2158 | return spec; | 2387 | return spec; |
2159 | spec = Option::mkfile::qmakespec; | 2388 | spec = Option::mkfile::qmakespec; |
2160 | const char *d = getenv("QTDIR"); | 2389 | #if 0 |
2161 | if(d) { | 2390 | if(const char *d = getenv("QTDIR")) { |
2162 | QString qdir = Option::fixPathToTargetOS(QString(d)); | 2391 | QString qdir = Option::fixPathToTargetOS(QString(d)); |
2163 | if(qdir.endsWith(QString(QChar(QDir::separator())))) | 2392 | if(qdir.endsWith(QString(QChar(QDir::separator())))) |
2164 | qdir.truncate(qdir.length()-1); | 2393 | qdir.truncate(qdir.length()-1); |
2165 | //fix path | 2394 | //fix path |
2166 | QFileInfo fi(spec); | 2395 | QFileInfo fi(spec); |
2167 | QString absSpec(fi.absFilePath()); | 2396 | QString absSpec(fi.absFilePath()); |
2168 | absSpec = Option::fixPathToTargetOS(absSpec); | 2397 | absSpec = Option::fixPathToTargetOS(absSpec); |
2169 | //replace what you can | 2398 | //replace what you can |
2170 | if(absSpec.startsWith(qdir)) { | 2399 | if(absSpec.startsWith(qdir)) { |
2171 | absSpec.replace(0, qdir.length(), "$(QTDIR)"); | 2400 | absSpec.replace(0, qdir.length(), "$(QTDIR)"); |
2172 | spec = absSpec; | 2401 | spec = absSpec; |
2173 | } | 2402 | } |
2174 | } | 2403 | } |
2404 | #else | ||
2405 | spec = Option::fixPathToTargetOS(spec); | ||
2406 | #endif | ||
2175 | return spec; | 2407 | return spec; |
2176 | } | 2408 | } |
2177 | 2409 | ||
2178 | bool | 2410 | bool |
2179 | MakefileGenerator::openOutput(QFile &file) const | 2411 | MakefileGenerator::openOutput(QFile &file) const |
2180 | { | 2412 | { |
2181 | { | 2413 | { |
2182 | QString outdir; | 2414 | QString outdir; |
2183 | if(!file.name().isEmpty()) { | 2415 | if(!file.name().isEmpty()) { |
2416 | if(QDir::isRelativePath(file.name())) | ||
2417 | file.setName(Option::output_dir + file.name()); //pwd when qmake was run | ||
2184 | QFileInfo fi(file); | 2418 | QFileInfo fi(file); |
2185 | if(fi.isDir()) | 2419 | if(fi.isDir()) |
2186 | outdir = file.name() + QDir::separator(); | 2420 | outdir = file.name() + QDir::separator(); |
2187 | } | 2421 | } |
2188 | if(!outdir.isEmpty() || file.name().isEmpty()) { | 2422 | if(!outdir.isEmpty() || file.name().isEmpty()) { |
2189 | QString fname = "Makefile"; | 2423 | QString fname = "Makefile"; |
2190 | if(!project->isEmpty("MAKEFILE")) | 2424 | if(!project->isEmpty("MAKEFILE")) |
2191 | fname = project->first("MAKEFILE"); | 2425 | fname = project->first("MAKEFILE"); |
2192 | file.setName(outdir + fname); | 2426 | file.setName(outdir + fname); |
2193 | } | 2427 | } |
2194 | } | 2428 | } |
2195 | if(QDir::isRelativePath(file.name())) | 2429 | if(QDir::isRelativePath(file.name())) |