summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2017-06-08 11:33:23 +0300
committerOrgad Shaneh <orgads@gmail.com>2017-06-12 10:47:27 +0000
commitf5f772849ca1ada44f3de537633eec2664b14fd4 (patch)
tree4c6afa8e4512ebc5591a4a78382f0279d398f5e4 /qmake/generators
parent9ac4a9ef260508337a236a5cb2a6b4295e1e0abd (diff)
qmake: Delete static library before calling ar on MinGW
This was already done on unix, but not for MinGW. If the archive already exists, it is appended rather than replaced. This can cause invalid references when whole-archive linking is used and some object file that was already linked was deleted. Change-Id: Ie265371f197d996d57002b248043736544ee641e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'qmake/generators')
-rw-r--r--qmake/generators/win32/mingw_make.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index 8d5a9a7d0f..b9895fb10d 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -36,6 +36,12 @@
#include <stdlib.h>
#include <time.h>
+#ifdef Q_OS_WIN
+#define NULL_DEVICE "NUL"
+#else
+#define NULL_DEVICE "/dev/null"
+#endif
+
QT_BEGIN_NAMESPACE
MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator()
@@ -318,6 +324,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
if(!project->isEmpty("QMAKE_PRE_LINK"))
t << "\n\t" <<var("QMAKE_PRE_LINK");
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
+ t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" NULL_DEVICE;
if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) {
t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ;
} else {