diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index e1fb42e0a44..edc9a0ed7fb 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -679,7 +679,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) } else { exists = QFile::exists(lfn.real()); } - if(!lfn.isNull()) { + if (!lfn.isNull() && !isSystemInclude(lfn.real())) { dep = files->lookupFile(lfn); if(!dep) { dep = new SourceFile; diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 8e18f69c03c..eb68614fe6c 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1229,8 +1229,10 @@ void UnixMakefileGenerator::init2() } if (include_deps && project->isActiveConfig("gcc_MD_depends")) { - project->values("QMAKE_CFLAGS") += "-MD"; - project->values("QMAKE_CXXFLAGS") += "-MD"; + // use -MMD if we know about -isystem too + ProString MD_flag(project->values("QMAKE_CFLAGS_ISYSTEM").isEmpty() ? "-MD" : "-MMD"); + project->values("QMAKE_CFLAGS") += MD_flag; + project->values("QMAKE_CXXFLAGS") += MD_flag; } if(!project->isEmpty("QMAKE_BUNDLE")) {