Module Name: src Committed By: sjg Date: Sun May 19 17:55:55 UTC 2024
Modified Files: src/usr.bin/make: dir.c main.c src/usr.bin/make/unit-tests: deptgt-phony.exp Log Message: Dir_FindFile treat sysIncPath and defSysIncPath as special Rather than play games with adding .DOTLAST and then having to exclude that from .SYSPATH, just have Dir_FindFile check if path is sysIncPath or defSysIncPath and behave as if .DOTLAST seen and also skip the final search of .CURDIR. Fix Dir_SetSYSPATH to use defSysIncPath if sysIncPath is empty. To generate a diff of this commit: cvs rdiff -u -r1.286 -r1.287 src/usr.bin/make/dir.c cvs rdiff -u -r1.615 -r1.616 src/usr.bin/make/main.c cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/deptgt-phony.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.286 src/usr.bin/make/dir.c:1.287 --- src/usr.bin/make/dir.c:1.286 Fri Dec 29 18:53:24 2023 +++ src/usr.bin/make/dir.c Sun May 19 17:55:54 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.286 2023/12/29 18:53:24 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.287 2024/05/19 17:55:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -132,7 +132,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.286 2023/12/29 18:53:24 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.287 2024/05/19 17:55:54 sjg Exp $"); /* * A search path is a list of CachedDir structures. A CachedDir has in it the @@ -566,10 +566,12 @@ void Dir_SetSYSPATH(void) { CachedDirListNode *ln; - + SearchPath *path = Lst_IsEmpty(&sysIncPath->dirs) + ? defSysIncPath : sysIncPath; + Var_ReadOnly(".SYSPATH", false); Global_Delete(".SYSPATH"); - for (ln = sysIncPath->dirs.first; ln != NULL; ln = ln->next) { + for (ln = path->dirs.first; ln != NULL; ln = ln->next) { CachedDir *dir = ln->datum; Global_Append(".SYSPATH", dir->name); } @@ -1163,7 +1165,9 @@ Dir_FindFile(const char *name, SearchPat return NULL; } - if (path->dirs.first != NULL) { + if (path == sysIncPath || path == defSysIncPath) + seenDotLast = true; + else if (path->dirs.first != NULL) { CachedDir *dir = path->dirs.first->datum; if (dir == dotLast) { seenDotLast = true; Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.615 src/usr.bin/make/main.c:1.616 --- src/usr.bin/make/main.c:1.615 Tue May 7 18:26:22 2024 +++ src/usr.bin/make/main.c Sun May 19 17:55:54 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.615 2024/05/07 18:26:22 sjg Exp $ */ +/* $NetBSD: main.c,v 1.616 2024/05/19 17:55:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.615 2024/05/07 18:26:22 sjg Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.616 2024/05/19 17:55:54 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1156,8 +1156,6 @@ InitDefSysIncPath(char *syspath) else syspath = bmake_strdup(syspath); - /* do NOT search .CURDIR first for .include <makefile> */ - SearchPath_Add(defSysIncPath, ".DOTLAST"); for (start = syspath; *start != '\0'; start = p) { for (p = start; *p != '\0' && *p != ':'; p++) continue; Index: src/usr.bin/make/unit-tests/deptgt-phony.exp diff -u src/usr.bin/make/unit-tests/deptgt-phony.exp:1.4 src/usr.bin/make/unit-tests/deptgt-phony.exp:1.5 --- src/usr.bin/make/unit-tests/deptgt-phony.exp:1.4 Tue Apr 30 16:41:32 2024 +++ src/usr.bin/make/unit-tests/deptgt-phony.exp Sun May 19 17:55:54 2024 @@ -2,7 +2,7 @@ Expanding "depsrc-phony-pr-15164-*-wildc Expanding "deptgt-phony-pr-15164-*-wildcard"... Searching for .depend ... failed. -Searching for .depend ...[dot last]... +Searching for .depend ... <defsyspath> ... failed. Wildcard expanding "all"...