From owner-freebsd-hackers Mon Sep 23 8:11:43 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 F3D2837B401 for ; Mon, 23 Sep 2002 08:11:41 -0700 (PDT) Received: from insomnia.spc.org (insomnia.spc.org [195.224.94.183]) by mx1.FreeBSD.org (Postfix) with SMTP id E635943E3B for ; Mon, 23 Sep 2002 08:11:40 -0700 (PDT) (envelope-from bms@insomnia.spc.org) Received: (qmail 5995 invoked by uid 1031); 23 Sep 2002 15:08:12 -0000 Date: Mon, 23 Sep 2002 16:08:11 +0100 From: Bruce M Simpson To: Roman Neuhauser Cc: Chuck Robey , freebsd-hackers@FreeBSD.ORG Subject: Re: two make questions Message-ID: <20020923150811.GI23343@spc.org> Mail-Followup-To: Bruce M Simpson , Roman Neuhauser , Chuck Robey , freebsd-hackers@FreeBSD.ORG References: <20020923133431.GZ30361@freepuppy.bellavista.cz> <20020923095217.O332-100000@april.chuckr.org> <20020923143523.GA30361@freepuppy.bellavista.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020923143523.GA30361@freepuppy.bellavista.cz> User-Agent: Mutt/1.3.28i 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, 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 majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message