From owner-freebsd-questions@FreeBSD.ORG Wed May 6 09:32:21 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66F721065670 for ; Wed, 6 May 2009 09:32:21 +0000 (UTC) (envelope-from mexas@bristol.ac.uk) Received: from dirj.bris.ac.uk (dirj.bris.ac.uk [137.222.10.78]) by mx1.freebsd.org (Postfix) with ESMTP id 2312F8FC19 for ; Wed, 6 May 2009 09:32:18 +0000 (UTC) (envelope-from mexas@bristol.ac.uk) Received: from seis.bris.ac.uk ([137.222.10.93]) by dirj.bris.ac.uk with esmtp (Exim 4.69) (envelope-from ) id 1M1dTf-000565-5J; Wed, 06 May 2009 10:32:17 +0100 Received: from mech-cluster238.men.bris.ac.uk ([137.222.187.238]) by seis.bris.ac.uk with esmtp (Exim 4.67) (envelope-from ) id 1M1dTF-0003TS-45; Wed, 06 May 2009 10:31:46 +0100 Received: from mech-cluster238.men.bris.ac.uk (localhost.men.bris.ac.uk [127.0.0.1]) by mech-cluster238.men.bris.ac.uk (8.14.3/8.14.3) with ESMTP id n469VKgP064714; Wed, 6 May 2009 10:31:20 +0100 (BST) (envelope-from mexas@bristol.ac.uk) Received: (from mexas@localhost) by mech-cluster238.men.bris.ac.uk (8.14.3/8.14.3/Submit) id n469VHAK064713; Wed, 6 May 2009 10:31:17 +0100 (BST) (envelope-from mexas@bristol.ac.uk) X-Authentication-Warning: mech-cluster238.men.bris.ac.uk: mexas set sender to mexas@bristol.ac.uk using -f Date: Wed, 6 May 2009 10:31:17 +0100 From: Anton Shterenlikht To: Mel Flynn Message-ID: <20090506093117.GA64688@mech-cluster238.men.bris.ac.uk> References: <20090506083152.GA48658@mech-cluster238.men.bris.ac.uk> <200905061115.07888.mel.flynn+fbsd.questions@mailing.thruhere.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200905061115.07888.mel.flynn+fbsd.questions@mailing.thruhere.net> User-Agent: Mutt/1.5.19 (2009-01-05) X-Spam-Score: -1.4 X-Spam-Level: - Cc: Anton Shterenlikht , freebsd-questions@freebsd.org Subject: Re: make - reassign variable using if-then ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 May 2009 09:32:21 -0000 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