diff options
Diffstat (limited to 'qmake/generators/unix/unixmake2.cpp')
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 102 |
1 files changed, 35 insertions, 67 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index ecb0de3b52..976751b02c 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -213,7 +213,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if(!project->isActiveConfig("staticlib")) { t << "LINK = " << var("QMAKE_LINK") << endl; t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; - t << "LIBS = $(SUBLIBS) " << fixLibFlags("QMAKE_LIBS").join(' ') << ' ' + t << "LIBS = $(SUBLIBS) " << fixLibFlags("LIBS").join(' ') << ' ' + << fixLibFlags("LIBS_PRIVATE").join(' ') << ' ' + << fixLibFlags("QMAKE_LIBS").join(' ') << ' ' << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << endl; } @@ -280,11 +282,11 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if (destd.endsWith('\\')) destd += '\\'; t << "DESTDIR = " << destd << endl; - t << "TARGET = " << fileVar("TARGET") << endl; // ### mixed use! + t << "TARGET = " << fileVar("TARGET") << endl; if(project->isActiveConfig("plugin")) { t << "TARGETD = " << fileVar("TARGET") << endl; } else if(!project->isActiveConfig("staticlib") && project->values("QMAKE_APP_FLAG").isEmpty()) { - t << "TARGETA = " << fileVar("TARGETA") << endl; // ### mixed use! + t << "TARGETA = " << fileVar("TARGETA") << endl; if(!project->isEmpty("QMAKE_BUNDLE")) { t << "TARGETD = " << fileVar("TARGET_x.y") << endl; t << "TARGET0 = " << fileVar("TARGET_") << endl; @@ -346,7 +348,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << mkdir_p_asstring("$(@D)", false) << "\n\t" << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@\n\n"; - static const char * const src[] = { "SOURCES", "GENERATED_SOURCES", 0 }; + static const char * const src[] = { "SOURCES", "GENERATED_SOURCES", nullptr }; for (int x = 0; src[x]; x++) { const ProStringList &l = project->values(src[x]); for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { @@ -502,7 +504,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; } else { - t << "$(TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " + t << depVar("TARGET") << ": " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << target_deps << ' ' << depVar("POST_TARGETDEPS") << "\n\t"; if (project->first("TEMPLATE") != "aux") { if (!destdir.isEmpty()) @@ -515,7 +517,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } t << endl << endl; } - allDeps = " $(TARGET)"; + allDeps = ' ' + depVar("TARGET"); } else if(!project->isActiveConfig("staticlib")) { QString destdir_r = project->first("DESTDIR").toQString(), incr_deps; if(!project->isEmpty("QMAKE_BUNDLE")) { @@ -580,14 +582,14 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } //real target - t << destdir_d << "$(TARGET): " << depVar("PRE_TARGETDEPS") << ' ' + t << destdir_d << depVar("TARGET") << ": " << depVar("PRE_TARGETDEPS") << ' ' << incr_deps << " $(SUBLIBS) " << target_deps << ' ' << depVar("POST_TARGETDEPS"); } else { - t << destdir_d << "$(TARGET): " << depVar("PRE_TARGETDEPS") + t << destdir_d << depVar("TARGET") << ": " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) $(SUBLIBS) $(OBJCOMP) " << target_deps << ' ' << depVar("POST_TARGETDEPS"); } - allDeps = ' ' + destdir_d + "$(TARGET)"; + allDeps = ' ' + destdir_d + depVar("TARGET"); if(!destdir.isEmpty()) t << "\n\t" << mkdir_p_asstring(destdir, false); if(!project->isEmpty("QMAKE_PRE_LINK")) @@ -604,7 +606,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; } else if(!project->isEmpty("QMAKE_BUNDLE")) { - bundledFiles << destdir_r + "$(TARGET)"; + bundledFiles << destdir_r + var("TARGET"); t << "\n\t" << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(DESTDIR)$(TARGET0)\n\t" << var("QMAKE_LINK_SHLIB_CMD") << "\n\t" @@ -669,8 +671,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << endl << endl; if (! project->isActiveConfig("plugin")) { - t << "staticlib: $(TARGETA)\n\n"; - t << "$(TARGETA): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) $(OBJCOMP)"; + t << "staticlib: " << depVar("TARGETA") << "\n\n"; + t << depVar("TARGETA") << ": " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) $(OBJCOMP)"; if(do_incremental) t << " $(INCREMENTAL_OBJECTS)"; t << ' ' << depVar("POST_TARGETDEPS") << "\n\t"; @@ -690,56 +692,20 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) QString destdir_r = project->first("DESTDIR").toQString(); QString destdir_d = escapeDependencyPath(destdir_r); QString destdir = escapeFilePath(destdir_r); - allDeps = ' ' + destdir_d + "$(TARGET)" - + varGlue("QMAKE_AR_SUBLIBS", ' ' + destdir_d, ' ' + destdir_d, ""); - t << "staticlib: " << destdir_d << "$(TARGET)\n\n"; - if(project->isEmpty("QMAKE_AR_SUBLIBS")) { - t << destdir_d << "$(TARGET): " << depVar("PRE_TARGETDEPS") - << " $(OBJECTS) $(OBJCOMP) " << depVar("POST_TARGETDEPS") << "\n\t"; - if(!destdir.isEmpty()) - t << mkdir_p_asstring(destdir, false) << "\n\t"; - if (!project->isEmpty("QMAKE_PRE_LINK")) - t << var("QMAKE_PRE_LINK") << "\n\t"; - t << "-$(DEL_FILE) " << destdir << "$(TARGET)\n\t" - << var("QMAKE_AR_CMD") << "\n"; - if(!project->isEmpty("QMAKE_POST_LINK")) - t << "\t" << var("QMAKE_POST_LINK") << "\n"; - if(!project->isEmpty("QMAKE_RANLIB")) - t << "\t$(RANLIB) " << destdir << "$(TARGET)\n"; - } else { - int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); - ProStringList objs = project->values("OBJECTS") + project->values("OBJCOMP"), - libs = project->values("QMAKE_AR_SUBLIBS"); - libs.prepend("$(TARGET)"); - for (ProStringList::Iterator libit = libs.begin(), objit = objs.begin(); - libit != libs.end(); ++libit) { - ProStringList build; - for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) - build << (*objit); - QString ar; - ProString lib = destdir + escapeFilePath(*libit); - if((*libit) == "$(TARGET)") { - t << destdir_d << "$(TARGET): " << depVar("PRE_TARGETDEPS") - << ' ' << depVar("POST_TARGETDEPS") << valList(escapeDependencyPaths(build)) << "\n\t"; - ar = project->first("QMAKE_AR_CMD").toQString(); - ar.replace(QLatin1String("$(OBJECTS)"), escapeFilePaths(build).join(' ')); - } else { - t << destdir_d << escapeDependencyPath(*libit) << ": " - << valList(escapeDependencyPaths(build)) << "\n\t"; - ar = "$(AR) " + lib + ' ' + escapeFilePaths(build).join(' '); - } - if(!destdir.isEmpty()) - t << mkdir_p_asstring(destdir, false) << "\n\t"; - if (!project->isEmpty("QMAKE_PRE_LINK")) - t << var("QMAKE_PRE_LINK") << "\n\t"; - t << "-$(DEL_FILE) " << lib << "\n\t" - << ar << "\n"; - if(!project->isEmpty("QMAKE_POST_LINK")) - t << "\t" << var("QMAKE_POST_LINK") << "\n"; - if(!project->isEmpty("QMAKE_RANLIB")) - t << "\t$(RANLIB) " << lib << "\n"; - } - } + allDeps = ' ' + destdir_d + depVar("TARGET"); + t << "staticlib: " << destdir_d << "$(TARGET)\n\n" + << destdir_d << depVar("TARGET") << ": " << depVar("PRE_TARGETDEPS") + << " $(OBJECTS) $(OBJCOMP) " << depVar("POST_TARGETDEPS") << "\n\t"; + if (!destdir.isEmpty()) + t << mkdir_p_asstring(destdir, false) << "\n\t"; + if (!project->isEmpty("QMAKE_PRE_LINK")) + t << var("QMAKE_PRE_LINK") << "\n\t"; + t << "-$(DEL_FILE) " << destdir << "$(TARGET)\n\t" + << var("QMAKE_AR_CMD") << "\n"; + if (!project->isEmpty("QMAKE_POST_LINK")) + t << "\t" << var("QMAKE_POST_LINK") << "\n"; + if (!project->isEmpty("QMAKE_RANLIB")) + t << "\t$(RANLIB) " << destdir << "$(TARGET)\n"; t << endl << endl; } @@ -1244,7 +1210,8 @@ void UnixMakefileGenerator::init2() if(!project->isEmpty("TARGET")) project->values("TARGET").first().prepend(project->first("DESTDIR")); } else if (project->isActiveConfig("staticlib")) { - project->values("TARGET").first().prepend(project->first("QMAKE_PREFIX_STATICLIB")); + project->values("PRL_TARGET") = + project->values("TARGET").first().prepend(project->first("QMAKE_PREFIX_STATICLIB")); project->values("TARGET").first() += "." + project->first("QMAKE_EXTENSION_STATICLIB"); if(project->values("QMAKE_AR_CMD").isEmpty()) project->values("QMAKE_AR_CMD").append("$(AR) $(DESTDIR)$(TARGET) $(OBJECTS)"); @@ -1278,6 +1245,7 @@ void UnixMakefileGenerator::init2() QString prefix; if(!project->isActiveConfig("no_plugin_name_prefix")) prefix = "lib"; + project->values("PRL_TARGET").prepend(prefix + project->first("TARGET")); project->values("TARGET_x.y.z").append(prefix + project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_PLUGIN")); @@ -1291,6 +1259,7 @@ void UnixMakefileGenerator::init2() "." + project->first("VER_MAJ")); project->values("TARGET") = project->values("TARGET_x.y.z"); } else if (!project->isEmpty("QMAKE_HPUX_SHLIB")) { + project->values("PRL_TARGET").prepend("lib" + project->first("TARGET")); project->values("TARGET_").append("lib" + project->first("TARGET") + ".sl"); if(project->isActiveConfig("lib_version_first")) project->values("TARGET_x").append("lib" + project->first("VER_MAJ") + "." + @@ -1300,6 +1269,7 @@ void UnixMakefileGenerator::init2() project->first("VER_MAJ")); project->values("TARGET") = project->values("TARGET_x"); } else if (!project->isEmpty("QMAKE_AIX_SHLIB")) { + project->values("PRL_TARGET").prepend("lib" + project->first("TARGET")); project->values("TARGET_").append(project->first("QMAKE_PREFIX_STATICLIB") + project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_STATICLIB")); if(project->isActiveConfig("lib_version_first")) { @@ -1331,6 +1301,7 @@ void UnixMakefileGenerator::init2() } project->values("TARGET") = project->values("TARGET_x.y.z"); } else { + project->values("PRL_TARGET").prepend("lib" + project->first("TARGET")); project->values("TARGET_").append("lib" + project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB")); if(project->isActiveConfig("lib_version_first")) { @@ -1510,10 +1481,7 @@ UnixMakefileGenerator::writeLibtoolFile() t << "# Libraries that this one depends upon.\n"; ProStringList libs; - if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) - libs = project->values("QMAKE_INTERNAL_PRL_LIBS"); - else - libs << "QMAKE_LIBS"; //obvious one + libs << "LIBS" << "QMAKE_LIBS"; t << "dependency_libs='"; for (ProStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) t << fixLibFlags((*it).toKey()).join(' ') << ' '; |