From owner-freebsd-questions@FreeBSD.ORG Thu Jun 7 13:35:10 2012 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 C52D3106566B for ; Thu, 7 Jun 2012 13:35:10 +0000 (UTC) (envelope-from tundra@tundraware.com) Received: from ozzie.tundraware.com (ozzie.tundraware.com [75.145.138.73]) by mx1.freebsd.org (Postfix) with ESMTP id 81C9F8FC0C for ; Thu, 7 Jun 2012 13:35:10 +0000 (UTC) Received: from [192.168.0.2] (viper.tundraware.com [192.168.0.2]) (authenticated bits=0) by ozzie.tundraware.com (8.14.5/8.14.5) with ESMTP id q57DYuO1038078 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Thu, 7 Jun 2012 08:34:56 -0500 (CDT) (envelope-from tundra@tundraware.com) Message-ID: <4FD0ADFB.8030508@tundraware.com> Date: Thu, 07 Jun 2012 08:34:51 -0500 From: Tim Daneliuk User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: FreeBSD Mailing List References: <4FCF48AF.307@tundraware.com> <20120607051901.GA2205@holstein.holy.cow> In-Reply-To: <20120607051901.GA2205@holstein.holy.cow> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (ozzie.tundraware.com [192.168.0.1]); Thu, 07 Jun 2012 08:34:56 -0500 (CDT) X-TundraWare-MailScanner-Information: Please contact the ISP for more information X-TundraWare-MailScanner-ID: q57DYuO1038078 X-TundraWare-MailScanner: Found to be clean X-TundraWare-MailScanner-From: tundra@tundraware.com X-Spam-Status: No Subject: Re: Somewhat OT - A Makefile Question 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: Thu, 07 Jun 2012 13:35:10 -0000 On 06/07/2012 12:19 AM, Parv wrote: > in message<4FCF48AF.307@tundraware.com>, > wrote Tim Daneliuk thusly... >> > ... >> Within a makefile, I need to assign the name of a program as in: >> >> FOO = "bar". >> >> The problem is that 'bar' may also be know as, say, "bar.sh". > ... >> Is there a simple way to determine which form "bar" or "bar.sh" on >> on a given system *at the time the make is run*? If both exist, I >> will pick one arbitrarily, > ... >> For example I don't think this works when both are there: >> >> FOO = $(shell `which bar bar.sh) > > Modify the subshell command to ... > > which bar bar.sh | head -n 1 > > > ... as in (for FreeBSD make) ... > > shell=`which zsh sh tcsh csh 2>/dev/null | fgrep -v 'not found' | head -n 3` > > all: > @printf "%s\n" ${shell} > > > > - parv > Thanks. I came up with something similar, but I think your recipe is a bit more elegant ... -- ---------------------------------------------------------------------------- Tim Daneliuk tundra@tundraware.com PGP Key: http://www.tundraware.com/PGP/