make -U

Ruslan Ermilov ru at FreeBSD.ORG
Wed Jul 30 14:27:59 PDT 2003


On Wed, Jul 30, 2003 at 04:23:20PM -0500, Juli Mallett wrote:
> * Ruslan Ermilov <ru at FreeBSD.org> [ Date: 2003-07-30 ]
> 	[ w.r.t. make -U ]
> > Sorry, I've accidentally dropped an email about `make -U'.
> > 
> > I think that it's not needed, since the functionality can
> > easily be achieved by running "make FOO=", i.e., assigning
> > an empty value.  Remember that command line variables take
> > precedence over globals, so the following makefile,
> > 
> > FOO+=	bar
> > 
> > all:
> > 	@echo ${FOO}
> > 
> > when run as ``make FOO=foo'', will print just ``foo''.
> 
> Does that work for the .if defined() case, too?  Makefiles can grow
> to be more complex than just that sort of stuff, after all :)
> 
Not sure what do you mean.  The "make -U FOO" was support to
undefine the FOO variable, as it the ``.undef FOO'' was called
at the end of makefile.  Of course, setting FOO= on a command
line still gets you a "defined" variable, but

.if defined(FOO) && !empty(FOO)

should do the trick.  Try this out with "make FOO=":

FOO=	bar

all:
.if defined(FOO) && !empty(FOO)
	@echo FOO is set
.endif


Cheers,
-- 
Ruslan Ermilov		Sysadmin and DBA,
ru at sunbay.com		Sunbay Software Ltd,
ru at FreeBSD.org		FreeBSD committer
-------------- 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/freebsd-current/attachments/20030731/c07e6715/attachment.bin


More information about the freebsd-current mailing list