summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1992-02-14 11:30:14 +0000
committerRoland McGrath <roland@redhat.com>1992-02-14 11:30:14 +0000
commit5adf3025db665058b1987b602e99b1dd9721b643 (patch)
tree83aac93eada0a9b43ec2778ccb133084ebccebd3
parent24e5b78f36632f94f7f79d2445f697f6677e4f78 (diff)
downloadgunmake-5adf3025db665058b1987b602e99b1dd9721b643.tar.gz
Formerly read.c.~26~
-rw-r--r--read.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/read.c b/read.c
index ab761bf..902bee6 100644
--- a/read.c
+++ b/read.c
@@ -220,7 +220,7 @@ read_makefile (filename, type)
unsigned int commands_started;
register char *p;
char *p2;
- int ignoring = 0;
+ int ignoring = 0, in_ignored_define = 0;
struct nameseq *filenames = 0;
struct dep *deps;
@@ -331,7 +331,8 @@ read_makefile (filename, type)
#define word1eq(s, l) ((p[l] == '\0' || isblank (p[l])) && \
!strncmp (s, p, l))
- if (word1eq ("ifdef", 5) || word1eq ("ifndef", 6)
+ if (!in_ignored_define
+ && word1eq ("ifdef", 5) || word1eq ("ifndef", 6)
|| word1eq ("ifeq", 4) || word1eq ("ifneq", 5)
|| word1eq ("else", 4) || word1eq ("endif", 5))
{
@@ -346,7 +347,25 @@ read_makefile (filename, type)
"invalid syntax in conditional");
}
else if (word1eq ("endef", 5))
- makefile_fatal (filename, lineno, "extraneous `endef'");
+ {
+ if (in_ignored_define)
+ in_ignored_define = 0;
+ else
+ makefile_fatal (filename, lineno, "extraneous `endef'");
+ }
+ else if (word1eq ("define", 6))
+ {
+ if (ignoring)
+ in_ignored_define = 1;
+ else
+ {
+ p2 = next_token (p + 6);
+ p = end_of_token (p2);
+ lineno = do_define (p2, p - p2, o_file,
+ lineno, infile, filename);
+ continue;
+ }
+ }
if (ignoring)
continue;
else if (lb.buffer[0] == '\t')
@@ -372,13 +391,6 @@ read_makefile (filename, type)
commands_idx += len;
commands[commands_idx++] = '\n';
}
- else if (word1eq ("define", 6))
- {
- p2 = next_token (p + 6);
- p = end_of_token (p2);
- lineno = do_define (p2, p - p2, o_file, lineno, infile, filename);
- continue;
- }
else if (word1eq ("override", 8))
{
p2 = next_token (p + 8);