From will@FreeBSD.org  Tue Sep  4 20:39:43 2001
Return-Path: <will@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP
	id E4A0737B401; Tue,  4 Sep 2001 20:39:43 -0700 (PDT)
Received: (from will@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id f853dhS21349;
	Tue, 4 Sep 2001 20:39:43 -0700 (PDT)
	(envelope-from will)
Message-Id: <200109050339.f853dhS21349@freefall.freebsd.org>
Date: Tue, 4 Sep 2001 20:39:43 -0700 (PDT)
From: Will Andrews <will@FreeBSD.org>
Reply-To: Will Andrews <will@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Marcel Moolenaar <marcel@freebsd.org>
Subject: Conflict between bsd.port.mk MAKEFILE variable and make(1)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         30331
>Category:       ports
>Synopsis:       [patch] Conflict between bsd.port.mk MAKEFILE variable and make(1)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 04 20:40:01 PDT 2001
>Closed-Date:    Tue Jun 02 17:42:02 UTC 2009
>Last-Modified:  Tue Jun 02 17:42:02 UTC 2009
>Originator:     Will Andrews
>Release:        FreeBSD 4.3-STABLE i386
>Organization:
The FreeBSD Project
>Environment:

N/A

>Description:

From Marcel Moolenaar <marcel@FreeBSD.org>:

I have my ports tree mounted through NFS and arranged to have
the work directory created on some local FS. This setup, although
it appears to be supported (by means of WRKDIRPREFIX) breaks
the ports collection. Below an heavily formatted abstract from a
build of XFree86-4 with the loud debugging option (-b l):

===>  Building for XFree86-4.1.0_6
cd /nfs/ports/x11/XFree86-4 &&						\
	make 'CKSUMFILES+=X410src-1.tgz X410src-2.tgz' pre-build
/usr/bin/true
if [ -f /nfs/ports/x11/XFree86-4/scripts/pre-build ]; then		\
	cd /nfs/ports/x11/XFree86-4 && /usr/bin/env OSVERSION=500022	\
		PORTOBJFORMAT=elf BSD_INSTALL_PROGRAM="install -c -s	\
		-o root -g wheel -m 555"  BSD_INSTALL_SCRIPT="install	\
		-c -o root -g wheel -m 555" BSD_INSTALL_DATA="install	\
		-c -o root -g wheel -m 444" BSD_INSTALL_MAN="install	\
		-c -o root -g wheel -m 444"				\
		CURDIR=/nfs/ports/x11/XFree86-4				\
		DISTDIR=/nfs/ports/distfiles				\
		WRKDIR=/usr/obj/nfs/ports/x11/XFree86-4/work		\
		WRKSRC=/usr/obj/nfs/ports/x11/XFree86-4/work/xc		\
		PATCHDIR=/nfs/ports/x11/XFree86-4/files			\
		SCRIPTDIR=/nfs/ports/x11/XFree86-4/scripts		\
		FILESDIR=/nfs/ports/x11/XFree86-4/files			\
		PORTSDIR=/nfs/ports DEPENDS=""				\
		PREFIX=/usr/X11R6 LOCALBASE=/usr/local			\
		X11BASE=/usr/X11R6					\
		/bin/sh  /nfs/ports/x11/XFree86-4/scripts/pre-build;	\
fi
cd /nfs/ports/x11/XFree86-4 &&						\
	make 'CKSUMFILES+=X410src-1.tgz X410src-2.tgz' do-build
(cd /usr/obj/nfs/ports/x11/XFree86-4/work/xc;				\
 /usr/bin/env PORTOBJFORMAT=elf PREFIX=/usr/X11R6 LOCALBASE=/usr/local	\
	X11BASE=/usr/X11R6 MOTIFLIB="-L/usr/X11R6/lib -lXm -lXp"	\
	LIBDIR="/usr/lib" CFLAGS="-O -pipe " CXXFLAGS=" -O -pipe "	\
	BSD_INSTALL_PROGRAM="install -c -s -o root -g wheel -m 555"	\
	BSD_INSTALL_SCRIPT="install -c -o root -g wheel -m 555"		\
	BSD_INSTALL_DATA="install -c -o root -g wheel -m 444"		\
	BSD_INSTALL_MAN="install -c -o root -g wheel -m 444"		\
	make -f /nfs/ports/x11/XFree86-4/Makefile WORLDOPTS= World)
	     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
make: don't know how to make World. Stop
*** Error code 2

The problem is that make is given the wrong makefile (ie
/nfs/ports/x11/XFree86-4/Makefile) while it should have been just
Makefile.

The rules in question live in /usr/ports/Mk/bsd.port.mk and there
we see that the variable MAKEFILE is used to allow ports to define
a different name for the makefile. Unfortunately, MAKEFILE is also a
variable set by make(1) itself when it's done a chdir(2) and needs
to locate the makefile. The following comment comes from
/usr/src/usr.bin/make/main.c:

     /*
      * set the MAKEFILE variable desired by System V fans -- the
      * placement of the setting here means it gets set to the last
      * makefile specified, as it is set by SysV make.
      */

Houston, we have a problem!

Renaming the MAKEFILE variable in /usr/ports/Mk/bsd.port.mk to,
for example, MAKE_FILE solves the problem. See diffs below.

Such a change would have an impact though. There are currently 291
ports that define MAKEFILE and they need to be changed as well.  I
spare you the list of ports. You can easily find that yourself by
grepping for MAKEFILE in all the makefiles.

FYI,


-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net

>How-To-Repeat:

See above.

>Fix:

Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.378
diff -u -r1.378 bsd.port.mk
--- bsd.port.mk 31 Aug 2001 02:13:02 -0000      1.378
+++ bsd.port.mk 5 Sep 2001 01:31:29 -0000
@@ -943,7 +943,7 @@
 MD5_FILE?=             ${MASTERDIR}/distinfo
 
 MAKE_FLAGS?=   -f
-MAKEFILE?=             Makefile
+MAKE_FILE?=            Makefile
 MAKE_ENV+=             PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} MOTIFLIB="${MOTIFLIB}" LIBDIR="${LIBDIR}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}"
 
 .if ${OSVERSION} < 500016
@@ -1831,9 +1831,9 @@
 .if !target(do-build)
 do-build:
 .if defined(USE_GMAKE)
-       @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET})
+       @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKE_FILE} ${MAKE_ARGS} ${ALL_TARGET})
 .else
-       @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET})
+       @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKE_FILE} ${MAKE_ARGS} ${ALL_TARGET})
 .endif
 .endif
 
@@ -1842,14 +1842,14 @@
 .if !target(do-install)
 do-install:
 .if defined(USE_GMAKE)
-       @(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET})
+       @(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKE_FILE} ${MAKE_ARGS} ${INSTALL_TARGET})
 .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
-       @(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} install.man)
+       @(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKE_FILE} ${MAKE_ARGS} install.man)
 .endif
 .else defined(USE_GMAKE)
-       @(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET})
+       @(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKE_FILE} ${MAKE_ARGS} ${INSTALL_TARGET})
 .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
-       @(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} install.man)
+       @(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKE_FILE} ${MAKE_ARGS} install.man)
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports->portmgr 
Responsible-Changed-By: will 
Responsible-Changed-When: Tue Sep 4 20:40:47 PDT 2001 
Responsible-Changed-Why:  
Over to MAINTAINER 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30331 

From: Marcel Moolenaar <marcel@xcllnt.net>
To: Will Andrews <will@FreeBSD.ORG>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: ports/30331: Conflict between bsd.port.mk MAKEFILE variable and make(1)
Date: Tue, 4 Sep 2001 23:25:34 -0700

 On Tue, Sep 04, 2001 at 08:39:43PM -0700, Will Andrews wrote:
 > 
 > Such a change would have an impact though. There are currently 291
 > ports that define MAKEFILE and they need to be changed as well.  I
 > spare you the list of ports. You can easily find that yourself by
 > grepping for MAKEFILE in all the makefiles.
 
 It affects the port tools as well. The ports collection is not able
 to make package-depends when installing a port. This suspiciously
 looks like the same problem. I haven't tried making a package yet.
 That could be affected too.
 
 -- 
  Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net

From: Tim Vanderhoek <vanderh@ecf.utoronto.ca>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/30331
Date: Sun, 1 Sep 2002 00:07:58 -0400

 X-Ref to (closed) ports/11134 - they appear to be similar
                                 problems, although I'm not exactly
                                 sure quite what's going on in this one
                                 (ports/30331).
 
 
 -- 
 If I could think of a two-line witty aphorism for you to remember
 me by, this would definitely be it.
State-Changed-From-To: open->suspended 
State-Changed-By: kris 
State-Changed-When: Thu Jun 17 06:04:53 GMT 2004 
State-Changed-Why:  
Suspended awaiting patch that addresses all the affected ports too. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=30331 

From: Florent Thoumie <flz@FreeBSD.org>
To: portmgr@FreeBSD.org, FreeBSD-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/30331: [patch] Conflict between bsd.port.mk MAKEFILE
	variable and make(1)
Date: Fri, 15 Apr 2005 11:25:49 +0200

 --=-wn3jnSOiY0nWRvur4/H+
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 	I'm willing to add MAKE_FILE variable to all affected ports once
 	the tree will be totally unfrozen so that you can apply this fix
 	safely.
 
 	Just poke me if you want to get rid of this PR.
 
 --=20
 Florent Thoumie
 flz@FreeBSD.org
 
 --=-wn3jnSOiY0nWRvur4/H+
 Content-Type: application/pgp-signature; name=signature.asc
 Content-Description: This is a digitally signed message part
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.0 (FreeBSD)
 
 iD8DBQBCX4idMxEkbVFH3PQRAuQtAJ4meHQxZJR5wXyx2FXZ4+CAohw2wACfQFdq
 1QsZQPrZDpNjeTMjrf0URJg=
 =GtIJ
 -----END PGP SIGNATURE-----
 
 --=-wn3jnSOiY0nWRvur4/H+--
 
State-Changed-From-To: suspended->feedback 
State-Changed-By: linimon 
State-Changed-When: Fri May 25 02:40:32 UTC 2007 
State-Changed-Why:  
flz, are you still interested in looking at this in some point in the future 
(like maybe when you're less burned out :-) ) ? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=30331 
State-Changed-From-To: feedback->suspended 
State-Changed-By: linimon 
State-Changed-When: Sat Mar 1 19:56:54 UTC 2008 
State-Changed-Why:  
There hasn't been any action on this in a while, so put it back to 
suspended. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=30331 

From: Pav Lucistnik <pav@FreeBSD.org>
To: bug-followup@FreeBSD.org, will@FreeBSD.org, marcel@FreeBSD.org
Cc:  
Subject: Re: ports/30331: [patch] Conflict between bsd.port.mk MAKEFILE
 variable and make(1)
Date: Tue, 02 Jun 2009 13:49:51 +0200

 http://www.freebsd.org/cgi/query-pr.cgi?pr=30331
 
 I cannot reproduce this with just WRKDIRPREFIX, the -f argument stays
 just Makefile here.  Can you give me a guide how to reproduce this?
 
 -- 
 Pav Lucistnik <pav@oook.cz>
               <pav@FreeBSD.org>
 
 Stupidity got us into this mess -- why can't it get us out?
 

From: Marcel Moolenaar <xcllnt@mac.com>
To: pav@FreeBSD.org
Cc: bug-followup@FreeBSD.org, will@FreeBSD.org, marcel@FreeBSD.org
Subject: Re: ports/30331: [patch] Conflict between bsd.port.mk MAKEFILE
 variable and make(1)
Date: Tue, 02 Jun 2009 09:38:23 -0700

 On Jun 2, 2009, at 4:49 AM, Pav Lucistnik wrote:
 
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=30331
 >
 > I cannot reproduce this with just WRKDIRPREFIX, the -f argument stays
 > just Makefile here.  Can you give me a guide how to reproduce this?
 
 With 8 years between the submission of the PR and the
 request to reproduce, I think it's probably better to
 just close the PR. I haven't had any problems in the
 last $FEW years (and XFree86-4.1.0) is no more, so if
 the problem still exists, I wouldn't really know how
 to trigger it.
 
 In short: I think we should either make the change
 under the assumption that it could still be a problem
 and without having a testcase anymore or we should
 just close the PR and wait for it to happen again if
 (and only if) the problem still exists.
 
 FYI,
 
 -- 
 Marcel Moolenaar
 xcllnt@mac.com
 
 
 
State-Changed-From-To: suspended->closed 
State-Changed-By: linimon 
State-Changed-When: Tue Jun 2 17:41:20 UTC 2009 
State-Changed-Why:  
marcel suggests that this just be closed as OBE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=30331 
>Unformatted:
