From: Paul Smith Date: Thu, 22 Dec 2016 21:35:47 +0000 (-0500) Subject: * main.c (main): [SV 40234] Show correct error message. X-Git-Tag: 4.2.90~107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0029ea89412225493fa01c75d193a6336a1717f5;p=thirdparty%2Fmake.git * main.c (main): [SV 40234] Show correct error message. --- diff --git a/main.c b/main.c index b170e8e1..80c17dae 100644 --- a/main.c +++ b/main.c @@ -2172,6 +2172,7 @@ main (int argc, char **argv, char **envp) while (d != 0) { struct file *f; + for (f = d->file->double_colon; f != NULL; f = f->prev) if (f->deps == 0 && f->cmds != 0) break; @@ -2296,8 +2297,6 @@ main (int argc, char **argv, char **envp) } } } - /* Reset this to empty so we get the right error message below. */ - read_files = 0; if (any_remade) goto re_exec; @@ -2534,10 +2533,11 @@ main (int argc, char **argv, char **envp) if (!goals) { - if (read_files == 0) - O (fatal, NILF, _("No targets specified and no makefile found")); + struct variable *v = lookup_variable (STRING_SIZE_TUPLE ("MAKEFILE_LIST")); + if (v && v->value && v->value[0] != '\0') + O (fatal, NILF, _("No targets")); - O (fatal, NILF, _("No targets")); + O (fatal, NILF, _("No targets specified and no makefile found")); } /* Update the goals. */ diff --git a/tests/scripts/features/include b/tests/scripts/features/include index f78563f9..4b8bd7ed 100644 --- a/tests/scripts/features/include +++ b/tests/scripts/features/include @@ -192,6 +192,14 @@ include inc2 rmfiles('inc1'); +# No target gets correct error +run_make_test('', '', '#MAKE#: *** No targets. Stop.', 512); + +# No target in included file either, still gets correct error. +touch('inc1.mk'); +run_make_test('include inc1.mk', '', '#MAKE#: *** No targets. Stop.', 512); +rmfiles('inc1.mk'); + # Include same file multiple times run_make_test(q!