🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by David Reed Smith Fri, 08 Jan 1993 08:52
GNU Make 3.62 and including makefiles
#1286
Author: David Reed Smith
Date: Fri, 08 Jan 1993 08:52
108 lines
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads