If the ".ONESHELL" is mentioned as target, then all recipes will be run in a single shell. I accidentally used ".ONESHELL: some-target", assuming it would only apply to that target. There was some discussions about supporting that, but until then I think it's a good idea to warn the user. Treating these spurious dependencies as errors would also work, but I'm not sure if that's okay.
* src/read.c (record_files): Print warning if .ONESHELL has spurious dependency --- src/read.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/read.c b/src/read.c index 9dbe30e..06d0ee6 100644 --- a/src/read.c +++ b/src/read.c @@ -2245,6 +2245,10 @@ record_files (struct nameseq *filenames, int are_also_makes, name = f->name; + if (!strcmp(name, ".ONESHELL") && f->deps) + O (error, flocp, + _("*** warning: .ONESHELL does not take dependencies")); + /* All done! Set up for the next one. */ if (nextf == 0) break; -- 2.30.2