dale@vicorp.UUCP (Dale Nielsen) (10/04/89)
There is a problem with make-3.56 when it is invoked with the -f option to specify the filename of the makefile which includes other makefiles for which rules exist. It saves the name of the makefile on a list called read_makefiles. Unfortunately, with the current version this name goes to the end of the list (which can potentially contain included makefiles not mentioned with the -f option). The list of makefiles included with the -f option (called makefiles) is is then added to using the first makefile on this list (when the correct makefile is actually the last one). I changed the routine read_makefile in read.c to add these makefiles to the end of read_makefiles rather than the beginning, so that when the makefile name is saved in makefiles from the beginning of the read_makefiles list, it is correct. Here are the context diffs of the changes I made. I didn't see anything else that depended on the order of links in the read_makefiles list, but if anyone knows of something that does, please let me know. *** read.c Tue Oct 3 13:37:51 1989 --- read.c.orig Mon Sep 18 20:18:56 1989 *************** *** 248,263 **** /* Add FILENAME to the chain of read makefiles. */ deps = (struct dep *) xmalloc (sizeof (struct dep)); ! if (read_makefiles == 0) ! read_makefiles = deps; ! else ! { ! register struct dep *p = read_makefiles; ! while (p->next) ! p = p->next; ! p->next = deps; ! } ! deps->next = 0; deps->name = 0; deps->file = lookup_file (filename); if (deps->file == 0) --- 248,255 ---- /* 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) -- --Dale Nielsen ARPA: dale@vicorp.UU.NET V. I. Corporation UUCP: uunet!vicorp!dale Amherst Research Park PHONE: (413) 253-3482 Amherst, Massachusetts 01002 FAX: (413) 256-0574