Formerly read.c.~26~

This commit is contained in:
Roland McGrath 1992-02-14 11:30:14 +00:00
parent 24e5b78f36
commit 5adf3025db

32
read.c
View file

@ -220,7 +220,7 @@ read_makefile (filename, type)
unsigned int commands_started; unsigned int commands_started;
register char *p; register char *p;
char *p2; char *p2;
int ignoring = 0; int ignoring = 0, in_ignored_define = 0;
struct nameseq *filenames = 0; struct nameseq *filenames = 0;
struct dep *deps; struct dep *deps;
@ -331,7 +331,8 @@ read_makefile (filename, type)
#define word1eq(s, l) ((p[l] == '\0' || isblank (p[l])) && \ #define word1eq(s, l) ((p[l] == '\0' || isblank (p[l])) && \
!strncmp (s, 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 ("ifeq", 4) || word1eq ("ifneq", 5)
|| word1eq ("else", 4) || word1eq ("endif", 5)) || word1eq ("else", 4) || word1eq ("endif", 5))
{ {
@ -346,7 +347,25 @@ read_makefile (filename, type)
"invalid syntax in conditional"); "invalid syntax in conditional");
} }
else if (word1eq ("endef", 5)) 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) if (ignoring)
continue; continue;
else if (lb.buffer[0] == '\t') else if (lb.buffer[0] == '\t')
@ -372,13 +391,6 @@ read_makefile (filename, type)
commands_idx += len; commands_idx += len;
commands[commands_idx++] = '\n'; 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)) else if (word1eq ("override", 8))
{ {
p2 = next_token (p + 8); p2 = next_token (p + 8);