On Mon, Sep 23, 2002 at 04:35:23PM +0200, Roman Neuhauser wrote: > 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.
Yeah, it takes a bit of getting used to. Make lets you define a dependency graph, and various transformations/instructions that can be applied to each node in that graph. In that respect it's more like a Caesar salad, the dependencies are the lettuce and the variables are croutons. Making it work is the dressing; you have to add it yourself ;-) "Managing Projects with Make" from O'Reilly is a good introduction but it's a tad dated. Also, make has a habit of being different from one platform to the next. I particularly like the BSD pmake, but Solaris make is different still, and GNU make is a law unto itself. > 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. The scope of a Makefile macro (variable) seems to be limited to the current invocation, unless you explicitly export things as environment variables, or set them on a command line when re-invoking Make. Depending on what you want to do this can get quite complicated. Have a look at /usr/src/Makefile which actually reinvokes itself quite a bit (and includes things from Makefile.inc which may *also* do that!). Nik Clayton mentioned a tool to automatically diagram makefile dependency graphs by target at the last FreeBSD UKUG meeting, using graphviz, but I can't recall its name. > 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. If you're including any standard makefile templates you may wish to review those; as well as /etc/make.conf and /etc/defaults/make.conf. You probably also want to look at the MAKEOBJDIRPREFIX behaviour in the make(1) man page. BMS To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message