]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* main.c (main): [SV 40234] Show correct error message.
authorPaul Smith <psmith@gnu.org>
Thu, 22 Dec 2016 21:35:47 +0000 (16:35 -0500)
committerPaul Smith <psmith@gnu.org>
Mon, 26 Dec 2016 14:01:59 +0000 (09:01 -0500)
main.c
tests/scripts/features/include

diff --git a/main.c b/main.c
index b170e8e1c75de2c605f672d91a9892b36d0f7f25..80c17dae6cd010e5f4b9639044d883e27d94935f 100644 (file)
--- 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.  */
index f78563f9ca5eda5f49a13262bf97853a91f88c6c..4b8bd7ed4ccc02593130db6d26bd04449cddb685 100644 (file)
@@ -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!