Diffstat (limited to 'qmake/generators/unix/unixmake.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 154 |
1 files changed, 119 insertions, 35 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 7df95b2..e274481 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp | |||
@@ -7,3 +7,3 @@ | |||
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
@@ -74,7 +74,6 @@ UnixMakefileGenerator::init() | |||
74 | if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) { | 74 | if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) { |
75 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); | 75 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { |
76 | if ( os == "cygwin" ) { | ||
77 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" ); | ||
78 | } else { | ||
79 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" ); | 76 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" ); |
77 | } else { | ||
78 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" ); | ||
80 | } | 79 | } |
@@ -178,14 +177,2 @@ UnixMakefileGenerator::init() | |||
178 | } | 177 | } |
179 | if ( project->isActiveConfig("thread") ) { | ||
180 | if(project->isActiveConfig("qt")) | ||
181 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | ||
182 | if ( !project->isEmpty("QMAKE_CFLAGS_THREAD")) | ||
183 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; | ||
184 | if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD")) | ||
185 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; | ||
186 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"]; | ||
187 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"]; | ||
188 | if(!project->isEmpty("QMAKE_LFLAGS_THREAD")) | ||
189 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"]; | ||
190 | } | ||
191 | if ( project->isActiveConfig("opengl") ) { | 178 | if ( project->isActiveConfig("opengl") ) { |
@@ -201,6 +188,2 @@ UnixMakefileGenerator::init() | |||
201 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 188 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
202 | if ( project->isActiveConfig("x11sm") ) | ||
203 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"]; | ||
204 | if ( project->isActiveConfig("dylib") ) | ||
205 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"]; | ||
206 | if ( project->isActiveConfig("x11inc") ) | 189 | if ( project->isActiveConfig("x11inc") ) |
@@ -212,2 +195,18 @@ UnixMakefileGenerator::init() | |||
212 | } | 195 | } |
196 | if ( project->isActiveConfig("x11sm") ) | ||
197 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"]; | ||
198 | if ( project->isActiveConfig("dylib") ) | ||
199 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"]; | ||
200 | if ( project->isActiveConfig("thread") ) { | ||
201 | if(project->isActiveConfig("qt")) | ||
202 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | ||
203 | if ( !project->isEmpty("QMAKE_CFLAGS_THREAD")) | ||
204 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; | ||
205 | if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD")) | ||
206 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; | ||
207 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"]; | ||
208 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"]; | ||
209 | if(!project->isEmpty("QMAKE_LFLAGS_THREAD")) | ||
210 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"]; | ||
211 | } | ||
213 | if ( project->isActiveConfig("moc") ) | 212 | if ( project->isActiveConfig("moc") ) |
@@ -359,2 +358,86 @@ UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList | |||
359 | 358 | ||
359 | bool | ||
360 | UnixMakefileGenerator::findLibraries() | ||
361 | { | ||
362 | QPtrList<MakefileDependDir> libdirs; | ||
363 | libdirs.setAutoDelete(TRUE); | ||
364 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; | ||
365 | for(int i = 0; !lflags[i].isNull(); i++) { | ||
366 | QStringList &l = project->variables()[lflags[i]]; | ||
367 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
368 | QString stub, dir, extn, opt = (*it).stripWhiteSpace(); | ||
369 | if(opt.startsWith("-")) { | ||
370 | if(opt.startsWith("-L")) { | ||
371 | QString r = opt.right(opt.length() - 2), l = r; | ||
372 | fixEnvVariables(l); | ||
373 | libdirs.append(new MakefileDependDir(r.replace("\"",""), | ||
374 | l.replace("\"",""))); | ||
375 | } else if(opt.startsWith("-l")) { | ||
376 | stub = opt.mid(2); | ||
377 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { | ||
378 | if(opt.length() > 11) { | ||
379 | opt = opt.mid(11); | ||
380 | } else { | ||
381 | ++it; | ||
382 | opt = (*it); | ||
383 | } | ||
384 | extn = ""; | ||
385 | dir = "/System/Library/Frameworks/" + opt + ".framework/"; | ||
386 | stub = opt; | ||
387 | } | ||
388 | } else { | ||
389 | extn = dir = ""; | ||
390 | stub = opt; | ||
391 | int slsh = opt.findRev(Option::dir_sep); | ||
392 | if(slsh != -1) { | ||
393 | dir = opt.left(slsh); | ||
394 | stub = opt.mid(slsh+1); | ||
395 | } | ||
396 | QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$"); | ||
397 | if(stub_reg.exactMatch(stub)) { | ||
398 | stub = stub_reg.cap(1); | ||
399 | extn = stub_reg.cap(2); | ||
400 | } | ||
401 | } | ||
402 | if(!stub.isEmpty()) { | ||
403 | const QString modifs[] = { "-mt", QString::null }; | ||
404 | for(int modif = 0; !modifs[modif].isNull(); modif++) { | ||
405 | bool found = FALSE; | ||
406 | QStringList extens; | ||
407 | if(!extn.isNull()) | ||
408 | extens << extn; | ||
409 | else | ||
410 | extens << project->variables()["QMAKE_EXTENSION_SHLIB"].first() << "a"; | ||
411 | for(QStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) { | ||
412 | if(dir.isNull()) { | ||
413 | QString lib_stub; | ||
414 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | ||
415 | if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub + | ||
416 | modifs[modif] + "." + (*extit))) { | ||
417 | lib_stub = stub + modifs[modif]; | ||
418 | break; | ||
419 | } | ||
420 | } | ||
421 | if(!lib_stub.isNull()) { | ||
422 | (*it) = "-l" + lib_stub; | ||
423 | found = TRUE; | ||
424 | break; | ||
425 | } | ||
426 | } else { | ||
427 | if(QFile::exists("lib" + stub + modifs[modif] + "." + (*extit))) { | ||
428 | (*it) = "lib" + stub + modifs[modif] + "." + (*extit); | ||
429 | found = TRUE; | ||
430 | break; | ||
431 | } | ||
432 | } | ||
433 | } | ||
434 | if(found) | ||
435 | break; | ||
436 | } | ||
437 | } | ||
438 | } | ||
439 | } | ||
440 | return FALSE; | ||
441 | } | ||
442 | |||
360 | void | 443 | void |
@@ -436,4 +519,5 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
436 | bool resource = FALSE; | 519 | bool resource = FALSE; |
520 | const QString root = "$(INSTALL_ROOT)"; | ||
437 | QStringList &uninst = project->variables()[t + ".uninstall"]; | 521 | QStringList &uninst = project->variables()[t + ".uninstall"]; |
438 | QString ret, destdir=fileFixify(project->first("DESTDIR")); | 522 | QString ret, destdir=project->first("DESTDIR"); |
439 | QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE); | 523 | QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE); |
@@ -441,3 +525,3 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
441 | destdir += Option::dir_sep; | 525 | destdir += Option::dir_sep; |
442 | targetdir = "$(INSTALL_ROOT)" + Option::fixPathToTargetOS(targetdir, FALSE); | 526 | targetdir = fileFixify(targetdir); |
443 | if(targetdir.right(1) != Option::dir_sep) | 527 | if(targetdir.right(1) != Option::dir_sep) |
@@ -460,4 +544,4 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
460 | dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); | 544 | dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); |
461 | dst_prl = targetdir + dst_prl; | 545 | dst_prl = root + targetdir + dst_prl; |
462 | ret += "-$(COPY) " + project->first("QMAKE_INTERNAL_PRL_FILE") + " " + dst_prl; | 546 | ret += "-$(COPY) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\""; |
463 | if(!uninst.isEmpty()) | 547 | if(!uninst.isEmpty()) |
@@ -466,9 +550,8 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
466 | } | 550 | } |
467 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); | 551 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { |
468 | if ( os != "cygwin" ) { | ||
469 | if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) { | 552 | if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) { |
470 | if ( os == "hpux" ) { | 553 | if ( project->isEmpty("QMAKE_HPUX_SHLIB") ) { |
471 | links << "$(TARGET0)"; | ||
472 | } else { | ||
473 | links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)"; | 554 | links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)"; |
555 | } else { | ||
556 | links << "$(TARGET0)"; | ||
474 | } | 557 | } |
@@ -480,3 +563,3 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
480 | src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); | 563 | src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); |
481 | QString dst_targ = fileFixify(targetdir + target); | 564 | QString dst_targ = root + fileFixify(targetdir + target); |
482 | if(!ret.isEmpty()) | 565 | if(!ret.isEmpty()) |
@@ -485,6 +568,8 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
485 | src_targ + "\" \"" + dst_targ + "\""; | 568 | src_targ + "\" \"" + dst_targ + "\""; |
486 | if(!project->isEmpty("QMAKE_STRIP")) { | 569 | if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP")) { |
487 | ret += "\n\t-" + var("QMAKE_STRIP"); | 570 | ret += "\n\t-" + var("QMAKE_STRIP"); |
571 | if(!project->isEmpty("QMAKE_STRIPFLAGS_LIB") && project->first("TEMPLATE") == "lib") | ||
572 | ret += " " + var("QMAKE_STRIPFLAGS_LIB"); | ||
488 | if(resource) | 573 | if(resource) |
489 | ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)"; | 574 | ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\""; |
490 | else | 575 | else |
@@ -508,3 +593,3 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
508 | link = link.right(link.length() - (lslash + 1)); | 593 | link = link.right(link.length() - (lslash + 1)); |
509 | QString dst_link = fileFixify(targetdir + link); | 594 | QString dst_link = root + fileFixify(targetdir + link); |
510 | ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; | 595 | ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; |
@@ -519,2 +604 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
519 | |||
520 | |||