From owner-cvs-src@FreeBSD.ORG Thu Jan 8 08:26:05 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D3EB716A4CE; Thu, 8 Jan 2004 08:26:05 -0800 (PST) Received: from phantom.cris.net (phantom.cris.net [212.110.130.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id 47B3643D2F; Thu, 8 Jan 2004 08:25:59 -0800 (PST) (envelope-from ru@FreeBSD.org.ua) Received: from phantom.cris.net (ru@localhost [127.0.0.1]) by phantom.cris.net (8.12.10/8.12.10) with ESMTP id i08GPul7033493; Thu, 8 Jan 2004 18:25:56 +0200 (EET) (envelope-from ru@FreeBSD.org.ua) Received: (from ru@localhost) by phantom.cris.net (8.12.10/8.12.10/Submit) id i08GPulc033488; Thu, 8 Jan 2004 18:25:56 +0200 (EET) (envelope-from ru) Date: Thu, 8 Jan 2004 18:25:56 +0200 From: Ruslan Ermilov To: "Brian F. Feldman" Message-ID: <20040108162556.GB31301@FreeBSD.org.ua> References: <20040108080514.GB27761@FreeBSD.org.ua> <200401081607.i08G7q5U011051@green.bikeshed.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mojUlQ0s9EVzWg2t" Content-Disposition: inline In-Reply-To: <200401081607.i08G7q5U011051@green.bikeshed.org> User-Agent: Mutt/1.5.5.1i cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/share/mk bsd.obj.mk X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jan 2004 16:26:06 -0000 --mojUlQ0s9EVzWg2t Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 08, 2004 at 11:07:52AM -0500, Brian F. Feldman wrote: > Ruslan Ermilov wrote: > > On Wed, Jan 07, 2004 at 03:41:03PM -0500, Brian F. Feldman wrote: > > > Ruslan Ermilov wrote: > > > > On Thu, Jan 01, 2004 at 09:05:48PM -0800, Brian Feldman wrote: > > > > > green 2004/01/01 21:05:48 PST > > > > >=20 > > > > > FreeBSD src repository > > > > >=20 > > > > > Modified files: > > > > > share/mk bsd.obj.mk=20 > > > > > Log: > > > > > Fix a very corner case when you want to make cleandir SUBDIRs w= hich > > > > > are built using a ${MAKE} that's not just "make". > > > > > =20 > > > > > Test by: make universe (followed by cleandirs) > > > > > =20 > > > > > Revision Changes Path > > > > > 1.49 +2 -2 src/share/mk/bsd.obj.mk > > > > >=20 > > > > The old version used ${MAKE}, why this was a problem at all? > > >=20 > > > The ${MAKE} that it uses would be overridden by the default ${MAKE} v= alue=20 > > > each time; this doesn't occur when dependencies are executed, though. > > >=20 > > Please explain in more detail. With the below makefile, > >=20 > > : all: > > : @cd ${.CURDIR}; ${MAKE} print-make > > :=20 > > : print-make: > > : @echo ${MAKE} > >=20 > > running /usr/bin/make will rightfully print "/usr/bin/make". > > make(1)'s main() always sets MAKE to argv[0] as its first task. >=20 > Here is the difference in behavior: >=20 > {"/home/green/tmp/x"}$ make print-make all > make > make > {"/home/green/tmp/x"}$ make MAKE=3D'/usr/bin/make -DNONDEF' print-make all > /usr/bin/make -DNONDEF > /usr/bin/make >=20 You aren't supposed to set the ${MAKE} variable manually -- it's automatically set by make(1) to the argv[0] value. By using it the way you show, you risk because there are four different types of make variables, and while you set the command-line type "MAKE" variable, make(1) will set the global "MAKE" variable to "make": : $ make MAKE=3D'/usr/bin/make -DFOO' print-make : /usr/bin/make -DFOO : $ make MAKE=3D'/usr/bin/make -DFOO' -V MAKE : make If you really need to access command-line arguments, there is the .MAKEFLAGS variable available for that purpose. But why do you need to ``make MAKE=3D'/usr/bin/make -DFOO' bar'' in the first place instead of simple ``make -DFOO bar''? If "bar" is recursive (i.e., runs ${MAKE} subprocesses), then -DFOO will be properly propagated: : $ cat Makefile : all: : @cd ${.CURDIR}; ${MAKE} print-make :=20 : print-make: : @echo ${FOO} : $ make -DFOO : 1 Cheers, --=20 Ruslan Ermilov FreeBSD committer ru@FreeBSD.org --mojUlQ0s9EVzWg2t Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQE//YSUUkv4P6juNwoRAv8mAKCHKJUb3Pyhz7lijzDypN/yby+EvACaA8Aa VzpVfTFhVVsxnjAi+VcJOvE= =ygAj -----END PGP SIGNATURE----- --mojUlQ0s9EVzWg2t--