summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--job.c15
-rw-r--r--read.c33
-rw-r--r--rule.c14
4 files changed, 56 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index bf59080..35f7e9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+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
diff --git a/job.c b/job.c
index fcdd2f1..7a77481 100644
--- a/job.c
+++ b/job.c
@@ -1274,11 +1274,16 @@ new_job (file)
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.
diff --git a/read.c b/read.c
index a677399..242f953 100644
--- a/read.c
+++ b/read.c
@@ -718,8 +718,7 @@ read_makefile (filename, flags)
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
{
@@ -767,12 +766,10 @@ read_makefile (filename, flags)
{
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:
@@ -835,11 +832,7 @@ read_makefile (filename, flags)
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++) = ' ';
@@ -851,6 +844,20 @@ read_makefile (filename, flags)
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';
diff --git a/rule.c b/rule.c
index eb4602f..b2b14a1 100644
--- a/rule.c
+++ b/rule.c
@@ -1,5 +1,5 @@
/* 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
@@ -14,7 +14,8 @@ GNU General Public License for more details.
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"
@@ -664,8 +665,13 @@ print_rule_data_base ()
}
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");