Don't choke on invalid pattern rules if we fail during makefile parsing.
Don't dump core if a non-empty command becomes empty after expansion.
+1998-10-13 Paul D. Smith <psmith@gnu.org>
+
+ * job.c (new_job): If the command list resolves to empty (through
+ variable expansion, for example), stop early rather than running
+ start_waiting_job().
+
+1998-10-12 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * rule.c (print_rule_data_base): Ignore num_pattern_rules if it is
+ zero.
+
+1998-10-09 Paul D. Smith <psmith@gnu.org>
+
+ * read.c (read_makefile): Allow non-empty lines to expand to the
+ empty string after variable, etc., expansion, and be ignored.
+
1998-09-21 Paul D. Smith <psmith@gnu.org>
* job.c (construct_command_argv_internal): Only add COMMAND.COM
c->sh_batch_file = NULL;
/* Fetch the first command line to be run. */
- job_next_command (c);
-
- /* The job is now primed. Start it running.
- (This will notice if there are in fact no commands.) */
- (void)start_waiting_job (c);
+ if (job_next_command (c))
+ /* The job is now primed. Start it running. */
+ (void)start_waiting_job (c);
+ else
+ {
+ /* There were no commands (variable expands to empty?). All done. */
+ c->file->update_status = 0;
+ notice_finished_file(c->file);
+ free_child (c);
+ }
if (job_slots == 1)
/* Since there is only one job slot, make things run linearly.
because there was no preceding target, and the line
might have been usable as a variable definition.
But now it is definitely lossage. */
- fatal (&fileinfo,
- "commands commence before first target");
+ fatal(&fileinfo, "commands commence before first target");
}
else
{
{
case w_eol:
if (cmdleft != 0)
- fatal (&fileinfo,
- "missing rule before commands");
- else
- /* This line contained a variable reference that
- expanded to nothing but whitespace. */
- continue;
+ fatal(&fileinfo, "missing rule before commands");
+ /* This line contained something but turned out to be nothing
+ but whitespace (a comment?). */
+ continue;
case w_colon:
case w_dcolon:
wtype = get_next_mword(lb_next, NULL, &lb_next, &len);
if (wtype == w_eol)
- /* There's no need to be ivory-tower about this: check for
- one of the most common bugs found in makefiles... */
- fatal (&fileinfo, "missing separator%s",
- strncmp(lb.buffer, " ", 8) ? ""
- : " (did you mean TAB instead of 8 spaces?)");
+ break;
p2 += strlen(p2);
*(p2++) = ' ';
p2 = next_token (variable_buffer);
+ /* If the word we're looking at is EOL, see if there's _anything_
+ on the line. If not, a variable expanded to nothing, so ignore
+ it. If so, we can't parse this line so punt. */
+ if (wtype == w_eol)
+ {
+ if (*p2 != '\0')
+ /* There's no need to be ivory-tower about this: check for
+ one of the most common bugs found in makefiles... */
+ fatal (&fileinfo, "missing separator%s",
+ strncmp(lb.buffer, " ", 8) ? ""
+ : " (did you mean TAB instead of 8 spaces?)");
+ continue;
+ }
+
/* Make the colon the end-of-string so we know where to stop
looking for targets. */
*colonp = '\0';
/* Pattern and suffix rule internals for GNU Make.
-Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+Copyright (C) 1988,89,90,91,92,93, 1998 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify
You should have received a copy of the GNU General Public License
along with GNU Make; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
#include "make.h"
#include "dep.h"
}
if (num_pattern_rules != rules)
- fatal (NILF, "BUG: num_pattern_rules wrong! %u != %u",
- num_pattern_rules, rules);
+ {
+ /* This can happen if a fatal error was detected while reading the
+ makefiles and thus count_implicit_rule_limits wasn't called yet. */
+ if (num_pattern_rules != 0)
+ fatal ("BUG: num_pattern_rules wrong! %u != %u",
+ num_pattern_rules, rules);
+ }
puts ("\n# Pattern-specific variable values");