cvs commit: src/share/mk bsd.obj.mk

Ruslan Ermilov ru at FreeBSD.org
Thu Jan 8 09:58:24 PST 2004


On Thu, Jan 08, 2004 at 12:07:32PM -0500, Brian F. Feldman wrote:
> Ruslan Ermilov <ru at FreeBSD.org> wrote:
> > On Thu, Jan 08, 2004 at 11:36:19AM -0500, Brian F. Feldman wrote:
> > > Ruslan Ermilov <ru at FreeBSD.org> wrote:
> > > > : $ make MAKE='/usr/bin/make -DFOO' print-make
> > > > : /usr/bin/make -DFOO
> > > > : $ make MAKE='/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='/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:
> > > 
> > > Think about this: what options to ${MAKE} are there that have nothing to do 
> > > with setting defines?  There's actually quite a few; the one in particular 
> > > that I care about is "-f"; if I want to use bsd.subdir.mk to simply apply 
> > > one BSD Makefile to several directions (which I _do_), I need to use -f, 
> > > i.e.:
> > > 
> > > MAKE+=  -f ${.CURDIR}/drivers/Makefile.subdriver
> > > 
> > > The only think that broke this was the cleandir target.
> > > 
> > Then you should be using the .MAKEFLAS variables here, see
> > sys/modules/Makefile for one working example, and let me
> > know if it works for you.
> 
> Since .MAKEFLAGS is doesn't expand variables, I have to do it this (pretty 
> ugly) way:
> 
> .MAKEFLAGS:=    ${.MAKEFLAGS} -f ${.CURDIR}/drivers/Makefile.subdriver
> 
: # cat Makefile
: all:
: 	@cd ${.CURDIR}; ${MAKE} print-foo
: 
: .MAKEFLAGS+=	FOO=${.CURDIR}
: 
: print-foo:
: 	@echo ${FOO}
: # make
: /tmp

> But it does at least work (does it definitely always get added to ${MAKE}?). 
> 
It's actually in the make(1) manpage:

: .MAKEFLAGS
: 	The environment variable MAKEFLAGS may contain anything that
: 	may be specified on make's command line.  Its contents are
: 	stored in make's .MAKEFLAGS variable.  Anything specified on
: 	make's command line is appended to the .MAKEFLAGS variable
: 	which is then entered into the environment as MAKEFLAGS for
: 	all programs which make executes.

> I don't see the bsd.obj.mk change as being anything but slightly more 
> correct, so I wouldn't see a good reason to remove it either way.  I'm glad 
> we've clarified the issue.
> 
I never said I want the commit to be backed out, did I?  ;)
I even see it as a slight improvement, but for a reason that
is different from what is in the commit log -- it saves one
make(1) invocation.  I think that a null commit would be in
order though.


Cheers,
-- 
Ruslan Ermilov
FreeBSD committer
ru at FreeBSD.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-all/attachments/20040108/06fb6769/attachment.bin


More information about the cvs-all mailing list