Date: Wed, 6 May 2009 10:31:17 +0100 From: Anton Shterenlikht <mexas@bristol.ac.uk> To: Mel Flynn <mel.flynn+fbsd.questions@mailing.thruhere.net> Cc: Anton Shterenlikht <mexas@bristol.ac.uk>, freebsd-questions@freebsd.org Subject: Re: make - reassign variable using if-then ? Message-ID: <20090506093117.GA64688@mech-cluster238.men.bris.ac.uk> In-Reply-To: <200905061115.07888.mel.flynn%2Bfbsd.questions@mailing.thruhere.net> References: <20090506083152.GA48658@mech-cluster238.men.bris.ac.uk> <200905061115.07888.mel.flynn%2Bfbsd.questions@mailing.thruhere.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, May 06, 2009 at 11:15:07AM +0200, Mel Flynn wrote: > On Wednesday 06 May 2009 10:31:53 Anton Shterenlikht wrote: > > I've this simple makefile: > > > > VAR=one > > > > all : main > > > > main : > > @echo ${.CURDIR} > > .if ${.CURDIR} > > @echo ${VAR} > > VAR=two > > @echo ${VAR} > > .endif > > > > When I output VAR second time, the value is still "one", and not the > > new value "two". Why? > > Because it is expanded before being passed to the shell. Sh sees: > echo one > VAR=two > echo one > > What are you really trying to accomplish? I'm trying to build gcc43 on alpha 6.4. In /usr/ports/lang/gcc43/Makefile I have: # grep NOT_FOR_ARCHS /usr/ports/lang/gcc43/Makefile NOT_FOR_ARCHS= alpha ia64 powerpc # In /etc/make.conf I have: .if ${.CURDIR:M*/lang/gcc43*} NOT_FOR_ARCHS= ia64 USE_GCC=4.3+ .endif This used to work fine until some update. Not anymore. The second setting is being used, i.e. the port is being built with gcc43. But the NOT_FOR_ARCHS is not changed, so I have to do it manually each time. So I tried to experiment with changing variable values withing if-then. many thanks anton -- Anton Shterenlikht Room 2.6, Queen's Building Mech Eng Dept Bristol University University Walk, Bristol BS8 1TR, UK Tel: +44 (0)117 928 8233 Fax: +44 (0)117 929 4423
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090506093117.GA64688>