From owner-freebsd-hackers Mon Sep 23 10: 9:10 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 9D92637B401 for ; Mon, 23 Sep 2002 10:09:07 -0700 (PDT) Received: from mail.thundernet.cz (mail.thundernet.cz [62.77.87.114]) by mx1.FreeBSD.org (Postfix) with SMTP id 0624C43E6A for ; Mon, 23 Sep 2002 10:09:05 -0700 (PDT) (envelope-from neuhauser@bellavista.cz) Received: (qmail 13384 invoked from network); 23 Sep 2002 17:08:57 -0000 Received: from unknown (HELO freepuppy.bellavista.cz) (62.168.44.50) by mail.thundernet.cz with SMTP; 23 Sep 2002 17:08:57 -0000 Received: by freepuppy.bellavista.cz (Postfix, from userid 1001) id 5887C2FDAB2; Mon, 23 Sep 2002 19:08:55 +0200 (CEST) Date: Mon, 23 Sep 2002 19:08:55 +0200 From: Roman Neuhauser To: freebsd-hackers@freebsd.org Subject: Re: two make questions Message-ID: <20020923170855.GE30361@freepuppy.bellavista.cz> Mail-Followup-To: freebsd-hackers@freebsd.org References: <20020923133431.GZ30361@freepuppy.bellavista.cz> <20020923095217.O332-100000@april.chuckr.org> <20020923143523.GA30361@freepuppy.bellavista.cz> <20020923150811.GI23343@spc.org> <20020923153516.GC30361@freepuppy.bellavista.cz> <20020923103554.A21087@newton.issci.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020923103554.A21087@newton.issci.ca> User-Agent: Mutt/1.5.1i 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 [sent only to Chad by mistake] # davidc@issci.ca / 2002-09-23 10:35:54 -0600: > On Mon, Sep 23, 2002 at 05:35:16PM +0200, Roman Neuhauser wrote: > > > unless you explicitly export things as environment variables, > > > or set them on a command line when re-invoking Make. > > > > i'm not sure what to take of this. consider this makefile: > > > > DESTDIR= > > SOURCES= foo bar baz > > TARGETS:= ${SOURCES:C;^;${DESTDIR}/;} > > SRCFILE= ${.TARGET:C,^${DESTDIR}/,,} > > > > .BEGIN: > > @echo "\$${DESTDIR}: ${DESTDIR}" > > @echo "\$${TARGETS}: ${TARGETS}" > > > > all: ${TARGETS} > > > > ${TARGETS}: ${SRCFILE} > > @echo "SRC: ${SRCFILE} -> TGT: ${.TARGET}" > > > > .PHONY: all ${TARGETS} > > > > roman@freepuppy ~/tmp 1133:0 > make all DESTDIR=/tmp/maketest > > ${DESTDIR}: /tmp/maketest > > ${TARGETS}: /foo /bar /baz > > Graph cycles through /foo > > > > Graph cycles through /bar > > > > Graph cycles through /baz > > > > `all' not remade because of errors. > > roman@freepuppy ~/tmp 1133:0 > > > How about something like this: > > #DESTDIR= This overrides the command line setting. As I said earlier, with DESTDIR= in the Makefile, .BEGIN still displays the value passed on the command line. These two things (your statement, and the observed behavior) seem to contradict each other. Wait, I know the assignment in my Makefile overrides the commandline assignment: but only outside targets. I just wanted to point out that going into a bit more detail can save quite an amount of confusion. :) > #DESTDIR?= /my/default might work better? > > SOURCES= foo bar baz > TARGETS:= ${SOURCES:C;^;${DESTDIR}/;} > > # Note: SRCFILE is evaluated at startup, which results in "" as .TARGET > # is not yet defined, and then it is evaluated in each target.. yup, per the man page. > # Note that DESTDIR will be overriden by the define at the top by the > # time we get into a target. i'm not sure i'm reading this right, but if i am, you're saying the opposite of what i'm seeing: DESTDIR is overriden by the command line assignment. [further explanation snipped] > Good luck, and I hope that helps. you bet! awesome, thanks! > > > 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'll google, thanks. > > Let me know if you find this :) yeah, i'm aware i don't have much to google for. :) btw, i'm sure i'll run into other delicate features in pmake. is it okay for me to continue asking here? questions@ doesn't seem to be *the* place. -- begin 666 nonexistent.vbs FreeBSD 4.7-RC 6:49PM up 6 days, 2:04, 29 users, load averages: 0.00, 0.04, 0.06 end To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message