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/unix/unixmake.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/unix/unixmake.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 557 |
1 files changed, 415 insertions, 142 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index e274481..caaddee 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp | |||
@@ -1,7 +1,5 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of UnixMakefileGenerator class. |
5 | ** | ||
6 | ** Created : 970521 | ||
7 | ** | 5 | ** |
@@ -9,3 +7,3 @@ | |||
9 | ** | 7 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
11 | ** | 9 | ** |
@@ -80,6 +78,20 @@ UnixMakefileGenerator::init() | |||
80 | } | 78 | } |
79 | if( project->isEmpty("QMAKE_CFLAGS_PRECOMPILE")) | ||
80 | project->variables()["QMAKE_CFLAGS_PRECOMPILE"].append("-x c-header -c"); | ||
81 | if( project->isEmpty("QMAKE_CXXFLAGS_PRECOMPILE")) | ||
82 | project->variables()["QMAKE_CXXFLAGS_PRECOMPILE"].append("-x c++-header -c"); | ||
83 | if( project->isEmpty("QMAKE_CFLAGS_USE_PRECOMPILE")) | ||
84 | project->variables()["QMAKE_CFLAGS_USE_PRECOMPILE"].append("-include"); | ||
85 | if( project->isEmpty("QMAKE_EXTENSION_PLUGIN") ) | ||
86 | project->variables()["QMAKE_EXTENSION_PLUGIN"].append(project->first("QMAKE_EXTENSION_SHLIB")); | ||
81 | if( project->isEmpty("QMAKE_COPY_FILE") ) | 87 | if( project->isEmpty("QMAKE_COPY_FILE") ) |
82 | project->variables()["QMAKE_COPY_FILE"].append( "$(COPY) -p" ); | 88 | project->variables()["QMAKE_COPY_FILE"].append( "$(COPY)" ); |
83 | if( project->isEmpty("QMAKE_COPY_DIR") ) | 89 | if( project->isEmpty("QMAKE_COPY_DIR") ) |
84 | project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -pR" ); | 90 | project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -R" ); |
91 | if( project->isEmpty("QMAKE_INSTALL_FILE") ) | ||
92 | project->variables()["QMAKE_INSTALL_FILE"].append( "$(COPY_FILE)" ); | ||
93 | if( project->isEmpty("QMAKE_INSTALL_DIR") ) | ||
94 | project->variables()["QMAKE_INSTALL_DIR"].append( "$(COPY_DIR)" ); | ||
95 | if( project->isEmpty("QMAKE_LIBTOOL") ) | ||
96 | project->variables()["QMAKE_LIBTOOL"].append( "libtool --silent" ); | ||
85 | //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET | 97 | //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET |
@@ -105,4 +117,3 @@ UnixMakefileGenerator::init() | |||
105 | project->isActiveConfig("dll")) || is_qt; | 117 | project->isActiveConfig("dll")) || is_qt; |
106 | if(!project->isActiveConfig("global_init_link_order")) | 118 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
107 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | ||
108 | if ( (!project->isEmpty("QMAKE_LIB_FLAG") && !project->isActiveConfig("staticlib") ) || | 119 | if ( (!project->isEmpty("QMAKE_LIB_FLAG") && !project->isActiveConfig("staticlib") ) || |
@@ -139,17 +150,18 @@ UnixMakefileGenerator::init() | |||
139 | if ( !project->isEmpty("QMAKE_RPATH") ) | 150 | if ( !project->isEmpty("QMAKE_RPATH") ) |
140 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"), | 151 | project->variables()["QMAKE_LFLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"), |
141 | " " + var("QMAKE_RPATH"), ""); | 152 | " " + var("QMAKE_RPATH"), ""); |
142 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue( "QMAKE_LIBDIR", "-L", " -L", "" ); | 153 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue( "QMAKE_LIBDIR", "-L", " -L", "" ); |
143 | } | 154 | } |
144 | if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) { | 155 | if ( project->isActiveConfig("qtopia") ) { |
145 | if(configs.findIndex("x11lib") == -1) | 156 | if(configs.findIndex("qtopialib") == -1) |
146 | configs.append("x11lib"); | 157 | configs.append("qtopialib"); |
147 | if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 ) | 158 | if(configs.findIndex("qtopiainc") == -1) |
148 | configs.append("x11inc"); | 159 | configs.append("qtopiainc"); |
149 | } | 160 | } |
150 | if ( project->isActiveConfig("x11") ) { | 161 | if ( project->isActiveConfig("qtopiainc") ) |
151 | if(configs.findIndex("x11lib") == -1) | 162 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QTOPIA"]; |
152 | configs.append("x11lib"); | 163 | if ( project->isActiveConfig("qtopialib") ) { |
153 | if(configs.findIndex("x11inc") == -1) | 164 | if(!project->isEmpty("QMAKE_LIBDIR_QTOPIA")) |
154 | configs.append("x11inc"); | 165 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QTOPIA", "-L", " -L", ""); |
166 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"]; | ||
155 | } | 167 | } |
@@ -165,9 +177,13 @@ UnixMakefileGenerator::init() | |||
165 | if ( !is_qt ) { | 177 | if ( !is_qt ) { |
166 | if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) { | 178 | if ( !project->isEmpty("QMAKE_RPATH") ) { |
167 | if ( !project->isEmpty("QMAKE_RPATH") ) | 179 | if ( !project->isEmpty("QMAKE_RTLDIR_QT") ) |
168 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"), | 180 | project->variables()["QMAKE_LFLAGS"] += varGlue("QMAKE_RTLDIR_QT", " " + var("QMAKE_RPATH"), |
169 | " " + var("QMAKE_RPATH"), ""); | 181 | " " + var("QMAKE_RPATH"), ""); |
170 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", ""); | 182 | else if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) |
183 | project->variables()["QMAKE_LFLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"), | ||
184 | " " + var("QMAKE_RPATH"), ""); | ||
171 | } | 185 | } |
172 | if (project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD")) | 186 | if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) |
187 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", ""); | ||
188 | if ( project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD") ) | ||
173 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 189 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
@@ -177,3 +193,3 @@ UnixMakefileGenerator::init() | |||
177 | } | 193 | } |
178 | if ( project->isActiveConfig("opengl") ) { | 194 | if ( project->isActiveConfig("opengl") && !project->isActiveConfig("dlopen_opengl")) { |
179 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; | 195 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; |
@@ -186,4 +202,14 @@ UnixMakefileGenerator::init() | |||
186 | } | 202 | } |
187 | if(project->isActiveConfig("global_init_link_order")) | 203 | if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) { |
188 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 204 | if(configs.findIndex("x11lib") == -1) |
205 | configs.append("x11lib"); | ||
206 | if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 ) | ||
207 | configs.append("x11inc"); | ||
208 | } | ||
209 | if ( project->isActiveConfig("x11") ) { | ||
210 | if(configs.findIndex("x11lib") == -1) | ||
211 | configs.append("x11lib"); | ||
212 | if(configs.findIndex("x11inc") == -1) | ||
213 | configs.append("x11inc"); | ||
214 | } | ||
189 | if ( project->isActiveConfig("x11inc") ) | 215 | if ( project->isActiveConfig("x11inc") ) |
@@ -202,6 +228,10 @@ UnixMakefileGenerator::init() | |||
202 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | 228 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); |
203 | if ( !project->isEmpty("QMAKE_CFLAGS_THREAD")) | 229 | if ( !project->isEmpty("QMAKE_CFLAGS_THREAD")) { |
204 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; | 230 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; |
205 | if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD")) | 231 | project->variables()["PRL_EXPORT_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; |
232 | } | ||
233 | if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD")) { | ||
206 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; | 234 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; |
235 | project->variables()["PRL_EXPORT_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; | ||
236 | } | ||
207 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"]; | 237 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"]; |
@@ -213,13 +243,13 @@ UnixMakefileGenerator::init() | |||
213 | setMocAware(TRUE); | 243 | setMocAware(TRUE); |
214 | if ( project->isEmpty("QMAKE_RUN_CC") ) | 244 | QString compile_flag = var("QMAKE_COMPILE_FLAG"); |
215 | project->variables()["QMAKE_RUN_CC"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src"); | 245 | if(compile_flag.isEmpty()) |
216 | if ( project->isEmpty("QMAKE_RUN_CC_IMP") ) | 246 | compile_flag = "-c"; |
217 | project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<"); | 247 | if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) { |
218 | if ( project->isEmpty("QMAKE_RUN_CXX") ) | 248 | QString prefix_flags = project->first("QMAKE_CFLAGS_PREFIX_INCLUDE"); |
219 | project->variables()["QMAKE_RUN_CXX"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src"); | 249 | if(prefix_flags.isEmpty()) |
220 | if ( project->isEmpty("QMAKE_RUN_CXX_IMP") ) | 250 | prefix_flags = "-include"; |
221 | project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<"); | 251 | compile_flag += " " + prefix_flags + " " + project->first("QMAKE_ORIG_TARGET"); |
222 | project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " "); | 252 | } |
223 | if ( !project->isEmpty("PRECOMPH") ) { | 253 | if(!project->isEmpty("ALLMOC_HEADER")) { |
224 | initOutPaths(); // Need to fix MOC_DIR since we do this before init() | 254 | initOutPaths(); // Need to fix outdirs since we do this before init() (because we could add to SOURCES et al) |
225 | QString allmoc = fileFixify(project->first("MOC_DIR") + "/allmoc.cpp", QDir::currentDirPath(), Option::output_dir); | 255 | QString allmoc = fileFixify(project->first("MOC_DIR") + "/allmoc.cpp", QDir::currentDirPath(), Option::output_dir); |
@@ -229,4 +259,15 @@ UnixMakefileGenerator::init() | |||
229 | } | 259 | } |
260 | if ( project->isEmpty("QMAKE_RUN_CC") ) | ||
261 | project->variables()["QMAKE_RUN_CC"].append("$(CC) " + compile_flag + " $(CFLAGS) $(INCPATH) -o $obj $src"); | ||
262 | if ( project->isEmpty("QMAKE_RUN_CC_IMP") ) | ||
263 | project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) " + compile_flag + " $(CFLAGS) $(INCPATH) -o $@ $<"); | ||
264 | if ( project->isEmpty("QMAKE_RUN_CXX") ) | ||
265 | project->variables()["QMAKE_RUN_CXX"].append("$(CXX) " + compile_flag + " $(CXXFLAGS) $(INCPATH) -o $obj $src"); | ||
266 | if ( project->isEmpty("QMAKE_RUN_CXX_IMP") ) | ||
267 | project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) " + compile_flag + " $(CXXFLAGS) $(INCPATH) -o $@ $<"); | ||
268 | project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " "); | ||
230 | if( project->isActiveConfig("GNUmake") && !project->isEmpty("QMAKE_CFLAGS_DEPS")) | 269 | if( project->isActiveConfig("GNUmake") && !project->isEmpty("QMAKE_CFLAGS_DEPS")) |
231 | include_deps = TRUE; //do not generate deps | 270 | include_deps = TRUE; //do not generate deps |
271 | if(project->isActiveConfig("compile_libtool")) | ||
272 | Option::obj_ext = ".lo"; //override the .o | ||
232 | 273 | ||
@@ -242,6 +283,8 @@ UnixMakefileGenerator::init() | |||
242 | 283 | ||
243 | QString plist = specdir() + QDir::separator() + "Info.plist." + | 284 | QString plist = fileFixify(project->first("QMAKE_INFO_PLIST")); |
244 | project->first("TEMPLATE"); | 285 | if(plist.isEmpty()) |
286 | plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); | ||
245 | if(QFile::exists(Option::fixPathToLocalOS(plist))) { | 287 | if(QFile::exists(Option::fixPathToLocalOS(plist))) { |
246 | project->variables()["QMAKE_INFO_PLIST"].append(plist); | 288 | if(project->isEmpty("QMAKE_INFO_PLIST")) |
289 | project->variables()["QMAKE_INFO_PLIST"].append(plist); | ||
247 | project->variables()["QMAKE_INFO_PLIST_OUT"].append(project->first("DESTDIR") + | 290 | project->variables()["QMAKE_INFO_PLIST_OUT"].append(project->first("DESTDIR") + |
@@ -285,2 +328,45 @@ UnixMakefileGenerator::init() | |||
285 | } | 328 | } |
329 | |||
330 | if(project->isActiveConfig("compile_libtool")) { | ||
331 | const QString libtoolify[] = { "QMAKE_RUN_CC", "QMAKE_RUN_CC_IMP", | ||
332 | "QMAKE_RUN_CXX", "QMAKE_RUN_CXX_IMP", | ||
333 | "QMAKE_LINK_THREAD", "QMAKE_LINK", "QMAKE_AR_CMD", "QMAKE_LINK_SHLIB_CMD", | ||
334 | QString::null }; | ||
335 | for(int i = 0; !libtoolify[i].isNull(); i++) { | ||
336 | QStringList &l = project->variables()[libtoolify[i]]; | ||
337 | if(!l.isEmpty()) { | ||
338 | QString libtool_flags, comp_flags; | ||
339 | if(libtoolify[i].startsWith("QMAKE_LINK") || libtoolify[i] == "QMAKE_AR_CMD") { | ||
340 | libtool_flags += " --mode=link"; | ||
341 | if(project->isActiveConfig("staticlib")) { | ||
342 | libtool_flags += " -static"; | ||
343 | } else { | ||
344 | if(!project->isEmpty("QMAKE_LIB_FLAG")) { | ||
345 | int maj = project->first("VER_MAJ").toInt(); | ||
346 | int min = project->first("VER_MIN").toInt(); | ||
347 | int pat = project->first("VER_PAT").toInt(); | ||
348 | comp_flags += " -version-info " + QString::number(10*maj + min) + | ||
349 | ":" + QString::number(pat) + ":0"; | ||
350 | if(libtoolify[i] != "QMAKE_AR_CMD") { | ||
351 | QString rpath = Option::output_dir; | ||
352 | if(!project->isEmpty("DESTDIR")) { | ||
353 | rpath = project->first("DESTDIR"); | ||
354 | if(QDir::isRelativePath(rpath)) | ||
355 | rpath.prepend(Option::output_dir + Option::dir_sep); | ||
356 | } | ||
357 | comp_flags += " -rpath " + Option::fixPathToTargetOS(rpath, FALSE); | ||
358 | } | ||
359 | } | ||
360 | } | ||
361 | if(project->isActiveConfig("plugin")) | ||
362 | libtool_flags += " -module"; | ||
363 | } else { | ||
364 | libtool_flags += " --mode=compile"; | ||
365 | } | ||
366 | l.first().prepend("$(LIBTOOL)" + libtool_flags + " "); | ||
367 | if(!comp_flags.isEmpty()) | ||
368 | l.first() += comp_flags; | ||
369 | } | ||
370 | } | ||
371 | } | ||
286 | } | 372 | } |
@@ -288,42 +374,55 @@ UnixMakefileGenerator::init() | |||
288 | QStringList | 374 | QStringList |
289 | UnixMakefileGenerator::uniqueSetLFlags(const QStringList &list1, QStringList &list2) | 375 | UnixMakefileGenerator::combineSetLFlags(const QStringList &list1, const QStringList &list2) |
290 | { | 376 | { |
377 | if(project->isActiveConfig("no_smart_library_merge")) | ||
378 | return list1 + list2; | ||
379 | |||
291 | QStringList ret; | 380 | QStringList ret; |
292 | for(QStringList::ConstIterator it = list1.begin(); it != list1.end(); ++it) { | 381 | for(int i = 0; i < 2; i++) { |
293 | bool unique = TRUE; | 382 | const QStringList *lst = i ? &list2 : &list1; |
294 | if((*it).startsWith("-")) { | 383 | for(QStringList::ConstIterator it = lst->begin(); it != lst->end(); ++it) { |
295 | if((*it).startsWith("-l") || (*it).startsWith("-L")) { | 384 | if((*it).startsWith("-")) { |
296 | unique = list2.findIndex((*it)) == -1; | 385 | if((*it).startsWith("-L")) { |
297 | } else if(project->isActiveConfig("macx") && (*it).startsWith("-framework")) { | 386 | if(ret.findIndex((*it)) == -1) |
298 | int as_one = TRUE; | 387 | ret.append((*it)); |
299 | QString framework_in; | 388 | } else if((*it).startsWith("-l")) { |
300 | if((*it).length() > 11) { | 389 | while(1) { |
301 | framework_in = (*it).mid(11); | 390 | QStringList::Iterator idx = ret.find((*it)); |
302 | } else { | 391 | if(idx == ret.end()) |
303 | if(it != list1.end()) { | 392 | break; |
304 | ++it; | 393 | ret.remove(idx); |
305 | as_one = FALSE; | ||
306 | framework_in = (*it); | ||
307 | } | 394 | } |
308 | } | 395 | ret.append((*it)); |
309 | if(!framework_in.isEmpty()) { | 396 | } else if(project->isActiveConfig("macx") && (*it).startsWith("-framework")) { |
310 | for(QStringList::ConstIterator outit = list2.begin(); outit != list2.end(); ++outit) { | 397 | int as_one = TRUE; |
311 | if((*outit).startsWith("-framework")) { | 398 | QString framework_in; |
312 | QString framework_out; | 399 | if((*it).length() > 11) { |
313 | if((*outit).length() > 11) { | 400 | framework_in = (*it).mid(11); |
314 | framework_out = (*outit).mid(11); | 401 | } else { |
315 | } else { | 402 | if(it != lst->end()) { |
316 | if(it != list2.end()) { | 403 | ++it; |
317 | ++outit; | 404 | as_one = FALSE; |
318 | framework_out = (*outit); | 405 | framework_in = (*it); |
406 | } | ||
407 | } | ||
408 | if(!framework_in.isEmpty()) { | ||
409 | for(QStringList::Iterator outit = ret.begin(); outit != ret.end(); ++outit) { | ||
410 | if((*outit).startsWith("-framework")) { | ||
411 | int found = 0; | ||
412 | if((*outit).length() > 11) { | ||
413 | if(framework_in == (*outit).mid(11)) | ||
414 | found = 1; | ||
415 | } else { | ||
416 | if(it != lst->end()) { | ||
417 | ++outit; | ||
418 | if(framework_in == (*outit)) { | ||
419 | --outit; | ||
420 | found = 2; | ||
421 | } | ||
422 | } | ||
319 | } | 423 | } |
320 | } | 424 | for(int i = 0; i < found; i++) |
321 | if(framework_out == framework_in) { | 425 | outit = ret.remove(outit); |
322 | unique = FALSE; | ||
323 | break; | ||
324 | } | 426 | } |
325 | } | 427 | } |
326 | } | ||
327 | if(unique) { | ||
328 | unique = FALSE; //because I'm about to just insert it myself | ||
329 | if(as_one) { | 428 | if(as_one) { |
@@ -335,11 +434,23 @@ UnixMakefileGenerator::uniqueSetLFlags(const QStringList &list1, QStringList &li | |||
335 | } | 434 | } |
435 | } else { | ||
436 | #if 1 | ||
437 | while(1) { | ||
438 | QStringList::Iterator idx = ret.find((*it)); | ||
439 | if(idx == ret.end()) | ||
440 | break; | ||
441 | ret.remove(idx); | ||
442 | } | ||
443 | #endif | ||
444 | ret.append((*it)); | ||
336 | } | 445 | } |
337 | } else { | 446 | } else /*if(QFile::exists((*it)))*/ { |
338 | unique = (list2.findIndex((*it)) == -1); | 447 | while(1) { |
448 | QStringList::Iterator idx = ret.find((*it)); | ||
449 | if(idx == ret.end()) | ||
450 | break; | ||
451 | ret.remove(idx); | ||
452 | } | ||
453 | ret.append((*it)); | ||
339 | } | 454 | } |
340 | } else if(QFile::exists((*it))) { | ||
341 | unique = (list2.findIndex((*it)) == -1); | ||
342 | } | 455 | } |
343 | if(unique) | ||
344 | ret.append((*it)); | ||
345 | } | 456 | } |
@@ -348,3 +459,2 @@ UnixMakefileGenerator::uniqueSetLFlags(const QStringList &list1, QStringList &li | |||
348 | 459 | ||
349 | |||
350 | void | 460 | void |
@@ -353,3 +463,4 @@ UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList | |||
353 | if(var == "QMAKE_PRL_LIBS") | 463 | if(var == "QMAKE_PRL_LIBS") |
354 | project->variables()["QMAKE_CURRENT_PRL_LIBS"] += uniqueSetLFlags(l, project->variables()["QMAKE_LIBS"]); | 464 | project->variables()["QMAKE_CURRENT_PRL_LIBS"] = combineSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"] + |
465 | project->variables()["QMAKE_LIBS"], l); | ||
355 | else | 466 | else |
@@ -358,2 +469,68 @@ UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList | |||
358 | 469 | ||
470 | QString | ||
471 | UnixMakefileGenerator::findDependency(const QString &dep) | ||
472 | { | ||
473 | QStringList::Iterator it; | ||
474 | { | ||
475 | QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; | ||
476 | for(it = qut.begin(); it != qut.end(); ++it) { | ||
477 | QString targ = var((*it) + ".target"); | ||
478 | if(targ.isEmpty()) | ||
479 | targ = (*it); | ||
480 | if(targ.endsWith(dep)) | ||
481 | return targ; | ||
482 | } | ||
483 | } | ||
484 | { | ||
485 | QStringList &quc = project->variables()["QMAKE_EXTRA_UNIX_COMPILERS"]; | ||
486 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
487 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
488 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); | ||
489 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) | ||
490 | continue; | ||
491 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
492 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
493 | QStringList &inputs = project->variables()[(*it2)]; | ||
494 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
495 | QString out = tmp_out; | ||
496 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
497 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
498 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
499 | if(out.endsWith(dep)) | ||
500 | return out; | ||
501 | } | ||
502 | } | ||
503 | } | ||
504 | } | ||
505 | return MakefileGenerator::findDependency(dep); | ||
506 | } | ||
507 | |||
508 | QStringList | ||
509 | &UnixMakefileGenerator::findDependencies(const QString &file) | ||
510 | { | ||
511 | QStringList &ret = MakefileGenerator::findDependencies(file); | ||
512 | // Note: The QMAKE_IMAGE_COLLECTION file have all images | ||
513 | // as dependency, so don't add precompiled header then | ||
514 | if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER") | ||
515 | && file != project->first("QMAKE_IMAGE_COLLECTION")) { | ||
516 | QString header_prefix = project->first("QMAKE_ORIG_TARGET") + ".gch" + Option::dir_sep; | ||
517 | header_prefix += project->first("QMAKE_PRECOMP_PREFIX"); | ||
518 | if(file.endsWith(".c")) { | ||
519 | QString precomp_h = header_prefix + "c"; | ||
520 | if(!ret.contains(precomp_h)) | ||
521 | ret += precomp_h; | ||
522 | } else { | ||
523 | for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) { | ||
524 | if(file.endsWith(*it)) { | ||
525 | QString precomp_h = header_prefix + "c++"; | ||
526 | if(!ret.contains(precomp_h)) | ||
527 | ret += precomp_h; | ||
528 | break; | ||
529 | } | ||
530 | } | ||
531 | } | ||
532 | } | ||
533 | return ret; | ||
534 | } | ||
535 | |||
359 | bool | 536 | bool |
@@ -402,3 +579,3 @@ UnixMakefileGenerator::findLibraries() | |||
402 | if(!stub.isEmpty()) { | 579 | if(!stub.isEmpty()) { |
403 | const QString modifs[] = { "-mt", QString::null }; | 580 | const QString modifs[] = { "", "-mt", QString::null }; |
404 | for(int modif = 0; !modifs[modif].isNull(); modif++) { | 581 | for(int modif = 0; !modifs[modif].isNull(); modif++) { |
@@ -433,4 +610,14 @@ UnixMakefileGenerator::findLibraries() | |||
433 | } | 610 | } |
611 | if(!found && project->isActiveConfig("compile_libtool")) { | ||
612 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | ||
613 | if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub + modifs[modif] + Option::libtool_ext)) { | ||
614 | (*it) = mdd->real_dir + Option::dir_sep + "lib" + stub + modifs[modif] + Option::libtool_ext; | ||
615 | found = TRUE; | ||
616 | break; | ||
617 | } | ||
618 | } | ||
619 | } | ||
434 | if(found) | 620 | if(found) |
435 | break; | 621 | break; |
622 | |||
436 | } | 623 | } |
@@ -442,2 +629,10 @@ UnixMakefileGenerator::findLibraries() | |||
442 | 629 | ||
630 | QString linkLib(const QString &file, const QString &libName) { | ||
631 | QString ret; | ||
632 | QRegExp reg("^.*lib(" + libName + "[^./=]*).*$"); | ||
633 | if(reg.exactMatch(file)) | ||
634 | ret = "-l" + reg.cap(1); | ||
635 | return ret; | ||
636 | } | ||
637 | |||
443 | void | 638 | void |
@@ -455,3 +650,3 @@ UnixMakefileGenerator::processPrlFiles() | |||
455 | project->variables()["QMAKE_CURRENT_PRL_LIBS"].clear(); | 650 | project->variables()["QMAKE_CURRENT_PRL_LIBS"].clear(); |
456 | QString opt = (*it).stripWhiteSpace();; | 651 | QString opt = (*it).stripWhiteSpace(); |
457 | if(opt.startsWith("-")) { | 652 | if(opt.startsWith("-")) { |
@@ -463,5 +658,14 @@ UnixMakefileGenerator::processPrlFiles() | |||
463 | } else if(opt.startsWith("-l") && !processed[opt]) { | 658 | } else if(opt.startsWith("-l") && !processed[opt]) { |
464 | QString lib = opt.right(opt.length() - 2), prl; | 659 | QString lib = opt.right(opt.length() - 2); |
465 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | 660 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { |
466 | prl = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::prl_ext; | 661 | if(!project->isActiveConfig("compile_libtool")) { //give them the .libs.. |
662 | QString la = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::libtool_ext; | ||
663 | if(QFile::exists(la) && QFile::exists(mdd->local_dir + Option::dir_sep + ".libs")) { | ||
664 | l_out.append("-L" + mdd->real_dir + Option::dir_sep + ".libs"); | ||
665 | libdirs.append(new MakefileDependDir(mdd->real_dir + Option::dir_sep + ".libs", | ||
666 | mdd->local_dir + Option::dir_sep + ".libs")); | ||
667 | } | ||
668 | } | ||
669 | |||
670 | QString prl = mdd->local_dir + Option::dir_sep + "lib" + lib; | ||
467 | if(processPrlFile(prl)) { | 671 | if(processPrlFile(prl)) { |
@@ -469,6 +673,3 @@ UnixMakefileGenerator::processPrlFiles() | |||
469 | prl.replace(0, mdd->local_dir.length(), mdd->real_dir); | 673 | prl.replace(0, mdd->local_dir.length(), mdd->real_dir); |
470 | QRegExp reg("^.*lib(" + lib + "[^./=]*)\\..*$"); | 674 | opt = linkLib(prl, lib); |
471 | if(reg.exactMatch(prl)) | ||
472 | prl = "-l" + reg.cap(1); | ||
473 | opt = prl; | ||
474 | processed.insert(opt, (void*)1); | 675 | processed.insert(opt, (void*)1); |
@@ -486,3 +687,3 @@ UnixMakefileGenerator::processPrlFiles() | |||
486 | QString prl = "/System/Library/Frameworks/" + opt + | 687 | QString prl = "/System/Library/Frameworks/" + opt + |
487 | ".framework/" + opt + Option::prl_ext; | 688 | ".framework/" + opt; |
488 | if(processPrlFile(prl)) | 689 | if(processPrlFile(prl)) |
@@ -493,11 +694,16 @@ UnixMakefileGenerator::processPrlFiles() | |||
493 | l_out.append(opt); | 694 | l_out.append(opt); |
494 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); | 695 | l_out = combineSetLFlags(l_out, project->variables()["QMAKE_CURRENT_PRL_LIBS"]); |
495 | } else { | 696 | } else { |
496 | if(!processed[opt] && processPrlFile(opt)) { | 697 | QString lib = opt; |
497 | processed.insert(opt, (void*)1); | 698 | if(!processed[lib] && processPrlFile(lib)) { |
498 | ret = TRUE; | 699 | processed.insert(lib, (void*)1); |
700 | ret = TRUE; | ||
499 | } | 701 | } |
702 | #if 0 | ||
703 | if(ret) | ||
704 | opt = linkLib(lib, ""); | ||
705 | #endif | ||
500 | if(!opt.isEmpty()) | 706 | if(!opt.isEmpty()) |
501 | l_out.append(opt); | 707 | l_out.append(opt); |
502 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); | 708 | l_out = combineSetLFlags(l_out, project->variables()["QMAKE_CURRENT_PRL_LIBS"]); |
503 | } | 709 | } |
@@ -539,3 +745,4 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
539 | } else if(project->first("TEMPLATE") == "lib") { | 745 | } else if(project->first("TEMPLATE") == "lib") { |
540 | if(project->isActiveConfig("create_prl") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { | 746 | if(project->isActiveConfig("create_prl") && !project->isActiveConfig("no_install_prl") && |
747 | !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { | ||
541 | QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE"); | 748 | QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE"); |
@@ -545,3 +752,3 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
545 | dst_prl = root + targetdir + dst_prl; | 752 | dst_prl = root + targetdir + dst_prl; |
546 | ret += "-$(COPY) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\""; | 753 | ret += "-$(INSTALL_FILE) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\""; |
547 | if(!uninst.isEmpty()) | 754 | if(!uninst.isEmpty()) |
@@ -550,2 +757,49 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
550 | } | 757 | } |
758 | if(project->isActiveConfig("create_libtool") && !project->isActiveConfig("compile_libtool")) { | ||
759 | QString src_lt = var("QMAKE_ORIG_TARGET"); | ||
760 | int slsh = src_lt.findRev(Option::dir_sep); | ||
761 | if(slsh != -1) | ||
762 | src_lt = src_lt.right(src_lt.length() - slsh); | ||
763 | int dot = src_lt.find('.'); | ||
764 | if(dot != -1) | ||
765 | src_lt = src_lt.left(dot); | ||
766 | src_lt += Option::libtool_ext; | ||
767 | src_lt.prepend("lib"); | ||
768 | QString dst_lt = root + targetdir + src_lt; | ||
769 | if(!project->isEmpty("DESTDIR")) { | ||
770 | src_lt.prepend(var("DESTDIR")); | ||
771 | src_lt = Option::fixPathToLocalOS(fileFixify(src_lt, | ||
772 | QDir::currentDirPath(), Option::output_dir)); | ||
773 | } | ||
774 | if(!ret.isEmpty()) | ||
775 | ret += "\n\t"; | ||
776 | ret += "-$(INSTALL_FILE) \"" + src_lt + "\" \"" + dst_lt + "\""; | ||
777 | if(!uninst.isEmpty()) | ||
778 | uninst.append("\n\t"); | ||
779 | uninst.append("-$(DEL_FILE) \"" + dst_lt + "\""); | ||
780 | } | ||
781 | if(project->isActiveConfig("create_pc")) { | ||
782 | QString src_pc = var("QMAKE_ORIG_TARGET"); | ||
783 | int slsh = src_pc.findRev(Option::dir_sep); | ||
784 | if(slsh != -1) | ||
785 | src_pc = src_pc.right(src_pc.length() - slsh); | ||
786 | int dot = src_pc.find('.'); | ||
787 | if(dot != -1) | ||
788 | src_pc = src_pc.left(dot); | ||
789 | src_pc += ".pc"; | ||
790 | QString d = root + targetdir + "pkgconfig" + Option::dir_sep; | ||
791 | QString dst_pc = d + src_pc; | ||
792 | if(!project->isEmpty("DESTDIR")) { | ||
793 | src_pc.prepend(var("DESTDIR")); | ||
794 | src_pc = Option::fixPathToLocalOS(fileFixify(src_pc, | ||
795 | QDir::currentDirPath(), Option::output_dir)); | ||
796 | } | ||
797 | if(!ret.isEmpty()) | ||
798 | ret += "\n\t"; | ||
799 | ret += mkdir_p_asstring(d) + "\n\t"; | ||
800 | ret += "-$(INSTALL_FILE) \"" + src_pc + "\" \"" + dst_pc + "\""; | ||
801 | if(!uninst.isEmpty()) | ||
802 | uninst.append("\n\t"); | ||
803 | uninst.append("-$(DEL_FILE) \"" + dst_pc + "\""); | ||
804 | } | ||
551 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { | 805 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { |
@@ -560,40 +814,60 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
560 | } | 814 | } |
561 | QString src_targ = target; | 815 | |
562 | if(!destdir.isEmpty()) | 816 | if(!resource && project->isActiveConfig("compile_libtool")) { |
563 | src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); | 817 | QString src_targ = target; |
564 | QString dst_targ = root + fileFixify(targetdir + target); | 818 | if(src_targ == "$(TARGET)") |
565 | if(!ret.isEmpty()) | 819 | src_targ = "$(TARGETL)"; |
566 | ret += "\n\t"; | 820 | QString dst_dir = fileFixify(targetdir); |
567 | ret += QString(resource ? "-$(COPY_DIR)" : "-$(COPY)") + " \"" + | 821 | if(QDir::isRelativePath(dst_dir)) |
568 | src_targ + "\" \"" + dst_targ + "\""; | 822 | dst_dir = Option::fixPathToTargetOS(Option::output_dir + Option::dir_sep + dst_dir); |
569 | if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP")) { | 823 | ret = "-$(LIBTOOL) --mode=install cp \"" + src_targ + "\" \"" + root + dst_dir + "\""; |
570 | ret += "\n\t-" + var("QMAKE_STRIP"); | 824 | uninst.append("-$(LIBTOOL) --mode=uninstall \"" + src_targ + "\""); |
571 | if(!project->isEmpty("QMAKE_STRIPFLAGS_LIB") && project->first("TEMPLATE") == "lib") | 825 | } else { |
572 | ret += " " + var("QMAKE_STRIPFLAGS_LIB"); | 826 | QString src_targ = target; |
827 | if(!destdir.isEmpty()) | ||
828 | src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); | ||
829 | QString dst_targ = root + fileFixify(targetdir + target, | ||
830 | QDir::currentDirPath(), Option::output_dir); | ||
831 | if(!ret.isEmpty()) | ||
832 | ret += "\n\t"; | ||
573 | if(resource) | 833 | if(resource) |
574 | ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\""; | 834 | ret += "$(DEL_FILE) -r \"" + dst_targ + "\"" + "\n\t"; |
835 | if(!ret.isEmpty()) | ||
836 | ret += "\n\t"; | ||
837 | ret += QString(resource ? "-$(INSTALL_DIR)" : "-$(INSTALL_FILE)") + " \"" + | ||
838 | src_targ + "\" \"" + dst_targ + "\""; | ||
839 | if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP") && | ||
840 | (project->first("TEMPLATE") != "lib" || !project->isActiveConfig("staticlib"))) { | ||
841 | ret += "\n\t-" + var("QMAKE_STRIP"); | ||
842 | if(project->first("TEMPLATE") == "lib" && !project->isEmpty("QMAKE_STRIPFLAGS_LIB")) | ||
843 | ret += " " + var("QMAKE_STRIPFLAGS_LIB"); | ||
844 | else if(project->first("TEMPLATE") == "app" && !project->isEmpty("QMAKE_STRIPFLAGS_APP")) | ||
845 | ret += " " + var("QMAKE_STRIPFLAGS_APP"); | ||
846 | if(resource) | ||
847 | ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\""; | ||
848 | else | ||
849 | ret += " \"" + dst_targ + "\""; | ||
850 | } | ||
851 | if(!uninst.isEmpty()) | ||
852 | uninst.append("\n\t"); | ||
853 | if(resource) | ||
854 | uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\""); | ||
575 | else | 855 | else |
576 | ret += " \"" + dst_targ + "\""; | 856 | uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); |
577 | } | 857 | if(!links.isEmpty()) { |
578 | if(!uninst.isEmpty()) | 858 | for(QStringList::Iterator it = links.begin(); it != links.end(); it++) { |
579 | uninst.append("\n\t"); | 859 | if(Option::target_mode == Option::TARG_WIN_MODE || |
580 | if(resource) | 860 | Option::target_mode == Option::TARG_MAC9_MODE) { |
581 | uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\""); | 861 | } else if(Option::target_mode == Option::TARG_UNIX_MODE || |
582 | else | 862 | Option::target_mode == Option::TARG_MACX_MODE) { |
583 | uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); | 863 | QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE); |
584 | if(!links.isEmpty()) { | 864 | int lslash = link.findRev(Option::dir_sep); |
585 | for(QStringList::Iterator it = links.begin(); it != links.end(); it++) { | 865 | if(lslash != -1) |
586 | if(Option::target_mode == Option::TARG_WIN_MODE || | 866 | link = link.right(link.length() - (lslash + 1)); |
587 | Option::target_mode == Option::TARG_MAC9_MODE) { | 867 | QString dst_link = root + targetdir + link; |
588 | } else if(Option::target_mode == Option::TARG_UNIX_MODE || | 868 | ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; |
589 | Option::target_mode == Option::TARG_MACX_MODE) { | 869 | if(!uninst.isEmpty()) |
590 | QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE); | 870 | uninst.append("\n\t"); |
591 | int lslash = link.findRev(Option::dir_sep); | 871 | uninst.append("-$(DEL_FILE) \"" + dst_link + "\""); |
592 | if(lslash != -1) | 872 | } |
593 | link = link.right(link.length() - (lslash + 1)); | ||
594 | QString dst_link = root + fileFixify(targetdir + link); | ||
595 | ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; | ||
596 | if(!uninst.isEmpty()) | ||
597 | uninst.append("\n\t"); | ||
598 | uninst.append("-$(DEL_FILE) \"" + dst_link + "\""); | ||
599 | } | 873 | } |
@@ -603,2 +877 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
603 | } | } | |
604 | |||