From owner-freebsd-bugs Wed Dec 12 10:30:18 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id E462637B41D for ; Wed, 12 Dec 2001 10:30:00 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id fBCIU0I39147; Wed, 12 Dec 2001 10:30:00 -0800 (PST) (envelope-from gnats) Received: from thuvia.demon.co.uk (thuvia.demon.co.uk [193.237.34.248]) by hub.freebsd.org (Postfix) with ESMTP id B1D0037B419 for ; Wed, 12 Dec 2001 10:28:53 -0800 (PST) Received: from dotar-sojat.thuvia.org (dotar-sojat.thuvia.org [10.0.0.4]) by phaidor.thuvia.org (8.11.6/8.11.6) with ESMTP id fBCISok03453 for ; Wed, 12 Dec 2001 18:28:50 GMT (envelope-from mark@thuvia.demon.co.uk) Received: (from mark@localhost) by dotar-sojat.thuvia.org (8.11.6/8.11.6) id fBCIWgR15816; Wed, 12 Dec 2001 18:32:42 GMT (envelope-from mark) Message-Id: <200112121832.fBCIWgR15816@dotar-sojat.thuvia.org> Date: Wed, 12 Dec 2001 18:32:42 GMT From: Mark Valentine Reply-To: Mark Valentine To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/32759: [PATCH] make(1) System V include behaviour differs Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 32759 >Category: bin >Synopsis: [PATCH] make(1) System V include behaviour differs >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Dec 12 10:30:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Mark Valentine >Release: FreeBSD 4.4-STABLE i386 >Organization: >Environment: System: FreeBSD dotar-sojat.thuvia.org 4.4-STABLE FreeBSD 4.4-STABLE #1: Thu Nov 29 19:15:44 GMT 2001 root@dejah-thoris.thuvia.org:/usr/obj/usr/src/sys/GENERIC i386 >Description: make(1) looks first for files "included" using the System V syntax relative to the directory of the including makefile. Sun's make and GNU make both look relative to the current directory. >How-To-Repeat: $ cd /tmp $ cat >test.mk include t/foo.mk $ mkdir t $ cat >t/foo.mk include bar.mk $ cat >t/bar.mk all:: @echo Not OK $ cat >bar.mk all:: @echo OK $ make -f test.mk Not OK $ gmake -f test.mk OK >Fix: The following patch has been lightly tested. Index: usr.bin/make/parse.c =================================================================== RCS file: /usr/cvs/src/usr.bin/make/parse.c,v retrieving revision 1.22 diff -u -r1.22 parse.c --- usr.bin/make/parse.c 28 Aug 1999 01:03:35 -0000 1.22 +++ usr.bin/make/parse.c 11 Dec 2001 19:46:31 -0000 @@ -1830,7 +1830,6 @@ char *fullname; /* full pathname of file */ IFile *oldFile; /* state associated with current file */ char *cp; /* current position in file spec */ - char *prefEnd; /* * Skip over whitespace @@ -1862,42 +1861,12 @@ /* * Now we know the file's name, we attempt to find the durn thing. - * A return of NULL indicates the file don't exist. - * - * Include files 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 we can locate the beast. - * XXX - this *does* search in the current directory, right? + * Search for it first on the -I search path, then on the .PATH + * search path, if not found in a -I directory. */ - - prefEnd = strrchr (fname, '/'); - if (prefEnd != (char *)NULL) { - char *newName; - - *prefEnd = '\0'; - newName = str_concat (fname, file, STR_ADDSLASH); - fullname = Dir_FindFile (newName, parseIncPath); - if (fullname == (char *)NULL) { - fullname = Dir_FindFile(newName, dirSearchPath); - } - free (newName); - *prefEnd = '/'; - } else { - fullname = (char *)NULL; - } - + fullname = Dir_FindFile (file, parseIncPath); if (fullname == (char *)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 = Dir_FindFile (file, parseIncPath); - if (fullname == (char *)NULL) { - fullname = Dir_FindFile(file, dirSearchPath); - } + fullname = Dir_FindFile(file, dirSearchPath); } if (fullname == (char *)NULL) { >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message