-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 154 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake.h | 1 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 149 |
3 files changed, 224 insertions, 80 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 | |||
@@ -6,5 +6,5 @@ | |||
6 | ** Created : 970521 | 6 | ** Created : 970521 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 10 | ** This file is part of the network module of the Qt GUI Toolkit. |
@@ -73,9 +73,8 @@ UnixMakefileGenerator::init() | |||
73 | 73 | ||
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 | } |
81 | } | 80 | } |
@@ -177,16 +176,4 @@ UnixMakefileGenerator::init() | |||
177 | } | 176 | } |
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") ) { |
192 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; | 179 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; |
@@ -200,8 +187,4 @@ UnixMakefileGenerator::init() | |||
200 | if(project->isActiveConfig("global_init_link_order")) | 187 | if(project->isActiveConfig("global_init_link_order")) |
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") ) |
207 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_X11"]; | 190 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_X11"]; |
@@ -211,4 +194,20 @@ UnixMakefileGenerator::init() | |||
211 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11"]; | 194 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11"]; |
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") ) |
214 | setMocAware(TRUE); | 213 | setMocAware(TRUE); |
@@ -358,4 +357,88 @@ UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList | |||
358 | } | 357 | } |
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 |
361 | UnixMakefileGenerator::processPrlFiles() | 444 | UnixMakefileGenerator::processPrlFiles() |
@@ -435,10 +518,11 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
435 | 518 | ||
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); |
440 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) | 524 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) |
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) |
444 | targetdir += Option::dir_sep; | 528 | targetdir += Option::dir_sep; |
@@ -459,17 +543,16 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
459 | if(slsh != -1) | 543 | if(slsh != -1) |
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()) |
464 | uninst.append("\n\t"); | 548 | uninst.append("\n\t"); |
465 | uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); | 549 | uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); |
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 | } |
475 | } | 558 | } |
@@ -479,13 +562,15 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
479 | if(!destdir.isEmpty()) | 562 | if(!destdir.isEmpty()) |
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()) |
483 | ret += "\n\t"; | 566 | ret += "\n\t"; |
484 | ret += QString(resource ? "-$(COPY_DIR)" : "-$(COPY)") + " \"" + | 567 | ret += QString(resource ? "-$(COPY_DIR)" : "-$(COPY)") + " \"" + |
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 |
491 | ret += " \"" + dst_targ + "\""; | 576 | ret += " \"" + dst_targ + "\""; |
@@ -507,5 +592,5 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
507 | if(lslash != -1) | 592 | if(lslash != -1) |
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 + "\""; |
511 | if(!uninst.isEmpty()) | 596 | if(!uninst.isEmpty()) |
@@ -518,3 +603,2 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
518 | } | 603 | } |
519 | 604 | ||
520 | |||
diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h index e889dcc..3d00214 100644 --- a/qmake/generators/unix/unixmake.h +++ b/qmake/generators/unix/unixmake.h | |||
@@ -56,4 +56,5 @@ protected: | |||
56 | virtual void processPrlFiles(); | 56 | virtual void processPrlFiles(); |
57 | 57 | ||
58 | virtual bool findLibraries(); | ||
58 | virtual void init(); | 59 | virtual void init(); |
59 | 60 | ||
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 9bb6f6b..7fbb9f4 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp | |||
@@ -82,5 +82,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
82 | !project->isActiveConfig("staticlib"))), | 82 | !project->isActiveConfig("staticlib"))), |
83 | src_incremental=FALSE, moc_incremental=FALSE; | 83 | src_incremental=FALSE, moc_incremental=FALSE; |
84 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); | ||
85 | 84 | ||
86 | t << "####### Compiler, tools and options" << endl << endl; | 85 | t << "####### Compiler, tools and options" << endl << endl; |
@@ -109,5 +108,12 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
109 | t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; | 108 | t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; |
110 | t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl; | 109 | t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl; |
111 | t << "INCPATH = " << varGlue("INCLUDEPATH","-I", " -I", "") << " -I" << specdir() << endl; | 110 | t << "INCPATH = " << "-I" << specdir(); |
111 | if(!project->isActiveConfig("no_include_pwd")) { | ||
112 | QString pwd = fileFixify(QDir::currentDirPath()); | ||
113 | if(pwd.isEmpty()) | ||
114 | pwd = "."; | ||
115 | t << " -I" << pwd; | ||
116 | } | ||
117 | t << varGlue("INCLUDEPATH"," -I", " -I", "") << endl; | ||
112 | 118 | ||
113 | if(!project->isActiveConfig("staticlib")) { | 119 | if(!project->isActiveConfig("staticlib")) { |
@@ -137,5 +143,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
137 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; | 143 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; |
138 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | 144 | t << "MOVE = " << var("QMAKE_MOVE") << endl; |
139 | t << "PRO = " << fileFixify(project->projectFile() )<< endl; | 145 | t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; |
146 | t << "MKDIR = " << var("QMAKE_MKDIR") << endl; | ||
140 | t << endl; | 147 | t << endl; |
141 | 148 | ||
@@ -213,6 +220,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
213 | if(do_incremental && !moc_incremental && !src_incremental) | 220 | if(do_incremental && !moc_incremental && !src_incremental) |
214 | do_incremental = FALSE; | 221 | do_incremental = FALSE; |
215 | t << "DIST = " << varList("DISTFILES") << endl; | 222 | t << "DIST = " << valList(fileFixify(project->variables()["DISTFILES"])) << endl; |
216 | t << "PRO = " << fileFixify(project->projectFile()) << endl; | ||
217 | t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; | 223 | t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; |
218 | t << "DESTDIR = " << var("DESTDIR") << endl; | 224 | t << "DESTDIR = " << var("DESTDIR") << endl; |
@@ -222,13 +228,12 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
222 | } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | 228 | } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) { |
223 | t << "TARGETA= " << var("TARGETA") << endl; | 229 | t << "TARGETA= " << var("TARGETA") << endl; |
224 | if (os == "hpux") { | 230 | if (project->isEmpty("QMAKE_HPUX_SHLIB")) { |
225 | t << "TARGETD= " << var("TARGET_x") << endl; | ||
226 | t << "TARGET0= " << var("TARGET_") << endl; | ||
227 | } | ||
228 | else { | ||
229 | t << "TARGETD= " << var("TARGET_x.y.z") << endl; | 231 | t << "TARGETD= " << var("TARGET_x.y.z") << endl; |
230 | t << "TARGET0= " << var("TARGET_") << endl; | 232 | t << "TARGET0= " << var("TARGET_") << endl; |
231 | t << "TARGET1= " << var("TARGET_x") << endl; | 233 | t << "TARGET1= " << var("TARGET_x") << endl; |
232 | t << "TARGET2= " << var("TARGET_x.y") << endl; | 234 | t << "TARGET2= " << var("TARGET_x.y") << endl; |
235 | } else { | ||
236 | t << "TARGETD= " << var("TARGET_x") << endl; | ||
237 | t << "TARGET0= " << var("TARGET_") << endl; | ||
233 | } | 238 | } |
234 | } | 239 | } |
@@ -262,5 +267,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
262 | if(!project->variables()["OBJECTS_DIR"].isEmpty()) | 267 | if(!project->variables()["OBJECTS_DIR"].isEmpty()) |
263 | odir = project->first("OBJECTS_DIR"); | 268 | odir = project->first("OBJECTS_DIR"); |
264 | t << "###### Dependancies" << endl << endl; | 269 | t << "###### Dependencies" << endl << endl; |
265 | t << odir << ".deps/%.d: %.cpp\n\t" | 270 | t << odir << ".deps/%.d: %.cpp\n\t" |
266 | << "@echo Creating depend for $<" << "\n\t" | 271 | << "@echo Creating depend for $<" << "\n\t" |
@@ -387,5 +392,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
387 | 392 | ||
388 | //real target | 393 | //real target |
389 | t << var("TARGET") << ": " << " " << incr_deps << " " << var("TARGETDEPS") << "\n\t"; | 394 | t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps |
395 | << " " << var("POST_TARGETDEPS") << "\n\t"; | ||
390 | if(!destdir.isEmpty()) | 396 | if(!destdir.isEmpty()) |
391 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 397 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
@@ -400,5 +406,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
400 | << endl << endl; | 406 | << endl << endl; |
401 | 407 | ||
402 | t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS") << "\n\t"; | 408 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
409 | << var("POST_TARGETDEPS") << "\n\t"; | ||
403 | if(!destdir.isEmpty()) | 410 | if(!destdir.isEmpty()) |
404 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 411 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
@@ -461,11 +468,11 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
461 | 468 | ||
462 | //real target | 469 | //real target |
463 | t << var("DESTDIR_TARGET") << ": " << incr_deps << " $(SUBLIBS) " << | 470 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " " |
464 | var("TARGETDEPS"); | 471 | << incr_deps << " $(SUBLIBS) " << var("POST_TARGETDEPS"); |
465 | } else { | 472 | } else { |
466 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << | 473 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << |
467 | var("DESTDIR_TARGET") << endl << endl; | 474 | var("DESTDIR_TARGET") << endl << endl; |
468 | t << var("DESTDIR_TARGET") << ": $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << | 475 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") |
469 | var("TARGETDEPS"); | 476 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << var("POST_TARGETDEPS"); |
470 | } | 477 | } |
471 | if(!destdir.isEmpty()) | 478 | if(!destdir.isEmpty()) |
@@ -484,14 +491,18 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
484 | t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; | 491 | t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; |
485 | t << endl << endl; | 492 | t << endl << endl; |
486 | } else if ( os == "hpux" ) { | 493 | } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) { |
487 | t << "\n\t" | 494 | t << "\n\t" |
488 | << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t" | 495 | << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" |
489 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; | 496 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; |
490 | t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)"); | 497 | t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" |
498 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" | ||
499 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); | ||
491 | if(!destdir.isEmpty()) | 500 | if(!destdir.isEmpty()) |
492 | t << "\n\t" | 501 | t << "\n\t" |
493 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" | 502 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" |
494 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" | 503 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" |
495 | << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR"); | 504 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t" |
505 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t" | ||
506 | << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR"); | ||
496 | if(!project->isEmpty("QMAKE_POST_LINK")) | 507 | if(!project->isEmpty("QMAKE_POST_LINK")) |
497 | t << "\n\t" << var("QMAKE_POST_LINK"); | 508 | t << "\n\t" << var("QMAKE_POST_LINK"); |
@@ -499,16 +510,12 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
499 | } else { | 510 | } else { |
500 | t << "\n\t" | 511 | t << "\n\t" |
501 | << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" | 512 | << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t" |
502 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; | 513 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; |
503 | t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" | 514 | t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)"); |
504 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" | ||
505 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); | ||
506 | if(!destdir.isEmpty()) | 515 | if(!destdir.isEmpty()) |
507 | t << "\n\t" | 516 | t << "\n\t" |
508 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" | 517 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" |
509 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" | 518 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" |
510 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t" | 519 | << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR"); |
511 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t" | ||
512 | << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR"); | ||
513 | if(!project->isEmpty("QMAKE_POST_LINK")) | 520 | if(!project->isEmpty("QMAKE_POST_LINK")) |
514 | t << "\n\t" << var("QMAKE_POST_LINK"); | 521 | t << "\n\t" << var("QMAKE_POST_LINK"); |
@@ -519,8 +526,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
519 | if (! project->isActiveConfig("plugin")) { | 526 | if (! project->isActiveConfig("plugin")) { |
520 | t << "staticlib: $(TARGETA)" << endl << endl; | 527 | t << "staticlib: $(TARGETA)" << endl << endl; |
521 | t << "$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 528 | t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
522 | if(do_incremental) | 529 | if(do_incremental) |
523 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; | 530 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; |
524 | t << var("TARGETDEPS") << "\n\t" | 531 | t << var("POST_TARGETDEPS") << "\n\t" |
525 | << "-$(DEL_FILE) $(TARGETA) " << "\n\t" | 532 | << "-$(DEL_FILE) $(TARGETA) " << "\n\t" |
526 | << var("QMAKE_AR_CMD"); | 533 | << var("QMAKE_AR_CMD"); |
@@ -536,5 +543,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
536 | << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; | 543 | << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; |
537 | if(project->isEmpty("QMAKE_AR_SUBLIBS")) { | 544 | if(project->isEmpty("QMAKE_AR_SUBLIBS")) { |
538 | t << var("DESTDIR") << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(TARGETDEPS) " << "\n\t"; | 545 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") |
546 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("POST_TARGETDEPS") << "\n\t"; | ||
539 | if(!project->isEmpty("DESTDIR")) { | 547 | if(!project->isEmpty("DESTDIR")) { |
540 | QString destdir = project->first("DESTDIR"); | 548 | QString destdir = project->first("DESTDIR"); |
@@ -551,5 +559,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
551 | << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; | 559 | << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; |
552 | } else { | 560 | } else { |
553 | int cnt = 0, max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); | 561 | int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); |
554 | QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], | 562 | QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], |
555 | libs = project->variables()["QMAKE_AR_SUBLIBS"]; | 563 | libs = project->variables()["QMAKE_AR_SUBLIBS"]; |
@@ -558,10 +566,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
558 | libit != libs.end(); ++libit) { | 566 | libit != libs.end(); ++libit) { |
559 | QStringList build; | 567 | QStringList build; |
560 | for(cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) | 568 | for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) |
561 | build << (*objit); | 569 | build << (*objit); |
562 | QString ar; | 570 | QString ar; |
563 | if((*libit) == "$(TARGET)") { | 571 | if((*libit) == "$(TARGET)") { |
564 | t << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) " | 572 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") |
565 | << valList(build) << "\n\t"; | 573 | << " $(UICDECLS) " << var("POST_TARGETDEPS") << valList(build) << "\n\t"; |
566 | ar = project->variables()["QMAKE_AR_CMD"].first(); | 574 | ar = project->variables()["QMAKE_AR_CMD"].first(); |
567 | ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", | 575 | ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", |
@@ -593,5 +601,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
593 | if(!project->isActiveConfig("no_mocdepend")) { | 601 | if(!project->isActiveConfig("no_mocdepend")) { |
594 | //this is an implicity depend on moc, so it will be built if necesary, however | 602 | //this is an implicity depend on moc, so it will be built if necesary, however |
595 | //moc itself shouldn't have this dependancy - this is a little kludgy but it is | 603 | //moc itself shouldn't have this dependency - this is a little kludgy but it is |
596 | //better than the alternative for now. | 604 | //better than the alternative for now. |
597 | QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"); | 605 | QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"); |
@@ -654,5 +662,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
654 | << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " | 662 | << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " |
655 | << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " | 663 | << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " |
656 | << "$(DEL_DIR) " << ddir_c | 664 | << "$(DEL_FILE) -r " << ddir_c |
657 | << endl << endl; | 665 | << endl << endl; |
658 | 666 | ||
@@ -678,4 +686,43 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
678 | t << endl; | 686 | t << endl; |
679 | 687 | ||
688 | t << "yaccclean:" << "\n"; | ||
689 | if(!var("YACCSOURCES").isEmpty()) { | ||
690 | QStringList clean, &l = project->variables()["YACCSOURCES"]; | ||
691 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
692 | QFileInfo fi((*it)); | ||
693 | QString dir; | ||
694 | if(fi.dirPath() != ".") | ||
695 | dir = fi.dirPath() + Option::dir_sep; | ||
696 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | ||
697 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | ||
698 | dir += Option::dir_sep; | ||
699 | clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); | ||
700 | clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); | ||
701 | } | ||
702 | if(!clean.isEmpty()) { | ||
703 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; | ||
704 | clean_targets += " yaccclean"; | ||
705 | } | ||
706 | } | ||
707 | |||
708 | t << "lexclean:" << "\n"; | ||
709 | if(!var("LEXSOURCES").isEmpty()) { | ||
710 | QStringList clean, &l = project->variables()["LEXSOURCES"]; | ||
711 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
712 | QFileInfo fi((*it)); | ||
713 | QString dir; | ||
714 | if(fi.dirPath() != ".") | ||
715 | dir = fi.dirPath() + Option::dir_sep; | ||
716 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | ||
717 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | ||
718 | dir += Option::dir_sep; | ||
719 | clean << dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); | ||
720 | } | ||
721 | if(!clean.isEmpty()) { | ||
722 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; | ||
723 | clean_targets += " lexclean"; | ||
724 | } | ||
725 | } | ||
726 | |||
680 | if(do_incremental) { | 727 | if(do_incremental) { |
681 | t << "incrclean:" << "\n"; | 728 | t << "incrclean:" << "\n"; |
@@ -711,6 +758,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
711 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) | 758 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) |
712 | destdir += Option::dir_sep; | 759 | destdir += Option::dir_sep; |
713 | t << "distclean: " << "clean\n\t" | 760 | t << "distclean: " << "clean\n"; |
714 | << "-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n"; | 761 | if(project->first("TEMPLATE") == "app" && |
762 | project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) | ||
763 | t << "\t-$(DEL_FILE) -r " << destdir.section(Option::dir_sep, 0, -4) << "\n"; | ||
764 | else | ||
765 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n"; | ||
715 | if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() && | 766 | if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() && |
716 | !project->isActiveConfig("plugin")) | 767 | !project->isActiveConfig("plugin")) |
@@ -845,5 +896,5 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) | |||
845 | 896 | ||
846 | if(project->isEmpty("SUBDIRS")) { | 897 | if(project->isEmpty("SUBDIRS")) { |
847 | t << "all qmake_all distclean install uiclean mocclean clean: FORCE" << endl; | 898 | t << "all qmake_all distclean install uiclean mocclean lexclean yaccclean clean: FORCE" << endl; |
848 | } else { | 899 | } else { |
849 | t << "all: $(SUBTARGETS)" << endl; | 900 | t << "all: $(SUBTARGETS)" << endl; |
@@ -863,5 +914,5 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) | |||
863 | } | 914 | } |
864 | t << endl; | 915 | t << endl; |
865 | t << "clean uninstall install uiclean mocclean: qmake_all FORCE"; | 916 | t << "clean uninstall install uiclean mocclean lexclean yaccclean: qmake_all FORCE"; |
866 | for( it.toFirst(); it.current(); ++it) { | 917 | for( it.toFirst(); it.current(); ++it) { |
867 | t << "\n\t ( "; | 918 | t << "\n\t ( "; |
@@ -907,4 +958,6 @@ void UnixMakefileGenerator::init2() | |||
907 | #endif | 958 | #endif |
908 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); | 959 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); |
960 | if ( !project->variables()["QMAKE_CYGWIN_EXE"].isEmpty() ) | ||
961 | project->variables()["TARGET_EXT"].append(".exe"); | ||
909 | } else if ( project->isActiveConfig("staticlib") ) { | 962 | } else if ( project->isActiveConfig("staticlib") ) { |
910 | project->variables()["TARGET"].first().prepend("lib"); | 963 | project->variables()["TARGET"].first().prepend("lib"); |
@@ -918,5 +971,4 @@ void UnixMakefileGenerator::init2() | |||
918 | else | 971 | else |
919 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); | 972 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); |
920 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); | ||
921 | if( project->isActiveConfig("plugin") ) { | 973 | if( project->isActiveConfig("plugin") ) { |
922 | project->variables()["TARGET_x.y.z"].append("lib" + | 974 | project->variables()["TARGET_x.y.z"].append("lib" + |
@@ -934,5 +986,5 @@ void UnixMakefileGenerator::init2() | |||
934 | if(project->isActiveConfig("qt")) | 986 | if(project->isActiveConfig("qt")) |
935 | project->variables()["DEFINES"].append("QT_PLUGIN"); | 987 | project->variables()["DEFINES"].append("QT_PLUGIN"); |
936 | } else if ( os == "hpux" ) { | 988 | } else if ( !project->isEmpty("QMAKE_HPUX_SHLIB") ) { |
937 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); | 989 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); |
938 | if(project->isActiveConfig("lib_version_first")) | 990 | if(project->isActiveConfig("lib_version_first")) |
@@ -943,5 +995,5 @@ void UnixMakefileGenerator::init2() | |||
943 | project->first("VER_MAJ")); | 995 | project->first("VER_MAJ")); |
944 | project->variables()["TARGET"] = project->variables()["TARGET_x"]; | 996 | project->variables()["TARGET"] = project->variables()["TARGET_x"]; |
945 | } else if ( os == "aix" ) { | 997 | } else if ( !project->isEmpty("QMAKE_AIX_SHLIB") ) { |
946 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); | 998 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); |
947 | if(project->isActiveConfig("lib_version_first")) { | 999 | if(project->isActiveConfig("lib_version_first")) { |
@@ -1012,6 +1064,13 @@ void UnixMakefileGenerator::init2() | |||
1012 | if ( !project->variables()["DESTDIR"].isEmpty() ) | 1064 | if ( !project->variables()["DESTDIR"].isEmpty() ) |
1013 | project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR")); | 1065 | project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR")); |
1014 | if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty() && !project->variables()["TARGET_x"].isEmpty() ) | 1066 | if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) { |
1067 | if(project->isActiveConfig("plugin")) { | ||
1068 | if(!project->variables()["TARGET"].isEmpty() ) | ||
1069 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); | ||
1070 | } else { | ||
1071 | if(!project->variables()["TARGET_x"].isEmpty() ) | ||
1015 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x"); | 1072 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x"); |
1073 | } | ||
1074 | } | ||
1016 | if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() ) | 1075 | if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() ) |
1017 | project->variables()["QMAKE_LINK_SHLIB_CMD"].append( | 1076 | project->variables()["QMAKE_LINK_SHLIB_CMD"].append( |