Date: Wed, 12 Dec 2001 18:32:42 GMT From: Mark Valentine <mark@thuvia.demon.co.uk> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/32759: [PATCH] make(1) System V include behaviour differs Message-ID: <200112121832.fBCIWgR15816@dotar-sojat.thuvia.org>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200112121832.fBCIWgR15816>