Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Sep 2002 13:08:04 -0400 (EDT)
From:      Chuck Robey <chuckr@chuckr.org>
To:        Roman Neuhauser <neuhauser@bellavista.cz>
Cc:        <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: two make questions
Message-ID:  <20020923130006.N332-100000@april.chuckr.org>
In-Reply-To: <20020923143523.GA30361@freepuppy.bellavista.cz>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 23 Sep 2002, Roman Neuhauser wrote:

> # chuckr@chuckr.org / 2002-09-23 10:06:12 -0400:
> > On Mon, 23 Sep 2002, Roman Neuhauser wrote:
>
> > > I'm not a C programmer (thus not really familiar with make), and I'm

I am a C programmer, and one of my strengths is that I know make pretty
well.

> > > trying to use it for project management (we write apps in php). I've
> > > stumbled across a few variable related issues where the actual behavior
> > > doesn't exactly map to the available documentation (make(1), and the
> > > pmake paper). See the messages below for complete descriptions.
>
> > > http://marc.theaimsgroup.com/?l=freebsd-questions&m=103250565427752&w=2
> > > http://marc.theaimsgroup.com/?l=freebsd-questions&m=103251441702280&w=2
> >
> > You're trying to treat the make variables as program variables, and that
> > doesn't work, once you assign a value to them, that's the value you get.
> > They *do not* work like variables in C or Basic.  The rule to follow is
> > never to attempt to modify a value in a variable.  If you need that
> > specific action, either use the ".for" type constructs, else use shell
> > variables, which will let you do that.
>
>     Chuck,
>
>     thanks a lot for your reply. You're right: I'm viewing Makefiles
>     as sequential programs, which obviously (even to me) is not quite
>     true, but I'm having difficulty getting rid of this.
>
>     Now, saying "don't do it" is nice, but I'd like to know why.  Why
>     doesn't this work?  Also, what documentation (besides the source) is
>     there that covers variable scopes?  See the second message for the
>     problem description.

Wish I could give you some satisfaction .... because "I've been there,
done that".  Unfortunately, you aren't going to find it.  If you decide
that the only thing that you can do is fix the docs, you won't even
succeed there, because it will only raise a huge volume of complaints
(seemingly endless nitpickers) all giving their own take on it, even
though they won't fix it themselves.

The only book there is on make is pretty pissed-poor, the make book from
O'Reilly.  I've been considering writing a book on the 3 main flavors of
make for a while now .... I'm not convinced yet that there's a market for
it.  I'm pretty sure now, with all the horrible make projects I've
undertaken, I could do it.

>
>     I can fix the behavior with conditional assignment to DESTDIR (?=)
>     in the Makefile, but still would like to understand what's causing
>     make to behave the way it does.

The odd behavior of variables is only one item from a whole list of them.
Go take a look at what use: means, if you want a headache.  Or, how about
the behavior of "include", which *does* work, even though the man page
says that only ".include" will work ("include" is compatible with both BSD
make and GNU make, an important point.)

When you don't have any problem with a file like bsd.port.mk, then you'll
be able to claim to know make.

>
>     Again, thanks, and HAND.
>
>     Also, I couldn't find on freebsd.org whether it's required to
>     group-reply on hackers@ (as it is on questions@), so I'm cc'ing you.
>     Sorry if this is not required. You don't need to cc me either way.
>
>     Roman
>
>

----------------------------------------------------------------------------
Chuck Robey         | Interests include C & Java programming, FreeBSD,
chuckr@chuckr.org   | electronics, communications, and signal processing.

New Year's Resolution:  I will not sphroxify gullible people into looking up
fictitious words in the dictionary.
----------------------------------------------------------------------------


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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