Article View: gnu.utils.bug
Article #1286GNU Make 3.62 and including makefiles
From: David Reed Smith
Date: Fri, 08 Jan 1993 08:52
Date: Fri, 08 Jan 1993 08:52
108 lines
3794 bytes
3794 bytes
According to the texinfo file that comes with GNU make, in the section
entitled "Including Other Makefiles":
If an included makefile cannot be found in any of these
directories, a warning message is generated, but it is not a fatal
error; processing of the makefile containing the `include'
continues.
Unfortunately, this is not how the program acts. Given the following
makefile:
include xxxx
all:
@echo hi
If the file 'xxxx' doesn't exist, you do get a warning, but then the
program dies, like this:
gmake: fopen: xxxx: No such file or directory
gmake: *** No way to make target `xxxx'. Stop.
If you make the following change to 'read.c', make acts properly and
produces the correct output:
make: fopen: xxxx: No such file or directory
hi
The change to read.c involves moving the section of code that adds the
current filename to the chain of read makefiles so that this only
happens if the file exists.
There are certainly other solutions to this problem, but this one
seemed the best to me given my understanding (or lack thereof) of the
code.
Does this solution seem appropriate to the current GNU make
developers?
Thanks.
---------------------------------------------------------------------------
*** read.c-dist Tue Jul 21 16:39:22 1992
--- read.c Fri Jan 8 14:25:16 1993
***************
*** 269,291 ****
}
}
- /* Add FILENAME to the chain of read makefiles. */
- deps = (struct dep *) xmalloc (sizeof (struct dep));
- deps->next = read_makefiles;
- read_makefiles = deps;
- deps->name = 0;
- deps->file = lookup_file (filename);
- if (deps->file == 0)
- {
- deps->file = enter_file (savestring (filename, strlen (filename)));
- if (type == 1)
- deps->file->dontcare = 1;
- }
- filename = deps->file->name;
- deps->file->precious = 1;
- deps->changed = type;
- deps = 0;
-
/* If the makefile can't be found at all,
either ignore it or give up entirely. */
--- 269,274 ----
***************
*** 294,299 ****
--- 277,301 ----
if (type != 1)
perror_with_name ("fopen: ", filename);
return;
+ }
+ else
+ {
+ /* Add FILENAME to the chain of read makefiles. */
+ deps = (struct dep *) xmalloc (sizeof (struct dep));
+ deps->next = read_makefiles;
+ read_makefiles = deps;
+ deps->name = 0;
+ deps->file = lookup_file (filename);
+ if (deps->file == 0)
+ {
+ deps->file = enter_file (savestring (filename, strlen (filename)));
+ if (type == 1)
+ deps->file->dontcare = 1;
+ }
+ filename = deps->file->name;
+ deps->file->precious = 1;
+ deps->changed = type;
+ deps = 0;
}
reading_filename = filename;
---------------------------------------------------------------------------
davids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
David Smith davids@davids.b11.ingr.com (Internet)
Intergraph Corporation uunet!ingr!b11!davids!davids (UUCP)
Mailstop CR1104 (205) 730-5752
Huntsville, AL 35894-0001
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID:
<199301082052.AA01488@davids.b11.ingr.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!davids.b11.ingr.com!davidsShow Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!davids.b11.ingr.com!davids From: davids@davids.b11.ingr.com (David Reed Smith) Subject: GNU Make 3.62 and including makefiles Message-ID: <199301082052.AA01488@davids.b11.ingr.com> Sender: gnulists@ai.mit.edu Reply-To: davids@davids.b11.ingr.com Organization: GNUs Not Usenet Distribution: gnu Date: Fri, 8 Jan 1993 08:52:24 GMT Approved: bug-gnu-utils@prep.ai.mit.edu Lines: 109