Warn about invalid SUBDIRS content

Invalid SUBDIRS values like

SUBDIRS += foo \
           bar \ \
           baz

would produce a Makefile with a sub-- target that will call the make
on the same Makefile again recursively, letting make run forever.

Ignore values like this and print a warning message.

Fixes: QTBUG-76068
Change-Id: I6ca0f8c8238249f1be02d8c311b4c148fd80e707
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Joerg Bornemann 2019-05-28 13:22:39 +02:00
parent 90c683e41c
commit 085d1335d1

View File

@ -2400,8 +2400,15 @@ MakefileGenerator::findSubDirsSubTargets() const
st->profile = file;
}
} else {
if(!file.isEmpty() && !project->isActiveConfig("subdir_first_pro"))
st->profile = file.section(Option::dir_sep, -1) + Option::pro_ext;
if (!file.isEmpty() && !project->isActiveConfig("subdir_first_pro")) {
const QString baseName = file.section(Option::dir_sep, -1);
if (baseName.isEmpty()) {
warn_msg(WarnLogic, "Ignoring invalid SUBDIRS entry %s",
subdirs[subdir].toLatin1().constData());
continue;
}
st->profile = baseName + Option::pro_ext;
}
st->in_directory = file;
}
while(st->in_directory.endsWith(Option::dir_sep))