diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | read.c | 15 |
2 files changed, 14 insertions, 6 deletions
@@ -1,3 +1,8 @@ +2011-04-29 Boris Kolpackov <boris@codesynthesis.com> + + * read.c (eval_makefile): Delay caching of the file name until after + all the expansions and searches. + 2011-04-17 David A. Wheeler <dwheeler@dwheeler.com> * doc/make.texi (Reading Makefiles): Document "!=". @@ -324,8 +324,7 @@ eval_makefile (const char *filename, int flags) char *expanded = 0; int makefile_errno; - filename = strcache_add (filename); - ebuf.floc.filenm = filename; + ebuf.floc.filenm = filename; /* Use the original file name. */ ebuf.floc.lineno = 1; if (ISDB (DB_VERBOSE)) @@ -369,13 +368,17 @@ eval_makefile (const char *filename, int flags) "/", filename); ebuf.fp = fopen (included, "r"); if (ebuf.fp) - { - filename = strcache_add (included); - break; - } + { + filename = included; + break; + } } } + /* Now we have the final name for this makefile. Enter it into + the cache. */ + filename = strcache_add (filename); + /* Add FILENAME to the chain of read makefiles. */ deps = alloc_dep (); deps->next = read_makefiles; |