From 5adf3025db665058b1987b602e99b1dd9721b643 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 14 Feb 1992 11:30:14 +0000 Subject: [PATCH] Formerly read.c.~26~ --- read.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/read.c b/read.c index ab761bf6..902bee61 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);