summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1993-02-04 00:01:08 +0000
committerRoland McGrath <roland@redhat.com>1993-02-04 00:01:08 +0000
commitdb545dffccd94782154d01a17430d08576198769 (patch)
tree08e73518d971951c28f25ed93a63b575abf68d42
parentf7ee7d26a5f1a183b8a9391f954c11dcdff21453 (diff)
downloadgunmake-db545dffccd94782154d01a17430d08576198769.tar.gz
Formerly read.c.~53~
-rw-r--r--read.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/read.c b/read.c
index 654f77e..0b032d5 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993
+ Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify
@@ -343,6 +344,8 @@ read_makefile (filename, type)
p = collapsed;
while (isspace (*p))
++p;
+ /* We cannot consider a line containing just a tab to be empty
+ because it might constitute an empty command for a target. */
if (*p == '\0' && lb.buffer[0] != '\t')
continue;
@@ -418,33 +421,34 @@ read_makefile (filename, type)
unsigned int len;
if (no_targets)
- {
- /* Ignore the commands in a rule with no targets. */
- no_targets = 0;
- continue;
- }
+ /* Ignore the commands in a rule with no targets. */
+ continue;
- if (filenames == 0)
- makefile_fatal (filename, lineno,
- "commands with no associated target");
-
- /* Add this command line to end of the line being accumulated. */
- p = lb.buffer;
- if (commands_idx == 0)
- commands_started = lineno;
- len = strlen (p);
- if (len + 1 + commands_idx > commands_len)
+ /* If there is no preceding rule line, don't treat this line
+ as a command, even though it begins with a tab character.
+ SunOS 4 make appears to behave this way. */
+
+ if (filenames != 0)
{
- commands_len = (len + 1 + commands_idx) * 2;
- commands = (char *) xrealloc (commands, commands_len);
- }
- bcopy (p, &commands[commands_idx], len);
- commands_idx += len;
- commands[commands_idx++] = '\n';
+ /* Append this command line to the line being accumulated. */
+ p = lb.buffer;
+ if (commands_idx == 0)
+ commands_started = lineno;
+ len = strlen (p);
+ if (len + 1 + commands_idx > commands_len)
+ {
+ commands_len = (len + 1 + commands_idx) * 2;
+ commands = (char *) xrealloc (commands, commands_len);
+ }
+ bcopy (p, &commands[commands_idx], len);
+ commands_idx += len;
+ commands[commands_idx++] = '\n';
- continue;
+ continue;
+ }
}
- else if (word1eq ("export", 6))
+
+ if (word1eq ("export", 6))
{
struct variable *v;
p2 = next_token (p + 6);