Module Name: src Committed By: sjg Date: Tue Apr 30 16:13:34 UTC 2024
Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: deptgt-phony.exp opt-m-include-dir.mk Log Message: make: ensure '.include <makefile>' respects MAKESYSPATH Since Dir_FindFile is used by '.include' and its variants, and will first search .CURDIR unless the give path starts with ".DOTLAST". Update unit-tests/opt-m-include-dir to test this. To generate a diff of this commit: cvs rdiff -u -r1.613 -r1.614 src/usr.bin/make/main.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/deptgt-phony.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt-m-include-dir.mk 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/main.c diff -u src/usr.bin/make/main.c:1.613 src/usr.bin/make/main.c:1.614 --- src/usr.bin/make/main.c:1.613 Sat Apr 27 17:33:46 2024 +++ src/usr.bin/make/main.c Tue Apr 30 16:13:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.613 2024/04/27 17:33:46 rillig Exp $ */ +/* $NetBSD: main.c,v 1.614 2024/04/30 16:13:33 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.613 2024/04/27 17:33:46 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.614 2024/04/30 16:13:33 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1156,6 +1156,8 @@ 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.2 src/usr.bin/make/unit-tests/deptgt-phony.exp:1.3 --- src/usr.bin/make/unit-tests/deptgt-phony.exp:1.2 Fri Feb 11 23:44:18 2022 +++ src/usr.bin/make/unit-tests/deptgt-phony.exp Tue Apr 30 16:13:34 2024 @@ -2,7 +2,7 @@ Expanding "depsrc-phony-pr-15164-*-wildc Expanding "deptgt-phony-pr-15164-*-wildcard"... Searching for .depend ... failed. -Searching for .depend ... +Searching for .depend ...[dot last]... /usr/share/mk ... failed. Wildcard expanding "all"... Index: src/usr.bin/make/unit-tests/opt-m-include-dir.mk diff -u src/usr.bin/make/unit-tests/opt-m-include-dir.mk:1.4 src/usr.bin/make/unit-tests/opt-m-include-dir.mk:1.5 --- src/usr.bin/make/unit-tests/opt-m-include-dir.mk:1.4 Tue Sep 1 20:14:34 2020 +++ src/usr.bin/make/unit-tests/opt-m-include-dir.mk Tue Apr 30 16:13:34 2024 @@ -1,4 +1,4 @@ -# $NetBSD: opt-m-include-dir.mk,v 1.4 2020/09/01 20:14:34 rillig Exp $ +# $NetBSD: opt-m-include-dir.mk,v 1.5 2024/04/30 16:13:34 sjg Exp $ # # Tests for the -m command line option, which adds a directory to the # search path for the .include <...> directive. @@ -22,11 +22,14 @@ TEST_DIR:= ${.PARSEFILE:R}.tmp/sub/sub/sub/workdir CANARY_FILE:= ${.PARSEFILE:R}.tmp/sub/opt-m-canary.mk ACTUAL_FILE:= ${.PARSEFILE:R}.tmp/sub/opt-m-step3.mk +WANTED_FILE:= ${.PARSEFILE:R}.tmp/sub/opt-m-check.mk _!= mkdir -p ${TEST_DIR} _!= > ${CANARY_FILE} _!= cp ${MAKEFILE} ${TEST_DIR}/step2.mk _!= cp ${MAKEFILE} ${ACTUAL_FILE} +_!= echo CHECK=ok > ${WANTED_FILE} +_!= echo CHECK=${WANTED_FILE:T} found in .CURDIR > ${TEST_DIR}/${WANTED_FILE:T} step1: @${.MAKE} -C ${TEST_DIR} -f step2.mk step2 @@ -52,9 +55,10 @@ step1: .elif ${.PARSEFILE:T} == "opt-m-step3.mk" # This file is included by step2.mk. +.include <opt-m-check.mk> step2: - @echo ok + @echo ${CHECK} .else . error