From 4d7f0ce8d096370f464493d9d0ceff1eace93f14 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Sun, 7 Apr 2013 16:35:17 +0100 Subject: Android: Backslash workarounds for Unix Makefile generator If mingw32-make.exe encounters a backslash as the last character on a line it interprets this as signifying line continuation. When building Android Qt on Windows via cmd.exe, this happens as backslashes are used on Windows as directory separators. The workarounds are to make sure that a comment appears directly after the definition of DESTDIR and that a space ends such $(MOVE) command lines. Change-Id: I7f93b655e004edaadac41d0d96bca23e1ba3a85c Reviewed-by: Oswald Buddenhagen --- qmake/generators/unix/unixmake2.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 9cb63ce539..2a99b5dd34 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -221,7 +221,11 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) do_incremental = false; t << "DIST = " << valList(fileFixify(project->values("DISTFILES").toQStringList())) << endl; t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; - t << "DESTDIR = " << var("DESTDIR") << endl; + // The comment is important for mingw32-make.exe on Windows as otherwise trailing slashes + // would be interpreted as line continuation. The lack of spacing between the value and the + // comment is also important as otherwise quoted use of "$(DESTDIR)" would include this + // spacing. + t << "DESTDIR = " << var("DESTDIR") << "#avoid trailing-slash linebreak" << endl; if(project->isActiveConfig("compile_libtool")) t << "TARGETL = " << var("TARGET_la") << endl; t << "TARGET = " << escapeFilePath(var("TARGET")) << endl; @@ -546,7 +550,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << var("QMAKE_LINK_SHLIB_CMD"); if(!destdir.isEmpty()) t << "\n\t" - << "-$(MOVE) $(TARGET) " << destdir; + << "-$(MOVE) $(TARGET) " << destdir << " "; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; @@ -579,10 +583,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET1)\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET2)\n\t" - << "-$(MOVE) $(TARGET) " << destdir << "\n\t" - << "-$(MOVE) $(TARGET0) " << destdir << "\n\t" - << "-$(MOVE) $(TARGET1) " << destdir << "\n\t" - << "-$(MOVE) $(TARGET2) " << destdir << "\n\t"; + << "-$(MOVE) $(TARGET) " << destdir << " \n\t" + << "-$(MOVE) $(TARGET0) " << destdir << " \n\t" + << "-$(MOVE) $(TARGET1) " << destdir << " \n\t" + << "-$(MOVE) $(TARGET2) " << destdir << " \n\t"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; @@ -595,8 +599,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET)\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t" - << "-$(MOVE) $(TARGET) " << destdir << "\n\t" - << "-$(MOVE) $(TARGET0) " << destdir << "\n\t"; + << "-$(MOVE) $(TARGET) " << destdir << " \n\t" + << "-$(MOVE) $(TARGET0) " << destdir << " \n\t"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; @@ -635,7 +639,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; if(!destdir.isEmpty()) t << "\t" << "-$(DEL_FILE) " << destdir << "$(TARGET)" << "\n" - << "\t" << "-$(MOVE) $(TARGET) " << destdir << "\n"; + << "\t" << "-$(MOVE) $(TARGET) " << destdir << " \n"; } else { int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); ProStringList objs = project->values("OBJECTS") + project->values("OBJCOMP"), @@ -666,7 +670,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t" << "$(RANLIB) " << (*libit) << "\n"; if(!destdir.isEmpty()) t << "\t" << "-$(DEL_FILE) " << destdir << (*libit) << "\n" - << "\t" << "-$(MOVE) " << (*libit) << " " << destdir << "\n"; + << "\t" << "-$(MOVE) " << (*libit) << " " << destdir << " \n"; } } t << endl << endl; -- cgit v1.2.3