Date: Mon, 23 Sep 2002 19:08:55 +0200 From: Roman Neuhauser <neuhauser@bellavista.cz> To: freebsd-hackers@freebsd.org Subject: Re: two make questions Message-ID: <20020923170855.GE30361@freepuppy.bellavista.cz> In-Reply-To: <20020923103554.A21087@newton.issci.ca> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
[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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020923170855.GE30361>