From owner-freebsd-hackers Mon Sep 23 10: 9:14 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 75DAF37B406 for ; Mon, 23 Sep 2002 10:09:10 -0700 (PDT) Received: from april.chuckr.org (april.chuckr.org [66.92.147.143]) by mx1.FreeBSD.org (Postfix) with ESMTP id 680F643E6E for ; Mon, 23 Sep 2002 10:09:09 -0700 (PDT) (envelope-from chuckr@chuckr.org) Received: from april.chuckr.org (localhost [127.0.0.1]) by april.chuckr.org (8.12.6/8.12.5) with ESMTP id g8NH875s048453; Mon, 23 Sep 2002 13:08:07 -0400 (EDT) (envelope-from chuckr@chuckr.org) Received: from localhost (chuckr@localhost) by april.chuckr.org (8.12.6/8.12.5/Submit) with ESMTP id g8NH85OG048450; Mon, 23 Sep 2002 13:08:06 -0400 (EDT) X-Authentication-Warning: april.chuckr.org: chuckr owned process doing -bs Date: Mon, 23 Sep 2002 13:08:04 -0400 (EDT) From: Chuck Robey To: Roman Neuhauser Cc: Subject: Re: two make questions In-Reply-To: <20020923143523.GA30361@freepuppy.bellavista.cz> Message-ID: <20020923130006.N332-100000@april.chuckr.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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