Formerly read.c.~65~

This commit is contained in:
Roland McGrath 1993-07-14 23:04:39 +00:00
parent 0a0130dcf2
commit 250e638f44

32
read.c
View File

@ -193,10 +193,9 @@ read_all_makefiles (makefiles)
d->name = 0; d->name = 0;
d->file = enter_file (*p); d->file = enter_file (*p);
d->file->dontcare = 1; d->file->dontcare = 1;
/* Setting the `changed' member to 1 will make failure to /* Tell update_goal_chain to bail out as soon as this file is
update or find this makefile as if it had come from the made, and main not to die if we can't make this file. */
MAKEFILES variable: we don't care, so we won't die. */ d->changed = RM_DONTCARE;
d->changed = 1;
if (tail == 0) if (tail == 0)
read_makefiles = d; read_makefiles = d;
else else
@ -213,18 +212,14 @@ read_all_makefiles (makefiles)
/* Read file FILENAME as a makefile and add its contents to the data base. /* Read file FILENAME as a makefile and add its contents to the data base.
TYPE indicates what flavor of makefile this is: 0 => a default or -f FLAGS contains bits as above.
makefile (the basis for comparison); 1 => from the MAKEFILES variable:
cannot determine the default goal, is searched for in the search path,
and it's not an error if it doesn't exist; 2 => an included makefile:
is searched for in the search path.
FILENAME is added to the `read_makefiles' chain. */ FILENAME is added to the `read_makefiles' chain. */
static void static void
read_makefile (filename, type) read_makefile (filename, flags)
char *filename; char *filename;
int type; int flags;
{ {
static char *collapsed = 0; static char *collapsed = 0;
static unsigned int collapsed_length = 0; static unsigned int collapsed_length = 0;
@ -254,7 +249,8 @@ read_makefile (filename, type)
if (filenames != 0) \ if (filenames != 0) \
record_files (filenames, pattern, pattern_percent, deps, \ record_files (filenames, pattern, pattern_percent, deps, \
commands_started, commands, commands_idx, \ commands_started, commands, commands_idx, \
two_colon, filename, lineno, type != 1); \ two_colon, filename, lineno, \
!(flags & RM_NO_DEFAULT_GOAL)); \
filenames = 0; \ filenames = 0; \
commands_idx = 0; \ commands_idx = 0; \
pattern = 0; \ pattern = 0; \
@ -268,7 +264,7 @@ read_makefile (filename, type)
/* Expand ~ in FILENAME unless it came from `include', /* Expand ~ in FILENAME unless it came from `include',
in which case it was already done. */ in which case it was already done. */
if (type != 2 && filename[0] == '~') if (!(flags & RM_NO_TILDE) && filename[0] == '~')
{ {
char *expanded = tilde_expand (filename); char *expanded = tilde_expand (filename);
/* This is a possible memory leak, but I don't care. */ /* This is a possible memory leak, but I don't care. */
@ -281,10 +277,10 @@ read_makefile (filename, type)
makefile_errno = errno; makefile_errno = errno;
/* If the makefile wasn't found and it's either a makefile from /* If the makefile wasn't found and it's either a makefile from
the `MAKEFILES' variable (type 1) or an included makefile (type 2), the `MAKEFILES' variable or an included makefile,
search the included makefile search path for this makefile. */ search the included makefile search path for this makefile. */
if (infile == 0 && (type == 1 || type == 2) && *filename != '/') if (infile == 0 && (flags & RM_INCLUDED) && *filename != '/')
{ {
register unsigned int i; register unsigned int i;
for (i = 0; include_directories[i] != 0; ++i) for (i = 0; include_directories[i] != 0; ++i)
@ -310,12 +306,12 @@ read_makefile (filename, type)
if (deps->file == 0) if (deps->file == 0)
{ {
deps->file = enter_file (savestring (filename, strlen (filename))); deps->file = enter_file (savestring (filename, strlen (filename)));
if (type == 1) if (flags & RM_DONTCARE)
deps->file->dontcare = 1; deps->file->dontcare = 1;
} }
filename = deps->file->name; filename = deps->file->name;
deps->file->precious = 1; deps->file->precious = 1;
deps->changed = type; deps->changed = flags;
deps = 0; deps = 0;
/* If the makefile can't be found at all, /* If the makefile can't be found at all,
@ -323,7 +319,7 @@ read_makefile (filename, type)
if (infile == 0) if (infile == 0)
{ {
if (type != 1) if (! (flags & RM_DONTCARE))
{ {
/* If we did some searching, errno has the error /* If we did some searching, errno has the error
from the last attempt, rather from FILENAME itself. */ from the last attempt, rather from FILENAME itself. */