diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index b001fd930b..9ab9a9adea 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -448,6 +448,9 @@ MakefileGenerator::init() if (chkglue.isEmpty()) // Backwards compat with Qt4 specs chkglue = isWindowsShell() ? "" : "|| "; + if (v["QMAKE_LINK_O_FLAG"].isEmpty()) + v["QMAKE_LINK_O_FLAG"].append("-o "); + ProStringList &quc = v["QMAKE_EXTRA_COMPILERS"]; //make sure the COMPILERS are in the correct input/output chain order diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 8ad603580c..2dfe16dbfc 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -436,7 +436,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\n\t" << mkdir_p_asstring(destdir) << "\n\t"; if(!project->isEmpty("QMAKE_PRE_LINK")) t << var("QMAKE_PRE_LINK") << "\n\t"; - t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(OBJCOMP) $(LIBS)"; + t << "$(LINK) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(TARGET) " << incr_deps << " " << incr_objs << " $(OBJCOMP) $(LIBS)"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; @@ -451,7 +451,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << mkdir_p_asstring(destdir) << "\n\t"; if (!project->isEmpty("QMAKE_PRE_LINK")) t << var("QMAKE_PRE_LINK") << "\n\t"; - t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)"; + t << "$(LINK) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)"; if (!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); } @@ -503,7 +503,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << incr_target_dir << ": $(INCREMENTAL_OBJECTS)" << "\n\t"; if(!destdir.isEmpty()) t << mkdir_p_asstring(destdir) << "\n\t"; - t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << + t << "$(LINK) " << incr_lflags << " " << var("QMAKE_LINK_O_FLAG") << incr_target_dir << " $(INCREMENTAL_OBJECTS)" << endl; //communicated below ProStringList &cmd = project->values("QMAKE_LINK_SHLIB_CMD"); @@ -1173,7 +1173,7 @@ void UnixMakefileGenerator::init2() } if (project->values("QMAKE_LINK_SHLIB_CMD").isEmpty()) project->values("QMAKE_LINK_SHLIB_CMD").append( - "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)"); + "$(LINK) $(LFLAGS) " + project->first("QMAKE_LINK_O_FLAG") + "$(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)"); } if (!project->values("QMAKE_APP_FLAG").isEmpty()) { project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_APP"); diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 06e25c29f3..2e0a724c02 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -405,7 +405,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) t << "\n\t" << objectsLinkLine << " " ; } } else if (project->first("TEMPLATE") != "aux") { - t << "\n\t" << "$(LINKER) $(LFLAGS) -o $(DESTDIR_TARGET) " << objectsLinkLine << " " << " $(LIBS)"; + t << "\n\t" << "$(LINKER) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) " << objectsLinkLine << " " << " $(LIBS)"; } if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" <values("QMAKE_LFLAGS").append("/VERSION:" + major + "." + minor); } + if (project->isEmpty("QMAKE_LINK_O_FLAG")) + project->values("QMAKE_LINK_O_FLAG").append("/OUT:"); + // Base class init! MakefileGenerator::init(); @@ -377,7 +380,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <isActiveConfig("staticlib")) { - t << "\n\t" << "$(LIBAPP) $(LIBFLAGS) /OUT:$(DESTDIR_TARGET) @<<" << "\n\t " + t << "\n\t" << "$(LIBAPP) $(LIBFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) @<<" << "\n\t " << "$(OBJECTS)" << "\n<<"; } else if (templateName != "aux") { @@ -459,7 +462,7 @@ void NmakeMakefileGenerator::writeLinkCommand(QTextStream &t, const QString &ext t << "$(LINKER) $(LFLAGS)"; if (!extraFlags.isEmpty()) t << ' ' << extraFlags; - t << " /OUT:$(DESTDIR_TARGET) @<<\n" + t << " " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) @<<\n" << "$(OBJECTS) $(LIBS)"; if (!extraInlineFileContent.isEmpty()) t << ' ' << extraInlineFileContent;