Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Aug 1997 21:38:27 -0600 (MDT)
From:      "Justin T. Gibbs" <gibbs@narnia.plutotech.com>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/4401: make searches for it's Makefile in MAKEOBJDIR before curdir.
Message-ID:  <199708270338.VAA19884@narnia.plutotech.com>
Resent-Message-ID: <199708270350.UAA03322@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         4401
>Category:       bin
>Synopsis:       make searches for it's Makefile in MAKEOBJDIR before curdir.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 26 20:50:03 PDT 1997
>Last-Modified:
>Originator:     Justin T. Gibbs
>Organization:
Pluto Technologies International Inc.
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:
>Description:

	If MAKEOBJDIR is set to a directory that happens to contain
	a Makefile, make will execute it instead of the Makefile in
	the current directory.

>How-To-Repeat:

	export MAKEOBJDIR=/usr/src/sys/compile/MYKERNEL
	cd /usr/src/bin/ls
	make
	
	Kernel gets built instead of ls. 8-)

>Fix:
	
Index: main.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/make/main.c,v
retrieving revision 1.21
diff -c -r1.21 main.c
*** main.c	1997/08/25 21:35:44	1.21
--- main.c	1997/08/26 20:18:50
***************
*** 834,841 ****
  		Parse_File("(stdin)", stdin);
  		Var_Set("MAKEFILE", "", VAR_GLOBAL);
  	} else {
- 		if ((stream = fopen(fname, "r")) != NULL)
- 			goto found;
  		/* if we've chdir'd, rebuild the path name */
  		if (curdir != objdir && *fname != '/') {
  			(void)sprintf(path, "%s/%s", curdir, fname);
--- 834,839 ----
***************
*** 843,849 ****
  				fname = path;
  				goto found;
  			}
! 		}
  		/* look in -I and system include directories. */
  		name = Dir_FindFile(fname, parseIncPath);
  		if (!name)
--- 841,848 ----
  				fname = path;
  				goto found;
  			}
! 		} else if ((stream = fopen(fname, "r")) != NULL)
! 			goto found;
  		/* look in -I and system include directories. */
  		name = Dir_FindFile(fname, parseIncPath);
  		if (!name)

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708270338.VAA19884>