From 45aa064bf8d261aca3d55ab54c4a9adccb08c2cd Mon Sep 17 00:00:00 2001 From: ru Date: Mon, 17 Oct 2005 15:56:26 +0000 Subject: Make sure that files included using ".include " are really looked for in the system make file directory or in the specified -m paths instead of always looking in the other -I and .PATH specified paths. (Commit log shamelessly stolen from NetBSD.) Reviewed by: yar --- usr.bin/make/parse.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index dda7afd..ae9db06 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -2130,7 +2130,7 @@ xparse_include(char *file, int sinclude) * Include files contained in double-quotes are first searched * for relative to the including file's location. We don't want * to cd there, of course, so we just tack on the old file's - * leading path components and call Dir_FindFile to see if + * leading path components and call Path_FindFile to see if * we can locate the beast. */ @@ -2155,28 +2155,27 @@ xparse_include(char *file, int sinclude) fullname = NULL; } free(Fname); - } else { - fullname = NULL; - } - - if (fullname == NULL) { - /* - * System makefile or makefile wasn't found in same directory as - * included makefile. Search for it first on the -I search path, - * then on the .PATH search path, if not found in a -I - * directory. - * XXX: Suffix specific? - */ - fullname = Path_FindFile(file, &parseIncPath); if (fullname == NULL) { - fullname = Path_FindFile(file, &dirSearchPath); + /* + * Makefile wasn't found in same directory as included + * makefile. Search for it first on the -I search path, + * then on the .PATH search path, if not found in a -I + * directory. + * XXX: Suffix specific? + */ + fullname = Path_FindFile(file, &parseIncPath); + if (fullname == NULL) { + fullname = Path_FindFile(file, &dirSearchPath); + } } + } else { + fullname = NULL; } if (fullname == NULL) { /* - * Still haven't found the makefile. Look for it on the system - * path as a last resort. + * System makefile or still haven't found the makefile. + * Look for it on the system path. */ fullname = Path_FindFile(file, &sysIncPath); } -- cgit v1.1